~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.


5beae9c0 pyrossh

2 years ago
Add settings
lib/state.dart CHANGED
@@ -194,7 +194,7 @@ class ChapterViewModel extends ChangeNotifier {
194
194
  void onVerseSelected(BuildContext context, int i) {
195
195
  if (!isWide(context)) {
196
196
  if (selectedVerses.isEmpty) {
197
- Scaffold.of(context).showBottomSheet((context) => const ActionsBar());
197
+ Scaffold.of(context).showBottomSheet((context) => const ActionsSheet());
198
198
  }
199
199
  }
200
200
  if (selectedVerses.contains(i)) {
lib/theme.dart CHANGED
@@ -22,6 +22,7 @@ final lightTheme = ThemeData(
22
22
  elevation: 10,
23
23
  shadowColor: Colors.black,
24
24
  backgroundColor: Colors.white,
25
+ // backgroundColor: Color(0xFFF2F2F7),
25
26
  surfaceTintColor: Colors.white,
26
27
  shape: Border(
27
28
  top: BorderSide(
lib/widgets/actions_bar.dart CHANGED
@@ -2,13 +2,12 @@ import "package:flutter/material.dart";
2
2
  import "package:only_bible_app/state.dart";
3
3
  import "package:only_bible_app/widgets/play_button.dart";
4
4
 
5
- class ActionsBar extends StatelessWidget {
5
+ class ActionsSheet extends StatelessWidget {
6
- const ActionsBar({super.key});
6
+ const ActionsSheet({super.key});
7
7
 
8
8
  @override
9
9
  Widget build(BuildContext context) {
10
10
  return BottomSheet(
11
- enableDrag: false,
12
11
  onClosing: () {},
13
12
  builder: (BuildContext ctx) => Container(
14
13
  padding: EdgeInsets.only(bottom: isIOS() ? 20 : 0),
lib/widgets/chapter_app_bar.dart CHANGED
@@ -1,7 +1,7 @@
1
1
  import "package:flutter/material.dart";
2
2
  import "package:only_bible_app/screens/book_select_screen.dart";
3
3
  import "package:only_bible_app/state.dart";
4
- import "package:only_bible_app/widgets/menu.dart";
4
+ import "package:only_bible_app/widgets/more_button.dart";
5
5
 
6
6
  class ChapterAppBar extends StatelessWidget implements PreferredSizeWidget {
7
7
  const ChapterAppBar({super.key});
@@ -49,12 +49,7 @@ class ChapterAppBar extends StatelessWidget implements PreferredSizeWidget {
49
49
  leading: null,
50
50
  automaticallyImplyLeading: false,
51
51
  actions: const [
52
- Menu(),
52
+ MoreButton(),
53
- // IconButton(
54
- // padding: EdgeInsets.zero,
55
- // onPressed: () {},
56
- // icon: const Icon(Icons.more_vert),
57
- // ),
58
53
  ],
59
54
  );
60
55
  }
lib/widgets/more_button.dart ADDED
@@ -0,0 +1,76 @@
1
+ import "package:flutter/material.dart";
2
+ import "package:only_bible_app/widgets/settings_sheet.dart";
3
+
4
+ class MoreButton extends StatefulWidget {
5
+ const MoreButton({super.key});
6
+
7
+ @override
8
+ State<MoreButton> createState() => _MoreButtonState();
9
+ }
10
+
11
+ class _MoreButtonState extends State<MoreButton> {
12
+ var isOpen = false;
13
+
14
+ setIsOpen() {
15
+ setState(() {
16
+ isOpen = true;
17
+ });
18
+ }
19
+
20
+ setIsClosed() {
21
+ setState(() {
22
+ isOpen = true;
23
+ });
24
+ }
25
+
26
+ @override
27
+ Widget build(BuildContext context) {
28
+ // showModalBottomSheet(
29
+ // context: context,
30
+ // enableDrag: false,
31
+ // shape: RoundedRectangleBorder(
32
+ // borderRadius: BorderRadius.vertical(
33
+ // top: Radius.circular(20),
34
+ // ),
35
+ // ),
36
+ // clipBehavior: Clip.antiAliasWithSaveLayer,
37
+ // builder: (context) => DraggableScrollableSheet(
38
+ // expand: false,
39
+ // initialChildSize: 0.9,
40
+ // minChildSize: 0.5,
41
+ // maxChildSize: 0.9,
42
+ // builder: (context, scrollController) {
43
+ // return SingleChildScrollView(
44
+ // child: new Container(
45
+ // color: Colors.white,
46
+ // child: buildTitleWidget(),
47
+ // ),
48
+ // );
49
+ // },
50
+ // ),
51
+ // isDismissible: false,
52
+ // isScrollControlled: true,
53
+ // );
54
+ return IconButton(
55
+ padding: EdgeInsets.zero,
56
+ onPressed: () {
57
+ showModalBottomSheet(
58
+ context: context,
59
+ isDismissible: true,
60
+ enableDrag: true,
61
+ // showDragHandle: true,
62
+ useSafeArea: true,
63
+ // clipBehavior: Clip.antiAliasWithSaveLayer,
64
+ builder: (context) => const SettingsSheet(),
65
+ );
66
+ // Scaffold.of(context).showBottomSheet(
67
+ // (context) => const SettingsSheet(),
68
+ // constraints: const BoxConstraints(
69
+ // maxHeight: 400,
70
+ // ),
71
+ // );
72
+ },
73
+ icon: const Icon(Icons.more_vert),
74
+ );
75
+ }
76
+ }
lib/widgets/settings_sheet.dart ADDED
@@ -0,0 +1,81 @@
1
+ import "package:flutter/material.dart";
2
+ import "package:only_bible_app/state.dart";
3
+ import "package:settings_ui/settings_ui.dart";
4
+ import "package:only_bible_app/screens/bible_select_screen.dart";
5
+
6
+ class SettingsSheet extends StatelessWidget {
7
+ const SettingsSheet({super.key});
8
+
9
+ @override
10
+ Widget build(BuildContext context) {
11
+ final model = AppModel.of(context);
12
+ final selectedBible = model.bible;
13
+ // Navigator.pop(context);
14
+ // Scaffold.of(context).showBodyScrim(false, 0.0);
15
+ return SettingsList(
16
+ // lightTheme: SettingsThemeData(
17
+ // settingsListBackground: Colors.white,
18
+ // ),
19
+ sections: [
20
+ SettingsSection(
21
+ // margin: EdgeInsetsDirectional.symmetric(horizontal: 5),
22
+ tiles: [
23
+ SettingsTile(
24
+ title: const Text("Settings"),
25
+ ),
26
+ SettingsTile.navigation(
27
+ leading: const Icon(Icons.language, color: Colors.green),
28
+ title: const Text("Language"),
29
+ value: const Text("English"),
30
+ ),
31
+ SettingsTile.navigation(
32
+ leading: const Icon(Icons.book_outlined, color: Colors.blueAccent),
33
+ title: const Text("Bible"),
34
+ value: Text(selectedBible.name),
35
+ onPressed: (_) {
36
+ Navigator.of(context).push(
37
+ createNoTransitionPageRoute(
38
+ const BibleSelectScreen(),
39
+ ),
40
+ );
41
+ return null;
42
+ },
43
+ ),
44
+ SettingsTile.switchTile(
45
+ onToggle: (value) {
46
+ model.toggleMode();
47
+ },
48
+ initialValue: model.darkMode,
49
+ leading: const Icon(Icons.dark_mode_outlined),
50
+ title: const Text("Dark mode"),
51
+ ),
52
+ SettingsTile.switchTile(
53
+ onToggle: (value) {
54
+ model.toggleBold();
55
+ },
56
+ initialValue: model.fontBold,
57
+ leading: const Icon(Icons.format_bold_outlined),
58
+ title: const Text("Bold font"),
59
+ ),
60
+ SettingsTile(
61
+ title: const Text("Increase font size"),
62
+ leading: const Icon(Icons.font_download),
63
+ trailing: IconButton(
64
+ onPressed: model.increaseFont,
65
+ icon: const Icon(Icons.add_circle_outline, size: 32, color: Colors.redAccent),
66
+ ),
67
+ ),
68
+ SettingsTile(
69
+ title: const Text("Decrease font size"),
70
+ leading: const Icon(Icons.font_download),
71
+ trailing: IconButton(
72
+ onPressed: model.decreaseFont,
73
+ icon: const Icon(Icons.remove_circle_outline, size: 32, color: Colors.blueAccent),
74
+ ),
75
+ ),
76
+ ],
77
+ ),
78
+ ],
79
+ );
80
+ }
81
+ }
pubspec.lock CHANGED
@@ -740,6 +740,14 @@ packages:
740
740
  url: "https://pub.dev"
741
741
  source: hosted
742
742
  version: "0.27.7"
743
+ settings_ui:
744
+ dependency: "direct main"
745
+ description:
746
+ name: settings_ui
747
+ sha256: d9838037cb554b24b4218b2d07666fbada3478882edefae375ee892b6c820ef3
748
+ url: "https://pub.dev"
749
+ source: hosted
750
+ version: "2.0.2"
743
751
  shared_preferences:
744
752
  dependency: "direct main"
745
753
  description:
pubspec.yaml CHANGED
@@ -23,6 +23,7 @@ dependencies:
23
23
  firebase_crashlytics: ^3.3.4
24
24
  firebase_performance: ^0.9.2+4
25
25
  firebase_storage: ^11.2.5
26
+ settings_ui: ^2.0.2
26
27
 
27
28
  dev_dependencies:
28
29
  flutter_test: