~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.
da3626d3
—
pyrossh 2 years ago
report errors
- lib/app.dart +4 -1
- lib/dialog.dart +34 -0
- lib/main.dart +16 -4
- lib/widgets/verses_view.dart +3 -0
lib/app.dart
CHANGED
|
@@ -2,17 +2,20 @@ import "package:flutter/material.dart";
|
|
|
2
2
|
import "package:flutter_gen/gen_l10n/app_localizations.dart";
|
|
3
3
|
import "package:only_bible_app/screens/bible_select_screen.dart";
|
|
4
4
|
import "package:only_bible_app/screens/chapter_view_screen.dart";
|
|
5
|
-
import
|
|
5
|
+
import "package:only_bible_app/store/state.dart";
|
|
6
6
|
import "package:only_bible_app/theme.dart";
|
|
7
7
|
import "package:only_bible_app/utils.dart";
|
|
8
8
|
import "package:only_bible_app/widgets/scaffold_markdown.dart";
|
|
9
9
|
|
|
10
|
+
final globalNavigatorKey = GlobalKey<NavigatorState>();
|
|
11
|
+
|
|
10
12
|
class App extends StatelessWidget {
|
|
11
13
|
const App({super.key});
|
|
12
14
|
|
|
13
15
|
@override
|
|
14
16
|
Widget build(BuildContext context) {
|
|
15
17
|
return MaterialApp(
|
|
18
|
+
navigatorKey: globalNavigatorKey,
|
|
16
19
|
onGenerateTitle: (context) => context.l.title,
|
|
17
20
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
18
21
|
supportedLocales: AppLocalizations.supportedLocales,
|
lib/dialog.dart
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import "dart:ui";
|
|
2
2
|
import "package:flutter/material.dart";
|
|
3
|
+
import "package:only_bible_app/utils.dart";
|
|
4
|
+
import "package:only_bible_app/navigation.dart";
|
|
3
5
|
|
|
4
6
|
showAlert(BuildContext context, String title, String message) {
|
|
5
7
|
showDialog(
|
|
@@ -29,3 +31,35 @@ showAlert(BuildContext context, String title, String message) {
|
|
|
29
31
|
showError(BuildContext context, String message) {
|
|
30
32
|
showAlert(context, "Error", message);
|
|
31
33
|
}
|
|
34
|
+
|
|
35
|
+
showReportError(BuildContext context, String message, StackTrace? st) {
|
|
36
|
+
showDialog(
|
|
37
|
+
context: context,
|
|
38
|
+
builder: (_) {
|
|
39
|
+
return BackdropFilter(
|
|
40
|
+
filter: ImageFilter.blur(sigmaX: 6, sigmaY: 6),
|
|
41
|
+
child: AlertDialog(
|
|
42
|
+
title: const Text("Alert"),
|
|
43
|
+
content: const Text("An error has occurred. Do you want to report this error to us?"),
|
|
44
|
+
actionsAlignment: MainAxisAlignment.end,
|
|
45
|
+
actionsOverflowButtonSpacing: 8.0,
|
|
46
|
+
actions: [
|
|
47
|
+
TextButton(
|
|
48
|
+
onPressed: () {
|
|
49
|
+
recordError(message, st);
|
|
50
|
+
changeBible(context);
|
|
51
|
+
},
|
|
52
|
+
child: const Text("Yes"),
|
|
53
|
+
),
|
|
54
|
+
TextButton(
|
|
55
|
+
onPressed: () {
|
|
56
|
+
changeBible(context);
|
|
57
|
+
},
|
|
58
|
+
child: const Text("No"),
|
|
59
|
+
),
|
|
60
|
+
],
|
|
61
|
+
),
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
}
|
lib/main.dart
CHANGED
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
import "package:flutter/material.dart";
|
|
2
2
|
import "package:flutter/foundation.dart";
|
|
3
|
+
import "package:flutter/scheduler.dart";
|
|
3
4
|
import "package:flutter_azure_tts/flutter_azure_tts.dart";
|
|
4
5
|
import "package:flutter_dotenv/flutter_dotenv.dart";
|
|
5
6
|
import "package:flutter_web_plugins/url_strategy.dart";
|
|
6
7
|
import "package:flutter_native_splash/flutter_native_splash.dart";
|
|
7
8
|
import "package:only_bible_app/app.dart";
|
|
9
|
+
import "package:only_bible_app/dialog.dart";
|
|
8
10
|
import "package:only_bible_app/navigation.dart";
|
|
9
11
|
import "package:only_bible_app/store/state.dart";
|
|
10
|
-
import "package:only_bible_app/utils.dart";
|
|
11
12
|
|
|
12
13
|
void main() async {
|
|
13
14
|
FlutterError.onError = (errorDetails) {
|
|
15
|
+
SchedulerBinding.instance.addPostFrameCallback((d) {
|
|
16
|
+
showReportError(
|
|
14
|
-
|
|
17
|
+
globalNavigatorKey.currentState!.context,
|
|
15
|
-
|
|
18
|
+
errorDetails.exception.toString(),
|
|
19
|
+
errorDetails.stack,
|
|
20
|
+
);
|
|
21
|
+
});
|
|
16
22
|
};
|
|
17
23
|
PlatformDispatcher.instance.onError = (error, stack) {
|
|
24
|
+
Future.delayed(const Duration(seconds: 1), () {
|
|
25
|
+
showReportError(
|
|
26
|
+
globalNavigatorKey.currentState!.context,
|
|
18
|
-
|
|
27
|
+
error.toString(),
|
|
28
|
+
stack,
|
|
29
|
+
);
|
|
30
|
+
});
|
|
19
31
|
return true;
|
|
20
32
|
};
|
|
21
33
|
FlutterNativeSplash.preserve(
|
lib/widgets/verses_view.dart
CHANGED
|
@@ -14,6 +14,9 @@ class VersesView extends StatelessWidget {
|
|
|
14
14
|
@override
|
|
15
15
|
Widget build(BuildContext context) {
|
|
16
16
|
final textStyle = DefaultTextStyle.of(context).style;
|
|
17
|
+
// if (chapter.index == 2) {
|
|
18
|
+
// throw Exception("123");
|
|
19
|
+
// }
|
|
17
20
|
return SwipeDetector(
|
|
18
21
|
onSwipeLeft: (offset) {
|
|
19
22
|
nextChapter(context, bible, chapter.book, chapter.index);
|