Skip to content

Commit

Permalink
Merge pull request #134 from vicolo-dev/master
Browse files Browse the repository at this point in the history
Merge master into develop
  • Loading branch information
AhsanSarwar45 authored Mar 26, 2024
2 parents 7f1490c + 1c83ffc commit fef3164
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 32 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

</div>

Its usable, but still WIP, so you might encounter some bugs. Feel free to open an issue.
Its usable, but still WIP, so you might encounter some bugs. So its not recommended to use to for critical alarms at the moment. Feel free to open an issue.

# Table of Content
- [Features](#features)
Expand Down Expand Up @@ -53,8 +53,9 @@ use android-only code, so that will need to be ported. Everything else should mo

## Development

This app is built using flutter. All you need is to follow [this](https://docs.flutter.dev/get-started/install)
guide to install it, and you should be able to start developing it.
This app is built using flutter. To start developing:
1. Follow [this](https://docs.flutter.dev/get-started/install) guide to install flutter and all required tools.
2. Run the app by `flutter run --flavor dev`. For production builds, use `flutter build apk --release --split-per-abi --flavor prod`.

## Todo
Stuff I would like to do soon™. In no particular order:
Expand Down
12 changes: 3 additions & 9 deletions lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import 'dart:async';
import 'dart:isolate';
import 'dart:ui';

import 'package:clock_app/alarm/logic/new_alarm_snackbar.dart';
import 'package:clock_app/alarm/screens/alarm_notification_screen.dart';
import 'package:clock_app/alarm/types/alarm.dart';
import 'package:clock_app/alarm/types/schedules/weekly_alarm_schedule.dart';
import 'package:clock_app/common/data/app_info.dart';
import 'package:clock_app/common/utils/list_storage.dart';
import 'package:clock_app/common/utils/snackbar.dart';
import 'package:clock_app/navigation/data/route_observer.dart';
import 'package:clock_app/navigation/screens/nav_scaffold.dart';
Expand All @@ -16,15 +12,12 @@ import 'package:clock_app/notifications/types/notifications_controller.dart';
import 'package:clock_app/onboarding/screens/onboarding_screen.dart';
import 'package:clock_app/settings/data/appearance_settings_schema.dart';
import 'package:clock_app/settings/data/settings_schema.dart';
import 'package:clock_app/settings/types/listener_manager.dart';
import 'package:clock_app/settings/types/setting_group.dart';
import 'package:clock_app/system/logic/handle_intents.dart';
import 'package:clock_app/theme/text.dart';
import 'package:clock_app/theme/types/color_scheme.dart';
import 'package:clock_app/theme/theme.dart';
import 'package:clock_app/theme/types/style_theme.dart';
import 'package:clock_app/theme/utils/color_scheme.dart';
import 'package:clock_app/theme/utils/style_theme.dart';
import 'package:clock_app/timer/screens/timer_notification_screen.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -105,6 +98,7 @@ class _AppState extends State<App> {
_appearanceSettings = appSettings.getGroup("Appearance");
_colorSettings = _appearanceSettings.getGroup("Colors");
_styleSettings = _appearanceSettings.getGroup("Style");

}

refreshTheme() {
Expand Down Expand Up @@ -162,8 +156,8 @@ class _AppState extends State<App> {
colorSchemeData.accent = overrideColor;
darkColorSchemeData.accent = overrideColor;
}
DarkMode darkMode = _colorSettings.getSetting("Dark Mode").value;
if (darkMode == DarkMode.user) {
bool systemDarkMode = _colorSettings.getSetting("System Dark Mode").value;
if (!systemDarkMode) {
darkColorSchemeData = colorSchemeData;
}
lightTheme =
Expand Down
18 changes: 11 additions & 7 deletions lib/common/logic/card_decoration.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import 'package:clock_app/settings/data/settings_schema.dart';
import 'package:clock_app/theme/types/theme_extension.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter/material.dart';
import 'package:material_color_utilities/hct/hct.dart';
import 'package:material_color_utilities/palettes/tonal_palette.dart';

TonalPalette toTonalPalette(int value) {
final color = Hct.fromInt(value);
return TonalPalette.of(color.hue, color.chroma);
}

TonalPalette toTonalPalette(int value) {
final color = Hct.fromInt(value);
return TonalPalette.of(color.hue, color.chroma);
}
BoxDecoration getCardDecoration(BuildContext context,
{Color? color,
bool showLightBorder = false,
Expand All @@ -25,8 +26,7 @@ BoxDecoration getCardDecoration(BuildContext context,
.getSetting("Use Material You")
.value;

TonalPalette tonalPalette = toTonalPalette(colorScheme.surface.value);

TonalPalette tonalPalette = toTonalPalette(colorScheme.surface.value);

return BoxDecoration(
border: showLightBorder
Expand All @@ -42,7 +42,11 @@ BoxDecoration getCardDecoration(BuildContext context,
strokeAlign: BorderSide.strokeAlignInside,
)
: null,
color: color ?? (useMaterialYou ? Color(tonalPalette.get(Theme.of(context).brightness == Brightness.light ? 85 : 15)) : colorScheme.surface),
color: color ??
(useMaterialYou
? Color(tonalPalette.get(
Theme.of(context).brightness == Brightness.light ? 96 : 15))
: colorScheme.surface),
borderRadius: theme.cardTheme.shape != null
? (theme.cardTheme.shape as RoundedRectangleBorder).borderRadius
: const BorderRadius.all(Radius.circular(8.0)),
Expand Down
18 changes: 6 additions & 12 deletions lib/settings/data/appearance_settings_schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:clock_app/theme/theme.dart';
import 'package:clock_app/theme/types/color_scheme.dart';
import 'package:clock_app/theme/types/style_theme.dart';
import 'package:clock_app/theme/utils/color_scheme.dart';
import 'package:clock_app/theme/utils/style_theme.dart';
import 'package:flutter/material.dart';

enum ThemeBrightness { light, dark, system }
Expand Down Expand Up @@ -38,17 +37,13 @@ SettingGroup appearanceSettingsSchema = SettingGroup(
ValueCondition(["Use Material You"], (value) => value == true)
],
onChange: (context, index) => {App.refreshTheme(context)}),
SelectSetting(
"Dark Mode",
[
SelectSettingOption("User Defined", DarkMode.user),
SelectSettingOption("System", DarkMode.system),
SelectSettingOption("Night/Day", DarkMode.nightDay),
],
SwitchSetting(
"System Dark Mode",
false,
enableConditions: [
ValueCondition(["Use Material You"], (value) => value == false)
],
onChange: (context, index) => {App.refreshTheme(context)}),
onChange: (context, value) => {App.refreshTheme(context)}),
CustomSetting(
"Color Scheme",
description:
Expand Down Expand Up @@ -78,7 +73,7 @@ SettingGroup appearanceSettingsSchema = SettingGroup(
"Dark Color Scheme",
description:
"Select from predefined color schemes or create your own",
defaultColorScheme,
defaultDarkColorScheme,
(context, setting) => ThemesScreen(
saveTag: 'color_schemes',
setting: setting,
Expand All @@ -97,8 +92,7 @@ SettingGroup appearanceSettingsSchema = SettingGroup(
searchTags: ["theme", "style", "visual", "dark mode", "night mode"],
enableConditions: [
ValueCondition(["Use Material You"], (value) => value == false),
ValueCondition(["Dark Mode"],
(value) => [DarkMode.system, DarkMode.nightDay].contains(value))
ValueCondition(["System Dark Mode"],(value) => value==true)
],
),
SwitchSetting(
Expand Down
1 change: 1 addition & 0 deletions lib/theme/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'package:clock_app/theme/types/theme_extension.dart';
import 'package:flutter/material.dart';

ColorSchemeData defaultColorScheme = defaultColorSchemes[0];
ColorSchemeData defaultDarkColorScheme = defaultColorSchemes[2];
StyleTheme defaultStyleTheme = defaultStyleThemes[0];

ThemeData defaultTheme = ThemeData(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: clock_app
description: An alarm, clock, timer and stowatch app.

publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 0.3.1
version: 0.3.2

environment:
sdk: ">=2.18.6 <3.0.0"
Expand Down

0 comments on commit fef3164

Please sign in to comment.