~repos /only-bible-app
GIT_CONFIG_PARAMETERS="'http.version=HTTP/1.1'" git clone
https://git.pyrossh.dev/only-bible-app.git
Discussions:
https://groups.google.com/g/rust-embed-devs
The only bible app you will ever need. No ads. No in-app purchases. No distractions.
4210caee
—
pyrossh 1 month ago
improvements
- lib/main.dart +1 -5
- lib/store/app_navigator.dart +0 -90
lib/main.dart
CHANGED
|
@@ -74,10 +74,6 @@ void main() async {
|
|
|
74
74
|
);
|
|
75
75
|
updateStatusBar(store.state.darkMode);
|
|
76
76
|
await store.dispatchAndWait(LoadBibleAction());
|
|
77
|
-
final navigator = AppNavigator(
|
|
78
|
-
navigatorKey: globalNavigatorKey,
|
|
79
|
-
initialState: store.state,
|
|
80
|
-
);
|
|
81
|
-
runApp(App(
|
|
77
|
+
runApp(App(globalNavigatorKey: globalNavigatorKey, store: store));
|
|
82
78
|
FlutterNativeSplash.remove();
|
|
83
79
|
}
|
lib/store/app_navigator.dart
CHANGED
|
@@ -2,11 +2,6 @@ import "package:flutter/material.dart";
|
|
|
2
2
|
import "package:app_review/app_review.dart";
|
|
3
3
|
import "package:go_router/go_router.dart";
|
|
4
4
|
import "package:only_bible_app/gen/bible.gen.dart";
|
|
5
|
-
import "package:only_bible_app/screens/bible_select_screen.dart";
|
|
6
|
-
import "package:only_bible_app/screens/book_select_screen.dart";
|
|
7
|
-
import "package:only_bible_app/screens/chapter_select_screen.dart";
|
|
8
|
-
import "package:only_bible_app/screens/chapter_view_screen.dart";
|
|
9
|
-
import "package:only_bible_app/screens/webview_screen.dart";
|
|
10
5
|
import "package:only_bible_app/sheets/actions_sheet.dart";
|
|
11
6
|
import "package:only_bible_app/sheets/settings_sheet.dart";
|
|
12
7
|
import "package:only_bible_app/store/actions.dart";
|
|
@@ -36,93 +31,8 @@ extension AppNavigatorContext on BuildContext {
|
|
|
36
31
|
}
|
|
37
32
|
|
|
38
33
|
class AppNavigator {
|
|
39
|
-
final GoRouter router;
|
|
40
34
|
OverlayEntry? _actionsOverlay;
|
|
41
35
|
|
|
42
|
-
AppNavigator({
|
|
43
|
-
required GlobalKey<NavigatorState> navigatorKey,
|
|
44
|
-
required AppState initialState,
|
|
45
|
-
}) : router = GoRouter(
|
|
46
|
-
navigatorKey: navigatorKey,
|
|
47
|
-
initialLocation: initialState.firstOpen
|
|
48
|
-
? "/bible"
|
|
49
|
-
: "/chapter/${Uri.encodeComponent(initialState.bibleName)}/${initialState.savedBook}/${initialState.savedChapter}",
|
|
50
|
-
routes: [
|
|
51
|
-
GoRoute(
|
|
52
|
-
path: "/bible",
|
|
53
|
-
pageBuilder: (context, state) => const NoTransitionPage(
|
|
54
|
-
child: BibleSelectScreen(),
|
|
55
|
-
),
|
|
56
|
-
),
|
|
57
|
-
GoRoute(
|
|
58
|
-
path: "/chapter/:bibleName/:bookIndex/:chapterIndex",
|
|
59
|
-
pageBuilder: (context, state) {
|
|
60
|
-
final bibleName = Uri.decodeComponent(state.pathParameters["bibleName"]!);
|
|
61
|
-
final bookIndex = int.parse(state.pathParameters["bookIndex"]!);
|
|
62
|
-
final chapterIndex = int.parse(state.pathParameters["chapterIndex"]!);
|
|
63
|
-
final slideDir = state.extra as TextDirection?;
|
|
64
|
-
if (slideDir != null) {
|
|
65
|
-
return CustomTransitionPage(
|
|
66
|
-
key: state.pageKey,
|
|
67
|
-
child: ChapterViewScreen(
|
|
68
|
-
bibleName: bibleName,
|
|
69
|
-
bookIndex: bookIndex,
|
|
70
|
-
chapterIndex: chapterIndex,
|
|
71
|
-
),
|
|
72
|
-
transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
|
73
|
-
const begin = Offset(1.0, 0.0);
|
|
74
|
-
const end = Offset.zero;
|
|
75
|
-
const curve = Curves.ease;
|
|
76
|
-
final tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
|
|
77
|
-
return SlideTransition(
|
|
78
|
-
textDirection: slideDir,
|
|
79
|
-
position: animation.drive(tween),
|
|
80
|
-
child: child,
|
|
81
|
-
);
|
|
82
|
-
},
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
return NoTransitionPage(
|
|
86
|
-
key: state.pageKey,
|
|
87
|
-
child: ChapterViewScreen(
|
|
88
|
-
bibleName: bibleName,
|
|
89
|
-
bookIndex: bookIndex,
|
|
90
|
-
chapterIndex: chapterIndex,
|
|
91
|
-
),
|
|
92
|
-
);
|
|
93
|
-
},
|
|
94
|
-
),
|
|
95
|
-
GoRoute(
|
|
96
|
-
path: "/books/:bibleName",
|
|
97
|
-
pageBuilder: (context, state) {
|
|
98
|
-
final bibleName = Uri.decodeComponent(state.pathParameters["bibleName"]!);
|
|
99
|
-
return NoTransitionPage(
|
|
100
|
-
child: BookSelectScreen(bibleName: bibleName),
|
|
101
|
-
);
|
|
102
|
-
},
|
|
103
|
-
),
|
|
104
|
-
GoRoute(
|
|
105
|
-
path: "/chapters/:bibleName/:bookIndex",
|
|
106
|
-
pageBuilder: (context, state) {
|
|
107
|
-
final bibleName = Uri.decodeComponent(state.pathParameters["bibleName"]!);
|
|
108
|
-
final bookIndex = int.parse(state.pathParameters["bookIndex"]!);
|
|
109
|
-
return NoTransitionPage(
|
|
110
|
-
child: ChapterSelectScreen(bibleName: bibleName, bookIndex: bookIndex),
|
|
111
|
-
);
|
|
112
|
-
},
|
|
113
|
-
),
|
|
114
|
-
GoRoute(
|
|
115
|
-
path: "/webview",
|
|
116
|
-
pageBuilder: (context, state) {
|
|
117
|
-
final url = state.extra as String;
|
|
118
|
-
return NoTransitionPage(
|
|
119
|
-
child: WebViewScreen(url: url),
|
|
120
|
-
);
|
|
121
|
-
},
|
|
122
|
-
),
|
|
123
|
-
],
|
|
124
|
-
);
|
|
125
|
-
|
|
126
36
|
String _chapterPath(String bibleName, int book, int chapter) {
|
|
127
37
|
return "/chapter/${Uri.encodeComponent(bibleName)}/$book/$chapter";
|
|
128
38
|
}
|