~repos /only-bible-app
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.
b01fb270
—
pyrossh 2 years ago
Allow play only on select bibles
- lib/state.dart +6 -3
- lib/theme.dart +3 -3
- lib/widgets/actions_sheet.dart +23 -9
- lib/widgets/chapter_app_bar.dart +0 -4
lib/state.dart
CHANGED
|
@@ -181,7 +181,6 @@ class ChapterViewModel extends ChangeNotifier {
|
|
|
181
181
|
|
|
182
182
|
save(int book, int chapter) async {
|
|
183
183
|
final prefs = await SharedPreferences.getInstance();
|
|
184
|
-
// prefs.setInt("bibleId", bibleId);
|
|
185
184
|
prefs.setInt("book", book);
|
|
186
185
|
prefs.setInt("chapter", chapter);
|
|
187
186
|
}
|
|
@@ -250,8 +249,12 @@ class ChapterViewModel extends ChangeNotifier {
|
|
|
250
249
|
}
|
|
251
250
|
|
|
252
251
|
onPlay(BuildContext context) async {
|
|
253
|
-
final
|
|
252
|
+
final bible = AppModel.ofEvent(context).bible;
|
|
254
253
|
final model = ChapterViewModel.ofEvent(context);
|
|
254
|
+
// if (!bible.hasAudio) {
|
|
255
|
+
// showError(context, "This bible version doesn't support ");
|
|
256
|
+
// return;
|
|
257
|
+
// }
|
|
255
258
|
if (isPlaying) {
|
|
256
259
|
await player.pause();
|
|
257
260
|
isPlaying = false;
|
|
@@ -260,7 +263,7 @@ class ChapterViewModel extends ChangeNotifier {
|
|
|
260
263
|
isPlaying = true;
|
|
261
264
|
notifyListeners();
|
|
262
265
|
for (final v in selectedVerses) {
|
|
263
|
-
final bibleName =
|
|
266
|
+
final bibleName = bible.name;
|
|
264
267
|
final book = (model.book + 1).toString().padLeft(2, "0");
|
|
265
268
|
final chapter = (model.chapter + 1).toString().padLeft(3, "0");
|
|
266
269
|
final verse = (v + 1).toString().padLeft(3, "0");
|
lib/theme.dart
CHANGED
|
@@ -27,7 +27,7 @@ final lightTheme = ThemeData(
|
|
|
27
27
|
elevation: 10,
|
|
28
28
|
backgroundColor: Color(0xFFF2F2F7),
|
|
29
29
|
shadowColor: Colors.black,
|
|
30
|
-
surfaceTintColor:
|
|
30
|
+
surfaceTintColor: Color(0xFFF2F2F7),
|
|
31
31
|
showDragHandle: true,
|
|
32
32
|
dragHandleSize: Size(50, 3),
|
|
33
33
|
clipBehavior: Clip.antiAliasWithSaveLayer,
|
|
@@ -72,7 +72,7 @@ final lightTheme = ThemeData(
|
|
|
72
72
|
enableFeedback: true,
|
|
73
73
|
padding: EdgeInsets.zero,
|
|
74
74
|
shape: const RoundedRectangleBorder(),
|
|
75
|
-
elevation: 0,
|
|
75
|
+
elevation: 0.5,
|
|
76
76
|
shadowColor: Colors.black,
|
|
77
77
|
backgroundColor: const Color(0xFFEAE9E9),
|
|
78
78
|
foregroundColor: const Color(0xFF9A1111),
|
|
@@ -159,7 +159,7 @@ final darkTheme = ThemeData(
|
|
|
159
159
|
padding: lightTheme.textButtonTheme.style!.padding,
|
|
160
160
|
shape: lightTheme.textButtonTheme.style!.shape,
|
|
161
161
|
textStyle: lightTheme.textButtonTheme.style!.textStyle,
|
|
162
|
-
elevation:
|
|
162
|
+
elevation: MaterialStateProperty.all(1),
|
|
163
163
|
shadowColor: MaterialStateProperty.all(Colors.white),
|
|
164
164
|
backgroundColor: MaterialStateProperty.all(const Color(0xFF323232)),
|
|
165
165
|
foregroundColor: MaterialStateProperty.all(const Color(0xFFBC86FC)),
|
lib/widgets/actions_sheet.dart
CHANGED
|
@@ -8,12 +8,14 @@ class ActionsSheet extends StatelessWidget {
|
|
|
8
8
|
|
|
9
9
|
@override
|
|
10
10
|
Widget build(BuildContext context) {
|
|
11
|
+
final app = AppModel.of(context);
|
|
11
|
-
final iconColor =
|
|
12
|
+
final iconColor = app.darkMode ? Colors.white.withOpacity(0.9) : Colors.black.withOpacity(0.9);
|
|
12
13
|
final bodySmall = Theme.of(context).textTheme.bodySmall;
|
|
13
14
|
final model = ChapterViewModel.of(context);
|
|
14
15
|
final audioIcon = model.isPlaying ? Icons.pause_circle_outline : Icons.play_circle_outline;
|
|
16
|
+
final audioText = model.isPlaying ? "Pause" : "Play";
|
|
15
17
|
return Container(
|
|
16
|
-
height:
|
|
18
|
+
height: 160,
|
|
17
19
|
color: Theme.of(context).colorScheme.background,
|
|
18
20
|
padding: EdgeInsets.only(bottom: isIOS() ? 20 : 0, left: 20, right: 20, top: 10),
|
|
19
21
|
child: Column(
|
|
@@ -52,25 +54,37 @@ class ActionsSheet extends StatelessWidget {
|
|
|
52
54
|
leading: IconButton(
|
|
53
55
|
padding: EdgeInsets.zero,
|
|
54
56
|
onPressed: () {},
|
|
55
|
-
icon: Icon(Icons.
|
|
57
|
+
icon: Icon(Icons.cancel_outlined, size: 24, color: iconColor),
|
|
56
58
|
),
|
|
57
|
-
trailing: Text("
|
|
59
|
+
trailing: Text("Clear", style: bodySmall),
|
|
58
60
|
),
|
|
59
61
|
IconButtonText(
|
|
60
62
|
leading: IconButton(
|
|
61
63
|
padding: EdgeInsets.zero,
|
|
62
64
|
onPressed: () {},
|
|
63
|
-
icon: Icon(Icons.
|
|
65
|
+
icon: Icon(Icons.copy, size: 24, color: iconColor),
|
|
64
66
|
),
|
|
65
|
-
trailing: Text("
|
|
67
|
+
trailing: Text("Copy", style: bodySmall),
|
|
68
|
+
),
|
|
69
|
+
IconButtonText(
|
|
70
|
+
leading: IconButton(
|
|
71
|
+
padding: EdgeInsets.zero,
|
|
72
|
+
onPressed: () {
|
|
73
|
+
if (app.bible.hasAudio) {
|
|
74
|
+
model.onPlay(context);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
icon: Icon(audioIcon, size: 32, color: app.bible.hasAudio ? iconColor : Colors.grey),
|
|
78
|
+
),
|
|
79
|
+
trailing: Text(audioText, style: bodySmall),
|
|
66
80
|
),
|
|
67
81
|
IconButtonText(
|
|
68
82
|
leading: IconButton(
|
|
69
83
|
padding: EdgeInsets.zero,
|
|
70
|
-
onPressed: ()
|
|
84
|
+
onPressed: () {},
|
|
71
|
-
icon: Icon(
|
|
85
|
+
icon: Icon(Icons.post_add_outlined, size: 32, color: iconColor),
|
|
72
86
|
),
|
|
73
|
-
trailing: Text("
|
|
87
|
+
trailing: Text("Note", style: bodySmall),
|
|
74
88
|
),
|
|
75
89
|
IconButtonText(
|
|
76
90
|
leading: IconButton(
|
lib/widgets/chapter_app_bar.dart
CHANGED
|
@@ -17,10 +17,6 @@ class ChapterAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|
|
17
17
|
final bookName = selectedBook.name;
|
|
18
18
|
return AppBar(
|
|
19
19
|
excludeHeaderSemantics: true,
|
|
20
|
-
// bottom: const PreferredSize(
|
|
21
|
-
// preferredSize: Size.fromHeight(1),
|
|
22
|
-
// child: Divider(height: 0, thickness: 1, indent: 18, endIndent: 20),
|
|
23
|
-
// ),
|
|
24
20
|
title: TextButton.icon(
|
|
25
21
|
style: TextButton.styleFrom(
|
|
26
22
|
padding: EdgeInsets.zero,
|