~repos /only-bible-app
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.
22a6663e
—
pyrossh 2 years ago
improve select page
bible_app/lib/components/book_selector.dart
CHANGED
|
@@ -11,6 +11,32 @@ onTabBookChange(int i) {
|
|
|
11
11
|
tabBookIndex.value = i;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
// class CounterPage extends StatefulWidget {
|
|
15
|
+
// _CounterPageState createState() => _CounterPageState();
|
|
16
|
+
// }
|
|
17
|
+
//
|
|
18
|
+
// class _CounterPageState extends State<CounterPage> {
|
|
19
|
+
// int count = 0;
|
|
20
|
+
//
|
|
21
|
+
// @override
|
|
22
|
+
// Widget build(BuildContext context) {
|
|
23
|
+
// return Scaffold(
|
|
24
|
+
// appBar: AppBar(title: Text("Widget Communication")),
|
|
25
|
+
// body: Center(
|
|
26
|
+
// child: Count(
|
|
27
|
+
// count: count,
|
|
28
|
+
// onCountSelected: () {
|
|
29
|
+
// print("Count was selected.");
|
|
30
|
+
// },
|
|
31
|
+
// onCountChanged: (int val) {
|
|
32
|
+
// setState(() => count += val);
|
|
33
|
+
// },
|
|
34
|
+
// )
|
|
35
|
+
// ),
|
|
36
|
+
// );
|
|
37
|
+
// }
|
|
38
|
+
// }
|
|
39
|
+
|
|
14
40
|
class BookSelector extends StatelessWidget {
|
|
15
41
|
const BookSelector({super.key});
|
|
16
42
|
|
|
@@ -20,7 +46,7 @@ class BookSelector extends StatelessWidget {
|
|
|
20
46
|
|
|
21
47
|
return DefaultTabController(
|
|
22
48
|
length: 2,
|
|
23
|
-
animationDuration: Platform.isMacOS ? Duration.zero: const Duration(milliseconds: 300),
|
|
49
|
+
// animationDuration: Platform.isMacOS ? Duration.zero: const Duration(milliseconds: 300),
|
|
24
50
|
child: Column(
|
|
25
51
|
children: [
|
|
26
52
|
SizedBox(
|
|
@@ -66,42 +92,28 @@ class BookSelector extends StatelessWidget {
|
|
|
66
92
|
border: Border(bottom: BorderSide(width: 1.5)),
|
|
67
93
|
),
|
|
68
94
|
),
|
|
69
|
-
|
|
95
|
+
Expanded(
|
|
70
96
|
child: TabBarView(
|
|
71
97
|
children: [
|
|
98
|
+
ListView(children: [
|
|
72
|
-
|
|
99
|
+
Container(
|
|
73
|
-
// margin: const EdgeInsets.symmetric(vertical: 15, horizontal: 30),
|
|
74
|
-
color: Colors.white,
|
|
75
|
-
child: Column(
|
|
76
|
-
crossAxisAlignment: CrossAxisAlignment.start,
|
|
77
|
-
children: [
|
|
78
|
-
Container(
|
|
79
|
-
|
|
100
|
+
margin: const EdgeInsets.only(bottom: 20, left: 10),
|
|
80
|
-
|
|
101
|
+
child: Text("Old Testament", style: Theme.of(context).textTheme.headlineMedium),
|
|
81
|
-
),
|
|
82
|
-
Expanded(child: BooksList(offset: 0, books: oldTestament)),
|
|
83
|
-
Container(
|
|
84
|
-
margin: const EdgeInsets.symmetric(vertical: 15),
|
|
85
|
-
child: Text("New Testament", style: Theme.of(context).textTheme.headlineMedium),
|
|
86
|
-
),
|
|
87
|
-
Expanded(child: BooksList(offset: 39, books: newTestament)),
|
|
88
|
-
],
|
|
89
102
|
),
|
|
90
|
-
|
|
103
|
+
BooksList(offset: 0, books: oldTestament),
|
|
91
|
-
|
|
104
|
+
Container(
|
|
92
|
-
// margin: const EdgeInsets.symmetric(vertical: 15, horizontal: 30),
|
|
93
|
-
color: Colors.white,
|
|
94
|
-
child: Column(
|
|
95
|
-
crossAxisAlignment: CrossAxisAlignment.start,
|
|
96
|
-
children: [
|
|
97
|
-
Container(
|
|
98
|
-
|
|
105
|
+
padding: const EdgeInsets.only(bottom: 20, top: 40, left: 10),
|
|
99
|
-
|
|
106
|
+
child: Text("New Testament", style: Theme.of(context).textTheme.headlineMedium),
|
|
100
|
-
),
|
|
101
|
-
const Expanded(child: ChaptersList()),
|
|
102
|
-
],
|
|
103
107
|
),
|
|
108
|
+
BooksList(offset: 39, books: newTestament),
|
|
109
|
+
]),
|
|
110
|
+
ListView(children: [
|
|
111
|
+
Container(
|
|
112
|
+
margin: const EdgeInsets.only(bottom: 10, left: 10),
|
|
113
|
+
child: Text(book.name, style: Theme.of(context).textTheme.headlineMedium),
|
|
104
|
-
|
|
114
|
+
),
|
|
115
|
+
const ChaptersList(),
|
|
116
|
+
]),
|
|
105
117
|
],
|
|
106
118
|
),
|
|
107
119
|
),
|
|
@@ -119,27 +131,28 @@ class BooksList extends StatelessWidget {
|
|
|
119
131
|
|
|
120
132
|
@override
|
|
121
133
|
Widget build(BuildContext context) {
|
|
122
|
-
return
|
|
134
|
+
return Wrap(
|
|
123
|
-
crossAxisSpacing: 10.0,
|
|
124
|
-
mainAxisSpacing: 10.0,
|
|
125
|
-
maxCrossAxisExtent: 80.0,
|
|
126
135
|
children: List.generate(books.length, (index) {
|
|
127
136
|
final name = books[index].replaceAll(" ", "").substring(0, 3).toUpperCase();
|
|
128
137
|
return InkWell(
|
|
138
|
+
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
|
129
139
|
onTap: () {
|
|
130
140
|
DefaultTabController.of(context).animateTo(1);
|
|
131
141
|
tabBookIndex.value = offset + index;
|
|
132
142
|
},
|
|
133
143
|
child: Container(
|
|
144
|
+
width: 90,
|
|
145
|
+
height: 50,
|
|
134
|
-
margin: const EdgeInsets.all(
|
|
146
|
+
margin: const EdgeInsets.all(8),
|
|
147
|
+
child: Material(
|
|
148
|
+
elevation: 3,
|
|
149
|
+
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
|
150
|
+
child: Center(
|
|
151
|
+
child: Text(
|
|
152
|
+
name,
|
|
135
|
-
|
|
153
|
+
textAlign: TextAlign.center,
|
|
136
|
-
|
|
154
|
+
style: Theme.of(context).textTheme.labelMedium,
|
|
137
|
-
|
|
155
|
+
),
|
|
138
|
-
child: Center(
|
|
139
|
-
child: Text(
|
|
140
|
-
name,
|
|
141
|
-
textAlign: TextAlign.center,
|
|
142
|
-
style: Theme.of(context).textTheme.labelMedium,
|
|
143
156
|
),
|
|
144
157
|
),
|
|
145
158
|
),
|
|
@@ -156,27 +169,26 @@ class ChaptersList extends StatelessWidget {
|
|
|
156
169
|
Widget build(BuildContext context) {
|
|
157
170
|
final bookIndex = tabBookIndex.reactiveValue(context);
|
|
158
171
|
final book = kannadaBible[bookIndex];
|
|
159
|
-
return
|
|
172
|
+
return Wrap(
|
|
160
|
-
primary: false,
|
|
161
|
-
padding: const EdgeInsets.all(0),
|
|
162
|
-
crossAxisSpacing: 10.0,
|
|
163
|
-
mainAxisSpacing: 10.0,
|
|
164
|
-
maxCrossAxisExtent: 80.0,
|
|
165
173
|
children: List.generate(book.chapters.length, (index) {
|
|
166
174
|
return InkWell(
|
|
175
|
+
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
|
167
176
|
onTap: () {
|
|
168
177
|
HomeScreenRoute(book: book.name, chapter: index).go(context);
|
|
169
178
|
},
|
|
170
179
|
child: Container(
|
|
180
|
+
width: 90,
|
|
181
|
+
height: 50,
|
|
171
|
-
margin: const EdgeInsets.all(
|
|
182
|
+
margin: const EdgeInsets.all(8),
|
|
183
|
+
child: Material(
|
|
184
|
+
elevation: 3,
|
|
185
|
+
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
|
186
|
+
child: Center(
|
|
187
|
+
child: Text(
|
|
188
|
+
"${index + 1}",
|
|
172
|
-
|
|
189
|
+
textAlign: TextAlign.center,
|
|
173
|
-
|
|
190
|
+
style: Theme.of(context).textTheme.labelMedium,
|
|
174
|
-
|
|
191
|
+
),
|
|
175
|
-
child: Center(
|
|
176
|
-
child: Text(
|
|
177
|
-
"${index + 1}",
|
|
178
|
-
textAlign: TextAlign.center,
|
|
179
|
-
style: Theme.of(context).textTheme.labelMedium,
|
|
180
192
|
),
|
|
181
193
|
),
|
|
182
194
|
),
|
bible_app/lib/main.dart
CHANGED
|
@@ -139,9 +139,9 @@ class App extends StatelessWidget {
|
|
|
139
139
|
),
|
|
140
140
|
labelMedium: TextStyle(
|
|
141
141
|
fontFamily: "SanFrancisco",
|
|
142
|
-
fontSize:
|
|
142
|
+
fontSize: 18,
|
|
143
143
|
fontWeight: FontWeight.w600,
|
|
144
|
-
color:
|
|
144
|
+
color: Colors.black,
|
|
145
145
|
letterSpacing: 0.5,
|
|
146
146
|
),
|
|
147
147
|
labelSmall: TextStyle(
|
bible_app/lib/screens/home.dart
CHANGED
|
@@ -59,13 +59,15 @@ class SelectScreenRoute extends GoRouteData {
|
|
|
59
59
|
|
|
60
60
|
@override
|
|
61
61
|
Page buildPage(BuildContext context, GoRouterState state) {
|
|
62
|
+
final width = MediaQuery.of(context).size.width;
|
|
63
|
+
final right = width/10;
|
|
62
64
|
return NoPageTransition(
|
|
63
65
|
child: Column(
|
|
64
66
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
65
67
|
children: [
|
|
66
68
|
Flexible(
|
|
67
69
|
child: Container(
|
|
68
|
-
margin:
|
|
70
|
+
margin: EdgeInsets.only(left: 40, top: 20, right: right),
|
|
69
71
|
child: const BookSelector(),
|
|
70
72
|
),
|
|
71
73
|
),
|