Skip to content

Commit

Permalink
improve stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrossh committed Aug 24, 2023
1 parent aa1a72b commit 020791e
Show file tree
Hide file tree
Showing 14 changed files with 138 additions and 175 deletions.
4 changes: 2 additions & 2 deletions assets/about-us.md → assets/md/about-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The word was given freely to all and is expected to be free even after processin
marketplace to take our God's word and make it den of thieves.

All the bibles used in this App are free and available in the public domain. Most of the text are sourced from
[The Word Project](https://www.wordproject.org/) and with the help and compilation done by the [Bible Database](https://github.com/godlytalias/Bible-Database) team,
[The Word Project](https://www.wordproject.org/) and compilation work done by the [Bible Database](https://github.com/godlytalias/Bible-Database) team.

I also agree and completely follow the [Copyrights declaration statement](https://www.wordproject.org/contact/new/copyrights.htm) of the Word project.
I also agree to and completely follow the [Copyrights Statement](https://www.wordproject.org/contact/new/copyrights.htm) of the Word project.

File renamed without changes.
11 changes: 4 additions & 7 deletions lib/providers/app_model.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// import "package:firebase_performance/firebase_performance.dart";
import "dart:ffi";

import "package:flutter/services.dart";
import "package:flutter/material.dart";
import "package:only_bible_app/screens/about_us_screen.dart";
import "package:only_bible_app/screens/bible_select_screen.dart";
import "package:only_bible_app/screens/book_select_screen.dart";
import "package:only_bible_app/models.dart";
import "package:only_bible_app/screens/privacy_policy_screen.dart";
import "package:only_bible_app/widgets/actions_sheet.dart";
import "package:only_bible_app/widgets/highlight_button.dart";
import "package:only_bible_app/widgets/scaffold_markdown.dart";
import "package:only_bible_app/widgets/note_sheet.dart";
import "package:only_bible_app/widgets/settings_sheet.dart";
import "package:package_info_plus/package_info_plus.dart";
Expand Down Expand Up @@ -348,23 +345,23 @@ class AppModel extends ChangeNotifier {
void rateApp(BuildContext context) {
if (isAndroid()) {
openUrl(context, "https://play.google.com/store/apps/details?id=${packageInfo.packageName}");
} else if (isIOS()) {
} else if (isIOS()) {
openUrl(context, "https://apps.apple.com/us/app/hare-pro/id123");
}
}

showPrivacyPolicy(BuildContext context) {
Navigator.of(context).push(
createNoTransitionPageRoute(
const PrivacyPolicyScreen(),
const ScaffoldMarkdown(title: "Privacy Policy", file: "privacy-policy.md"),
),
);
}

showAboutUs(BuildContext context) {
Navigator.of(context).push(
createNoTransitionPageRoute(
const AboutUsScreen(),
const ScaffoldMarkdown(title: "About Us", file: "about-us.md"),
),
);
}
Expand Down
34 changes: 0 additions & 34 deletions lib/screens/privacy_policy_screen.dart

This file was deleted.

13 changes: 9 additions & 4 deletions lib/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ final lightTheme = ThemeData(
),
hintStyle: TextStyle(color: Colors.grey),
),
appBarTheme: const AppBarTheme(
backgroundColor: Colors.white,
elevation: 0,
scrolledUnderElevation: 0,
appBarTheme: AppBarTheme(
backgroundColor: lightColorScheme.background,
elevation: 1,
foregroundColor: lightColorScheme.primary,
),
bottomSheetTheme: const BottomSheetThemeData(
elevation: 10,
Expand Down Expand Up @@ -172,6 +172,11 @@ final darkTheme = lightTheme.copyWith(
hoverColor: darkColorScheme.outline,
dividerColor: Colors.white,
shadowColor: Colors.white,
appBarTheme: AppBarTheme(
backgroundColor: darkColorScheme.background,
foregroundColor: darkColorScheme.primary,
elevation: 1,
),
bottomSheetTheme: lightTheme.bottomSheetTheme.copyWith(
backgroundColor: const Color(0xFF141415),
shadowColor: Colors.white,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,31 @@ import "package:flutter/material.dart";
import "package:flutter_markdown/flutter_markdown.dart";
import "package:only_bible_app/utils.dart";

class AboutUsScreen extends StatelessWidget {
const AboutUsScreen({super.key});
class ScaffoldMarkdown extends StatelessWidget {
final String title;
final String file;

const ScaffoldMarkdown({super.key, required this.title, required this.file});

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
appBar: AppBar(
title: const Text("About Us"),
title: Text(title),
),
body: SafeArea(
child: FutureBuilder(
future: DefaultAssetBundle.of(context).loadString("assets/about-us.md"),
future: DefaultAssetBundle.of(context).loadString("assets/md/$file"),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Markdown(
styleSheetTheme: MarkdownStyleSheetBaseTheme.material,
styleSheet: MarkdownStyleSheet(
p: Theme.of(context).textTheme.bodyMedium,
h1: Theme.of(context).textTheme.headlineMedium,
h2: Theme.of(context).textTheme.headlineMedium,
),
data: snapshot.data!,
onTapLink: (text, href, title) {
openUrl(context, href!);
Expand Down
85 changes: 31 additions & 54 deletions lib/widgets/settings_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import "package:flutter/material.dart";
import "package:only_bible_app/providers/app_model.dart";
import "package:only_bible_app/utils.dart";
import "package:settings_ui/settings_ui.dart";
// import "package:toggle_switch/toggle_switch.dart";

class SettingsSheet extends StatelessWidget {
const SettingsSheet({super.key});
Expand All @@ -11,8 +10,8 @@ class SettingsSheet extends StatelessWidget {
Widget build(BuildContext context) {
final app = AppModel.of(context);
final selectedBible = app.bible;
final modeIcon = app.darkMode ? Icons.dark_mode : Icons.light_mode;
final modeIconColor = app.darkMode ? const Color(0xFF59EEFF) : const Color(0xFFE5B347);
// final modeIcon = app.darkMode ? Icons.dark_mode : Icons.light_mode;
// final modeIconColor = app.darkMode ? const Color(0xFF59EEFF) : Colors.yellowAccent.shade700;
final iconColor = Theme.of(context).textTheme.bodyMedium!.color;
return SettingsList(
contentPadding: EdgeInsets.zero,
Expand All @@ -39,60 +38,38 @@ class SettingsSheet extends StatelessWidget {
value: Text(selectedBible.name),
onPressed: app.changeBible,
),
SettingsTile.switchTile(
onToggle: (value) {
app.toggleMode();
},
initialValue: app.darkMode,
leading: Icon(modeIcon, color: modeIconColor),
title: const Text("Dark mode"),
SettingsTile.navigation(
leading: const Icon(Icons.color_lens_outlined, color: Colors.pink),
title: const Text("Theme"),
trailing: ToggleButtons(
onPressed: (int index) {
app.toggleMode();
},
highlightColor: Colors.transparent,
borderColor: Colors.grey,
borderRadius: const BorderRadius.all(Radius.circular(25)),
selectedColor: app.darkMode ? Colors.lightBlue.shade300 : Colors.yellowAccent.shade700,
selectedBorderColor: Colors.grey,
color: Colors.grey,
fillColor: Colors.transparent,
constraints: const BoxConstraints(
minHeight: 36.0,
minWidth: 50.0,
),
isSelected: [!app.darkMode, app.darkMode],
children: const [
Icon(Icons.light_mode),
Icon(Icons.dark_mode),
],
),
),
// SettingsTile.navigation(
// leading: Icon(Icons.color_lens_outlined, color: Colors.pink),
// title: const Text("Theme"),
// trailing: ToggleSwitch(
// // minWidth: 50.0,
// // minHeight: 50.0,
// initialLabelIndex: app.darkMode ? 1 : 0,
// cornerRadius: 20.0,
// borderWidth: 1,
// dividerColor: Colors.black,
// dividerMargin: 1,
// borderColor: [Color(0xFFE9E9EA), Color(0xFFE9E9EA)],
// activeFgColor: modeIconColor,
// inactiveBgColor: Color(0xFFEAEAEB),
// inactiveFgColor: Colors.grey,
// activeBgColors: [[Colors.white, Colors.white], [Color(0xFF39393D), Color(0xFF39393D)]],
// totalSwitches: 2,
// icons: const [
// Icons.light_mode,
// Icons.dark_mode,
// ],
// iconSize: 50.0,
// animate: true,
// onToggle: (index) {
// app.toggleMode();
// },
// ),
// ),
SettingsTile.switchTile(
onToggle: (value) {
app.toggleBold();
},
initialValue: app.fontBold,
leading: Icon(Icons.format_bold, color: iconColor),
title: const Text("Font Weight"),
// trailing: ToggleSwitch(
// minHeight: 35,
// minWidth: 70,
// cornerRadius: 20.0,
// initialLabelIndex: 0,
// totalSwitches: 2,
// labels: const ["Normal", "Bold"],
// onToggle: (index) {
// print('switched to: $index');
// },
// ),
title: const Text("Font Bold"),
),
SettingsTile(
title: const Text("Increase font size"),
Expand All @@ -117,23 +94,23 @@ class SettingsSheet extends StatelessWidget {
margin: const EdgeInsetsDirectional.symmetric(horizontal: 20, vertical: 20),
tiles: [
SettingsTile.navigation(
leading: const Icon(Icons.policy_outlined, color: Colors.grey),
leading: const Icon(Icons.policy_outlined, color: Colors.brown),
title: const Text("Privacy Policy"),
onPressed: app.showPrivacyPolicy,
),
SettingsTile.navigation(
leading: const Icon(Icons.share_outlined, color: Colors.grey),
leading: const Icon(Icons.share_outlined, color: Colors.blueAccent),
title: const Text("Share the app"),
onPressed: app.shareAppLink,
),
if (!isDesktop()) // TODO: mabe support OSx if we release in that store
SettingsTile.navigation(
leading: const Icon(Icons.star_border_outlined, color: Colors.grey),
leading: Icon(Icons.star, color: Colors.yellowAccent.shade700),
title: const Text("Rate the app"),
onPressed: app.rateApp,
),
SettingsTile.navigation(
leading: const Icon(Icons.info_outline, color: Colors.grey),
leading: const Icon(Icons.info_outline, color: Colors.black),
title: const Text("About us"),
onPressed: app.showAboutUs,
),
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/sliver_tile_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum ListType {
double childAspectRatio(bool isDesktop) {
switch (this) {
case ListType.small:
return isDesktop ? 2.33 : 1.4;
return isDesktop ? 1.8 : 1.4;
case ListType.large:
return isDesktop ? 5 : 4;
}
Expand Down
Loading

0 comments on commit 020791e

Please sign in to comment.