~repos /only-bible-app

#kotlin#android#ios

GIT_CONFIG_PARAMETERS="'http.version=HTTP/1.1'" git clone https://git.pyrossh.dev/only-bible-app.git
Discussions: https://groups.google.com/g/rust-embed-devs

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


Files changed (3) hide show
  1. lib/dialog.dart +73 -104
  2. lib/main.dart +3 -3
  3. lib/widgets/book_tile.dart +39 -0
lib/dialog.dart CHANGED
@@ -3,6 +3,7 @@ import "package:flutter/material.dart";
3
3
  import "package:only_bible_app/gen/bible.gen.dart";
4
4
  import "package:only_bible_app/store/actions_navigation.dart";
5
5
  import "package:only_bible_app/utils.dart";
6
+ import "package:only_bible_app/widgets/book_tile.dart";
6
7
 
7
8
  void showAlert(BuildContext context, String title, String message) {
8
9
  showDialog(
@@ -87,76 +88,60 @@ void showBookSelectDialog(BuildContext context, Bible bible) {
87
88
 
88
89
  showDialog(
89
90
  context: context,
91
+ barrierColor: Colors.black54,
90
92
  builder: (_) {
91
- final colorScheme = Theme.of(context).colorScheme;
92
93
  final currentBook = context.read().savedBook;
93
94
  final oldBooks = bible.getOldBooks();
94
95
  final newBooks = bible.getNewBooks();
95
96
 
96
- Widget bookTile(Book book) {
97
- final isSelected = currentBook == book.index;
98
- return Material(
97
+ return AlertDialog(
99
- color: isSelected ? colorScheme.primaryContainer : colorScheme.surfaceContainerHighest,
98
+ contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
100
- borderRadius: BorderRadius.circular(12),
101
- child: InkWell(
99
+ content: SizedBox(
102
- borderRadius: BorderRadius.circular(12),
100
+ width: double.maxFinite,
103
- onTap: () => onBookSelected(_, book.index),
101
+ height: 500,
104
- child: Center(
102
+ child: ListView(
103
+ children: [
104
+ Padding(
105
+ padding: const EdgeInsets.only(bottom: 8),
105
- child: Text(
106
+ child: Text(
106
- book.shortName(context.bookNames[book.index]),
107
- textAlign: TextAlign.center,
107
+ context.l.oldTestamentTitle,
108
- style: TextStyle(
109
- fontSize: 15,
110
- fontWeight: isSelected ? FontWeight.bold : FontWeight.w500,
108
+ style: Theme.of(context).textTheme.headlineMedium,
111
- color: isSelected ? colorScheme.onPrimaryContainer : colorScheme.onSurface,
112
109
  ),
113
110
  ),
111
+ GridView.count(
112
+ shrinkWrap: true,
113
+ physics: const NeverScrollableScrollPhysics(),
114
+ crossAxisCount: 4,
115
+ crossAxisSpacing: 8.0,
116
+ mainAxisSpacing: 8.0,
117
+ children: oldBooks
118
+ .map((book) => BookTile(
119
+ label: book.shortName(context.bookNames[book.index]),
120
+ isSelected: currentBook == book.index,
121
+ onTap: () => onBookSelected(_, book.index)))
122
+ .toList(),
114
- ),
123
+ ),
115
- ),
116
- );
117
- }
118
-
119
- return BackdropFilter(
120
- filter: ImageFilter.blur(sigmaX: 6, sigmaY: 6),
121
- child: AlertDialog(
122
- contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
123
- content: SizedBox(
124
- width: double.maxFinite,
125
- height: 500,
126
- child: ListView(
127
- children: [
128
- Padding(
124
+ Padding(
129
- padding: const EdgeInsets.only(bottom: 8),
125
+ padding: const EdgeInsets.only(top: 16, bottom: 8),
130
- child: Text(
126
+ child: Text(
131
- context.l.oldTestamentTitle,
127
+ context.l.newTestamentTitle,
132
- style: Theme.of(context).textTheme.headlineMedium,
128
+ style: Theme.of(context).textTheme.headlineMedium,
133
- ),
134
- ),
135
- GridView.count(
136
- shrinkWrap: true,
137
- physics: const NeverScrollableScrollPhysics(),
138
- crossAxisCount: 4,
139
- crossAxisSpacing: 8.0,
140
- mainAxisSpacing: 8.0,
141
- children: oldBooks.map(bookTile).toList(),
142
- ),
143
- Padding(
144
- padding: const EdgeInsets.only(top: 16, bottom: 8),
145
- child: Text(
146
- context.l.newTestamentTitle,
147
- style: Theme.of(context).textTheme.headlineMedium,
148
- ),
149
- ),
150
- GridView.count(
151
- shrinkWrap: true,
152
- physics: const NeverScrollableScrollPhysics(),
153
- crossAxisCount: 4,
154
- crossAxisSpacing: 8.0,
155
- mainAxisSpacing: 8.0,
156
- children: newBooks.map(bookTile).toList(),
157
129
  ),
130
+ ),
131
+ GridView.count(
132
+ shrinkWrap: true,
133
+ physics: const NeverScrollableScrollPhysics(),
134
+ crossAxisCount: 4,
135
+ crossAxisSpacing: 8.0,
136
+ mainAxisSpacing: 8.0,
137
+ children: newBooks
138
+ .map((book) => BookTile(
139
+ label: book.shortName(context.bookNames[book.index]),
140
+ isSelected: currentBook == book.index,
141
+ onTap: () => onBookSelected(_, book.index)))
142
+ .toList(),
143
+ ),
158
- ],
144
+ ],
159
- ),
160
145
  ),
161
146
  ),
162
147
  );
@@ -169,50 +154,34 @@ void showChapterSelectDialog(BuildContext context, Bible bible, Book book) {
169
154
  final currentBook = context.read().savedBook;
170
155
  showDialog(
171
156
  context: context,
157
+ barrierColor: Colors.black54,
172
158
  builder: (_) {
173
- final colorScheme = Theme.of(context).colorScheme;
174
- return BackdropFilter(
175
- filter: ImageFilter.blur(sigmaX: 6, sigmaY: 6),
176
- child: AlertDialog(
159
+ return AlertDialog(
177
- title: Text(context.bookNames[book.index]),
160
+ title: Text(context.bookNames[book.index]),
178
- contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
161
+ contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
179
- content: SizedBox(
162
+ content: SizedBox(
180
- width: double.maxFinite,
163
+ width: double.maxFinite,
181
- height: 400,
164
+ height: 400,
182
- child: GridView.builder(
165
+ child: GridView.builder(
183
- gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
166
+ gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
184
- crossAxisCount: 5,
167
+ crossAxisCount: 5,
185
- crossAxisSpacing: 8.0,
168
+ crossAxisSpacing: 8.0,
186
- mainAxisSpacing: 8.0,
169
+ mainAxisSpacing: 8.0,
187
- ),
188
- itemCount: book.chapters!.length,
189
- itemBuilder: (_, index) {
190
- final isSelected = currentBook == book.index && currentChapter == index;
191
- return Material(
192
- color: isSelected ? colorScheme.primaryContainer : colorScheme.surfaceContainerHighest,
193
- borderRadius: BorderRadius.circular(12),
194
- child: InkWell(
195
- borderRadius: BorderRadius.circular(12),
196
- onTap: () {
197
- Navigator.of(_).pop();
198
- context.dispatch(
199
- GoToChapterAction(bible.name!, book.index, index),
200
- );
201
- },
202
- child: Center(
203
- child: Text(
204
- "${index + 1}",
205
- style: TextStyle(
206
- fontSize: 16,
207
- fontWeight: isSelected ? FontWeight.bold : FontWeight.w500,
208
- color: isSelected ? colorScheme.onPrimaryContainer : colorScheme.onSurface,
209
- ),
210
- ),
211
- ),
212
- ),
213
- );
214
- },
215
170
  ),
171
+ itemCount: book.chapters!.length,
172
+ itemBuilder: (_, index) {
173
+ final isSelected = currentBook == book.index && currentChapter == index;
174
+ return BookTile(
175
+ label: "${index + 1}",
176
+ isSelected: isSelected,
177
+ onTap: () {
178
+ Navigator.of(_).pop();
179
+ context.dispatch(
180
+ GoToChapterAction(bible.name!, book.index, index),
181
+ );
182
+ },
183
+ );
184
+ },
216
185
  ),
217
186
  ),
218
187
  );
lib/main.dart CHANGED
@@ -34,6 +34,9 @@ void updateStatusBar(bool v) {
34
34
  }
35
35
 
36
36
  void main() async {
37
+ FlutterNativeSplash.preserve(
38
+ widgetsBinding: WidgetsFlutterBinding.ensureInitialized(),
39
+ );
37
40
  // FlutterError.onError = (errorDetails) {
38
41
  // SchedulerBinding.instance.addPostFrameCallback((d) {
39
42
  // showReportError(
@@ -53,9 +56,6 @@ void main() async {
53
56
  // });
54
57
  // return true;
55
58
  // };
56
- FlutterNativeSplash.preserve(
57
- widgetsBinding: WidgetsFlutterBinding.ensureInitialized(),
58
- );
59
59
  usePathUrlStrategy();
60
60
  FlutterAzureTts.init(
61
61
  subscriptionKey: "a9d2d78796924a2a9df2b6d5c1c4a576",
lib/widgets/book_tile.dart ADDED
@@ -0,0 +1,39 @@
1
+ import "package:flutter/material.dart";
2
+
3
+ class BookTile extends StatelessWidget {
4
+ final String label;
5
+ final bool isSelected;
6
+ final VoidCallback onTap;
7
+
8
+ const BookTile({super.key, required this.label, required this.isSelected, required this.onTap});
9
+
10
+ @override
11
+ Widget build(BuildContext context) {
12
+ final colorScheme = Theme.of(context).colorScheme;
13
+ return Material(
14
+ color: isSelected ? colorScheme.primaryContainer : colorScheme.surface,
15
+ shape: RoundedRectangleBorder(
16
+ borderRadius: BorderRadius.circular(12),
17
+ side: BorderSide(
18
+ color: isSelected ? colorScheme.primary : colorScheme.outlineVariant,
19
+ width: isSelected ? 2 : 1,
20
+ ),
21
+ ),
22
+ child: InkWell(
23
+ borderRadius: BorderRadius.circular(12),
24
+ onTap: onTap,
25
+ child: Center(
26
+ child: Text(
27
+ label,
28
+ textAlign: TextAlign.center,
29
+ style: TextStyle(
30
+ fontSize: 16,
31
+ fontWeight: isSelected ? FontWeight.bold : FontWeight.w500,
32
+ color: isSelected ? colorScheme.onPrimaryContainer : colorScheme.onSurface,
33
+ ),
34
+ ),
35
+ ),
36
+ ),
37
+ );
38
+ }
39
+ }