~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.
532977a3
—
pyrossh 2 years ago
Fix various issues
- lib/screens/chapter_view_screen.dart +1 -1
- lib/state.dart +13 -1
- lib/widgets/actions_bar.dart +0 -6
- lib/widgets/verse_view.dart +1 -1
lib/screens/chapter_view_screen.dart
CHANGED
|
@@ -41,7 +41,7 @@ class ChapterViewScreen extends StatelessWidget {
|
|
|
41
41
|
value: model,
|
|
42
42
|
child: Scaffold(
|
|
43
43
|
backgroundColor: Theme.of(context).colorScheme.background,
|
|
44
|
-
bottomSheet: const ActionsBar(),
|
|
44
|
+
// bottomSheet: const ActionsBar(),
|
|
45
45
|
body: SafeArea(
|
|
46
46
|
child: SwipeDetector(
|
|
47
47
|
onSwipeLeft: (offset) {
|
lib/state.dart
CHANGED
|
@@ -8,6 +8,7 @@ import "package:just_audio/just_audio.dart";
|
|
|
8
8
|
import "package:only_bible_app/screens/chapter_view_screen.dart";
|
|
9
9
|
import "package:only_bible_app/utils/dialog.dart";
|
|
10
10
|
import "package:only_bible_app/models.dart";
|
|
11
|
+
import "package:only_bible_app/widgets/actions_bar.dart";
|
|
11
12
|
import "package:provider/provider.dart";
|
|
12
13
|
import "package:shared_preferences/shared_preferences.dart";
|
|
13
14
|
|
|
@@ -178,12 +179,22 @@ class ChapterViewModel extends ChangeNotifier {
|
|
|
178
179
|
return selectedVerses.contains(i);
|
|
179
180
|
}
|
|
180
181
|
|
|
181
|
-
void onVerseSelected(int i) {
|
|
182
|
+
void onVerseSelected(BuildContext context, int i) {
|
|
183
|
+
if (!isWide(context)) {
|
|
184
|
+
if (selectedVerses.isEmpty) {
|
|
185
|
+
Scaffold.of(context).showBottomSheet((context) => const ActionsBar());
|
|
186
|
+
}
|
|
187
|
+
}
|
|
182
188
|
if (selectedVerses.contains(i)) {
|
|
183
189
|
selectedVerses.remove(i);
|
|
184
190
|
} else {
|
|
185
191
|
selectedVerses.add(i);
|
|
186
192
|
}
|
|
193
|
+
if (!isWide(context)) {
|
|
194
|
+
if (selectedVerses.isEmpty) {
|
|
195
|
+
Navigator.of(context).pop();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
187
198
|
notifyListeners();
|
|
188
199
|
}
|
|
189
200
|
|
|
@@ -211,6 +222,7 @@ class ChapterViewModel extends ChangeNotifier {
|
|
|
211
222
|
log("Could not play audio", name: "play", error: (err.toString(), url));
|
|
212
223
|
FirebaseCrashlytics.instance.recordFlutterError(FlutterErrorDetails(exception: (err.toString(), url)));
|
|
213
224
|
showError(context, "Could not play audio");
|
|
225
|
+
return;
|
|
214
226
|
} finally {
|
|
215
227
|
await player.pause();
|
|
216
228
|
isPlaying = false;
|
lib/widgets/actions_bar.dart
CHANGED
|
@@ -7,12 +7,6 @@ class ActionsBar extends StatelessWidget {
|
|
|
7
7
|
|
|
8
8
|
@override
|
|
9
9
|
Widget build(BuildContext context) {
|
|
10
|
-
final isDesktop = isWide(context);
|
|
11
|
-
final showPlay = ChapterViewModel.of(context).hasSelectedVerses();
|
|
12
|
-
if (isDesktop || !showPlay) {
|
|
13
|
-
// TODO: hack fix this
|
|
14
|
-
return const ColoredBox(color: Colors.transparent);
|
|
15
|
-
}
|
|
16
10
|
return BottomSheet(
|
|
17
11
|
enableDrag: false,
|
|
18
12
|
onClosing: () {},
|
lib/widgets/verse_view.dart
CHANGED
|
@@ -16,7 +16,7 @@ class VerseText extends StatelessWidget {
|
|
|
16
16
|
|
|
17
17
|
return GestureDetector(
|
|
18
18
|
onTap: () {
|
|
19
|
-
ChapterViewModel.ofEvent(context).onVerseSelected(index);
|
|
19
|
+
ChapterViewModel.ofEvent(context).onVerseSelected(context, index);
|
|
20
20
|
},
|
|
21
21
|
child: DecoratedBox(
|
|
22
22
|
decoration: BoxDecoration(
|