~repos /only-bible-app
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.
38c780d7
—
pyrossh 1 month ago
ui changes
- lib/dialog.dart +18 -10
- lib/store/actions_state.dart +3 -3
- lib/store/app_state.dart +6 -6
- lib/theme.dart +75 -23
- lib/widgets/settings_sheet.dart +31 -27
- lib/widgets/verses_view.dart +13 -8
lib/dialog.dart
CHANGED
|
@@ -102,18 +102,22 @@ void showBookSelectDialog(BuildContext context, Bible bible) {
|
|
|
102
102
|
child: ListView(
|
|
103
103
|
children: [
|
|
104
104
|
Padding(
|
|
105
|
-
padding: const EdgeInsets.only(bottom: 8),
|
|
105
|
+
padding: const EdgeInsets.only(bottom: 8, left: 4),
|
|
106
106
|
child: Text(
|
|
107
107
|
context.l.oldTestamentTitle,
|
|
108
|
+
style: TextStyle(
|
|
109
|
+
fontSize: 20,
|
|
110
|
+
fontWeight: FontWeight.w500,
|
|
108
|
-
|
|
111
|
+
color: context.theme.colorScheme.onSurfaceVariant,
|
|
112
|
+
),
|
|
109
113
|
),
|
|
110
114
|
),
|
|
111
115
|
GridView.count(
|
|
112
116
|
shrinkWrap: true,
|
|
113
117
|
physics: const NeverScrollableScrollPhysics(),
|
|
114
|
-
crossAxisCount:
|
|
118
|
+
crossAxisCount: 5,
|
|
115
|
-
crossAxisSpacing:
|
|
119
|
+
crossAxisSpacing: 6,
|
|
116
|
-
mainAxisSpacing:
|
|
120
|
+
mainAxisSpacing: 6,
|
|
117
121
|
children: oldBooks
|
|
118
122
|
.map((book) => BookTile(
|
|
119
123
|
label: book.shortName(context.bookNames[book.index]),
|
|
@@ -122,18 +126,22 @@ void showBookSelectDialog(BuildContext context, Bible bible) {
|
|
|
122
126
|
.toList(),
|
|
123
127
|
),
|
|
124
128
|
Padding(
|
|
125
|
-
padding: const EdgeInsets.only(top: 16, bottom: 8),
|
|
129
|
+
padding: const EdgeInsets.only(top: 16, bottom: 8, left: 4),
|
|
126
130
|
child: Text(
|
|
127
131
|
context.l.newTestamentTitle,
|
|
132
|
+
style: TextStyle(
|
|
133
|
+
fontSize: 20,
|
|
134
|
+
fontWeight: FontWeight.w500,
|
|
128
|
-
|
|
135
|
+
color: context.theme.colorScheme.onSurfaceVariant,
|
|
136
|
+
),
|
|
129
137
|
),
|
|
130
138
|
),
|
|
131
139
|
GridView.count(
|
|
132
140
|
shrinkWrap: true,
|
|
133
141
|
physics: const NeverScrollableScrollPhysics(),
|
|
134
|
-
crossAxisCount:
|
|
142
|
+
crossAxisCount: 5,
|
|
135
|
-
crossAxisSpacing:
|
|
143
|
+
crossAxisSpacing: 6.0,
|
|
136
|
-
mainAxisSpacing:
|
|
144
|
+
mainAxisSpacing: 6.0,
|
|
137
145
|
children: newBooks
|
|
138
146
|
.map((book) => BookTile(
|
|
139
147
|
label: book.shortName(context.bookNames[book.index]),
|
lib/store/actions_state.dart
CHANGED
|
@@ -36,13 +36,13 @@ class ToggleDarkModeAction extends ReduxAction<AppState> {
|
|
|
36
36
|
AppState reduce() => state.copy(darkMode: !state.darkMode);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
class
|
|
39
|
+
class UpdateFontSizeAction extends ReduxAction<AppState> {
|
|
40
40
|
final double value;
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
UpdateFontSizeAction(this.value);
|
|
43
43
|
|
|
44
44
|
@override
|
|
45
|
-
AppState reduce() => state.copy(
|
|
45
|
+
AppState reduce() => state.copy(fontSize: value);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
class UpdateChapterAction extends ReduxAction<AppState> {
|
lib/store/app_state.dart
CHANGED
|
@@ -8,7 +8,7 @@ class AppState {
|
|
|
8
8
|
final bool engTitles;
|
|
9
9
|
final bool boldFont;
|
|
10
10
|
final bool darkMode;
|
|
11
|
-
final double
|
|
11
|
+
final double fontSize;
|
|
12
12
|
final int savedBook;
|
|
13
13
|
final int savedChapter;
|
|
14
14
|
final List<Verse> selectedVerses;
|
|
@@ -21,7 +21,7 @@ class AppState {
|
|
|
21
21
|
this.engTitles = false,
|
|
22
22
|
this.boldFont = false,
|
|
23
23
|
this.darkMode = false,
|
|
24
|
-
this.
|
|
24
|
+
this.fontSize = 16.0,
|
|
25
25
|
this.savedBook = 0,
|
|
26
26
|
this.savedChapter = 0,
|
|
27
27
|
this.selectedVerses = const [],
|
|
@@ -35,7 +35,7 @@ class AppState {
|
|
|
35
35
|
bool? engTitles,
|
|
36
36
|
bool? boldFont,
|
|
37
37
|
bool? darkMode,
|
|
38
|
-
double?
|
|
38
|
+
double? fontSize,
|
|
39
39
|
int? savedBook,
|
|
40
40
|
int? savedChapter,
|
|
41
41
|
List<Verse>? selectedVerses,
|
|
@@ -48,7 +48,7 @@ class AppState {
|
|
|
48
48
|
engTitles: engTitles ?? this.engTitles,
|
|
49
49
|
boldFont: boldFont ?? this.boldFont,
|
|
50
50
|
darkMode: darkMode ?? this.darkMode,
|
|
51
|
-
|
|
51
|
+
fontSize: fontSize ?? this.fontSize,
|
|
52
52
|
savedBook: savedBook ?? this.savedBook,
|
|
53
53
|
savedChapter: savedChapter ?? this.savedChapter,
|
|
54
54
|
selectedVerses: selectedVerses ?? this.selectedVerses,
|
|
@@ -63,7 +63,7 @@ class AppState {
|
|
|
63
63
|
"engTitles": engTitles,
|
|
64
64
|
"boldFont": boldFont,
|
|
65
65
|
"darkMode": darkMode,
|
|
66
|
-
"
|
|
66
|
+
"fontSize": fontSize,
|
|
67
67
|
"savedBook": savedBook,
|
|
68
68
|
"savedChapter": savedChapter,
|
|
69
69
|
"highlights": highlights,
|
|
@@ -75,7 +75,7 @@ class AppState {
|
|
|
75
75
|
engTitles: json["engTitles"] as bool? ?? false,
|
|
76
76
|
boldFont: json["boldFont"] as bool? ?? false,
|
|
77
77
|
darkMode: json["darkMode"] as bool? ?? false,
|
|
78
|
-
|
|
78
|
+
fontSize: (json["fontSize"] as num?)?.toDouble() ?? ((json["textScale"] as num?)?.toDouble() ?? 0.0) + 16.0,
|
|
79
79
|
savedBook: json["savedBook"] as int? ?? 0,
|
|
80
80
|
savedChapter: json["savedChapter"] as int? ?? 0,
|
|
81
81
|
highlights: (json["highlights"] as Map<String, dynamic>?)?.map((k, v) => MapEntry(k, v as int)) ?? const {},
|
lib/theme.dart
CHANGED
|
@@ -14,26 +14,78 @@ const darkHighlights = [
|
|
|
14
14
|
Color(0xFF48F334),
|
|
15
15
|
];
|
|
16
16
|
|
|
17
|
-
const lightColorScheme = ColorScheme
|
|
17
|
+
const lightColorScheme = ColorScheme(
|
|
18
|
+
brightness: Brightness.light,
|
|
19
|
+
primary: Color(0xFF495D92),
|
|
20
|
+
onPrimary: Color(0xFFFFFFFF),
|
|
21
|
+
primaryContainer: Color(0xFFDAE2FF),
|
|
22
|
+
onPrimaryContainer: Color(0xFF001848),
|
|
23
|
+
secondary: Color(0xFF4C5C92),
|
|
24
|
+
onSecondary: Color(0xFFFFFFFF),
|
|
25
|
+
secondaryContainer: Color(0xFFDCE1FF),
|
|
26
|
+
onSecondaryContainer: Color(0xFF02174B),
|
|
27
|
+
tertiary: Color(0xFF7D4E7D),
|
|
28
|
+
onTertiary: Color(0xFFFFFFFF),
|
|
29
|
+
tertiaryContainer: Color(0xFFFFD6FA),
|
|
30
|
+
onTertiaryContainer: Color(0xFF320935),
|
|
31
|
+
error: Color(0xFFBA1A1A),
|
|
32
|
+
onError: Color(0xFFFFFFFF),
|
|
33
|
+
errorContainer: Color(0xFFFFDAD6),
|
|
34
|
+
onErrorContainer: Color(0xFF410002),
|
|
18
|
-
surface:
|
|
35
|
+
surface: Color(0xFFFAF8FF),
|
|
19
|
-
onSurface: Color(
|
|
36
|
+
onSurface: Color(0xFF1A1B21),
|
|
37
|
+
onSurfaceVariant: Color(0xFF45464F),
|
|
38
|
+
outline: Color(0xFF757780),
|
|
39
|
+
outlineVariant: Color(0xFFC5C6D0),
|
|
40
|
+
shadow: Color(0xFF000000),
|
|
20
|
-
|
|
41
|
+
scrim: Color(0xFF000000),
|
|
42
|
+
inverseSurface: Color(0xFF2F3036),
|
|
43
|
+
onInverseSurface: Color(0xFFF1F0F7),
|
|
21
|
-
|
|
44
|
+
inversePrimary: Color(0xFFB2C5FF),
|
|
45
|
+
surfaceDim: Color(0xFFDAD9E0),
|
|
22
|
-
|
|
46
|
+
surfaceBright: Color(0xFFFAF8FF),
|
|
47
|
+
surfaceContainerLowest: Color(0xFFFFFFFF),
|
|
23
|
-
|
|
48
|
+
surfaceContainerLow: Color(0xFFF4F3FA),
|
|
24
|
-
|
|
49
|
+
surfaceContainer: Color(0xFFEEEDF4),
|
|
50
|
+
surfaceContainerHigh: Color(0xFFE8E7EF),
|
|
51
|
+
surfaceContainerHighest: Color(0xFFE3E2E9),
|
|
25
52
|
);
|
|
26
53
|
|
|
27
|
-
const darkColorScheme = ColorScheme
|
|
54
|
+
const darkColorScheme = ColorScheme(
|
|
55
|
+
brightness: Brightness.dark,
|
|
56
|
+
primary: Color(0xFFB2C5FF),
|
|
28
|
-
|
|
57
|
+
onPrimary: Color(0xFF182E60),
|
|
29
|
-
onSurface: Colors.white,
|
|
30
|
-
|
|
58
|
+
primaryContainer: Color(0xFF304578),
|
|
59
|
+
onPrimaryContainer: Color(0xFFDAE2FF),
|
|
31
|
-
secondary: Color(
|
|
60
|
+
secondary: Color(0xFFB5C4FF),
|
|
61
|
+
onSecondary: Color(0xFF1C2D61),
|
|
62
|
+
secondaryContainer: Color(0xFF344479),
|
|
63
|
+
onSecondaryContainer: Color(0xFFDCE1FF),
|
|
32
|
-
tertiary: Color(
|
|
64
|
+
tertiary: Color(0xFFEEB4EA),
|
|
33
|
-
onTertiary: Color(
|
|
65
|
+
onTertiary: Color(0xFF4A204C),
|
|
66
|
+
tertiaryContainer: Color(0xFF633664),
|
|
67
|
+
onTertiaryContainer: Color(0xFFFFD6FA),
|
|
68
|
+
error: Color(0xFFFFB4AB),
|
|
69
|
+
onError: Color(0xFF690005),
|
|
70
|
+
errorContainer: Color(0xFF93000A),
|
|
71
|
+
onErrorContainer: Color(0xFFFFDAD6),
|
|
34
|
-
|
|
72
|
+
surface: Color(0xFF121318),
|
|
35
|
-
|
|
73
|
+
onSurface: Color(0xFFE3E2E9),
|
|
74
|
+
onSurfaceVariant: Color(0xFFC5C6D0),
|
|
36
|
-
outline: Color(
|
|
75
|
+
outline: Color(0xFF8F909A),
|
|
76
|
+
outlineVariant: Color(0xFF45464F),
|
|
77
|
+
shadow: Color(0xFF000000),
|
|
78
|
+
scrim: Color(0xFF000000),
|
|
79
|
+
inverseSurface: Color(0xFFE3E2E9),
|
|
80
|
+
onInverseSurface: Color(0xFF2F3036),
|
|
81
|
+
inversePrimary: Color(0xFF495D92),
|
|
82
|
+
surfaceDim: Color(0xFF121318),
|
|
83
|
+
surfaceBright: Color(0xFF38393F),
|
|
84
|
+
surfaceContainerLowest: Color(0xFF0D0E13),
|
|
85
|
+
surfaceContainerLow: Color(0xFF1A1B21),
|
|
86
|
+
surfaceContainer: Color(0xFF1E1F25),
|
|
87
|
+
surfaceContainerHigh: Color(0xFF282A2F),
|
|
88
|
+
surfaceContainerHighest: Color(0xFF33343A),
|
|
37
89
|
);
|
|
38
90
|
|
|
39
91
|
final lightTheme = ThemeData(
|
|
@@ -137,7 +189,7 @@ final lightTheme = ThemeData(
|
|
|
137
189
|
),
|
|
138
190
|
elevation: 2,
|
|
139
191
|
shadowColor: Colors.black,
|
|
140
|
-
backgroundColor: lightColorScheme.
|
|
192
|
+
backgroundColor: lightColorScheme.surfaceContainerLow,
|
|
141
193
|
foregroundColor: Colors.black,
|
|
142
194
|
textStyle: const TextStyle(
|
|
143
195
|
fontSize: 18,
|
|
@@ -224,7 +276,7 @@ final darkTheme = lightTheme.copyWith(
|
|
|
224
276
|
elevation: 0.5,
|
|
225
277
|
shadowColor: Colors.white,
|
|
226
278
|
surfaceTintColor: Colors.white,
|
|
227
|
-
backgroundColor: darkColorScheme.
|
|
279
|
+
backgroundColor: darkColorScheme.surfaceContainerHigh,
|
|
228
280
|
foregroundColor: darkColorScheme.primary,
|
|
229
281
|
shape: const RoundedRectangleBorder(
|
|
230
282
|
side: BorderSide(
|
|
@@ -258,7 +310,7 @@ final darkTheme = lightTheme.copyWith(
|
|
|
258
310
|
),
|
|
259
311
|
elevation: 0,
|
|
260
312
|
shadowColor: Colors.white,
|
|
261
|
-
backgroundColor: darkColorScheme.
|
|
313
|
+
backgroundColor: darkColorScheme.surfaceContainerLow,
|
|
262
314
|
foregroundColor: darkColorScheme.primary,
|
|
263
315
|
),
|
|
264
316
|
),
|
|
@@ -276,10 +328,10 @@ final darkTheme = lightTheme.copyWith(
|
|
|
276
328
|
color: darkColorScheme.onSurface,
|
|
277
329
|
),
|
|
278
330
|
labelMedium: lightTheme.textTheme.labelMedium!.copyWith(
|
|
279
|
-
color: darkColorScheme.
|
|
331
|
+
color: darkColorScheme.tertiary,
|
|
280
332
|
),
|
|
281
333
|
labelLarge: lightTheme.textTheme.labelLarge!.copyWith(
|
|
282
|
-
color: darkColorScheme.
|
|
334
|
+
color: darkColorScheme.tertiary,
|
|
283
335
|
),
|
|
284
336
|
),
|
|
285
337
|
);
|
lib/widgets/settings_sheet.dart
CHANGED
|
@@ -14,6 +14,7 @@ class SettingsSheet extends StatelessWidget {
|
|
|
14
14
|
final darkMode = context.select((s) => s.darkMode);
|
|
15
15
|
final boldFont = context.select((s) => s.boldFont);
|
|
16
16
|
final engTitles = context.select((s) => s.engTitles);
|
|
17
|
+
final fontSize = context.select((s) => s.fontSize).clamp(10.0, 30.0);
|
|
17
18
|
return SettingsList(
|
|
18
19
|
contentPadding: EdgeInsets.zero,
|
|
19
20
|
platform: DevicePlatform.iOS,
|
|
@@ -56,33 +57,36 @@ class SettingsSheet extends StatelessWidget {
|
|
|
56
57
|
],
|
|
57
58
|
),
|
|
58
59
|
),
|
|
59
|
-
|
|
60
|
+
CustomSettingsTile(
|
|
61
|
+
child: Container(
|
|
60
|
-
|
|
62
|
+
color: darkMode ? const Color(0xFF1C1C1E) : Colors.white,
|
|
63
|
+
child: Column(
|
|
64
|
+
children: [
|
|
65
|
+
Padding(
|
|
66
|
+
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
61
|
-
|
|
67
|
+
child: Row(
|
|
68
|
+
children: [
|
|
69
|
+
Icon(
|
|
62
|
-
|
|
70
|
+
Icons.format_size,
|
|
63
|
-
|
|
71
|
+
color: context.theme.colorScheme.onSurface,
|
|
64
|
-
|
|
72
|
+
),
|
|
73
|
+
const SizedBox(width: 12),
|
|
74
|
+
Text("${fontSize.round()}"),
|
|
75
|
+
Expanded(
|
|
76
|
+
child: Slider(
|
|
65
|
-
|
|
77
|
+
value: fontSize,
|
|
78
|
+
min: 14,
|
|
79
|
+
max: 26,
|
|
80
|
+
divisions: 12,
|
|
81
|
+
label: "${fontSize.round()}",
|
|
66
|
-
|
|
82
|
+
onChanged: (v) => context.dispatch(UpdateFontSizeAction(v)),
|
|
67
|
-
icon: const Icon(
|
|
68
|
-
Icons.add_circle_outline,
|
|
69
|
-
size: 32,
|
|
70
|
-
color: Colors.redAccent,
|
|
71
|
-
|
|
83
|
+
),
|
|
72
|
-
|
|
84
|
+
),
|
|
85
|
+
],
|
|
73
|
-
|
|
86
|
+
),
|
|
74
|
-
SettingsTile(
|
|
75
|
-
title: Text(context.l.decrementFontTitle),
|
|
76
|
-
leading: Icon(
|
|
77
|
-
Icons.font_download,
|
|
78
|
-
color: context.theme.colorScheme.onSurface,
|
|
79
|
-
|
|
87
|
+
),
|
|
80
|
-
trailing: IconButton(
|
|
81
|
-
onPressed: () => context.dispatch(UpdateTextScaleAction(-0.1)),
|
|
82
|
-
icon: const Icon(
|
|
83
|
-
|
|
88
|
+
const Divider(height: 1, indent: 16),
|
|
84
|
-
|
|
89
|
+
],
|
|
85
|
-
color: Colors.blueAccent,
|
|
86
90
|
),
|
|
87
91
|
),
|
|
88
92
|
),
|
lib/widgets/verses_view.dart
CHANGED
|
@@ -14,14 +14,14 @@ class VersesView extends StatelessWidget {
|
|
|
14
14
|
|
|
15
15
|
@override
|
|
16
16
|
Widget build(BuildContext context) {
|
|
17
|
-
final (boldFont,
|
|
17
|
+
final (boldFont, fontSize, selectedVerses, _, _) =
|
|
18
|
-
context.select((s) => (s.boldFont, s.
|
|
18
|
+
context.select((s) => (s.boldFont, s.fontSize, s.selectedVerses, s.highlights, s.darkMode));
|
|
19
19
|
final appState = context.read();
|
|
20
|
-
final textStyle = DefaultTextStyle.of(context).style;
|
|
21
20
|
final theme = Theme.of(context).textTheme;
|
|
22
|
-
final baseStyle =
|
|
21
|
+
final baseStyle = theme.bodyMedium!.copyWith(
|
|
23
|
-
|
|
22
|
+
fontWeight: boldFont ? FontWeight.w500 : FontWeight.w400,
|
|
24
|
-
|
|
23
|
+
fontSize: fontSize,
|
|
24
|
+
);
|
|
25
25
|
return Stack(
|
|
26
26
|
children: [
|
|
27
27
|
SwipeDetector(
|
|
@@ -35,7 +35,7 @@ class VersesView extends StatelessWidget {
|
|
|
35
35
|
children: [
|
|
36
36
|
for (final v in chapter.verses!)
|
|
37
37
|
Padding(
|
|
38
|
-
padding: const EdgeInsets.only(bottom:
|
|
38
|
+
padding: const EdgeInsets.only(bottom: 8),
|
|
39
39
|
child: GestureDetector(
|
|
40
40
|
onTap: () => context.dispatch(SelectVerseAction(v)),
|
|
41
41
|
behavior: HitTestBehavior.opaque,
|
|
@@ -48,7 +48,12 @@ class VersesView extends StatelessWidget {
|
|
|
48
48
|
text: "${v.heading!.replaceAll("<br>", "\n")}\n",
|
|
49
49
|
style: theme.labelLarge,
|
|
50
50
|
),
|
|
51
|
+
TextSpan(
|
|
51
|
-
|
|
52
|
+
text: "${v.index + 1} ",
|
|
53
|
+
style: theme.labelMedium!.copyWith(
|
|
54
|
+
color: const Color(0xFF9A1111),
|
|
55
|
+
),
|
|
56
|
+
),
|
|
52
57
|
TextSpan(
|
|
53
58
|
text: v.text ?? "",
|
|
54
59
|
style: appState.getHighlightStyle(context, v, false),
|