feat: swiper and bottom nav bar first draft

swiper-bottom-nav-bar
98spag 2023-04-16 12:38:21 +02:00
parent 5fe48fcc52
commit abcbce3e95
7 changed files with 199 additions and 155 deletions

View File

@ -3,145 +3,151 @@
"packages": [ "packages": [
{ {
"name": "async", "name": "async",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/async-2.10.0", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.10.0",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.18" "languageVersion": "2.18"
}, },
{ {
"name": "boolean_selector", "name": "boolean_selector",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/boolean_selector-2.1.1",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.17" "languageVersion": "2.17"
}, },
{
"name": "card_swiper",
"rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/card_swiper-2.0.4",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{ {
"name": "characters", "name": "characters",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/characters-1.2.1", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.2.1",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "languageVersion": "2.12"
}, },
{ {
"name": "clock", "name": "clock",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/clock-1.1.1", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/clock-1.1.1",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "languageVersion": "2.12"
}, },
{ {
"name": "collection", "name": "collection",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/collection-1.17.0", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.17.0",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "languageVersion": "2.12"
}, },
{ {
"name": "cupertino_icons", "name": "cupertino_icons",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.5", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/cupertino_icons-1.0.5",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "languageVersion": "2.12"
}, },
{ {
"name": "fake_async", "name": "fake_async",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/fake_async-1.3.1", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.1",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "languageVersion": "2.12"
}, },
{ {
"name": "flutter", "name": "flutter",
"rootUri": "file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter", "rootUri": "file:///C:/Users/Nutzer/flutter/packages/flutter",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.17" "languageVersion": "2.17"
}, },
{ {
"name": "flutter_lints", "name": "flutter_lints",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/flutter_lints-2.0.1", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-2.0.1",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.17" "languageVersion": "2.17"
}, },
{ {
"name": "flutter_test", "name": "flutter_test",
"rootUri": "file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter_test", "rootUri": "file:///C:/Users/Nutzer/flutter/packages/flutter_test",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.17" "languageVersion": "2.17"
}, },
{ {
"name": "js", "name": "js",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/js-0.6.5", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/js-0.6.5",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.16" "languageVersion": "2.16"
}, },
{ {
"name": "lints", "name": "lints",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/lints-2.0.1", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/lints-2.0.1",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.17" "languageVersion": "2.17"
}, },
{ {
"name": "matcher", "name": "matcher",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/matcher-0.12.13", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/matcher-0.12.13",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.18" "languageVersion": "2.18"
}, },
{ {
"name": "material_color_utilities", "name": "material_color_utilities",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/material_color_utilities-0.2.0", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/material_color_utilities-0.2.0",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.13" "languageVersion": "2.13"
}, },
{ {
"name": "meta", "name": "meta",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/meta-1.8.0", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.8.0",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "languageVersion": "2.12"
}, },
{ {
"name": "path", "name": "path",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/path-1.8.2", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/path-1.8.2",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "languageVersion": "2.12"
}, },
{ {
"name": "sky_engine", "name": "sky_engine",
"rootUri": "file:///usr/local/Caskroom/flutter/3.7.7/flutter/bin/cache/pkg/sky_engine", "rootUri": "file:///C:/Users/Nutzer/flutter/bin/cache/pkg/sky_engine",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "languageVersion": "2.12"
}, },
{ {
"name": "source_span", "name": "source_span",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/source_span-1.9.1", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/source_span-1.9.1",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.14" "languageVersion": "2.14"
}, },
{ {
"name": "stack_trace", "name": "stack_trace",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/stack_trace-1.11.0", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/stack_trace-1.11.0",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.18" "languageVersion": "2.18"
}, },
{ {
"name": "stream_channel", "name": "stream_channel",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/stream_channel-2.1.1", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/stream_channel-2.1.1",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.14" "languageVersion": "2.14"
}, },
{ {
"name": "string_scanner", "name": "string_scanner",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/string_scanner-1.2.0", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.2.0",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.18" "languageVersion": "2.18"
}, },
{ {
"name": "term_glyph", "name": "term_glyph",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/term_glyph-1.2.1", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/term_glyph-1.2.1",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "languageVersion": "2.12"
}, },
{ {
"name": "test_api", "name": "test_api",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/test_api-0.4.16", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/test_api-0.4.16",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.18" "languageVersion": "2.18"
}, },
{ {
"name": "vector_math", "name": "vector_math",
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/vector_math-2.1.4", "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/vector_math-2.1.4",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.14" "languageVersion": "2.14"
}, },
@ -152,7 +158,7 @@
"languageVersion": "2.19" "languageVersion": "2.19"
} }
], ],
"generated": "2023-04-13T20:45:03.708493Z", "generated": "2023-04-16T10:37:14.046582Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "2.19.6" "generatorVersion": "2.19.6"
} }

View File

@ -1,101 +1,105 @@
async async
2.18 2.18
file:///Users/bogdan/.pub-cache/hosted/pub.dev/async-2.10.0/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.10.0/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/async-2.10.0/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.10.0/lib/
boolean_selector boolean_selector
2.17 2.17
file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/boolean_selector-2.1.1/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/boolean_selector-2.1.1/lib/
card_swiper
2.12
file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/card_swiper-2.0.4/
file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/card_swiper-2.0.4/lib/
characters characters
2.12 2.12
file:///Users/bogdan/.pub-cache/hosted/pub.dev/characters-1.2.1/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.2.1/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/characters-1.2.1/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.2.1/lib/
clock clock
2.12 2.12
file:///Users/bogdan/.pub-cache/hosted/pub.dev/clock-1.1.1/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/clock-1.1.1/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/clock-1.1.1/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/clock-1.1.1/lib/
collection collection
2.12 2.12
file:///Users/bogdan/.pub-cache/hosted/pub.dev/collection-1.17.0/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.17.0/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/collection-1.17.0/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.17.0/lib/
cupertino_icons cupertino_icons
2.12 2.12
file:///Users/bogdan/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.5/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/cupertino_icons-1.0.5/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.5/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/cupertino_icons-1.0.5/lib/
fake_async fake_async
2.12 2.12
file:///Users/bogdan/.pub-cache/hosted/pub.dev/fake_async-1.3.1/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.1/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/fake_async-1.3.1/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.1/lib/
flutter_lints flutter_lints
2.17 2.17
file:///Users/bogdan/.pub-cache/hosted/pub.dev/flutter_lints-2.0.1/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-2.0.1/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/flutter_lints-2.0.1/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-2.0.1/lib/
js js
2.16 2.16
file:///Users/bogdan/.pub-cache/hosted/pub.dev/js-0.6.5/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/js-0.6.5/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/js-0.6.5/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/js-0.6.5/lib/
lints lints
2.17 2.17
file:///Users/bogdan/.pub-cache/hosted/pub.dev/lints-2.0.1/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/lints-2.0.1/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/lints-2.0.1/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/lints-2.0.1/lib/
matcher matcher
2.18 2.18
file:///Users/bogdan/.pub-cache/hosted/pub.dev/matcher-0.12.13/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/matcher-0.12.13/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/matcher-0.12.13/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/matcher-0.12.13/lib/
material_color_utilities material_color_utilities
2.13 2.13
file:///Users/bogdan/.pub-cache/hosted/pub.dev/material_color_utilities-0.2.0/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/material_color_utilities-0.2.0/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/material_color_utilities-0.2.0/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/material_color_utilities-0.2.0/lib/
meta meta
2.12 2.12
file:///Users/bogdan/.pub-cache/hosted/pub.dev/meta-1.8.0/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.8.0/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/meta-1.8.0/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.8.0/lib/
path path
2.12 2.12
file:///Users/bogdan/.pub-cache/hosted/pub.dev/path-1.8.2/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/path-1.8.2/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/path-1.8.2/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/path-1.8.2/lib/
source_span source_span
2.14 2.14
file:///Users/bogdan/.pub-cache/hosted/pub.dev/source_span-1.9.1/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/source_span-1.9.1/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/source_span-1.9.1/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/source_span-1.9.1/lib/
stack_trace stack_trace
2.18 2.18
file:///Users/bogdan/.pub-cache/hosted/pub.dev/stack_trace-1.11.0/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/stack_trace-1.11.0/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/stack_trace-1.11.0/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/stack_trace-1.11.0/lib/
stream_channel stream_channel
2.14 2.14
file:///Users/bogdan/.pub-cache/hosted/pub.dev/stream_channel-2.1.1/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/stream_channel-2.1.1/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/stream_channel-2.1.1/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/stream_channel-2.1.1/lib/
string_scanner string_scanner
2.18 2.18
file:///Users/bogdan/.pub-cache/hosted/pub.dev/string_scanner-1.2.0/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.2.0/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/string_scanner-1.2.0/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.2.0/lib/
term_glyph term_glyph
2.12 2.12
file:///Users/bogdan/.pub-cache/hosted/pub.dev/term_glyph-1.2.1/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/term_glyph-1.2.1/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/term_glyph-1.2.1/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/term_glyph-1.2.1/lib/
test_api test_api
2.18 2.18
file:///Users/bogdan/.pub-cache/hosted/pub.dev/test_api-0.4.16/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/test_api-0.4.16/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/test_api-0.4.16/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/test_api-0.4.16/lib/
vector_math vector_math
2.14 2.14
file:///Users/bogdan/.pub-cache/hosted/pub.dev/vector_math-2.1.4/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/vector_math-2.1.4/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/ file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/vector_math-2.1.4/lib/
ernaehrung
2.19
file:///Users/bogdan/IdeaProjects/ernaehrung/
file:///Users/bogdan/IdeaProjects/ernaehrung/lib/
sky_engine sky_engine
2.12 2.12
file:///usr/local/Caskroom/flutter/3.7.7/flutter/bin/cache/pkg/sky_engine/ file:///C:/Users/Nutzer/flutter/bin/cache/pkg/sky_engine/
file:///usr/local/Caskroom/flutter/3.7.7/flutter/bin/cache/pkg/sky_engine/lib/ file:///C:/Users/Nutzer/flutter/bin/cache/pkg/sky_engine/lib/
flutter flutter
2.17 2.17
file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter/ file:///C:/Users/Nutzer/flutter/packages/flutter/
file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter/lib/ file:///C:/Users/Nutzer/flutter/packages/flutter/lib/
flutter_test flutter_test
2.17 2.17
file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter_test/ file:///C:/Users/Nutzer/flutter/packages/flutter_test/
file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter_test/lib/ file:///C:/Users/Nutzer/flutter/packages/flutter_test/lib/
ernaehrung
2.19
file:///C:/Users/Nutzer/source/repos/Flutter-Ernaehrungsapp/
file:///C:/Users/Nutzer/source/repos/Flutter-Ernaehrungsapp/lib/
2 2

View File

@ -1 +1 @@
3.7.9 3.7.11

View File

@ -31,4 +31,5 @@
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />
</application> </application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest> </manifest>

View File

@ -1,115 +1,139 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:card_swiper/card_swiper.dart';
void main() { void main() {
runApp(const MyApp()); runApp(MyApp());
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
title: 'Flutter Demo', title: 'Flutter Demo',
theme: ThemeData( theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
), ),
home: const MyHomePage(title: 'Flutter Demo Home Page'), home: MyHomePage(title: 'Flutter Demo Home Page'),
); );
} }
} }
class MyHomePage extends StatefulWidget { class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title; final String title;
MyHomePage({required this.title});
@override @override
State<MyHomePage> createState() => _MyHomePageState(); _MyHomePageState createState() => _MyHomePageState();
} }
class _MyHomePageState extends State<MyHomePage> { class _MyHomePageState extends State<MyHomePage> {
int _counter = 0; int _selectedIndex = 0;
final PageController _pageController = PageController(initialPage: 0);
void _incrementCounter() { void _onItemTapped(int index) {
setState(() { setState(() {
// This call to setState tells the Flutter framework that something has _selectedIndex = index;
// changed in this State, which causes it to rerun the build method below _pageController.animateToPage(index,
// so that the display can reflect the updated values. If we changed duration: const Duration(milliseconds: 300), curve: Curves.easeInOut);
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title), title: Text(widget.title),
), ),
body: Center( body: PageView(
// Center is a layout widget. It takes a single child and positions it controller: _pageController,
// in the middle of the parent. children: _widgetOptions,
onPageChanged: (int index) {
setState(() {
_selectedIndex = index;
});
},
),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Page 1',
),
BottomNavigationBarItem(
icon: Icon(Icons.work),
label: 'Page 2',
),
BottomNavigationBarItem(
icon: Icon(Icons.school),
label: 'Page 3',
),
],
currentIndex: _selectedIndex,
onTap: _onItemTapped,
),
);
}
static final List<Widget> _widgetOptions = <Widget>[
Swiper(
itemBuilder: (BuildContext context, int index) {
return const CardContent(
title: 'Page 1',
description: 'This is page 1',
);
},
itemCount: 1,
loop: false,
),
Swiper(
itemBuilder: (BuildContext context, int index) {
return const CardContent(
title: 'Page 2',
description: 'This is page 2',
);
},
itemCount: 1,
loop: false,
),
Swiper(
itemBuilder: (BuildContext context, int index) {
return const CardContent(
title: 'Page 3',
description: 'This is page 3',
);
},
itemCount: 1,
loop: false,
),
];
}
class CardContent extends StatelessWidget {
final String title;
final String description;
const CardContent({required this.title, required this.description});
@override
Widget build(BuildContext context) {
return SizedBox(
height: MediaQuery.of(context).size.height * 0.8,
child: Card(
margin: const EdgeInsets.all(20.0),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column( child: Column(
// Column is also a layout widget. It takes a list of children and crossAxisAlignment: CrossAxisAlignment.start,
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
const Text( Text(title, style: const TextStyle(fontSize: 24.0)),
'You have pushed the button this many times:', const SizedBox(height: 8.0),
), Text(description, style: const TextStyle(fontSize: 16.0)),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
], ],
), ),
), ),
floatingActionButton: FloatingActionButton( ),
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
); );
} }
} }

View File

@ -17,6 +17,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
card_swiper:
dependency: "direct main"
description:
name: card_swiper
sha256: "0c94c538f47be1dab52d018d4900a7046b4cb0700dc7f95b8628da89d1212b35"
url: "https://pub.dev"
source: hosted
version: "2.0.4"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -186,3 +194,4 @@ packages:
version: "2.1.4" version: "2.1.4"
sdks: sdks:
dart: ">=2.19.6 <3.0.0" dart: ">=2.19.6 <3.0.0"
flutter: ">=0.1.4"

View File

@ -31,7 +31,7 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
card_swiper : ^2.0.1
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2