~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.
23f7cf92
—
pyrossh 2 years ago
improve transitions and add close button
lib/components/book_selector.dart
CHANGED
|
@@ -54,6 +54,7 @@ class BookSelectorState extends State<BookSelector> {
|
|
|
54
54
|
BooksList(
|
|
55
55
|
title: "Old Testament",
|
|
56
56
|
books: oldTestament,
|
|
57
|
+
showClose: true,
|
|
57
58
|
onTap: onBookSelected,
|
|
58
59
|
),
|
|
59
60
|
Container(
|
|
@@ -62,6 +63,7 @@ class BookSelectorState extends State<BookSelector> {
|
|
|
62
63
|
BooksList(
|
|
63
64
|
title: "New Testament",
|
|
64
65
|
books: newTestament,
|
|
66
|
+
showClose: false,
|
|
65
67
|
onTap: onBookSelected,
|
|
66
68
|
),
|
|
67
69
|
],
|
lib/components/books_list.dart
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "package:flutter/material.dart";
|
|
2
|
+
import 'package:go_router/go_router.dart';
|
|
2
3
|
import 'package:only_bible_app/state.dart';
|
|
3
4
|
import 'package:only_bible_app/components/tile.dart';
|
|
4
5
|
import 'package:only_bible_app/models/book.dart';
|
|
@@ -7,12 +8,14 @@ class BooksList extends StatelessWidget {
|
|
|
7
8
|
final String title;
|
|
8
9
|
final List<Book> books;
|
|
9
10
|
final Function(int) onTap;
|
|
11
|
+
final bool showClose;
|
|
10
12
|
|
|
11
13
|
const BooksList({
|
|
12
14
|
super.key,
|
|
13
15
|
required this.title,
|
|
14
16
|
required this.books,
|
|
15
17
|
required this.onTap,
|
|
18
|
+
required this.showClose,
|
|
16
19
|
});
|
|
17
20
|
|
|
18
21
|
@override
|
|
@@ -22,7 +25,24 @@ class BooksList extends StatelessWidget {
|
|
|
22
25
|
children: [
|
|
23
26
|
Container(
|
|
24
27
|
margin: const EdgeInsets.only(bottom: 20),
|
|
28
|
+
child: Row(
|
|
29
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
|
30
|
+
children: [
|
|
31
|
+
Expanded(
|
|
25
|
-
|
|
32
|
+
child: Text(title, style: Theme.of(context).textTheme.headlineMedium),
|
|
33
|
+
),
|
|
34
|
+
if (showClose)
|
|
35
|
+
Container(
|
|
36
|
+
margin: const EdgeInsets.only(right: 30),
|
|
37
|
+
child: IconButton(
|
|
38
|
+
icon: const Icon(Icons.close, size: 28),
|
|
39
|
+
onPressed: () {
|
|
40
|
+
Navigator.of(context).pop();
|
|
41
|
+
},
|
|
42
|
+
),
|
|
43
|
+
)
|
|
44
|
+
],
|
|
45
|
+
),
|
|
26
46
|
),
|
|
27
47
|
Wrap(
|
|
28
48
|
children: List.of(
|
lib/components/chapters_list.dart
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "package:flutter/material.dart";
|
|
2
|
+
import 'package:go_router/go_router.dart';
|
|
2
3
|
import 'package:only_bible_app/state.dart';
|
|
3
4
|
import 'package:only_bible_app/components/tile.dart';
|
|
4
5
|
|
|
@@ -20,7 +21,22 @@ class ChaptersList extends StatelessWidget {
|
|
|
20
21
|
children: [
|
|
21
22
|
Container(
|
|
22
23
|
margin: const EdgeInsets.only(bottom: 20),
|
|
24
|
+
child: Row(
|
|
25
|
+
children: [
|
|
26
|
+
Expanded(
|
|
23
|
-
|
|
27
|
+
child: Text(title, style: Theme.of(context).textTheme.headlineMedium),
|
|
28
|
+
),
|
|
29
|
+
Container(
|
|
30
|
+
margin: const EdgeInsets.only(right: 30),
|
|
31
|
+
child: IconButton(
|
|
32
|
+
icon: const Icon(Icons.close, size: 28),
|
|
33
|
+
onPressed: () {
|
|
34
|
+
Navigator.of(context).pop();
|
|
35
|
+
},
|
|
36
|
+
),
|
|
37
|
+
)
|
|
38
|
+
],
|
|
39
|
+
),
|
|
24
40
|
),
|
|
25
41
|
Wrap(
|
|
26
42
|
children: List.generate(length, (index) {
|
lib/components/side_menu_page.dart
CHANGED
|
@@ -7,7 +7,7 @@ class SideMenuPage extends ModalRoute<void> {
|
|
|
7
7
|
Duration get transitionDuration => const Duration(milliseconds: 300);
|
|
8
8
|
|
|
9
9
|
@override
|
|
10
|
-
Duration get reverseTransitionDuration =>
|
|
10
|
+
Duration get reverseTransitionDuration => Duration.zero;
|
|
11
11
|
|
|
12
12
|
@override
|
|
13
13
|
bool get opaque => false;
|
|
@@ -35,24 +35,13 @@ class SideMenuPage extends ModalRoute<void> {
|
|
|
35
35
|
child: Container(
|
|
36
36
|
color: Theme.of(context).colorScheme.background,
|
|
37
37
|
margin: EdgeInsets.only(left: 0, right: isWide(context) ? 650 : 0),
|
|
38
|
+
child: isWide(context)
|
|
39
|
+
? const BookSelector()
|
|
40
|
+
: SlideTransition(
|
|
41
|
+
position: Tween(begin: const Offset(-1, 0), end: Offset.zero).animate(animation),
|
|
38
|
-
|
|
42
|
+
child: const BookSelector(),
|
|
43
|
+
),
|
|
39
44
|
),
|
|
40
45
|
);
|
|
41
46
|
}
|
|
42
|
-
|
|
43
|
-
@override
|
|
44
|
-
Widget buildTransitions(
|
|
45
|
-
BuildContext context,
|
|
46
|
-
Animation<double> animation,
|
|
47
|
-
Animation<double> secondaryAnimation,
|
|
48
|
-
Widget child,
|
|
49
|
-
) {
|
|
50
|
-
if (isWide(context)) {
|
|
51
|
-
return child;
|
|
52
|
-
}
|
|
53
|
-
return SlideTransition(
|
|
54
|
-
position: Tween(begin: const Offset(-1, 0), end: Offset.zero).animate(animation),
|
|
55
|
-
child: child,
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
47
|
}
|