~repos /only-bible-app

#kotlin#android#ios

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.


lib/navigation.dart CHANGED
@@ -4,8 +4,6 @@ import "package:flutter/services.dart";
4
4
  import "package:app_review/app_review.dart";
5
5
  import "package:go_router/go_router.dart";
6
6
  import "package:only_bible_app/models.dart";
7
- import "package:only_bible_app/sheets/actions_sheet.dart";
8
- import "package:only_bible_app/sheets/highlight_sheet.dart";
9
7
  import "package:only_bible_app/sheets/settings_sheet.dart";
10
8
  import "package:only_bible_app/store/actions.dart";
11
9
  import "package:only_bible_app/store/state.dart";
@@ -221,11 +219,6 @@ void showSettings(BuildContext context, Bible bible) {
221
219
  void showActions(BuildContext context, Bible bible) {
222
220
  if (!actionsShownAtom.value) {
223
221
  dispatch(const SetActionsShown(true));
224
- Scaffold.of(context).showBottomSheet(
225
- enableDrag: false,
226
- clipBehavior: Clip.antiAliasWithSaveLayer,
227
- (context) => ActionsSheet(bible: bible),
228
- );
229
222
  }
230
223
  }
231
224
 
@@ -233,22 +226,15 @@ void hideActions(BuildContext context) {
233
226
  if (actionsShownAtom.value) {
234
227
  dispatch(const SetActionsShown(false));
235
228
  dispatch(const ClearSelectedVerses());
236
- Navigator.of(context).pop();
237
229
  }
238
230
  }
239
231
 
240
232
  void showHighlights(BuildContext context) {
241
233
  dispatch(const SetHighlightsShown(true));
242
- Scaffold.of(context).showBottomSheet(
243
- enableDrag: false,
244
- clipBehavior: Clip.antiAliasWithSaveLayer,
245
- (context) => const HighlightSheet(),
246
- );
247
234
  }
248
235
 
249
236
  void hideHighlights(BuildContext context) {
250
237
  if (highlightsShownAtom.value) {
251
238
  dispatch(const SetHighlightsShown(false));
252
- Navigator.of(context).pop();
253
239
  }
254
240
  }
lib/screens/chapter_view_screen.dart CHANGED
@@ -1,5 +1,8 @@
1
1
  import "package:flutter/material.dart";
2
2
  import "package:only_bible_app/models.dart";
3
+ import "package:only_bible_app/navigation.dart";
4
+ import "package:only_bible_app/sheets/actions_sheet.dart";
5
+ import "package:only_bible_app/sheets/highlight_sheet.dart";
3
6
  import "package:only_bible_app/store/state.dart";
4
7
  import "package:only_bible_app/utils.dart";
5
8
  import "package:only_bible_app/widgets/chapter_app_bar.dart";
@@ -10,11 +13,12 @@ class ChapterViewScreen extends StatelessWidget {
10
13
  final int bookIndex;
11
14
  final int chapterIndex;
12
15
 
13
- const ChapterViewScreen(
16
+ const ChapterViewScreen({
14
- {super.key,
17
+ super.key,
15
- required this.bibleName,
18
+ required this.bibleName,
16
- required this.bookIndex,
19
+ required this.bookIndex,
17
- required this.chapterIndex,});
20
+ required this.chapterIndex,
21
+ });
18
22
 
19
23
  @override
20
24
  Widget build(BuildContext context) {
@@ -22,33 +26,41 @@ class ChapterViewScreen extends StatelessWidget {
22
26
  future: bibleAtom.getValue(bibleName),
23
27
  builder: (context, state) {
24
28
  return state.when(
25
- loading: () => ColoredBox(
29
+ loading: () => ColoredBox(
26
- color: Theme.of(context).colorScheme.surface,
30
+ color: Theme.of(context).colorScheme.surface,
27
- child: const Center(
31
+ child: const Center(
28
- child: CircularProgressIndicator(),
32
+ child: CircularProgressIndicator(),
29
- ),
33
+ ),
34
+ ),
35
+ success: (Bible? bible) {
36
+ final book = bible!.books[bookIndex];
37
+ final chapter = book.chapters[chapterIndex];
38
+ return Scaffold(
39
+ appBar: ChapterAppBar(bible: bible, book: book, chapter: chapter),
40
+ backgroundColor: Theme.of(context).colorScheme.surface,
41
+ body: SafeArea(
42
+ child: Column(
43
+ children: [
44
+ Expanded(child: VersesView(bible: bible, chapter: chapter)),
45
+ if (highlightsShownAtom.watch(context))
46
+ const HighlightSheet()
47
+ else if (actionsShownAtom.watch(context))
48
+ ActionsSheet(bible: bible),
49
+ ],
30
50
  ),
31
- success: (Bible? bible) {
32
- final book = bible!.books[bookIndex];
33
- final chapter = book.chapters[chapterIndex];
34
- return Scaffold(
35
- appBar:
36
- ChapterAppBar(bible: bible, book: book, chapter: chapter),
37
- backgroundColor: Theme.of(context).colorScheme.surface,
38
- body: SafeArea(
39
- child: VersesView(bible: bible, chapter: chapter),
40
- ),
51
+ ),
41
- );
52
+ );
42
- },
53
+ },
43
- error: () {
54
+ error: () {
44
- print(state.stackTrace);
55
+ print(state.stackTrace);
45
- return ColoredBox(
56
+ return ColoredBox(
46
- color: Theme.of(context).colorScheme.surface,
57
+ color: Theme.of(context).colorScheme.surface,
47
- child: Center(
58
+ child: Center(
48
- child: Text("Could not load the bible ${state.error}"),
59
+ child: Text("Could not load the bible ${state.error}"),
49
- ),
60
+ ),
50
- );
61
+ );
51
- },);
62
+ },
63
+ );
52
64
  },
53
65
  );
54
66
  }
lib/sheets/actions_sheet.dart CHANGED
@@ -11,13 +11,16 @@ class ActionsSheet extends StatelessWidget {
11
11
 
12
12
  @override
13
13
  Widget build(BuildContext context) {
14
+ final iconColor = darkModeAtom.value
15
+ ? Colors.white.withOpacity(0.9)
16
+ : Colors.black.withOpacity(0.9);
14
- final bottom = isIOS() ? 20.0 : 0.0;
17
+ final audioIcon = isPlaying.watch(context)
15
- final iconColor = darkModeAtom.value ? Colors.white.withOpacity(0.9) : Colors.black.withOpacity(0.9);
16
- final audioIcon = isPlaying.watch(context) ? Icons.pause_circle_outline : Icons.play_circle_outline;
18
+ ? Icons.pause_circle_outline
19
+ : Icons.play_circle_outline;
17
20
  return Container(
18
- height: context.actionsHeight,
21
+ height: 50,
19
22
  color: Theme.of(context).colorScheme.surface,
20
- padding: EdgeInsets.only(left: 20, right: 20, bottom: bottom),
23
+ padding: const EdgeInsets.only(left: 20, right: 20),
21
24
  child: Row(
22
25
  mainAxisAlignment: MainAxisAlignment.spaceAround,
23
26
  children: [
@@ -40,7 +43,8 @@ class ActionsSheet extends StatelessWidget {
40
43
  ),
41
44
  IconButton(
42
45
  padding: EdgeInsets.zero,
46
+ onPressed: () =>
43
- onPressed: () => shareVerses(context, bible, selectedVersesAtom.value),
47
+ shareVerses(context, bible, selectedVersesAtom.value),
44
48
  icon: Icon(Icons.share_outlined, size: 34, color: iconColor),
45
49
  ),
46
50
  ],
lib/sheets/highlight_sheet.dart CHANGED
@@ -9,16 +9,17 @@ class HighlightSheet extends StatelessWidget {
9
9
 
10
10
  @override
11
11
  Widget build(BuildContext context) {
12
- final bottom = isIOS() ? 20.0 : 0.0;
12
+ final iconColor = darkModeAtom.value
13
+ ? Colors.white.withOpacity(0.9)
13
- final iconColor = darkModeAtom.value ? Colors.white.withOpacity(0.9) : Colors.black.withOpacity(0.9);
14
+ : Colors.black.withOpacity(0.9);
14
15
  void onHighlight(int index) {
15
16
  setHighlight(context, index);
16
17
  }
17
18
 
18
19
  return Container(
19
- height: context.actionsHeight,
20
+ height: 50,
20
21
  color: context.theme.colorScheme.surface,
21
- padding: EdgeInsets.only(left: 20, right: 20, bottom: bottom),
22
+ padding: const EdgeInsets.only(left: 20, right: 20),
22
23
  child: Row(
23
24
  mainAxisAlignment: MainAxisAlignment.spaceAround,
24
25
  children: [