From abcbce3e954d112811b731b26fdb6af98128f988 Mon Sep 17 00:00:00 2001 From: 98spag Date: Sun, 16 Apr 2023 12:38:21 +0200 Subject: [PATCH 1/2] feat: swiper and bottom nav bar first draft --- .dart_tool/package_config.json | 56 ++++---- .dart_tool/package_config_subset | 108 +++++++------- .dart_tool/version | 2 +- android/app/src/main/AndroidManifest.xml | 1 + lib/main.dart | 176 +++++++++++++---------- pubspec.lock | 9 ++ pubspec.yaml | 2 +- 7 files changed, 199 insertions(+), 155 deletions(-) diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index 253e523..952c81f 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -3,145 +3,151 @@ "packages": [ { "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/", "languageVersion": "2.18" }, { "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/", "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", - "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/", "languageVersion": "2.12" }, { "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/", "languageVersion": "2.12" }, { "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/", "languageVersion": "2.12" }, { "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/", "languageVersion": "2.12" }, { "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/", "languageVersion": "2.12" }, { "name": "flutter", - "rootUri": "file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter", + "rootUri": "file:///C:/Users/Nutzer/flutter/packages/flutter", "packageUri": "lib/", "languageVersion": "2.17" }, { "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/", "languageVersion": "2.17" }, { "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/", "languageVersion": "2.17" }, { "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/", "languageVersion": "2.16" }, { "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/", "languageVersion": "2.17" }, { "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/", "languageVersion": "2.18" }, { "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/", "languageVersion": "2.13" }, { "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/", "languageVersion": "2.12" }, { "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/", "languageVersion": "2.12" }, { "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/", "languageVersion": "2.12" }, { "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/", "languageVersion": "2.14" }, { "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/", "languageVersion": "2.18" }, { "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/", "languageVersion": "2.14" }, { "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/", "languageVersion": "2.18" }, { "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/", "languageVersion": "2.12" }, { "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/", "languageVersion": "2.18" }, { "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/", "languageVersion": "2.14" }, @@ -152,7 +158,7 @@ "languageVersion": "2.19" } ], - "generated": "2023-04-13T20:45:03.708493Z", + "generated": "2023-04-16T10:37:14.046582Z", "generator": "pub", "generatorVersion": "2.19.6" } diff --git a/.dart_tool/package_config_subset b/.dart_tool/package_config_subset index dc93315..17af9d8 100644 --- a/.dart_tool/package_config_subset +++ b/.dart_tool/package_config_subset @@ -1,101 +1,105 @@ async 2.18 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.10.0/lib/ boolean_selector 2.17 -file:///Users/bogdan/.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/ +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 2.12 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.2.1/lib/ clock 2.12 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/clock-1.1.1/lib/ collection 2.12 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.17.0/lib/ cupertino_icons 2.12 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/cupertino_icons-1.0.5/lib/ fake_async 2.12 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.1/lib/ flutter_lints 2.17 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-2.0.1/lib/ js 2.16 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/js-0.6.5/lib/ lints 2.17 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/lints-2.0.1/lib/ matcher 2.18 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/matcher-0.12.13/lib/ material_color_utilities 2.13 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/material_color_utilities-0.2.0/lib/ meta 2.12 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.8.0/lib/ path 2.12 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/path-1.8.2/lib/ source_span 2.14 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/source_span-1.9.1/lib/ stack_trace 2.18 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/stack_trace-1.11.0/lib/ stream_channel 2.14 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/stream_channel-2.1.1/lib/ string_scanner 2.18 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.2.0/lib/ term_glyph 2.12 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/term_glyph-1.2.1/lib/ test_api 2.18 -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/test_api-0.4.16/lib/ vector_math 2.14 -file:///Users/bogdan/.pub-cache/hosted/pub.dev/vector_math-2.1.4/ -file:///Users/bogdan/.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/ +file:///C:/Users/Nutzer/AppData/Local/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/lib/ sky_engine 2.12 -file:///usr/local/Caskroom/flutter/3.7.7/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/ +file:///C:/Users/Nutzer/flutter/bin/cache/pkg/sky_engine/lib/ flutter 2.17 -file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter/ -file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter/lib/ +file:///C:/Users/Nutzer/flutter/packages/flutter/ +file:///C:/Users/Nutzer/flutter/packages/flutter/lib/ flutter_test 2.17 -file:///usr/local/Caskroom/flutter/3.7.7/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/ +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 diff --git a/.dart_tool/version b/.dart_tool/version index 7560320..ad64131 100644 --- a/.dart_tool/version +++ b/.dart_tool/version @@ -1 +1 @@ -3.7.9 \ No newline at end of file +3.7.11 \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 7bb52fe..631cb46 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -31,4 +31,5 @@ android:name="flutterEmbedding" android:value="2" /> + diff --git a/lib/main.dart b/lib/main.dart index 008fa38..1c4a394 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,115 +1,139 @@ import 'package:flutter/material.dart'; +import 'package:card_swiper/card_swiper.dart'; void main() { - runApp(const MyApp()); + runApp(MyApp()); } class MyApp extends StatelessWidget { - const MyApp({super.key}); - - // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', 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, ), - home: const MyHomePage(title: 'Flutter Demo Home Page'), + home: MyHomePage(title: 'Flutter Demo Home Page'), ); } } 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; + MyHomePage({required this.title}); + @override - State createState() => _MyHomePageState(); + _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State { - int _counter = 0; + int _selectedIndex = 0; + final PageController _pageController = PageController(initialPage: 0); - void _incrementCounter() { + void _onItemTapped(int index) { setState(() { - // This call to setState tells the Flutter framework that something has - // changed in this State, which causes it to rerun the build method below - // so that the display can reflect the updated values. If we changed - // _counter without calling setState(), then the build method would not be - // called again, and so nothing would appear to happen. - _counter++; + _selectedIndex = index; + _pageController.animateToPage(index, + duration: const Duration(milliseconds: 300), curve: Curves.easeInOut); }); } @override 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( 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), ), - body: Center( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. - child: Column( - // Column is also a layout widget. It takes a list of children and - // 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: [ - const Text( - 'You have pushed the button this many times:', - ), - Text( - '$_counter', - style: Theme.of(context).textTheme.headlineMedium, - ), - ], - ), + body: PageView( + controller: _pageController, + children: _widgetOptions, + onPageChanged: (int index) { + setState(() { + _selectedIndex = index; + }); + }, + ), + bottomNavigationBar: BottomNavigationBar( + items: const [ + 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, ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), // This trailing comma makes auto-formatting nicer for build methods. ); } + + static final List _widgetOptions = [ + 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( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title, style: const TextStyle(fontSize: 24.0)), + const SizedBox(height: 8.0), + Text(description, style: const TextStyle(fontSize: 16.0)), + ], + ), + ), + ), + ); + + } } diff --git a/pubspec.lock b/pubspec.lock index b2cb69d..0825636 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -17,6 +17,14 @@ packages: url: "https://pub.dev" source: hosted 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: dependency: transitive description: @@ -186,3 +194,4 @@ packages: version: "2.1.4" sdks: dart: ">=2.19.6 <3.0.0" + flutter: ">=0.1.4" diff --git a/pubspec.yaml b/pubspec.yaml index 55f1d5c..678a817 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,7 +31,7 @@ dependencies: flutter: sdk: flutter - + card_swiper : ^2.0.1 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 From 75ea3ed6f328f062c839c5ffcf85b3c865ed44cf Mon Sep 17 00:00:00 2001 From: bogdan <1926167@stud.hs-mannheim.de> Date: Wed, 19 Apr 2023 16:24:14 +0200 Subject: [PATCH 2/2] =?UTF-8?q?WelcomeScreen=20und=20Navigation=20zusammen?= =?UTF-8?q?=20verkn=C3=BCpft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dart_tool/package_config.json | 52 ++--- .dart_tool/package_config_subset | 116 +++++------ .dart_tool/version | 2 +- lib/components/cardComponent.dart | 30 +++ .../welcomePageChildrenTextField.dart | 187 ++++++++++++++++++ lib/main.dart | 132 +------------ lib/views/navigation/navigationScreen.dart | 89 +++++++++ lib/views/welcome/welcomeScreen.dart | 42 ++++ 8 files changed, 442 insertions(+), 208 deletions(-) create mode 100644 lib/components/cardComponent.dart create mode 100644 lib/components/welcomePageChildrenTextField.dart create mode 100644 lib/views/navigation/navigationScreen.dart create mode 100644 lib/views/welcome/welcomeScreen.dart diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index 952c81f..a6e1a10 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -3,151 +3,151 @@ "packages": [ { "name": "async", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.10.0", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/async-2.10.0", "packageUri": "lib/", "languageVersion": "2.18" }, { "name": "boolean_selector", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/boolean_selector-2.1.1", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1", "packageUri": "lib/", "languageVersion": "2.17" }, { "name": "card_swiper", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/card_swiper-2.0.4", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/card_swiper-2.0.4", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "characters", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.2.1", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/characters-1.2.1", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "clock", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/clock-1.1.1", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/clock-1.1.1", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "collection", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.17.0", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/collection-1.17.0", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "cupertino_icons", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/cupertino_icons-1.0.5", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.5", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "fake_async", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.1", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/fake_async-1.3.1", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "flutter", - "rootUri": "file:///C:/Users/Nutzer/flutter/packages/flutter", + "rootUri": "file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter", "packageUri": "lib/", "languageVersion": "2.17" }, { "name": "flutter_lints", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-2.0.1", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/flutter_lints-2.0.1", "packageUri": "lib/", "languageVersion": "2.17" }, { "name": "flutter_test", - "rootUri": "file:///C:/Users/Nutzer/flutter/packages/flutter_test", + "rootUri": "file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter_test", "packageUri": "lib/", "languageVersion": "2.17" }, { "name": "js", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/js-0.6.5", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/js-0.6.5", "packageUri": "lib/", "languageVersion": "2.16" }, { "name": "lints", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/lints-2.0.1", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/lints-2.0.1", "packageUri": "lib/", "languageVersion": "2.17" }, { "name": "matcher", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/matcher-0.12.13", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/matcher-0.12.13", "packageUri": "lib/", "languageVersion": "2.18" }, { "name": "material_color_utilities", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/material_color_utilities-0.2.0", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/material_color_utilities-0.2.0", "packageUri": "lib/", "languageVersion": "2.13" }, { "name": "meta", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.8.0", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/meta-1.8.0", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "path", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/path-1.8.2", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/path-1.8.2", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "sky_engine", - "rootUri": "file:///C:/Users/Nutzer/flutter/bin/cache/pkg/sky_engine", + "rootUri": "file:///usr/local/Caskroom/flutter/3.7.7/flutter/bin/cache/pkg/sky_engine", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "source_span", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/source_span-1.9.1", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/source_span-1.9.1", "packageUri": "lib/", "languageVersion": "2.14" }, { "name": "stack_trace", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/stack_trace-1.11.0", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/stack_trace-1.11.0", "packageUri": "lib/", "languageVersion": "2.18" }, { "name": "stream_channel", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/stream_channel-2.1.1", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/stream_channel-2.1.1", "packageUri": "lib/", "languageVersion": "2.14" }, { "name": "string_scanner", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.2.0", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/string_scanner-1.2.0", "packageUri": "lib/", "languageVersion": "2.18" }, { "name": "term_glyph", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/term_glyph-1.2.1", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/term_glyph-1.2.1", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "test_api", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/test_api-0.4.16", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/test_api-0.4.16", "packageUri": "lib/", "languageVersion": "2.18" }, { "name": "vector_math", - "rootUri": "file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/vector_math-2.1.4", + "rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/vector_math-2.1.4", "packageUri": "lib/", "languageVersion": "2.14" }, @@ -158,7 +158,7 @@ "languageVersion": "2.19" } ], - "generated": "2023-04-16T10:37:14.046582Z", + "generated": "2023-04-17T20:45:45.108623Z", "generator": "pub", "generatorVersion": "2.19.6" } diff --git a/.dart_tool/package_config_subset b/.dart_tool/package_config_subset index 17af9d8..f5fefb5 100644 --- a/.dart_tool/package_config_subset +++ b/.dart_tool/package_config_subset @@ -1,105 +1,105 @@ async 2.18 -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.10.0/ -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.10.0/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/async-2.10.0/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/async-2.10.0/lib/ boolean_selector 2.17 -file:///C:/Users/Nutzer/AppData/Local/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/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/ +file:///Users/bogdan/.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/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/card_swiper-2.0.4/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/card_swiper-2.0.4/lib/ characters 2.12 -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.2.1/ -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.2.1/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/characters-1.2.1/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/characters-1.2.1/lib/ clock 2.12 -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/clock-1.1.1/ -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/clock-1.1.1/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/clock-1.1.1/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/clock-1.1.1/lib/ collection 2.12 -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.17.0/ -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.17.0/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/collection-1.17.0/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/collection-1.17.0/lib/ cupertino_icons 2.12 -file:///C:/Users/Nutzer/AppData/Local/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/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.5/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.5/lib/ fake_async 2.12 -file:///C:/Users/Nutzer/AppData/Local/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/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/fake_async-1.3.1/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/fake_async-1.3.1/lib/ flutter_lints 2.17 -file:///C:/Users/Nutzer/AppData/Local/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/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/flutter_lints-2.0.1/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/flutter_lints-2.0.1/lib/ js 2.16 -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/js-0.6.5/ -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/js-0.6.5/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/js-0.6.5/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/js-0.6.5/lib/ lints 2.17 -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/lints-2.0.1/ -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/lints-2.0.1/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/lints-2.0.1/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/lints-2.0.1/lib/ matcher 2.18 -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/matcher-0.12.13/ -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/matcher-0.12.13/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/matcher-0.12.13/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/matcher-0.12.13/lib/ material_color_utilities 2.13 -file:///C:/Users/Nutzer/AppData/Local/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/lib/ +file:///Users/bogdan/.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/ meta 2.12 -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.8.0/ -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.8.0/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/meta-1.8.0/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/meta-1.8.0/lib/ path 2.12 -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/path-1.8.2/ -file:///C:/Users/Nutzer/AppData/Local/Pub/Cache/hosted/pub.dev/path-1.8.2/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/path-1.8.2/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/path-1.8.2/lib/ source_span 2.14 -file:///C:/Users/Nutzer/AppData/Local/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/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/source_span-1.9.1/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/source_span-1.9.1/lib/ stack_trace 2.18 -file:///C:/Users/Nutzer/AppData/Local/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/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/stack_trace-1.11.0/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/stack_trace-1.11.0/lib/ stream_channel 2.14 -file:///C:/Users/Nutzer/AppData/Local/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/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/stream_channel-2.1.1/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/stream_channel-2.1.1/lib/ string_scanner 2.18 -file:///C:/Users/Nutzer/AppData/Local/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/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/string_scanner-1.2.0/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/string_scanner-1.2.0/lib/ term_glyph 2.12 -file:///C:/Users/Nutzer/AppData/Local/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/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/term_glyph-1.2.1/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/term_glyph-1.2.1/lib/ test_api 2.18 -file:///C:/Users/Nutzer/AppData/Local/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/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/test_api-0.4.16/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/test_api-0.4.16/lib/ vector_math 2.14 -file:///C:/Users/Nutzer/AppData/Local/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/lib/ -sky_engine -2.12 -file:///C:/Users/Nutzer/flutter/bin/cache/pkg/sky_engine/ -file:///C:/Users/Nutzer/flutter/bin/cache/pkg/sky_engine/lib/ -flutter -2.17 -file:///C:/Users/Nutzer/flutter/packages/flutter/ -file:///C:/Users/Nutzer/flutter/packages/flutter/lib/ -flutter_test -2.17 -file:///C:/Users/Nutzer/flutter/packages/flutter_test/ -file:///C:/Users/Nutzer/flutter/packages/flutter_test/lib/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/vector_math-2.1.4/ +file:///Users/bogdan/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/ ernaehrung 2.19 -file:///C:/Users/Nutzer/source/repos/Flutter-Ernaehrungsapp/ -file:///C:/Users/Nutzer/source/repos/Flutter-Ernaehrungsapp/lib/ +file:///Users/bogdan/IdeaProjects/erna%CC%88hrung/ +file:///Users/bogdan/IdeaProjects/erna%CC%88hrung/lib/ +sky_engine +2.12 +file:///usr/local/Caskroom/flutter/3.7.7/flutter/bin/cache/pkg/sky_engine/ +file:///usr/local/Caskroom/flutter/3.7.7/flutter/bin/cache/pkg/sky_engine/lib/ +flutter +2.17 +file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter/ +file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter/lib/ +flutter_test +2.17 +file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter_test/ +file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter_test/lib/ 2 diff --git a/.dart_tool/version b/.dart_tool/version index ad64131..7560320 100644 --- a/.dart_tool/version +++ b/.dart_tool/version @@ -1 +1 @@ -3.7.11 \ No newline at end of file +3.7.9 \ No newline at end of file diff --git a/lib/components/cardComponent.dart b/lib/components/cardComponent.dart new file mode 100644 index 0000000..0e3e437 --- /dev/null +++ b/lib/components/cardComponent.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; + +class CardComponent extends StatelessWidget { + final String title; + final String description; + + const CardComponent({super.key, 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( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title, style: const TextStyle(fontSize: 24.0)), + const SizedBox(height: 8.0), + Text(description, style: const TextStyle(fontSize: 16.0)), + ], + ), + ), + ), + ); + + } +} \ No newline at end of file diff --git a/lib/components/welcomePageChildrenTextField.dart b/lib/components/welcomePageChildrenTextField.dart new file mode 100644 index 0000000..5ea0ac8 --- /dev/null +++ b/lib/components/welcomePageChildrenTextField.dart @@ -0,0 +1,187 @@ +import 'package:ernaehrung/views/navigation/navigationScreen.dart'; +import 'package:flutter/material.dart'; + +class WelcomePageStateTextFieldState extends StatefulWidget { + const WelcomePageStateTextFieldState({super.key}); + + @override + State createState() => + _WelcomePageStateTextFieldState(); +} + +class _WelcomePageStateTextFieldState + extends State { + final firstnameTextEditingController = TextEditingController(); + final secondnameTextEditingController = TextEditingController(); + final weightTextEditingController = TextEditingController(); + final heightTextEditingController = TextEditingController(); + final caloriesTextEditingController = TextEditingController(); + + bool isNameVisible = false; + bool isSNameVisible = false; + bool isWeightVisible = false; + bool isHeightVisible = false; + bool isCaloriesVisible = false; + + void setNameVisible(bool visibility) { + setState(() => isNameVisible = visibility); + } + + void setSNameVisible(bool visibility) { + setState(() => isSNameVisible = visibility); + } + + void setWeightVisible(bool visibility) { + setState(() => isWeightVisible = visibility); + } + + void setHeightVisible(bool visibility) { + setState(() => isHeightVisible = visibility); + } + + void setCaloriesVisible(bool visibility) { + setState(() => isCaloriesVisible = visibility); + } + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox( + height: 24, + ), + TextFormField( + onChanged: (newText) { + if (newText.isNotEmpty) { + setNameVisible(true); + } else { + setNameVisible(false); + } + }, + controller: firstnameTextEditingController, + decoration: InputDecoration( + hintText: 'Name', + border: const OutlineInputBorder(gapPadding: 8), + suffixIcon: isNameVisible + ? IconButton( + onPressed: () { + firstnameTextEditingController.clear(); + setState(() => isNameVisible = false); + }, + icon: const Icon(Icons.clear)) + : null, + ), + keyboardType: TextInputType.text, + ), + const SizedBox( + height: 24, + ), + TextFormField( + onChanged: (newText) { + if (newText.isNotEmpty) { + setSNameVisible(true); + } else { + setSNameVisible(false); + } + }, + controller: secondnameTextEditingController, + decoration: InputDecoration( + hintText: 'Vorname', + border: const OutlineInputBorder(gapPadding: 8), + suffixIcon: isSNameVisible + ? IconButton( + onPressed: () { + secondnameTextEditingController.clear(); + setState(() => isSNameVisible = false); + }, + icon: const Icon(Icons.clear)) + : null, + ), + keyboardType: TextInputType.text), + const SizedBox( + height: 24, + ), + TextFormField( + onChanged: (newText) { + if (newText.isNotEmpty) { + setWeightVisible(true); + } else { + setWeightVisible(false); + } + }, + controller: weightTextEditingController, + decoration: InputDecoration( + hintText: 'Gewicht', + border: const OutlineInputBorder(gapPadding: 8), + suffixIcon: isWeightVisible + ? IconButton( + onPressed: () { + weightTextEditingController.clear(); + setState(() => isWeightVisible = false); + }, + icon: const Icon(Icons.clear)) + : null, + ), + keyboardType: TextInputType.number), + const SizedBox( + height: 24, + ), + TextFormField( + onChanged: (newText) { + if (newText.isNotEmpty) { + setHeightVisible(true); + } else { + setHeightVisible(false); + } + }, + controller: heightTextEditingController, + decoration: InputDecoration( + hintText: 'Größe', + border: const OutlineInputBorder(gapPadding: 8), + suffixIcon: isHeightVisible + ? IconButton( + onPressed: () { + heightTextEditingController.clear(); + setState(() => isHeightVisible = false); + }, + icon: const Icon(Icons.clear)) + : null, + ), + keyboardType: TextInputType.number), + const SizedBox( + height: 24, + ), + TextFormField( + onChanged: (newText) { + if (newText.isNotEmpty) { + setCaloriesVisible(true); + } else { + setCaloriesVisible(false); + } + }, + controller: caloriesTextEditingController, + decoration: InputDecoration( + hintText: 'gewünschte Kalorienzufuhr', + border: const OutlineInputBorder(gapPadding: 8), + suffixIcon: isCaloriesVisible + ? IconButton( + onPressed: () { + caloriesTextEditingController.clear(); + setState(() => isCaloriesVisible = false); + }, + icon: const Icon(Icons.clear)) + : null, + ), + keyboardType: TextInputType.number), + const SizedBox( + height: 24, + ), + ElevatedButton(onPressed: (){ + Navigator.pushAndRemoveUntil(context, + MaterialPageRoute(builder: (context) => const NavigationScreen()), (r) => false); + }, child: const Text('Bestätigen')) + ], + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index 1c4a394..d688926 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,11 +1,14 @@ +import 'package:ernaehrung/views/navigation/navigationScreen.dart'; +import 'package:ernaehrung/views/welcome/welcomeScreen.dart'; import 'package:flutter/material.dart'; -import 'package:card_swiper/card_swiper.dart'; void main() { - runApp(MyApp()); + runApp(const MyApp()); } class MyApp extends StatelessWidget { + const MyApp({super.key}); + @override Widget build(BuildContext context) { return MaterialApp( @@ -13,127 +16,10 @@ class MyApp extends StatelessWidget { theme: ThemeData( primarySwatch: Colors.blue, ), - home: MyHomePage(title: 'Flutter Demo Home Page'), + home: const WelcomeScreen(), + routes: { + '/navigation': (context) => const NavigationScreen(), + }, ); } } - -class MyHomePage extends StatefulWidget { - final String title; - - MyHomePage({required this.title}); - - @override - _MyHomePageState createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _selectedIndex = 0; - final PageController _pageController = PageController(initialPage: 0); - - void _onItemTapped(int index) { - setState(() { - _selectedIndex = index; - _pageController.animateToPage(index, - duration: const Duration(milliseconds: 300), curve: Curves.easeInOut); - }); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text(widget.title), - ), - body: PageView( - controller: _pageController, - children: _widgetOptions, - onPageChanged: (int index) { - setState(() { - _selectedIndex = index; - }); - }, - ), - bottomNavigationBar: BottomNavigationBar( - items: const [ - 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 _widgetOptions = [ - 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( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(title, style: const TextStyle(fontSize: 24.0)), - const SizedBox(height: 8.0), - Text(description, style: const TextStyle(fontSize: 16.0)), - ], - ), - ), - ), - ); - - } -} diff --git a/lib/views/navigation/navigationScreen.dart b/lib/views/navigation/navigationScreen.dart new file mode 100644 index 0000000..9885192 --- /dev/null +++ b/lib/views/navigation/navigationScreen.dart @@ -0,0 +1,89 @@ +import 'package:card_swiper/card_swiper.dart'; +import 'package:ernaehrung/components/cardComponent.dart'; +import 'package:flutter/material.dart'; + +class NavigationScreen extends StatefulWidget { + const NavigationScreen({super.key}); + + @override + NavigationScreenState createState() => NavigationScreenState(); +} + +class NavigationScreenState extends State { + int _selectedIndex = 0; + final PageController _pageController = PageController(initialPage: 0); + + void _onItemTapped(int index) { + setState(() { + _selectedIndex = index; + _pageController.animateToPage(index, + duration: const Duration(milliseconds: 300), curve: Curves.easeInOut); + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: PageView( + controller: _pageController, + children: _widgetOptions, + onPageChanged: (int index) { + setState(() { + _selectedIndex = index; + }); + }, + ), + bottomNavigationBar: BottomNavigationBar( + items: const [ + 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 _widgetOptions = [ + Swiper( + itemBuilder: (BuildContext context, int index) { + return const CardComponent( + title: 'Page 1', + description: 'This is page 1', + ); + }, + itemCount: 1, + loop: false, + ), + Swiper( + itemBuilder: (BuildContext context, int index) { + return const CardComponent( + title: 'Page 2', + description: 'This is page 2', + ); + }, + itemCount: 1, + loop: false, + ), + Swiper( + itemBuilder: (BuildContext context, int index) { + return const CardComponent( + title: 'Page 3', + description: 'This is page 3', + ); + }, + itemCount: 1, + loop: false, + ), + ]; +} diff --git a/lib/views/welcome/welcomeScreen.dart b/lib/views/welcome/welcomeScreen.dart new file mode 100644 index 0000000..dd4106c --- /dev/null +++ b/lib/views/welcome/welcomeScreen.dart @@ -0,0 +1,42 @@ +import 'package:ernaehrung/components/welcomePageChildrenTextField.dart'; +import 'package:flutter/material.dart'; + +class WelcomeScreen extends StatelessWidget { + const WelcomeScreen({super.key}); + + @override + Widget build(BuildContext context) { + return const MaterialApp( + title: 'Welcome Screen', + home: WelcomeScreenPage(), + ); + } +} + +class WelcomeScreenPage extends StatefulWidget { + const WelcomeScreenPage({super.key}); + + @override + State createState() => WelcomeScreenPageState(); +} + +class WelcomeScreenPageState extends State { + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Welcome Screen'), + ), + body: const SizedBox( + height: double.infinity, + width: double.infinity, + child: SingleChildScrollView( + child: Form( + child: WelcomePageStateTextFieldState(), + ) + ), + ) + ); + } +}