Skip to content

Commit 7a37d73

Browse files
committed
moved quick actions to seperate file
1 parent ae86d1d commit 7a37d73

File tree

5 files changed

+72
-30
lines changed

5 files changed

+72
-30
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ lib/generated_plugin_registrant.dart
3535

3636
# Exceptions to above rules.
3737
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
38+
39+
# keys
40+
*/keys.dart

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
| ![More page](./readme-images/more-page.png) | **More page**, where users can change settings and see some more features |
2222
| ![dark view](./readme-images/dark-showcase.png) | 🌙 **Dark theme** |
2323
| ![rename](./readme-images/rename.png) | Bus stops can be renamed (renamed bus stops in italics) |
24+
| ![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). |
2425

2526
[This](https://imgur.com/a/8QOCKBy) and [this](https://imgur.com/a/wXQWfeq) was what the design looked like at first.
2627

@@ -51,6 +52,7 @@
5152
- [x] Theme customization
5253
- [x] Light/dark theme
5354
- [ ] Change status bar text color depending on theme
55+
- [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))
5456
- [ ] Accent color (unplanned) (~~might not implement~~) (only blue, green, and light blue)
5557
- [ ] Change font size (unplanned) (might not implement)
5658
- [ ] **THINK OF A MORE CREATIVE NAME.**

lib/main.dart

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:nextbussg/providers/favorites.dart';
66
import 'package:nextbussg/providers/home_rebuilder.dart';
77
import 'package:nextbussg/providers/locationPerms.dart';
88
import 'package:nextbussg/providers/search.dart';
9+
import 'package:nextbussg/quick_actions.dart';
910
import 'package:nextbussg/routes/search.dart';
1011
import 'package:nextbussg/styles/theme.dart';
1112
import 'package:flutter/material.dart';
@@ -90,36 +91,7 @@ class MainApp extends StatelessWidget {
9091

9192
// quick actions
9293
final QuickActions quickActions = QuickActions();
93-
quickActions.initialize((String shortcutType) {
94-
// if (shortcutType == 'mrt_map') {
95-
// Routing.openRoute(context, MRTMapPage());
96-
// } else if (shor)
97-
switch (shortcutType) {
98-
case "mrt_map":
99-
{
100-
print("MRT MAP");
101-
Routing.openRoute(context, MRTMapPage());
102-
}
103-
break;
104-
case "favorites":
105-
{
106-
Routing.openRoute(context, AllFavoritesPage());
107-
}
108-
break;
109-
}
110-
});
111-
quickActions.setShortcutItems(<ShortcutItem>[
112-
const ShortcutItem(
113-
type: 'mrt_map',
114-
localizedTitle: "MRT map",
115-
icon: 'taskCompleted',
116-
),
117-
const ShortcutItem(
118-
type: 'favorites',
119-
localizedTitle: "All Favorites",
120-
icon: 'love',
121-
),
122-
]);
94+
setup(context, quickActions);
12395

12496
// //////
12597

lib/quick_actions.dart

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import 'package:nextbussg/utils/route.dart';
2+
import 'package:quick_actions/quick_actions.dart';
3+
4+
import 'components/home/favorites/all_favorites_page.dart';
5+
import 'components/more/mrt_map_page.dart';
6+
7+
// quickActions.initialize((String shortcutType) {
8+
// switch (shortcutType) {
9+
// case "mrt_map":
10+
// {
11+
// print("MRT MAP");
12+
// Routing.openRoute(context, MRTMapPage());
13+
// }
14+
// break;
15+
// case "favorites":
16+
// {
17+
// Routing.openRoute(context, AllFavoritesPage());
18+
// }
19+
// break;
20+
// }
21+
// });
22+
// quickActions.setShortcutItems(<ShortcutItem>[
23+
// const ShortcutItem(
24+
// type: 'mrt_map',
25+
// localizedTitle: "MRT map",
26+
// icon: 'taskCompleted',
27+
// ),
28+
// const ShortcutItem(
29+
// type: 'favorites',
30+
// localizedTitle: "All Favorites",
31+
// icon: 'love',
32+
// ),
33+
// ]);
34+
35+
setup(context, QuickActions quickActions) {
36+
quickActions.initialize((String shortcutType) {
37+
switch (shortcutType) {
38+
case "mrt_map":
39+
{
40+
print("MRT MAP");
41+
Routing.openRoute(context, MRTMapPage());
42+
}
43+
break;
44+
case "favorites":
45+
{
46+
Routing.openRoute(context, AllFavoritesPage());
47+
}
48+
break;
49+
}
50+
});
51+
quickActions.setShortcutItems(<ShortcutItem>[
52+
const ShortcutItem(
53+
type: 'mrt_map',
54+
localizedTitle: "MRT map",
55+
icon: 'taskCompleted',
56+
),
57+
const ShortcutItem(
58+
type: 'favorites',
59+
localizedTitle: "All Favorites",
60+
icon: 'love',
61+
),
62+
]);
63+
64+
return quickActions;
65+
}

readme-images/quick-actions.png

812 KB
Loading

0 commit comments

Comments
 (0)