~repos /only-bible-app

#kotlin#android#ios

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.


e31681b1 pyrossh

2 years ago
improve ui
lib/state.dart CHANGED
@@ -144,9 +144,11 @@ class AppModel extends ChangeNotifier {
144
144
  }
145
145
 
146
146
  hideActions(BuildContext context) {
147
+ if (actionsShown) {
147
- actionsShown = false;
148
+ actionsShown = false;
148
- Navigator.of(context).pop();
149
+ Navigator.of(context).pop();
149
- notifyListeners();
150
+ notifyListeners();
151
+ }
150
152
  }
151
153
  }
152
154
 
@@ -186,6 +188,7 @@ class ChapterViewModel extends ChangeNotifier {
186
188
  }
187
189
 
188
190
  navigateBookChapter(BuildContext context, int book, int chapter, TextDirection? dir) {
191
+ AppModel.ofEvent(context).hideActions(context);
189
192
  Navigator.of(context).push(
190
193
  createSlideRoute(
191
194
  context: context,
lib/theme.dart CHANGED
@@ -19,7 +19,6 @@ final lightTheme = ThemeData(
19
19
  // ),
20
20
  appBarTheme: const AppBarTheme(
21
21
  backgroundColor: Colors.white,
22
- toolbarHeight: 30,
23
22
  elevation: 0,
24
23
  scrolledUnderElevation: 0,
25
24
  ),
lib/widgets/chapter_app_bar.dart CHANGED
@@ -7,7 +7,7 @@ class ChapterAppBar extends StatelessWidget implements PreferredSizeWidget {
7
7
  const ChapterAppBar({super.key});
8
8
 
9
9
  @override
10
- Size get preferredSize => const Size.fromHeight(30);
10
+ Size get preferredSize => const Size.fromHeight(40);
11
11
 
12
12
  @override
13
13
  Widget build(BuildContext context) {
@@ -15,38 +15,40 @@ class ChapterAppBar extends StatelessWidget implements PreferredSizeWidget {
15
15
  final model = ChapterViewModel.of(context);
16
16
  final selectedBook = selectedBible.books[model.book];
17
17
  final bookName = selectedBook.name;
18
- return AppBar(
18
+ return SafeArea(
19
+ child: Padding(
20
+ padding: const EdgeInsets.only(left: 18, right: 5, bottom: 0),
21
+ child: Row(
22
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
23
+ children: [
24
+ InkWell(
19
- excludeHeaderSemantics: true,
25
+ enableFeedback: true,
26
+ onTap: () {
20
- title: TextButton.icon(
27
+ Navigator.of(context).push(
21
- style: TextButton.styleFrom(
28
+ createNoTransitionPageRoute(
22
- padding: EdgeInsets.zero,
23
- backgroundColor: Theme.of(context).colorScheme.background,
29
+ BookSelectScreen(bible: selectedBible),
24
- elevation: 0,
25
- ),
30
+ ),
31
+ );
32
+ },
26
- label: Icon(
33
+ child: Row(
34
+ mainAxisAlignment: MainAxisAlignment.start,
35
+ children: [
36
+ Text(
37
+ "$bookName ${model.chapter + 1}",
38
+ style: Theme.of(context).textTheme.headlineMedium,
39
+ ),
40
+ Icon(
27
- Icons.expand_more,
41
+ Icons.expand_more,
28
- size: 28,
42
+ size: 28,
29
- color: Theme.of(context).textTheme.headlineMedium!.color,
43
+ color: Theme.of(context).textTheme.headlineMedium!.color,
30
- ),
44
+ ),
31
- icon: Text(
45
+ ],
32
- "$bookName ${model.chapter + 1}",
33
- style: Theme.of(context).textTheme.headlineMedium,
34
- ),
46
+ ),
35
- onPressed: () {
36
- Navigator.of(context).push(
37
- createNoTransitionPageRoute(
38
- BookSelectScreen(bible: selectedBible),
39
47
  ),
48
+ const MoreButton(),
49
+ ],
40
- );
50
+ ),
41
- },
42
51
  ),
43
- centerTitle: false,
44
- surfaceTintColor: Colors.white,
45
- leading: null,
46
- automaticallyImplyLeading: false,
47
- actions: const [
48
- MoreButton(),
49
- ],
50
52
  );
51
53
  }
52
54
  }
lib/widgets/settings_sheet.dart CHANGED
@@ -13,80 +13,86 @@ class SettingsSheet extends StatelessWidget {
13
13
  final modeIcon = model.darkMode ? Icons.dark_mode : Icons.light_mode;
14
14
  final modeIconColor = model.darkMode ? const Color(0xFF59EEFF) : const Color(0xFFE5B347);
15
15
  final iconColor = Theme.of(context).textTheme.bodyMedium!.color;
16
- return SettingsList(
16
+ return Column(
17
+ children: [
18
+ const Padding(
17
- contentPadding: EdgeInsets.zero,
19
+ padding: EdgeInsets.only(bottom: 15),
18
- platform: DevicePlatform.iOS,
19
- lightTheme: const SettingsThemeData(
20
- settingsListBackground: Color(0xFFF2F2F7),
21
- ),
22
- darkTheme: const SettingsThemeData(
23
- settingsListBackground: Color(0xFF141415),
24
- ),
25
- sections: [
26
- SettingsSection(
27
- margin: const EdgeInsetsDirectional.symmetric(horizontal: 20),
28
- title: Container(
29
- alignment: Alignment.topLeft,
30
- child: const Text(
20
+ child: Text(
31
- "Settings",
21
+ "Settings",
32
- style: TextStyle(
22
+ style: TextStyle(
33
- fontSize: 16,
23
+ fontSize: 18,
34
- fontWeight: FontWeight.w500,
24
+ fontWeight: FontWeight.w500,
35
- ),
36
25
  ),
37
26
  ),
38
- tiles: [
39
- SettingsTile.navigation(
40
- leading: const Icon(Icons.language, color: Colors.green),
41
- title: const Text("Language"),
42
- value: const Text("English"),
43
- ),
27
+ ),
28
+ Expanded(
44
- SettingsTile.navigation(
29
+ child: SettingsList(
45
- leading: const Icon(Icons.book_outlined, color: Colors.blueAccent),
30
+ contentPadding: EdgeInsets.zero,
31
+ platform: DevicePlatform.iOS,
46
- title: const Text("Bible"),
32
+ lightTheme: const SettingsThemeData(
47
- value: Text(selectedBible.name),
48
- onPressed: (c) {
49
- Navigator.of(c).pushReplacement(
50
- createNoTransitionPageRoute(
51
- const BibleSelectScreen(),
52
- ),
53
- );
54
- return null;
55
- },
56
- ),
57
- SettingsTile.switchTile(
58
- onToggle: (value) {
59
- model.toggleMode();
60
- },
61
- initialValue: model.darkMode,
62
- leading: Icon(modeIcon, color: modeIconColor),
33
+ settingsListBackground: Color(0xFFF2F2F7),
63
- title: const Text("Dark mode"),
64
- ),
65
- SettingsTile.switchTile(
66
- onToggle: (value) {
67
- model.toggleBold();
68
- },
69
- initialValue: model.fontBold,
70
- leading: Icon(Icons.format_bold, color: iconColor),
71
- title: const Text("Bold font"),
72
34
  ),
73
- SettingsTile(
74
- title: const Text("Increase font size"),
35
+ darkTheme: const SettingsThemeData(
75
- leading: Icon(Icons.font_download, color: iconColor),
36
+ settingsListBackground: Color(0xFF141415),
76
- trailing: IconButton(
77
- onPressed: model.increaseFont,
78
- icon: const Icon(Icons.add_circle_outline, size: 32, color: Colors.redAccent),
79
- ),
80
37
  ),
38
+ sections: [
39
+ SettingsSection(
40
+ margin: const EdgeInsetsDirectional.symmetric(horizontal: 20),
41
+ tiles: [
42
+ SettingsTile.navigation(
43
+ leading: const Icon(Icons.language, color: Colors.green),
44
+ title: const Text("Language"),
45
+ value: const Text("English"),
46
+ ),
47
+ SettingsTile.navigation(
48
+ leading: const Icon(Icons.book_outlined, color: Colors.blueAccent),
49
+ title: const Text("Bible"),
50
+ value: Text(selectedBible.name),
51
+ onPressed: (c) {
52
+ Navigator.of(c).pushReplacement(
53
+ createNoTransitionPageRoute(
54
+ const BibleSelectScreen(),
55
+ ),
56
+ );
57
+ return null;
58
+ },
59
+ ),
60
+ SettingsTile.switchTile(
61
+ onToggle: (value) {
62
+ model.toggleMode();
63
+ },
64
+ initialValue: model.darkMode,
65
+ leading: Icon(modeIcon, color: modeIconColor),
66
+ title: const Text("Dark mode"),
67
+ ),
68
+ SettingsTile.switchTile(
69
+ onToggle: (value) {
70
+ model.toggleBold();
71
+ },
72
+ initialValue: model.fontBold,
73
+ leading: Icon(Icons.format_bold, color: iconColor),
74
+ title: const Text("Bold font"),
75
+ ),
81
- SettingsTile(
76
+ SettingsTile(
77
+ title: const Text("Increase font size"),
78
+ leading: Icon(Icons.font_download, color: iconColor),
79
+ trailing: IconButton(
80
+ onPressed: model.increaseFont,
81
+ icon: const Icon(Icons.add_circle_outline, size: 32, color: Colors.redAccent),
82
+ ),
83
+ ),
84
+ SettingsTile(
82
- title: const Text("Decrease font size"),
85
+ title: const Text("Decrease font size"),
83
- leading: Icon(Icons.font_download, color: iconColor),
86
+ leading: Icon(Icons.font_download, color: iconColor),
84
- trailing: IconButton(
87
+ trailing: IconButton(
85
- onPressed: model.decreaseFont,
88
+ onPressed: model.decreaseFont,
86
- icon: const Icon(Icons.remove_circle_outline, size: 32, color: Colors.blueAccent),
89
+ icon: const Icon(Icons.remove_circle_outline, size: 32, color: Colors.blueAccent),
90
+ ),
91
+ ),
92
+ ],
87
93
  ),
94
+ ],
88
- ),
95
+ ),
89
- ],
90
96
  ),
91
97
  ],
92
98
  );
lib/widgets/verses_view.dart CHANGED
@@ -20,52 +20,62 @@ class VersesView extends StatelessWidget {
20
20
  model.onPrevious(context, model.book, model.chapter);
21
21
  },
22
22
  child: Padding(
23
- padding: EdgeInsets.only(left: 20, right: 20, bottom: app.actionsShown ? 120 : 0),
23
+ padding: const EdgeInsets.only(left: 20, right: 20),
24
24
  child: SingleChildScrollView(
25
25
  physics: const BouncingScrollPhysics(),
26
+ child: Column(
27
+ children: [
28
+ // const Padding(
29
+ // padding: EdgeInsets.only(top: 0),
30
+ // ),
26
- child: Text.rich(
31
+ Text.rich(
27
- // scrollPhysics: const BouncingScrollPhysics(),
32
+ // scrollPhysics: const BouncingScrollPhysics(),
28
- // contextMenuBuilder: null,
33
+ // contextMenuBuilder: null,
29
- textScaleFactor: app.textScaleFactor,
34
+ textScaleFactor: app.textScaleFactor,
30
- // onSelectionChanged: (selection, _) {
35
+ // onSelectionChanged: (selection, _) {
31
- // },
36
+ // },
32
- TextSpan(
37
+ TextSpan(
33
- style: app.fontBold
38
+ style: app.fontBold
34
- ? textStyle.copyWith(
39
+ ? textStyle.copyWith(
35
- fontWeight: FontWeight.w500,
40
+ fontWeight: FontWeight.w500,
36
- )
41
+ )
37
- : textStyle,
42
+ : textStyle,
38
- // recognizer: TapAndPanGestureRecognizer()..onDragEnd = (e) => print("Hello"),
43
+ // recognizer: TapAndPanGestureRecognizer()..onDragEnd = (e) => print("Hello"),
39
- children: chapter.verses
44
+ children: chapter.verses
40
- .asMap()
45
+ .asMap()
41
- .entries
46
+ .entries
42
- .map(
47
+ .map(
43
- (e) => [
48
+ (e) => [
44
- WidgetSpan(
49
+ WidgetSpan(
45
- child: Transform.translate(
50
+ child: Transform.translate(
46
- offset: const Offset(0, -2),
51
+ offset: const Offset(0, -2),
47
- child: Text("${e.key + 1} ", style: Theme.of(context).textTheme.labelMedium),
52
+ child: Text("${e.key + 1} ", style: Theme.of(context).textTheme.labelMedium),
48
- ),
53
+ ),
49
- ),
54
+ ),
50
- TextSpan(
55
+ TextSpan(
51
- text: "${e.value.text}\n",
56
+ text: "${e.value.text}\n",
52
- style: model.isVerseSelected(e.key)
57
+ style: model.isVerseSelected(e.key)
53
- ? TextStyle(
58
+ ? TextStyle(
54
- backgroundColor: Theme.of(context).highlightColor,
59
+ backgroundColor: Theme.of(context).highlightColor,
55
- )
60
+ )
56
- : null,
61
+ : null,
57
- recognizer: TapGestureRecognizer()..onTap = () => model.onVerseSelected(context, e.key),
62
+ recognizer: TapGestureRecognizer()..onTap = () => model.onVerseSelected(context, e.key),
58
- ),
63
+ ),
59
- const WidgetSpan(
64
+ const WidgetSpan(
60
- child: Padding(
65
+ child: Padding(
61
- padding: EdgeInsets.only(top: 16, bottom: 16),
66
+ padding: EdgeInsets.only(top: 16, bottom: 16),
62
- ),
67
+ ),
63
- ),
68
+ ),
64
- ],
69
+ ],
65
- )
70
+ )
66
- .expand((element) => element)
71
+ .expand((element) => element)
67
- .toList(),
72
+ .toList(),
68
- ),
73
+ ),
74
+ ),
75
+ Padding(
76
+ padding: EdgeInsets.only(bottom: app.actionsShown ? 120 : 0),
77
+ ),
78
+ ],
69
79
  ),
70
80
  ),
71
81
  ),