diff --git a/.gitignore b/.gitignore index ae1f183..b2cbebc 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,6 @@ lib/generated_plugin_registrant.dart # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +# keys +*/keys.dart \ No newline at end of file diff --git a/README.md b/README.md index bacb9e5..69a1ef9 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ | ![More page](./readme-images/more-page.png) | **More page**, where users can change settings and see some more features | | ![dark view](./readme-images/dark-showcase.png) | 🌙 **Dark theme** | | ![rename](./readme-images/rename.png) | Bus stops can be renamed (renamed bus stops in italics) | +| ![quick actions](./readme-images/quick-actions.png) | **Quick actions!** These do not seem to be working on iOS at the moment: [#13634](https://github.com/flutter/flutter/issues/13634). | [This](https://imgur.com/a/8QOCKBy) and [this](https://imgur.com/a/wXQWfeq) was what the design looked like at first. @@ -51,6 +52,7 @@ - [x] Theme customization - [x] Light/dark theme - [ ] Change status bar text color depending on theme + - [x ] Add quick actions to go to favorites and MRT map (implemented, but not working on IOS: [#13634](https://github.com/flutter/flutter/issues/13634)) - [ ] Accent color (unplanned) (~~might not implement~~) (only blue, green, and light blue) - [ ] Change font size (unplanned) (might not implement) - [ ] **THINK OF A MORE CREATIVE NAME.** diff --git a/lib/main.dart b/lib/main.dart index 5f70548..3309e29 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,6 +6,7 @@ import 'package:nextbussg/providers/favorites.dart'; import 'package:nextbussg/providers/home_rebuilder.dart'; import 'package:nextbussg/providers/locationPerms.dart'; import 'package:nextbussg/providers/search.dart'; +import 'package:nextbussg/quick_actions.dart'; import 'package:nextbussg/routes/search.dart'; import 'package:nextbussg/styles/theme.dart'; import 'package:flutter/material.dart'; @@ -90,36 +91,7 @@ class MainApp extends StatelessWidget { // quick actions final QuickActions quickActions = QuickActions(); - quickActions.initialize((String shortcutType) { - // if (shortcutType == 'mrt_map') { - // Routing.openRoute(context, MRTMapPage()); - // } else if (shor) - switch (shortcutType) { - case "mrt_map": - { - print("MRT MAP"); - Routing.openRoute(context, MRTMapPage()); - } - break; - case "favorites": - { - Routing.openRoute(context, AllFavoritesPage()); - } - break; - } - }); - quickActions.setShortcutItems([ - const ShortcutItem( - type: 'mrt_map', - localizedTitle: "MRT map", - icon: 'taskCompleted', - ), - const ShortcutItem( - type: 'favorites', - localizedTitle: "All Favorites", - icon: 'love', - ), - ]); + setup(context, quickActions); // ////// diff --git a/lib/quick_actions.dart b/lib/quick_actions.dart new file mode 100644 index 0000000..03136b1 --- /dev/null +++ b/lib/quick_actions.dart @@ -0,0 +1,65 @@ +import 'package:nextbussg/utils/route.dart'; +import 'package:quick_actions/quick_actions.dart'; + +import 'components/home/favorites/all_favorites_page.dart'; +import 'components/more/mrt_map_page.dart'; + +// quickActions.initialize((String shortcutType) { +// switch (shortcutType) { +// case "mrt_map": +// { +// print("MRT MAP"); +// Routing.openRoute(context, MRTMapPage()); +// } +// break; +// case "favorites": +// { +// Routing.openRoute(context, AllFavoritesPage()); +// } +// break; +// } +// }); +// quickActions.setShortcutItems([ +// const ShortcutItem( +// type: 'mrt_map', +// localizedTitle: "MRT map", +// icon: 'taskCompleted', +// ), +// const ShortcutItem( +// type: 'favorites', +// localizedTitle: "All Favorites", +// icon: 'love', +// ), +// ]); + +setup(context, QuickActions quickActions) { + quickActions.initialize((String shortcutType) { + switch (shortcutType) { + case "mrt_map": + { + print("MRT MAP"); + Routing.openRoute(context, MRTMapPage()); + } + break; + case "favorites": + { + Routing.openRoute(context, AllFavoritesPage()); + } + break; + } + }); + quickActions.setShortcutItems([ + const ShortcutItem( + type: 'mrt_map', + localizedTitle: "MRT map", + icon: 'taskCompleted', + ), + const ShortcutItem( + type: 'favorites', + localizedTitle: "All Favorites", + icon: 'love', + ), + ]); + + return quickActions; +} diff --git a/readme-images/quick-actions.png b/readme-images/quick-actions.png new file mode 100644 index 0000000..b84b716 Binary files /dev/null and b/readme-images/quick-actions.png differ