Skip to content

Commit

Permalink
moved quick actions to seperate file
Browse files Browse the repository at this point in the history
  • Loading branch information
ninest committed Apr 6, 2020
1 parent ae86d1d commit 7a37d73
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.**
Expand Down
32 changes: 2 additions & 30 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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(<ShortcutItem>[
const ShortcutItem(
type: 'mrt_map',
localizedTitle: "MRT map",
icon: 'taskCompleted',
),
const ShortcutItem(
type: 'favorites',
localizedTitle: "All Favorites",
icon: 'love',
),
]);
setup(context, quickActions);

// //////

Expand Down
65 changes: 65 additions & 0 deletions lib/quick_actions.dart
Original file line number Diff line number Diff line change
@@ -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(<ShortcutItem>[
// 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(<ShortcutItem>[
const ShortcutItem(
type: 'mrt_map',
localizedTitle: "MRT map",
icon: 'taskCompleted',
),
const ShortcutItem(
type: 'favorites',
localizedTitle: "All Favorites",
icon: 'love',
),
]);

return quickActions;
}
Binary file added readme-images/quick-actions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7a37d73

Please sign in to comment.