From 015149ef0d43c6e22e085556cc5ae91cbb16c003 Mon Sep 17 00:00:00 2001 From: Lord-Bubbles Date: Sun, 13 Oct 2024 21:55:57 -0500 Subject: [PATCH 1/7] Update dependencies --- weekly_assignment_4/pubspec.lock | 129 ++++++++++++++++++++++--------- weekly_assignment_4/pubspec.yaml | 2 +- 2 files changed, 92 insertions(+), 39 deletions(-) diff --git a/weekly_assignment_4/pubspec.lock b/weekly_assignment_4/pubspec.lock index 9295504..6537ddd 100644 --- a/weekly_assignment_4/pubspec.lock +++ b/weekly_assignment_4/pubspec.lock @@ -5,49 +5,56 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.18.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.8" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted version: "1.3.1" flutter: @@ -59,49 +66,79 @@ packages: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.dartlang.org" + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "5.0.0" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: name: lints - url: "https://pub.dartlang.org" + sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413" + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "5.0.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.11.1" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.15.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.9.0" sky_engine: dependency: transitive description: flutter @@ -111,50 +148,66 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.7.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + url: "https://pub.dev" + source: hosted + version: "14.2.5" sdks: - dart: ">=2.18.2 <3.0.0" + dart: ">=3.5.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/weekly_assignment_4/pubspec.yaml b/weekly_assignment_4/pubspec.yaml index 58c4d87..70bed79 100644 --- a/weekly_assignment_4/pubspec.yaml +++ b/weekly_assignment_4/pubspec.yaml @@ -46,7 +46,7 @@ dev_dependencies: # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. - flutter_lints: ^2.0.0 + flutter_lints: ^5.0.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec From b92b25803978c0449eb2dc3fe8d79ce60e8a3759 Mon Sep 17 00:00:00 2001 From: Lord-Bubbles Date: Sun, 13 Oct 2024 21:56:36 -0500 Subject: [PATCH 2/7] Change kotlin version to a supported version to run android emulator --- weekly_assignment_4/android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weekly_assignment_4/android/build.gradle b/weekly_assignment_4/android/build.gradle index 83ae220..ea855b6 100644 --- a/weekly_assignment_4/android/build.gradle +++ b/weekly_assignment_4/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.6.10' + ext.kotlin_version = '1.7.10' repositories { google() mavenCentral() @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } From 7ee95eed4c05224b7d16f1321df2383dcb165746 Mon Sep 17 00:00:00 2001 From: Lord-Bubbles Date: Sun, 13 Oct 2024 21:57:14 -0500 Subject: [PATCH 3/7] Update CMakeLists.txt --- weekly_assignment_4/windows/flutter/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/weekly_assignment_4/windows/flutter/CMakeLists.txt b/weekly_assignment_4/windows/flutter/CMakeLists.txt index 930d207..903f489 100644 --- a/weekly_assignment_4/windows/flutter/CMakeLists.txt +++ b/weekly_assignment_4/windows/flutter/CMakeLists.txt @@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake) # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") @@ -92,7 +97,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - windows-x64 $ + ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS From cbde2be18f079177e7b57bc1559525399aff001f Mon Sep 17 00:00:00 2001 From: Lord-Bubbles Date: Sun, 13 Oct 2024 21:57:52 -0500 Subject: [PATCH 4/7] Change homepage to have two buttons that navigate to different pages --- weekly_assignment_4/lib/main.dart | 98 ++++++++++++++++--------------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/weekly_assignment_4/lib/main.dart b/weekly_assignment_4/lib/main.dart index e016029..cb31e5e 100644 --- a/weekly_assignment_4/lib/main.dart +++ b/weekly_assignment_4/lib/main.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'Navbar.dart'; +import 'Navrail.dart'; void main() { runApp(const MyApp()); @@ -11,25 +13,24 @@ class MyApp extends StatelessWidget { @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'), - ); + title: 'Weekly Assignment 4', + 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: 'Weekly Assignment 4')); } } -class MyHomePage extends StatefulWidget { +class MyHomePage extends StatelessWidget { const MyHomePage({super.key, required this.title}); // This widget is the home page of your application. It is stateful, meaning @@ -43,24 +44,6 @@ class MyHomePage extends StatefulWidget { final String title; - @override - State createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _counter = 0; - - void _incrementCounter() { - 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++; - }); - } - @override Widget build(BuildContext context) { // This method is rerun every time setState is called, for instance as done @@ -73,12 +56,12 @@ class _MyHomePageState extends State { 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(title), ), body: Center( // Center is a layout widget. It takes a single child and positions it // in the middle of the parent. - child: Column( + child: Row( // 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. @@ -93,23 +76,42 @@ class _MyHomePageState extends State { // 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, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - const Text( - 'You have pushed the button this many times:', - ), - Text( - '$_counter', - style: Theme.of(context).textTheme.headline4, + TextButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const Navbar( + title: Text('Bottom Navigation Bar Page'), + ))); + }, + style: TextButton.styleFrom( + backgroundColor: Colors.black, + foregroundColor: Colors.blue[300], + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5))), + child: const Text('Go to navigation bar page'), ), + TextButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const Navrail( + title: Text('Navigation Rail Page'), + ))); + }, + style: TextButton.styleFrom( + backgroundColor: Colors.black, + foregroundColor: Colors.blue[300], + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5))), + child: const Text('Go to navigation rail page')) ], ), ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), // This trailing comma makes auto-formatting nicer for build methods. ); } } From db3b8e57518f0f0bc077027e60ea69a8e7ffb378 Mon Sep 17 00:00:00 2001 From: Lord-Bubbles Date: Sun, 13 Oct 2024 21:58:12 -0500 Subject: [PATCH 5/7] Create the NavigationBarPage --- weekly_assignment_4/lib/Navbar.dart | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 weekly_assignment_4/lib/Navbar.dart diff --git a/weekly_assignment_4/lib/Navbar.dart b/weekly_assignment_4/lib/Navbar.dart new file mode 100644 index 0000000..524fe29 --- /dev/null +++ b/weekly_assignment_4/lib/Navbar.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; + +class Navbar extends StatefulWidget { + const Navbar({super.key, required this.title}); + + final Text title; + + @override + State createState() => _NavbarState(); +} + +class _NavbarState extends State { + int _selectedIndex = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: widget.title, + ), + body: Column(children: [ + Expanded( + child: Center( + child: IndexedStack( + index: _selectedIndex, + children: [Text('Home'), Text('Profile'), Text('Settings')], + ), + )) + ]), + bottomNavigationBar: BottomNavigationBar( + onTap: (int index) { + setState(() { + _selectedIndex = index; + }); + }, + currentIndex: _selectedIndex, + selectedItemColor: Colors.blue, + items: const [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + label: 'Home', + ), + BottomNavigationBarItem( + icon: Icon(Icons.person), + label: 'Profile', + ), + BottomNavigationBarItem( + icon: Icon(Icons.settings), label: 'Settings') + ], + )); + } +} From c0920f76420c00acb63627ec6a875aa13a95bfc1 Mon Sep 17 00:00:00 2001 From: Lord-Bubbles Date: Sun, 13 Oct 2024 21:58:30 -0500 Subject: [PATCH 6/7] Create the NavigationRailPage --- weekly_assignment_4/lib/Navrail.dart | 60 ++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 weekly_assignment_4/lib/Navrail.dart diff --git a/weekly_assignment_4/lib/Navrail.dart b/weekly_assignment_4/lib/Navrail.dart new file mode 100644 index 0000000..9ed1bdb --- /dev/null +++ b/weekly_assignment_4/lib/Navrail.dart @@ -0,0 +1,60 @@ +import 'package:flutter/material.dart'; + +class Navrail extends StatefulWidget { + const Navrail({super.key, required this.title}); + + final Text title; + + @override + State createState() => _NavrailState(); +} + +class _NavrailState extends State { + int _selectedIndex = 0; + double groupAlignment = -1.0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: widget.title), + body: Row( + children: [ + NavigationRail( + selectedIndex: _selectedIndex, + groupAlignment: groupAlignment, + labelType: NavigationRailLabelType.all, + onDestinationSelected: (int index) { + setState(() { + _selectedIndex = index; + }); + }, + selectedLabelTextStyle: TextStyle(color: Colors.blue), + unselectedLabelTextStyle: TextStyle(color: Colors.black), + selectedIconTheme: const IconThemeData(color: Colors.blue), + useIndicator: false, + destinations: const [ + NavigationRailDestination( + icon: Icon(Icons.favorite_border), + label: Text('Favorite'), + selectedIcon: Icon(Icons.favorite)), + NavigationRailDestination( + icon: Icon(Icons.bookmark_outline), + label: Text('Bookmark'), + selectedIcon: Icon(Icons.bookmark)), + NavigationRailDestination( + icon: Icon(Icons.star_border), + label: Text('Star'), + selectedIcon: Icon(Icons.star)) + ], + ), + const VerticalDivider(thickness: 1, width: 1), + Expanded( + child: Center( + child: IndexedStack( + index: _selectedIndex, + children: [Text('Favorite'), Text('Bookmark'), Text('Star')], + ))) + ], + )); + } +} From 0e32e774a90aedb19431160763ff2b8157ab63d3 Mon Sep 17 00:00:00 2001 From: Lord-Bubbles Date: Sun, 13 Oct 2024 21:59:58 -0500 Subject: [PATCH 7/7] Add vscode to gitignore --- weekly_assignment_4/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weekly_assignment_4/.gitignore b/weekly_assignment_4/.gitignore index 24476c5..5836224 100644 --- a/weekly_assignment_4/.gitignore +++ b/weekly_assignment_4/.gitignore @@ -19,7 +19,7 @@ migrate_working_dir/ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. -#.vscode/ +.vscode/ # Flutter/Dart/Pub related **/doc/api/