~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.
b536cc6b
—
pyrossh 2 years ago
Fix iterator issue
- lib/providers/app_model.dart +10 -15
- lib/widgets/verses_view.dart +1 -1
lib/providers/app_model.dart
CHANGED
|
@@ -209,12 +209,10 @@ class AppModel extends ChangeNotifier {
|
|
|
209
209
|
);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
clearEvents(
|
|
213
|
-
|
|
212
|
+
clearEvents(BuildContext context) {
|
|
214
|
-
) {
|
|
215
|
-
if (isPlaying) {
|
|
213
|
+
// if (isPlaying) {
|
|
216
|
-
|
|
214
|
+
// pause();
|
|
217
|
-
}
|
|
215
|
+
// }
|
|
218
216
|
clearSelections();
|
|
219
217
|
hideActions(context);
|
|
220
218
|
}
|
|
@@ -484,12 +482,7 @@ class AppModel extends ChangeNotifier {
|
|
|
484
482
|
}
|
|
485
483
|
|
|
486
484
|
bool isVerseSelected(Verse v) {
|
|
487
|
-
return selectedVerses.any((el) => el.index == v.index);
|
|
485
|
+
return selectedVerses.any((el) => el.book == v.book && el.chapter == v.chapter && el.index == v.index);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
bool isVerseHighlighted(BuildContext context) {
|
|
491
|
-
// box.read("${book}:${chapter}:${verse}", "color");
|
|
492
|
-
return false;
|
|
493
486
|
}
|
|
494
487
|
|
|
495
488
|
void onVerseSelected(BuildContext context, Verse v) {
|
|
@@ -522,13 +515,13 @@ class AppModel extends ChangeNotifier {
|
|
|
522
515
|
}
|
|
523
516
|
|
|
524
517
|
onPlay(BuildContext context) async {
|
|
518
|
+
final versesToPlay = List.from(selectedVerses);
|
|
525
519
|
if (isPlaying) {
|
|
526
520
|
pause();
|
|
527
521
|
} else {
|
|
528
522
|
isPlaying = true;
|
|
529
523
|
notifyListeners();
|
|
530
|
-
// add locks todo
|
|
531
|
-
for (final v in
|
|
524
|
+
for (final v in versesToPlay) {
|
|
532
525
|
final bibleName = bible.name;
|
|
533
526
|
final book = (v.book + 1).toString().padLeft(2, "0");
|
|
534
527
|
final chapter = (v.chapter + 1).toString().padLeft(3, "0");
|
|
@@ -542,7 +535,9 @@ class AppModel extends ChangeNotifier {
|
|
|
542
535
|
} catch (err) {
|
|
543
536
|
log("Could not play audio", name: "play", error: (err.toString(), pathname));
|
|
544
537
|
FirebaseCrashlytics.instance.recordFlutterError(FlutterErrorDetails(exception: (err.toString(), pathname)));
|
|
538
|
+
if (context.mounted) {
|
|
545
|
-
|
|
539
|
+
showError(context, "Could not play audio");
|
|
540
|
+
}
|
|
546
541
|
return;
|
|
547
542
|
} finally {
|
|
548
543
|
pause();
|
lib/widgets/verses_view.dart
CHANGED
|
@@ -80,7 +80,7 @@ class VersesView extends StatelessWidget {
|
|
|
80
80
|
backgroundColor: app.darkMode ? Colors.grey.shade800 : Colors.grey.shade200,
|
|
81
81
|
)
|
|
82
82
|
: TextStyle(
|
|
83
|
-
backgroundColor: app.getHighlight(v) ??
|
|
83
|
+
backgroundColor: app.getHighlight(v) ?? context.theme.colorScheme.background,
|
|
84
84
|
),
|
|
85
85
|
recognizer: TapGestureRecognizer()
|
|
86
86
|
..onTap = () {
|