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


6ce3325a pyrossh

2 years ago
improve code
lib/utils/side_menu_modal.dart CHANGED
@@ -1,5 +1,5 @@
1
1
  import "package:flutter/material.dart";
2
- import 'package:only_bible_app/state.dart';
2
+ import "package:only_bible_app/state.dart";
3
3
 
4
4
  class SideMenuModal extends ModalRoute<void> {
5
5
  final Widget child;
@@ -38,12 +38,15 @@ class SideMenuModal extends ModalRoute<void> {
38
38
  child: Container(
39
39
  color: Theme.of(context).colorScheme.background,
40
40
  margin: EdgeInsets.only(left: 0, right: isWide(context) ? 650 : 0),
41
+ child: Container(
42
+ margin: EdgeInsets.only(top: isWide(context) ? 5 : 0, left: 20, right: 20),
41
- child: isWide(context)
43
+ child: isWide(context)
42
- ? child
44
+ ? child
43
- : SlideTransition(
45
+ : SlideTransition(
44
- position: Tween(begin: const Offset(-1, 0), end: Offset.zero).animate(animation),
46
+ position: Tween(begin: const Offset(-1, 0), end: Offset.zero).animate(animation),
45
- child: child,
47
+ child: child,
46
- ),
48
+ ),
49
+ ),
47
50
  ),
48
51
  );
49
52
  }
lib/widgets/bible_selector.dart CHANGED
@@ -7,54 +7,51 @@ class BibleSelector extends StatelessWidget {
7
7
 
8
8
  @override
9
9
  Widget build(BuildContext context) {
10
- return Container(
10
+ return Column(
11
- margin: EdgeInsets.only(top: isWide(context) ? 5 : 0, left: 20),
12
- child: Column(
13
- crossAxisAlignment: CrossAxisAlignment.start,
11
+ crossAxisAlignment: CrossAxisAlignment.start,
14
- children: [
12
+ children: [
15
- Container(
13
+ Container(
16
- margin: const EdgeInsets.only(bottom: 20),
14
+ margin: const EdgeInsets.only(bottom: 10),
17
- child: Row(
15
+ child: Row(
18
- mainAxisAlignment: MainAxisAlignment.center,
16
+ mainAxisAlignment: MainAxisAlignment.center,
19
- children: [
17
+ children: [
20
- Expanded(
18
+ Expanded(
21
- child: Text("Bibles", style: Theme.of(context).textTheme.headlineMedium),
19
+ child: Text("Bibles", style: Theme.of(context).textTheme.headlineMedium),
20
+ ),
21
+ Container(
22
+ margin: const EdgeInsets.only(right: 10),
23
+ child: IconButton(
24
+ icon: const Icon(Icons.close, size: 28),
25
+ onPressed: () {
26
+ Navigator.of(context).pop();
27
+ },
22
28
  ),
23
- Container(
24
- margin: const EdgeInsets.only(right: 10),
25
- child: IconButton(
26
- icon: const Icon(Icons.close, size: 28),
27
- onPressed: () {
28
- Navigator.of(context).pop();
29
- },
30
- ),
31
- )
29
+ )
32
- ],
30
+ ],
33
- ),
34
31
  ),
32
+ ),
35
- Expanded(
33
+ Expanded(
36
- child: GridView.count(
34
+ child: GridView.count(
37
- crossAxisCount: 2,
35
+ crossAxisCount: 2,
38
- padding: EdgeInsets.zero,
36
+ padding: EdgeInsets.zero,
39
- shrinkWrap: true,
37
+ shrinkWrap: true,
40
- crossAxisSpacing: 0,
38
+ crossAxisSpacing: 0,
41
- mainAxisSpacing: 0,
39
+ mainAxisSpacing: 0,
42
- childAspectRatio: 4,
40
+ childAspectRatio: 4,
43
- children: List.of(
41
+ children: List.of(
44
- bibles.map((bible) {
42
+ bibles.map((bible) {
45
- return Container(
43
+ return Container(
46
- margin: const EdgeInsets.only(right: 16, bottom: 16),
44
+ margin: const EdgeInsets.only(right: 16, bottom: 16),
47
- child: TextButton(
45
+ child: TextButton(
48
- child: Text(bible.name),
46
+ child: Text(bible.name),
49
- onPressed: () => changeBible(context, bible.id),
47
+ onPressed: () => changeBible(context, bible.id),
50
- ),
48
+ ),
51
- );
49
+ );
52
- }),
50
+ }),
53
- ),
54
51
  ),
55
52
  ),
53
+ ),
56
- ],
54
+ ],
57
- ),
58
55
  );
59
56
  }
60
57
  }
lib/widgets/book_selector.dart CHANGED
@@ -7,70 +7,73 @@ class BookSelector extends StatelessWidget {
7
7
  const BookSelector({super.key});
8
8
 
9
9
  onBookSelected(BuildContext context, int index) {
10
- Navigator.of(context).pushReplacement(SideMenuModal(child: ChapterSelector(selectedBookIndex: index)));
10
+ Navigator.of(context).pushReplacement(
11
+ SideMenuModal(
12
+ child: ChapterSelector(
13
+ selectedBookIndex: index,
14
+ ),
15
+ ),
16
+ );
11
17
  }
12
18
 
13
19
  @override
14
20
  Widget build(BuildContext context) {
15
- return Container(
16
- margin: EdgeInsets.only(top: isWide(context) ? 5 : 0, left: 20, right: 20),
17
- child: CustomScrollView(
21
+ return CustomScrollView(
18
- slivers: [
22
+ slivers: [
19
- SliverToBoxAdapter(
23
+ SliverToBoxAdapter(
20
- child: Container(
24
+ child: Container(
21
- margin: const EdgeInsets.only(bottom: 10),
25
+ margin: const EdgeInsets.only(bottom: 10),
22
- child: Row(
26
+ child: Row(
23
- mainAxisAlignment: MainAxisAlignment.center,
27
+ mainAxisAlignment: MainAxisAlignment.center,
24
- children: [
28
+ children: [
25
- Expanded(
29
+ Expanded(
26
- child: Text("Old Testament", style: Theme.of(context).textTheme.headlineMedium),
30
+ child: Text("Old Testament", style: Theme.of(context).textTheme.headlineMedium),
27
- ),
31
+ ),
28
- IconButton(
32
+ IconButton(
29
- icon: const Icon(Icons.close, size: 28),
33
+ icon: const Icon(Icons.close, size: 28),
30
- onPressed: () {
34
+ onPressed: () {
31
- Navigator.of(context).pop();
35
+ Navigator.of(context).pop();
32
- },
36
+ },
33
- ),
37
+ ),
34
- ],
38
+ ],
35
- ),
36
39
  ),
37
40
  ),
41
+ ),
38
- SliverGrid.count(
42
+ SliverGrid.count(
39
- crossAxisCount: 6,
43
+ crossAxisCount: 6,
40
- crossAxisSpacing: 16,
44
+ crossAxisSpacing: 16,
41
- mainAxisSpacing: 16,
45
+ mainAxisSpacing: 16,
42
- childAspectRatio: 1.6,
46
+ childAspectRatio: 1.6,
43
- children: List.of(
47
+ children: List.of(
44
- selectedBible.value!.getOldBooks().map((book) {
48
+ selectedBible.value!.getOldBooks().map((book) {
45
- return TextButton(
49
+ return TextButton(
46
- child: Text(book.shortName()),
50
+ child: Text(book.shortName()),
47
- onPressed: () => onBookSelected(context, book.index),
51
+ onPressed: () => onBookSelected(context, book.index),
48
- );
52
+ );
49
- }),
53
+ }),
50
- ),
51
54
  ),
55
+ ),
52
- SliverToBoxAdapter(
56
+ SliverToBoxAdapter(
53
- child: Container(
57
+ child: Container(
54
- margin: const EdgeInsets.only(top: 30, bottom: 20),
58
+ margin: const EdgeInsets.only(top: 30, bottom: 20),
55
- child: Text("New Testament", style: Theme.of(context).textTheme.headlineMedium),
59
+ child: Text("New Testament", style: Theme.of(context).textTheme.headlineMedium),
56
- ),
57
60
  ),
61
+ ),
58
- SliverGrid.count(
62
+ SliverGrid.count(
59
- crossAxisCount: 6,
63
+ crossAxisCount: 6,
60
- crossAxisSpacing: 16,
64
+ crossAxisSpacing: 16,
61
- mainAxisSpacing: 16,
65
+ mainAxisSpacing: 16,
62
- childAspectRatio: 1.6,
66
+ childAspectRatio: 1.6,
63
- children: List.of(
67
+ children: List.of(
64
- selectedBible.value!.getNewBooks().map((book) {
68
+ selectedBible.value!.getNewBooks().map((book) {
65
- return TextButton(
69
+ return TextButton(
66
- child: Text(book.shortName()),
70
+ child: Text(book.shortName()),
67
- onPressed: () => onBookSelected(context, book.index),
71
+ onPressed: () => onBookSelected(context, book.index),
68
- );
72
+ );
69
- }),
73
+ }),
70
- ),
71
74
  ),
75
+ ),
72
- ],
76
+ ],
73
- ),
74
77
  );
75
78
  }
76
79
  }
lib/widgets/chapter_selector.dart CHANGED
@@ -13,43 +13,40 @@ class ChapterSelector extends StatelessWidget {
13
13
  @override
14
14
  Widget build(BuildContext context) {
15
15
  final book = selectedBible.value!.books[selectedBookIndex];
16
- return Container(
17
- margin: EdgeInsets.only(top: isWide(context) ? 5 : 0, left: 20, right: 20),
18
- child: CustomScrollView(
16
+ return CustomScrollView(
19
- slivers: [
17
+ slivers: [
20
- SliverToBoxAdapter(
18
+ SliverToBoxAdapter(
21
- child: Container(
19
+ child: Container(
22
- margin: const EdgeInsets.only(bottom: 10),
20
+ margin: const EdgeInsets.only(bottom: 10),
23
- child: Row(
21
+ child: Row(
24
- mainAxisAlignment: MainAxisAlignment.center,
22
+ mainAxisAlignment: MainAxisAlignment.center,
25
- children: [
23
+ children: [
26
- Expanded(
24
+ Expanded(
27
- child: Text(book.name, style: Theme.of(context).textTheme.headlineMedium),
25
+ child: Text(book.name, style: Theme.of(context).textTheme.headlineMedium),
28
- ),
26
+ ),
29
- IconButton(
27
+ IconButton(
30
- icon: const Icon(Icons.close, size: 28),
28
+ icon: const Icon(Icons.close, size: 28),
31
- onPressed: () {
29
+ onPressed: () {
32
- Navigator.of(context).pop();
30
+ Navigator.of(context).pop();
33
- },
31
+ },
34
- ),
32
+ ),
35
- ],
33
+ ],
36
- ),
37
34
  ),
38
35
  ),
36
+ ),
39
- SliverGrid.count(
37
+ SliverGrid.count(
40
- crossAxisCount: 6,
38
+ crossAxisCount: 6,
41
- crossAxisSpacing: 16,
39
+ crossAxisSpacing: 16,
42
- mainAxisSpacing: 16,
40
+ mainAxisSpacing: 16,
43
- childAspectRatio: 1.6,
41
+ childAspectRatio: 1.6,
44
- children: List.generate(book.chapters.length, (index) {
42
+ children: List.generate(book.chapters.length, (index) {
45
- return TextButton(
43
+ return TextButton(
46
- child: Text("${index + 1}"),
44
+ child: Text("${index + 1}"),
47
- onPressed: () => onChapterSelected(context, index),
45
+ onPressed: () => onChapterSelected(context, index),
48
- );
46
+ );
49
- }),
47
+ }),
50
- ),
48
+ ),
51
- ],
49
+ ],
52
- ),
53
50
  );
54
51
  }
55
52
  }