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


bbf4a9f7 pyrossh

2 years ago
improve responsive design
bible_app/ios/Podfile.lock CHANGED
@@ -2,6 +2,9 @@ PODS:
2
2
  - audio_session (0.0.1):
3
3
  - Flutter
4
4
  - Flutter (1.0.0)
5
+ - flutter_charset_detector_ios (0.0.1):
6
+ - Flutter
7
+ - UniversalDetector2 (= 2.0.1)
5
8
  - flutter_native_splash (0.0.1):
6
9
  - Flutter
7
10
  - integration_test (0.0.1):
@@ -14,21 +17,29 @@ PODS:
14
17
  - shared_preferences_foundation (0.0.1):
15
18
  - Flutter
16
19
  - FlutterMacOS
20
+ - UniversalDetector2 (2.0.1)
17
21
 
18
22
  DEPENDENCIES:
19
23
  - audio_session (from `.symlinks/plugins/audio_session/ios`)
20
24
  - Flutter (from `Flutter`)
25
+ - flutter_charset_detector_ios (from `.symlinks/plugins/flutter_charset_detector_ios/ios`)
21
26
  - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
22
27
  - integration_test (from `.symlinks/plugins/integration_test/ios`)
23
28
  - just_audio (from `.symlinks/plugins/just_audio/ios`)
24
29
  - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
25
30
  - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
26
31
 
32
+ SPEC REPOS:
33
+ trunk:
34
+ - UniversalDetector2
35
+
27
36
  EXTERNAL SOURCES:
28
37
  audio_session:
29
38
  :path: ".symlinks/plugins/audio_session/ios"
30
39
  Flutter:
31
40
  :path: Flutter
41
+ flutter_charset_detector_ios:
42
+ :path: ".symlinks/plugins/flutter_charset_detector_ios/ios"
32
43
  flutter_native_splash:
33
44
  :path: ".symlinks/plugins/flutter_native_splash/ios"
34
45
  integration_test:
@@ -43,11 +54,13 @@ EXTERNAL SOURCES:
43
54
  SPEC CHECKSUMS:
44
55
  audio_session: 4f3e461722055d21515cf3261b64c973c062f345
45
56
  Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
57
+ flutter_charset_detector_ios: 5157d0104855b9deb78e1395515a287197bc2d55
46
58
  flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
47
59
  integration_test: 13825b8a9334a850581300559b8839134b124670
48
60
  just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
49
61
  path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
50
62
  shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
63
+ UniversalDetector2: 7c9ffd935cf050eeb19edf7e90f6febe3743a1af
51
64
 
52
65
  PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189
53
66
 
bible_app/lib/components/header.dart CHANGED
@@ -1,4 +1,3 @@
1
- import "dart:math";
2
1
  import "package:flutter/material.dart";
3
2
  import "./play_button.dart";
4
3
  import "./side_menu_page.dart";
@@ -17,9 +16,8 @@ class Header extends StatelessWidget {
17
16
  Widget build(BuildContext context) {
18
17
  return Container(
19
18
  padding: EdgeInsets.only(
20
- // horizontal: isDesktop() ? 40 : 20,
21
- top: isDesktop() ? 10 : 0,
19
+ top: isWide(context) ? 10 : 0,
22
- bottom: isDesktop() ? 10 : 0,
20
+ bottom: isWide(context) ? 10 : 0,
23
21
  ),
24
22
  decoration: const BoxDecoration(
25
23
  border: Border(bottom: BorderSide(width: 1.5)),
@@ -43,10 +41,10 @@ class Header extends StatelessWidget {
43
41
  mainAxisAlignment: MainAxisAlignment.spaceBetween,
44
42
  children: [
45
43
  Container(
46
- margin: EdgeInsets.only(right: isDesktop() ? 50 : 8),
44
+ margin: EdgeInsets.only(right: isWide(context) ? 50 : 8),
47
45
  child: PlayButton(book: book, chapter: chapter, verses: verses),
48
46
  ),
49
- Menu(),
47
+ const Menu(),
50
48
  ],
51
49
  ),
52
50
  ],
bible_app/lib/components/menu.dart CHANGED
@@ -7,7 +7,7 @@ class Menu extends StatelessWidget {
7
7
 
8
8
  @override
9
9
  Widget build(BuildContext context) {
10
- final moreIcon = isDesktopMode(context) ? Icons.more_vert : Icons.more_vert;
10
+ final moreIcon = isWide(context) ? Icons.more_vert : Icons.more_vert;
11
11
  return PopupMenuButton(
12
12
  icon: Icon(moreIcon, size: 36),
13
13
  offset: const Offset(0.0, 70),
@@ -15,13 +15,13 @@ class Menu extends StatelessWidget {
15
15
  itemBuilder: (BuildContext context) => [
16
16
  PopupMenuItem(
17
17
  value: 1,
18
- padding: EdgeInsets.symmetric(vertical: 15, horizontal: isDesktop() ? 50 : 5),
18
+ padding: EdgeInsets.symmetric(vertical: 15, horizontal: isWide(context) ? 10 : 5),
19
19
  onTap: toggleMode,
20
20
  child: Row(
21
21
  crossAxisAlignment: CrossAxisAlignment.center,
22
22
  mainAxisAlignment: MainAxisAlignment.start,
23
23
  children: [
24
- Container(margin: EdgeInsets.only(left: isDesktop() ? 10 : 25)),
24
+ Container(margin: EdgeInsets.only(left: isWide(context) ? 10 : 25)),
25
25
  Icon(darkMode.reactiveValue(context) ? Icons.dark_mode : Icons.light_mode, color: Colors.black, size: 30),
26
26
  Text(" ${darkMode.reactiveValue(context) ? "Dark" : "Light"} Mode"),
27
27
  ],
bible_app/lib/components/shell.dart CHANGED
@@ -1,6 +1,8 @@
1
+ import 'package:flutter_reactive_value/flutter_reactive_value.dart';
1
2
  import 'package:go_router/go_router.dart';
2
3
  import "package:flutter/material.dart";
3
4
  import 'package:flutter/services.dart';
5
+ import '../models/theme.dart';
4
6
  import '../state.dart';
5
7
  import "sidebar.dart";
6
8
 
@@ -12,24 +14,20 @@ class Shell extends ShellRoute {
12
14
 
13
15
  @override
14
16
  ShellRouteBuilder? get builder => (context, state, child) {
15
- SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
16
- systemNavigationBarColor: Colors.white,
17
- systemNavigationBarIconBrightness: Brightness.dark,
18
- statusBarColor: Colors.white,
19
- statusBarIconBrightness: Brightness.dark,
20
- ));
21
- return Scaffold(
17
+ return Scaffold(
22
- backgroundColor: Colors.white,
18
+ backgroundColor: Colors.white,
23
- body: SafeArea(
19
+ body: SafeArea(
20
+ child: isWide(context)
24
- child: Row(
21
+ ? Row(
25
- children: [
22
+ children: [
26
- isDesktop() ? const Sidebar() : Container(),
23
+ const Sidebar(),
27
- Flexible(
24
+ Flexible(
28
- child: child,
25
+ child: child,
29
- ),
26
+ ),
30
- ],
27
+ ],
28
+ )
29
+ : child,
31
- ),
30
+ ),
32
- ),
33
- );
31
+ );
34
- };
32
+ };
35
- }
33
+ }
bible_app/lib/components/side_menu_page.dart CHANGED
@@ -34,7 +34,7 @@ class SideMenuPage extends ModalRoute<void> {
34
34
  type: MaterialType.transparency,
35
35
  child: Container(
36
36
  color: Colors.white,
37
- margin: EdgeInsets.only(left: 0, right: isDesktop() ? 650 : 0),
37
+ margin: EdgeInsets.only(left: 0, right: isWide(context) ? 650 : 0),
38
38
  child: const BookSelector(),
39
39
  ),
40
40
  );
bible_app/lib/components/tile.dart CHANGED
@@ -9,26 +9,9 @@ class Tile extends StatelessWidget {
9
9
 
10
10
  @override
11
11
  Widget build(BuildContext context) {
12
- // Material(
13
- // elevation: 3,
14
- // borderRadius: const BorderRadius.all(Radius.circular(30)),
15
- // child: Center(
16
- // child: Text(
17
- // name,
18
- // textAlign: TextAlign.center,
19
- // style: TextStyle(
20
- // fontFamily: "SanFrancisco",
21
- // fontSize: 20,
22
- // fontWeight: FontWeight.w500,
23
- // color: Color(0xFF9A1111),
24
- // letterSpacing: 0.5,
25
- // ),
26
- // ),
27
- // ),
28
- // )
29
12
  return Container(
30
- width: isDesktop() ? 60 : 50,
13
+ width: isWide(context) ? 60 : 50,
31
- height: isDesktop() ? 60 : 40,
14
+ height: isWide(context) ? 60 : 40,
32
15
  margin: const EdgeInsets.only(right: 16, bottom: 16),
33
16
  decoration: const BoxDecoration(
34
17
  color: Color(0xFFEAE9E9),
bible_app/lib/main.dart CHANGED
@@ -3,7 +3,7 @@ import 'package:flutter_persistent_value_notifier/flutter_persistent_value_notif
3
3
  import 'package:flutter_native_splash/flutter_native_splash.dart';
4
4
  import 'package:go_router/go_router.dart';
5
5
  import 'components/shell.dart';
6
- import 'routes/home_screen_route.dart';
6
+ import 'routes/home_screen.dart';
7
7
  import 'state.dart';
8
8
 
9
9
  void main() async {
@@ -11,8 +11,12 @@ void main() async {
11
11
  FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
12
12
  await initPersistentValueNotifier();
13
13
  await loadBible();
14
+ await updateStatusBar();
14
15
  runApp(MaterialApp.router(
15
16
  debugShowCheckedModeBanner: false,
17
+ theme: ThemeData(
18
+ visualDensity: VisualDensity.adaptivePlatformDensity,
19
+ ),
16
20
  routerConfig: GoRouter(
17
21
  debugLogDiagnostics: true,
18
22
  initialLocation: "/${selectedBible.value[bookIndex.value].name}/${chapterIndex.value}",
@@ -21,7 +25,7 @@ void main() async {
21
25
  routes: [
22
26
  GoRouteData.$route(
23
27
  path: '/:book/:chapter',
24
- factory: (GoRouterState state) => HomeScreenRoute(
28
+ factory: (GoRouterState state) => HomeScreen(
25
29
  book: state.pathParameters['book']!,
26
30
  chapter: int.parse(state.pathParameters['chapter']!),
27
31
  ),
bible_app/lib/models/theme.dart CHANGED
@@ -1,4 +1,5 @@
1
1
  import "package:flutter/material.dart";
2
+ import "package:flutter/services.dart";
2
3
 
3
4
  const lightPrimary = Color(0xFF4C2323);
4
5
  const lightPrimaryLighter = Color(0xFF3C1B1C);
@@ -9,25 +10,19 @@ const lightLabel = Color(0xFF9A1111);
9
10
  const lightBody = Color(0xFF010101);
10
11
  const lightHighlightColor = Color(0xAAF8D0DC);
11
12
 
12
- class AppTheme {
13
- const AppTheme({
14
- required this.labelText,
15
- required this.logoText,
16
- required this.bodyText,
17
- required this.headerText,
13
+ const lightStatusBar = SystemUiOverlayStyle(
18
- required this.titleText,
19
- required this.secondaryColor,
14
+ systemNavigationBarColor: Colors.white,
15
+ systemNavigationBarIconBrightness: Brightness.dark,
16
+ statusBarColor: Colors.white,
20
- required this.highlightColor,
17
+ statusBarIconBrightness: Brightness.dark,
21
- });
18
+ );
22
19
 
23
- final TextStyle labelText;
24
- final TextStyle logoText;
25
- final TextStyle bodyText;
26
- final TextStyle headerText;
20
+ const darkStatusBar = SystemUiOverlayStyle(
27
- final TextStyle titleText;
21
+ systemNavigationBarColor: Colors.black,
22
+ systemNavigationBarIconBrightness: Brightness.light,
28
- final Color secondaryColor;
23
+ statusBarColor: Colors.black,
29
- final Color highlightColor;
24
+ statusBarIconBrightness: Brightness.light,
30
- }
25
+ );
31
26
 
32
27
  const lightTheme = AppTheme(
33
28
  secondaryColor: lightSecondary,
@@ -62,4 +57,24 @@ const lightTheme = AppTheme(
62
57
  fontWeight: FontWeight.w600,
63
58
  fontSize: 20,
64
59
  ),
65
- );
60
+ );
61
+
62
+ class AppTheme {
63
+ const AppTheme({
64
+ required this.labelText,
65
+ required this.logoText,
66
+ required this.bodyText,
67
+ required this.headerText,
68
+ required this.titleText,
69
+ required this.secondaryColor,
70
+ required this.highlightColor,
71
+ });
72
+
73
+ final TextStyle labelText;
74
+ final TextStyle logoText;
75
+ final TextStyle bodyText;
76
+ final TextStyle headerText;
77
+ final TextStyle titleText;
78
+ final Color secondaryColor;
79
+ final Color highlightColor;
80
+ }
bible_app/lib/routes/{home_screen_route.dart → home_screen.dart} RENAMED
@@ -4,11 +4,11 @@ import '../components/header.dart';
4
4
  import '../components/verse_view.dart';
5
5
  import '../state.dart';
6
6
 
7
- class HomeScreenRoute extends GoRouteData {
7
+ class HomeScreen extends GoRouteData {
8
8
  final String book;
9
9
  final int chapter;
10
10
 
11
- HomeScreenRoute({required this.book, required this.chapter}) {
11
+ HomeScreen({required this.book, required this.chapter}) {
12
12
  selectedVerses.value.clear();
13
13
  }
14
14
 
@@ -19,7 +19,7 @@ class HomeScreenRoute extends GoRouteData {
19
19
  return NoTransitionPage(
20
20
  child: Container(
21
21
  margin: EdgeInsets.symmetric(
22
- horizontal: isDesktop() ? 40 : 20,
22
+ horizontal: isWide(context) ? 40 : 20,
23
23
  ),
24
24
  child: Column(
25
25
  children: [
@@ -39,15 +39,9 @@ class HomeScreenRoute extends GoRouteData {
39
39
  );
40
40
  },
41
41
  ),
42
- )
42
+ ),
43
43
  ],
44
44
  ),
45
- // Container(
46
- // margin: const EdgeInsets.only(top: 5),
47
- // decoration: const BoxDecoration(
48
- // border: Border(bottom: BorderSide(width: 1.5)),
49
- // ),
50
- // ),
51
45
  ),
52
46
  );
53
47
  }
bible_app/lib/state.dart CHANGED
@@ -43,7 +43,15 @@ decreaseFont() {
43
43
 
44
44
  toggleMode() {
45
45
  darkMode.value = !darkMode.value;
46
+ updateStatusBar();
47
+ }
48
+
49
+ updateStatusBar() {
46
- print(darkMode.value);
50
+ if (darkMode.value) {
51
+ SystemChrome.setSystemUIOverlayStyle(darkStatusBar);
52
+ } else {
53
+ SystemChrome.setSystemUIOverlayStyle(lightStatusBar);
54
+ }
47
55
  }
48
56
 
49
57
  saveBookIndex(int book, int chapter) {
@@ -58,8 +66,8 @@ loadBible() async {
58
66
 
59
67
  getBibleFromAsset(String file) async {
60
68
  final bytes = await rootBundle.load("assets/$file");
61
- final text = utf8.decode(GZipCodec().decode(bytes.buffer.asUint8List()));
69
+ final decodedBytes = GZipCodec().decode(bytes.buffer.asUint8List());
62
- return getBibleFromText(text);
70
+ return getBibleFromText(utf8.decode(decodedBytes, allowMalformed: false));
63
71
  }
64
72
 
65
73
  getBibleFromText(String text) {
@@ -109,14 +117,10 @@ onVerseSelected(int i) {
109
117
  }
110
118
  }
111
119
 
112
- bool isDesktop() {
113
- return Platform.isMacOS || Platform.isLinux || Platform.isWindows;
114
- }
115
-
116
- bool isDesktopMode(BuildContext context) {
120
+ bool isWide(BuildContext context) {
117
- if (Platform.isMacOS || Platform.isLinux || Platform.isWindows) {
121
+ if (Platform.isIOS || Platform.isAndroid) {
118
- return true;
122
+ return false;
119
123
  }
120
124
  final width = MediaQuery.of(context).size.width;
121
- return width > 550;
125
+ return width > 600;
122
126
  }
bible_app/pubspec.lock CHANGED
@@ -118,6 +118,38 @@ packages:
118
118
  description: flutter
119
119
  source: sdk
120
120
  version: "0.0.0"
121
+ flutter_charset_detector:
122
+ dependency: "direct main"
123
+ description:
124
+ name: flutter_charset_detector
125
+ sha256: edc87079f3c8917f2fa5620e594d10deef81bbf3d7a89cf99441dec955a06d9f
126
+ url: "https://pub.dev"
127
+ source: hosted
128
+ version: "1.0.2"
129
+ flutter_charset_detector_android:
130
+ dependency: transitive
131
+ description:
132
+ name: flutter_charset_detector_android
133
+ sha256: "2439a3bf418fe0fb962fc3dc9d0401c3561a497017bc587b9c48a47490f9c428"
134
+ url: "https://pub.dev"
135
+ source: hosted
136
+ version: "1.0.0"
137
+ flutter_charset_detector_ios:
138
+ dependency: transitive
139
+ description:
140
+ name: flutter_charset_detector_ios
141
+ sha256: e0e2c7b819cd1f7c9a50da94bf7f0e6d7a095eb64e81196ec758e77793903d43
142
+ url: "https://pub.dev"
143
+ source: hosted
144
+ version: "1.0.2"
145
+ flutter_charset_detector_platform_interface:
146
+ dependency: transitive
147
+ description:
148
+ name: flutter_charset_detector_platform_interface
149
+ sha256: fcb61de27285031164c945aca4b42e4d36f9a9e359212f21ab652275c9c723ec
150
+ url: "https://pub.dev"
151
+ source: hosted
152
+ version: "1.0.0"
121
153
  flutter_driver:
122
154
  dependency: transitive
123
155
  description: flutter
bible_app/pubspec.yaml CHANGED
@@ -16,6 +16,7 @@ dependencies:
16
16
  go_router: ^10.0.0
17
17
  shared_preferences: ^2.2.0
18
18
  flutter_native_splash: ^2.3.1
19
+ flutter_charset_detector: ^1.0.2
19
20
 
20
21
  dev_dependencies:
21
22
  flutter_test:
bible_app/scripts/generate.dart CHANGED
@@ -1,5 +1,4 @@
1
1
  import "dart:io";
2
- import 'package:only_bible_app/models/book.dart';
3
2
  import 'package:only_bible_app/state.dart';
4
3
 
5
4
  void main() async {
scripts/search.js DELETED
@@ -1,46 +0,0 @@
1
- import flexsearch from "flexsearch";
2
- import fs from "fs";
3
- import bible from "../src/data/kannada.json" assert { type: "json" };
4
-
5
- const index = new flexsearch.Index({
6
- tokenize: "forward",
7
- split: /[\p{Z}\p{S}\p{P}\p{C}]+/u,
8
- });
9
- let verses = ""
10
- const books = []
11
- let count = 0;
12
- for (const book of bible) {
13
- const offsets = [];
14
- for (const chapter of book.chapters) {
15
- for (const item of chapter) {
16
- verses += item.verse + "\n";
17
- index.add(count, item.verse);
18
- count++
19
- }
20
- offsets.push(count);
21
- }
22
- books.push({
23
- name: {
24
- en: book.name,
25
- },
26
- chapters: offsets
27
- });
28
- }
29
- console.log(books)
30
- fs.writeFileSync("./books.json", JSON.stringify(books, 2, 2));
31
-
32
- // fs.writeFileSync("./verses.txt", verses);
33
- // const results = index.search("ದೇವರು");
34
- // console.log(results);
35
-
36
- // index.export((key, data) => {
37
- // console.log(key, data);
38
- // });
39
-
40
-
41
- 0
42
- 1
43
- 2
44
- 3
45
- 4
46
- 4