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


6cf602a8 pyrossh

2 years ago
add light theme
bible_app/lib/components/book_selector.dart CHANGED
@@ -31,7 +31,6 @@ class BookSelectorState extends State<BookSelector> {
31
31
  onChapterSelected(int index) {
32
32
  saveBookIndex(bookIndex, index);
33
33
  context.push("/${selectedBible.value[bookIndex].name}/$index");
34
- context.pop();
35
34
  }
36
35
 
37
36
  @override
bible_app/lib/components/books_list.dart CHANGED
@@ -1,4 +1,5 @@
1
1
  import "package:flutter/material.dart";
2
+ import "../state.dart";
2
3
  import "tile.dart";
3
4
  import "../models/book.dart";
4
5
 
@@ -16,10 +17,7 @@ class BooksList extends StatelessWidget {
16
17
  children: [
17
18
  Container(
18
19
  margin: const EdgeInsets.only(bottom: 20),
19
- child: Text(
20
- title,
21
- style: Theme.of(context).textTheme.headlineMedium,
20
+ child: Text(title, style: theme.value.titleText),
22
- ),
23
21
  ),
24
22
  Wrap(
25
23
  children: List.of(books.map((book) {
bible_app/lib/components/chapters_list.dart CHANGED
@@ -1,4 +1,5 @@
1
1
  import "package:flutter/material.dart";
2
+ import '../state.dart';
2
3
  import 'tile.dart';
3
4
 
4
5
  class ChaptersList extends StatelessWidget {
@@ -14,7 +15,7 @@ class ChaptersList extends StatelessWidget {
14
15
  children: [
15
16
  Container(
16
17
  margin: const EdgeInsets.only(bottom: 20),
17
- child: Text(title, style: Theme.of(context).textTheme.headlineMedium),
18
+ child: Text(title, style: theme.value.titleText),
18
19
  ),
19
20
  Wrap(
20
21
  children: List.generate(length, (index) {
bible_app/lib/components/header.dart CHANGED
@@ -18,8 +18,7 @@ class Header extends StatelessWidget {
18
18
  return Container(
19
19
  padding: EdgeInsets.symmetric(
20
20
  // horizontal: isDesktop() ? 40 : 20,
21
- vertical: isDesktop() ? 15 : 0
21
+ vertical: isDesktop() ? 15 : 0),
22
- ),
23
22
  decoration: const BoxDecoration(
24
23
  border: Border(bottom: BorderSide(width: 1.5)),
25
24
  ),
@@ -33,7 +32,7 @@ class Header extends StatelessWidget {
33
32
  child: Row(
34
33
  crossAxisAlignment: CrossAxisAlignment.center,
35
34
  children: [
36
- Text("${selectedBible.value[book].name} ${chapter + 1}", style: Theme.of(context).textTheme.headlineLarge),
35
+ Text("${selectedBible.value[book].name} ${chapter + 1}", style: theme.value.headerText),
37
36
  Container(
38
37
  margin: const EdgeInsets.only(left: 3),
39
38
  child: Transform.rotate(
bible_app/lib/components/play_button.dart CHANGED
@@ -16,7 +16,7 @@ class PlayButton extends StatelessWidget {
16
16
  Widget build(BuildContext context) {
17
17
  final icon = isPlaying.reactiveValue(context) ? Icons.pause_circle_filled : Icons.play_circle_fill;
18
18
  return IconButton(
19
- padding: EdgeInsets.symmetric(horizontal: 50),
19
+ padding: const EdgeInsets.symmetric(horizontal: 50),
20
20
  icon: Icon(icon, size: 36),
21
21
  onPressed: () async {
22
22
  final player = AudioPlayer();
bible_app/lib/components/sidebar.dart CHANGED
@@ -1,5 +1,7 @@
1
1
  import "package:flutter/material.dart";
2
2
 
3
+ import "../state.dart";
4
+
3
5
  class Sidebar extends StatelessWidget {
4
6
  const Sidebar({super.key});
5
7
 
@@ -32,10 +34,10 @@ class Sidebar extends StatelessWidget {
32
34
  crossAxisAlignment: CrossAxisAlignment.center,
33
35
  children: [
34
36
  Flexible(
35
- child: Text("KANNADA", style: Theme.of(context).textTheme.labelLarge),
37
+ child: Text("KANNADA", style: theme.value.logoText),
36
38
  ),
37
39
  Flexible(
38
- child: Text("BIBLE", style: Theme.of(context).textTheme.labelLarge),
40
+ child: Text("BIBLE", style: theme.value.logoText),
39
41
  ),
40
42
  ],
41
43
  ),
@@ -92,7 +94,7 @@ class Bookmark extends StatelessWidget {
92
94
  width: 30.0,
93
95
  height: 80.0,
94
96
  decoration: BoxDecoration(
95
- color: Theme.of(context).secondaryHeaderColor,
97
+ color: theme.value.secondaryColor,
96
98
  borderRadius: const BorderRadius.only(
97
99
  topLeft: Radius.circular(4),
98
100
  topRight: Radius.circular(4),
@@ -101,7 +103,7 @@ class Bookmark extends StatelessWidget {
101
103
  ),
102
104
  CustomPaint(
103
105
  painter: TrianglePainter(
104
- color: Theme.of(context).secondaryHeaderColor,
106
+ color: theme.value.secondaryColor,
105
107
  ),
106
108
  ),
107
109
  ],
bible_app/lib/components/verse_view.dart CHANGED
@@ -20,7 +20,7 @@ class VerseText extends StatelessWidget {
20
20
  onTap: onTap,
21
21
  child: Container(
22
22
  decoration: BoxDecoration(
23
- color: selected ? Theme.of(context).highlightColor : Colors.white,
23
+ color: selected ? theme.value.highlightColor : Colors.white,
24
24
  ),
25
25
  child: Row(
26
26
  crossAxisAlignment: CrossAxisAlignment.start,
@@ -29,11 +29,11 @@ class VerseText extends StatelessWidget {
29
29
  margin: const EdgeInsets.only(right: 4),
30
30
  child: Transform.translate(
31
31
  offset: const Offset(0, 2),
32
- child: Text("${index + 1}", style: Theme.of(context).textTheme.labelSmall),
32
+ child: Text("${index + 1}", style: theme.value.labelText),
33
33
  ),
34
34
  ),
35
35
  Flexible(
36
- child: Text(text, style: Theme.of(context).textTheme.bodyMedium),
36
+ child: Text(text, style: theme.value.bodyText),
37
37
  )
38
38
  ],
39
39
  ),
bible_app/lib/models/theme.dart CHANGED
@@ -1,89 +1,65 @@
1
- import "dart:ui";
2
1
  import "package:flutter/material.dart";
3
2
 
3
+ const lightPrimary = Color(0xFF4C2323);
4
+ const lightPrimaryLighter = Color(0xFF3C1B1C);
5
+ const lightSecondary = Color(0xFFFFB341);
6
+ const lightTertiary = Color(0xFF4C2323);
4
- class ThemeColors {
7
+ const lightHeadline = Color(0xFF010101);
5
- final Color primary;
8
+ const lightLabel = Color(0xFF9A1111);
9
+ const lightBody = Color(0xFF010101);
10
+ const lightHighlightColor = Color(0xAAF8D0DC);
6
11
 
12
+ class AppTheme {
7
- const ThemeColors({
13
+ const AppTheme({
14
+ required this.labelText,
8
- required this.primary,
15
+ required this.logoText,
9
- // required Color primaryLight,
10
- // required Color secondary,
16
+ required this.bodyText,
11
- // required Color tertiary,
12
- // required Color headerText,
17
+ required this.headerText,
13
- // required Color verseNo,
14
- // required Color verseText,
18
+ required this.titleText,
19
+ required this.secondaryColor,
20
+ required this.highlightColor,
15
21
  });
16
- }
17
22
 
23
+ final TextStyle labelText;
18
- class Theme {
24
+ final TextStyle logoText;
19
- const Theme({required TextStyle body});
25
+ final TextStyle bodyText;
26
+ final TextStyle headerText;
27
+ final TextStyle titleText;
28
+ final Color secondaryColor;
29
+ final Color highlightColor;
20
30
  }
21
31
 
22
- const lightColors = ThemeColors(
23
- primary: Color(0xFF4C2323),
24
- // primaryLight: Color(0xFF3C1B1C),
25
- // secondary: Color(0xFFFFB341),
26
- // tertiary: Color(0xFF4C2323),
27
- // headerText: Color(0xFF010101),
28
- // verseNo: Color(0xFF9A1111),
29
- // verseText: Color(0xFF010101),
30
- );
31
-
32
- const lightPrimary = Color(0xFF4C2323);
33
-
34
- const lightTheme = Theme(
32
+ const lightTheme = AppTheme(
33
+ secondaryColor: lightSecondary,
34
+ highlightColor: lightHighlightColor,
35
+ labelText: TextStyle(
36
+ fontFamily: "SanFrancisco",
37
+ fontSize: 12,
38
+ fontWeight: FontWeight.w800,
39
+ color: lightLabel,
40
+ letterSpacing: 0.5,
41
+ ),
42
+ logoText: TextStyle(
43
+ fontSize: 38,
44
+ fontWeight: FontWeight.w700,
45
+ color: lightSecondary,
46
+ ),
35
- body: TextStyle(
47
+ bodyText: TextStyle(
36
- color: Colors.red,
48
+ color: lightBody,
37
49
  fontSize: 16,
38
50
  fontFamily: "SanFranciscoPro",
39
51
  fontWeight: FontWeight.w400,
40
52
  // letterSpacing: 0.5,
41
53
  ),
42
- );
43
-
44
- final darkTheme = ThemeData(
45
- brightness: Brightness.light,
46
- primaryColor: const Color(0xFF4C2323),
47
- secondaryHeaderColor: const Color(0xFFFFB341),
48
- highlightColor: const Color(0xAAF8D0DC),
49
- fontFamily: "SanFranciscoPro",
50
- textTheme: const TextTheme(
51
- bodyMedium: TextStyle(
54
+ headerText: TextStyle(
52
- color: Color(0xFF010101),
55
+ color: lightBody,
53
- fontSize: 16,
56
+ fontSize: 20,
54
- fontFamily: "SanFranciscoPro",
55
- fontWeight: FontWeight.w400,
57
+ fontWeight: FontWeight.w500,
56
- // letterSpacing: 0.5,
58
+ letterSpacing: 0.5,
57
- ),
59
+ ),
58
- headlineLarge: TextStyle(
60
+ titleText: TextStyle(
59
- color: Colors.black,
61
+ color: lightBody,
62
+ fontWeight: FontWeight.w600,
60
- fontSize: 20,
63
+ fontSize: 20,
61
- fontWeight: FontWeight.w500,
62
- letterSpacing: 0.5,
63
- ),
64
- headlineMedium: TextStyle(
65
- color: Colors.black,
66
- fontWeight: FontWeight.w600,
67
- fontSize: 20,
68
- ),
69
- labelMedium: TextStyle(
70
- fontFamily: "SanFrancisco",
71
- fontSize: 18,
72
- fontWeight: FontWeight.w600,
73
- color: Colors.black,
74
- letterSpacing: 0.5,
75
- ),
76
- labelSmall: TextStyle(
77
- fontFamily: "SanFrancisco",
78
- fontSize: 12,
79
- fontWeight: FontWeight.w800,
80
- color: Color(0xFF9A1111),
81
- letterSpacing: 0.5,
82
- ),
83
- labelLarge: TextStyle(
84
- fontSize: 38,
85
- fontWeight: FontWeight.w700,
86
- color: Color(0xFFFFB341),
87
- ),
88
64
  ),
89
- );
65
+ );
bible_app/lib/state.dart CHANGED
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
5
5
  import 'package:flutter_persistent_value_notifier/flutter_persistent_value_notifier.dart';
6
6
  import 'package:flutter_reactive_value/flutter_reactive_value.dart';
7
7
  import 'models/book.dart';
8
+ import 'models/theme.dart';
8
9
 
9
10
  final darkMode = PersistentValueNotifier<bool>(
10
11
  sharedPreferencesKey: 'darkMode',
@@ -29,7 +30,7 @@ final chapterIndex = PersistentValueNotifier<int>(
29
30
  final selectedBible = ValueNotifier<List<Book>>([]);
30
31
  final selectedVerses = ValueNotifier([]);
31
32
  final isPlaying = ValueNotifier(false);
32
- // final theme = ValueNotifier<ThemeData>();
33
+ final theme = ValueNotifier<AppTheme>(lightTheme);
33
34
 
34
35
  saveBookIndex(int book, int chapter) {
35
36
  bookIndex.value = book;