~repos /only-bible-app

#kotlin#android#ios

git clone https://pyrossh.dev/repos/only-bible-app.git

The only bible app you will ever need. No ads. No in-app purchases. No distractions.


20064b5c pyrossh

2 years ago
Improve actions
lib/providers/app_provider.dart CHANGED
@@ -13,11 +13,11 @@ import "package:flutter/services.dart";
13
13
  import "package:only_bible_app/screens/bible_select_screen.dart";
14
14
  import "package:only_bible_app/screens/book_select_screen.dart";
15
15
  import "package:only_bible_app/models.dart";
16
- import "package:only_bible_app/widgets/actions_sheet.dart";
16
+ import "package:only_bible_app/sheets/actions_sheet.dart";
17
- import "package:only_bible_app/widgets/highlight_sheet.dart";
17
+ import "package:only_bible_app/sheets/highlight_sheet.dart";
18
18
  import "package:only_bible_app/widgets/scaffold_markdown.dart";
19
19
  import "package:only_bible_app/widgets/note_sheet.dart";
20
- import "package:only_bible_app/widgets/settings_sheet.dart";
20
+ import "package:only_bible_app/sheets/settings_sheet.dart";
21
21
  import "package:package_info_plus/package_info_plus.dart";
22
22
  import "package:provider/provider.dart";
23
23
  import "package:shared_preferences/shared_preferences.dart";
@@ -407,8 +407,12 @@ class AppProvider extends ChangeNotifier {
407
407
  );
408
408
  }
409
409
  if (darkMode) {
410
+ // return TextStyle(
411
+ // color: getHighlight(v) ?? context.theme.colorScheme.onBackground,
412
+ // );
410
413
  return TextStyle(
414
+ backgroundColor: getHighlight(v)?.withOpacity(0.7),
411
- color: getHighlight(v) ?? context.theme.colorScheme.onBackground,
415
+ color: getHighlight(v) != null ? Colors.white : context.theme.colorScheme.onBackground,
412
416
  );
413
417
  }
414
418
  return TextStyle(
lib/sheets/actions_sheet.dart ADDED
@@ -0,0 +1,63 @@
1
+ import "package:flutter/material.dart";
2
+ import "package:only_bible_app/dialog.dart";
3
+ import "package:only_bible_app/providers/app_provider.dart";
4
+ import "package:only_bible_app/utils.dart";
5
+
6
+ class ActionsSheet extends StatelessWidget {
7
+ const ActionsSheet({super.key});
8
+
9
+ @override
10
+ Widget build(BuildContext context) {
11
+ final app = AppProvider.of(context);
12
+ final isDesktop = isWide(context);
13
+ final bottom = isIOS() ? 20.0 : 0.0;
14
+ final height = isIOS() ? 100.0 : 65.0;
15
+ final iconColor = app.darkMode ? Colors.white.withOpacity(0.9) : Colors.black.withOpacity(0.9);
16
+ final audioIcon = app.isPlaying ? Icons.pause_circle_outline : Icons.play_circle_outline;
17
+ final audioEnabled = app.hasAudio(context);
18
+ return Container(
19
+ height: height,
20
+ color: Theme.of(context).colorScheme.background,
21
+ padding: EdgeInsets.only(left: 20, right: 20, bottom: bottom),
22
+ child: Row(
23
+ mainAxisAlignment: isDesktop ? MainAxisAlignment.spaceEvenly : MainAxisAlignment.spaceBetween,
24
+ children: [
25
+ IconButton(
26
+ padding: EdgeInsets.zero,
27
+ onPressed: () => context.appEvent.removeSelectedHighlights(context),
28
+ icon: Icon(Icons.cancel_outlined, size: 28, color: iconColor),
29
+ ),
30
+ IconButton(
31
+ padding: EdgeInsets.zero,
32
+ onPressed: () => context.appEvent.showHighlights(context),
33
+ icon: Icon(Icons.border_color_outlined, size: 28, color: iconColor),
34
+ ),
35
+ IconButton(
36
+ padding: EdgeInsets.zero,
37
+ onPressed: () {
38
+ if (audioEnabled) {
39
+ context.appEvent.onPlay(context);
40
+ } else {
41
+ showError(
42
+ context,
43
+ "This Bible doesn't support audio. Currently audio is only available for the Kannada Bible.",
44
+ );
45
+ }
46
+ },
47
+ icon: Icon(audioIcon, size: 34, color: audioEnabled ? iconColor : Colors.grey),
48
+ ),
49
+ IconButton(
50
+ padding: EdgeInsets.zero,
51
+ onPressed: () => context.appEvent.showNoteField(context, context.appEvent.selectedVerses.first),
52
+ icon: Icon(Icons.post_add_outlined, size: 34, color: iconColor),
53
+ ),
54
+ IconButton(
55
+ padding: EdgeInsets.zero,
56
+ onPressed: () => context.appEvent.shareVerses(context),
57
+ icon: Icon(Icons.share_outlined, size: 34, color: iconColor),
58
+ ),
59
+ ],
60
+ ),
61
+ );
62
+ }
63
+ }
lib/sheets/highlight_sheet.dart ADDED
@@ -0,0 +1,57 @@
1
+ import "package:flutter/material.dart";
2
+ import "package:only_bible_app/theme.dart";
3
+ import "package:only_bible_app/utils.dart";
4
+ import "package:only_bible_app/widgets/highlight_button.dart";
5
+
6
+ class HighlightSheet extends StatelessWidget {
7
+ const HighlightSheet({super.key});
8
+
9
+ @override
10
+ Widget build(BuildContext context) {
11
+ final isDesktop = isWide(context);
12
+ final bottom = isIOS() ? 20.0 : 0.0;
13
+ final height = isIOS() ? 100.0 : 65.0;
14
+ final iconColor = context.app.darkMode ? Colors.white.withOpacity(0.9) : Colors.black.withOpacity(0.9);
15
+ void onHighlight(int index) {
16
+ final verses = context.appEvent.selectedVerses;
17
+ context.appEvent.setHighlight(context, verses, index);
18
+ context.appEvent.closeActions(context);
19
+ }
20
+
21
+ return Container(
22
+ height: height,
23
+ color: context.theme.colorScheme.background,
24
+ padding: EdgeInsets.only(left: 20, right: 20, bottom: bottom),
25
+ child: Row(
26
+ mainAxisAlignment: isDesktop ? MainAxisAlignment.spaceEvenly : MainAxisAlignment.spaceBetween,
27
+ children: [
28
+ IconButton(
29
+ padding: EdgeInsets.zero,
30
+ onPressed: () => context.appEvent.removeSelectedHighlights(context),
31
+ icon: Icon(Icons.cancel_outlined, size: 28, color: iconColor),
32
+ ),
33
+ HighlightButton(
34
+ index: 0,
35
+ color: context.app.darkMode ? darkHighlights[0] : lightHighlights[0],
36
+ onHighlightSelected: onHighlight,
37
+ ),
38
+ HighlightButton(
39
+ index: 1,
40
+ color: context.app.darkMode ? darkHighlights[1] : lightHighlights[1],
41
+ onHighlightSelected: onHighlight,
42
+ ),
43
+ HighlightButton(
44
+ index: 2,
45
+ color: context.app.darkMode ? darkHighlights[2] : lightHighlights[2],
46
+ onHighlightSelected: onHighlight,
47
+ ),
48
+ HighlightButton(
49
+ index: 3,
50
+ color: context.app.darkMode ? darkHighlights[3] : lightHighlights[3],
51
+ onHighlightSelected: onHighlight,
52
+ ),
53
+ ],
54
+ ),
55
+ );
56
+ }
57
+ }
lib/{widgets → sheets}/settings_sheet.dart RENAMED
File without changes
lib/widgets/actions_sheet.dart DELETED
@@ -1,91 +0,0 @@
1
- import "package:flutter/material.dart";
2
- import "package:only_bible_app/dialog.dart";
3
- import "package:only_bible_app/providers/app_provider.dart";
4
- import "package:only_bible_app/utils.dart";
5
- import "package:only_bible_app/widgets/icon_button_text.dart";
6
-
7
- class ActionsSheet extends StatelessWidget {
8
- const ActionsSheet({super.key});
9
-
10
- @override
11
- Widget build(BuildContext context) {
12
- final app = AppProvider.of(context);
13
- final isDesktop = isWide(context);
14
- final bottom = isIOS() ? 20.0 : 0.0;
15
- final height = isIOS() ? 100.0 : 80.0;
16
- final iconColor = app.darkMode ? Colors.white.withOpacity(0.9) : Colors.black.withOpacity(0.9);
17
- final bodySmall = Theme.of(context).textTheme.bodySmall;
18
- final audioIcon = app.isPlaying ? Icons.pause_circle_outline : Icons.play_circle_outline;
19
- final audioText = app.isPlaying ? "Pause" : "Play";
20
- final audioEnabled = app.hasAudio(context);
21
- return Container(
22
- height: height,
23
- color: Theme.of(context).colorScheme.background,
24
- padding: EdgeInsets.only(left: 20, right: 20, top: isDesktop ? 10 : 10, bottom: bottom),
25
- child: Column(
26
- mainAxisAlignment: MainAxisAlignment.start,
27
- children: [
28
- Row(
29
- mainAxisAlignment: isDesktop ? MainAxisAlignment.spaceEvenly : MainAxisAlignment.spaceBetween,
30
- children: [
31
- IconButtonText(
32
- leading: IconButton(
33
- padding: EdgeInsets.zero,
34
- onPressed: () => context.appEvent.removeSelectedHighlights(context),
35
- icon: Icon(Icons.cancel_outlined, size: 28, color: iconColor),
36
- ),
37
- trailing: Text("", style: bodySmall),
38
- ),
39
- IconButtonText(
40
- leading: IconButton(
41
- padding: EdgeInsets.zero,
42
- onPressed: () => context.appEvent.showHighlights(context),
43
- icon: Icon(Icons.border_color_outlined, size: 28, color: iconColor),
44
- ),
45
- trailing: Text("", style: bodySmall),
46
- ),
47
- IconButtonText(
48
- leading: IconButton(
49
- padding: EdgeInsets.zero,
50
- onPressed: () {
51
- if (audioEnabled) {
52
- context.appEvent.onPlay(context);
53
- } else {
54
- showError(
55
- context,
56
- "This Bible doesn't support audio. Currently audio is only available for the Kannada Bible.",
57
- );
58
- }
59
- },
60
- icon: Icon(audioIcon, size: 34, color: audioEnabled ? iconColor : Colors.grey),
61
- ),
62
- trailing: Text(
63
- "",
64
- style: bodySmall!.copyWith(
65
- color: audioEnabled ? bodySmall.color : Colors.grey,
66
- ),
67
- ),
68
- ),
69
- IconButtonText(
70
- leading: IconButton(
71
- padding: EdgeInsets.zero,
72
- onPressed: () => context.appEvent.showNoteField(context, context.appEvent.selectedVerses.first),
73
- icon: Icon(Icons.post_add_outlined, size: 34, color: iconColor),
74
- ),
75
- trailing: Text("", style: bodySmall),
76
- ),
77
- IconButtonText(
78
- leading: IconButton(
79
- padding: EdgeInsets.zero,
80
- onPressed: () => context.appEvent.shareVerses(context),
81
- icon: Icon(Icons.share_outlined, size: 34, color: iconColor),
82
- ),
83
- trailing: Text("", style: bodySmall),
84
- ),
85
- ],
86
- ),
87
- ],
88
- ),
89
- );
90
- }
91
- }
lib/widgets/highlight_button.dart CHANGED
@@ -17,7 +17,7 @@ class HighlightButton extends StatelessWidget {
17
17
  color: color.withOpacity(1),
18
18
  shape: BoxShape.circle,
19
19
  ),
20
- child: const SizedBox(width: 45, height: 45),
20
+ child: const SizedBox(width: 28, height: 28),
21
21
  ),
22
22
  );
23
23
  }
lib/widgets/highlight_sheet.dart DELETED
@@ -1,38 +0,0 @@
1
- import "package:flutter/material.dart";
2
- import "package:only_bible_app/theme.dart";
3
- import "package:only_bible_app/utils.dart";
4
- import "package:only_bible_app/widgets/highlight_button.dart";
5
-
6
- class HighlightSheet extends StatelessWidget {
7
- const HighlightSheet({super.key});
8
-
9
- @override
10
- Widget build(BuildContext context) {
11
- final isDesktop = isWide(context);
12
- final bottom = isIOS() ? 20.0 : 0.0;
13
- final height = isIOS() ? 100.0 : 80.0;
14
- void onHighlight(int index) {
15
- final verses = context.appEvent.selectedVerses;
16
- context.appEvent.setHighlight(context, verses, index);
17
- context.appEvent.closeActions(context);
18
- }
19
- // context.app.darkMode ? const Color(0xFF69A9FC) :
20
-
21
- return Container(
22
- height: height,
23
- color: context.theme.colorScheme.background,
24
- padding: EdgeInsets.only(left: 20, right: 20, top: isDesktop ? 10 : 10, bottom: bottom),
25
- child: Row(
26
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
27
- children: List.generate(
28
- 4,
29
- (i) => HighlightButton(
30
- index: i,
31
- color: context.app.darkMode ? darkHighlights[i] : lightHighlights[i],
32
- onHighlightSelected: onHighlight,
33
- ),
34
- ),
35
- ),
36
- );
37
- }
38
- }