diff --git a/lib/app/modules/addOrUpdateAlarm/controllers/add_or_update_alarm_controller.dart b/lib/app/modules/addOrUpdateAlarm/controllers/add_or_update_alarm_controller.dart index 61473ead..243d5fb8 100644 --- a/lib/app/modules/addOrUpdateAlarm/controllers/add_or_update_alarm_controller.dart +++ b/lib/app/modules/addOrUpdateAlarm/controllers/add_or_update_alarm_controller.dart @@ -197,7 +197,7 @@ class AddOrUpdateAlarmController extends GetxController { actions: [ TextButton( style: TextButton.styleFrom( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), ), child: const Text('Cancel', style: TextStyle(color: Colors.black)), onPressed: () { @@ -209,7 +209,7 @@ class AddOrUpdateAlarmController extends GetxController { ), TextButton( style: TextButton.styleFrom( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), ), child: const Text( 'Grant Permission', @@ -290,7 +290,7 @@ class AddOrUpdateAlarmController extends GetxController { Get.back(); }, style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(kprimaryColor), + backgroundColor: MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Text( 'Cancel'.tr, @@ -370,7 +370,7 @@ class AddOrUpdateAlarmController extends GetxController { actions: [ TextButton( style: TextButton.styleFrom( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), ), child: const Text('Cancel', style: TextStyle(color: Colors.black)), onPressed: () { @@ -382,7 +382,7 @@ class AddOrUpdateAlarmController extends GetxController { ), TextButton( style: TextButton.styleFrom( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), ), child: const Text('Allow', style: TextStyle(color: Colors.black)), onPressed: () { @@ -465,7 +465,7 @@ class AddOrUpdateAlarmController extends GetxController { TextButton( style: ButtonStyle( backgroundColor: - MaterialStateProperty.all(kprimaryColor), + MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Text( 'Save', @@ -485,7 +485,7 @@ class AddOrUpdateAlarmController extends GetxController { TextButton( style: ButtonStyle( backgroundColor: - MaterialStateProperty.all(kprimaryColor), + MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Text( 'Retake', @@ -505,7 +505,7 @@ class AddOrUpdateAlarmController extends GetxController { TextButton( style: ButtonStyle( backgroundColor: - MaterialStateProperty.all(kprimaryColor), + MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Text( 'Disable', @@ -572,7 +572,7 @@ class AddOrUpdateAlarmController extends GetxController { }, confirm: TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(kprimaryColor), + backgroundColor: MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Obx( () => Text( @@ -1241,6 +1241,11 @@ class AddOrUpdateAlarmController extends GetxController { selectedDate.value = (await showDatePicker( builder: (BuildContext context, Widget? child) { return Theme( + + data: ThemeData.dark().copyWith( + colorScheme: ColorScheme.dark( + primary: getPrimaryColorTheme(), + data: themeController.currentTheme.value == ThemeMode.light ? ThemeData.light().copyWith( colorScheme: const ColorScheme.light( @@ -1250,6 +1255,7 @@ class AddOrUpdateAlarmController extends GetxController { : ThemeData.dark().copyWith( colorScheme: const ColorScheme.dark( primary: kprimaryColor, + ), ), child: child!, diff --git a/lib/app/modules/addOrUpdateAlarm/views/add_or_update_alarm_view.dart b/lib/app/modules/addOrUpdateAlarm/views/add_or_update_alarm_view.dart index bfab5344..4c09a92d 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/add_or_update_alarm_view.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/add_or_update_alarm_view.dart @@ -134,7 +134,7 @@ class AddOrUpdateAlarmView extends GetView { TextButton( style: ButtonStyle( backgroundColor: - MaterialStateProperty.all(kprimaryColor), + MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Obx( () => Text( @@ -305,7 +305,7 @@ class AddOrUpdateAlarmView extends GetView { FontWeight .bold, color: - kprimaryColor, + getPrimaryColorTheme(), ), textStyle: Theme.of( context) @@ -415,7 +415,7 @@ class AddOrUpdateAlarmView extends GetView { FontWeight .bold, color: - kprimaryColor, + getPrimaryColorTheme(), ), textStyle: Theme.of( context) @@ -560,7 +560,7 @@ class AddOrUpdateAlarmView extends GetView { FontWeight .bold, color: - kprimaryColor, + getPrimaryColorTheme(), ), textStyle: Theme.of( context) @@ -750,17 +750,17 @@ class AddOrUpdateAlarmView extends GetView { border: Border.all( color: - kprimaryColor, + getPrimaryColorTheme(), width: 1.0, ), ), padding: const EdgeInsets .all(5.0), - child: const Icon( + child: Icon( Icons.done, color: - kprimaryColor, + getPrimaryColorTheme(), ), ), ), @@ -1036,7 +1036,7 @@ class AddOrUpdateAlarmView extends GetView { child: TextButton( style: ButtonStyle( backgroundColor: - MaterialStateProperty.all(kprimaryColor), + WidgetStateProperty.all(getPrimaryColorTheme()), ), child: Text( (controller.alarmRecord.value.alarmID == '') diff --git a/lib/app/modules/addOrUpdateAlarm/views/alarm_id_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/alarm_id_tile.dart index df0865d4..c9342425 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/alarm_id_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/alarm_id_tile.dart @@ -82,7 +82,7 @@ class AlarmIDTile extends StatelessWidget { child: TextButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all( - kprimaryColor, + getPrimaryColorTheme(), ), ), child: Text( diff --git a/lib/app/modules/addOrUpdateAlarm/views/alarm_offset_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/alarm_offset_tile.dart index 70e672d2..4ca25198 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/alarm_offset_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/alarm_offset_tile.dart @@ -65,7 +65,7 @@ class AlarmOffset extends StatelessWidget { style: ElevatedButton.styleFrom( backgroundColor: (controller .isOffsetBefore.value) - ? kprimaryColor + ? getPrimaryColorTheme() : themeController.primaryTextColor.value.withOpacity(0.10), foregroundColor: (controller.isOffsetBefore.value) @@ -87,7 +87,7 @@ class AlarmOffset extends StatelessWidget { style: ElevatedButton.styleFrom( backgroundColor: (!controller .isOffsetBefore.value) - ? kprimaryColor + ? getPrimaryColorTheme() : themeController.primaryTextColor.value .withOpacity(0.10), foregroundColor: diff --git a/lib/app/modules/addOrUpdateAlarm/views/ascending_volume.dart b/lib/app/modules/addOrUpdateAlarm/views/ascending_volume.dart index 81a27a78..3a22145c 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/ascending_volume.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/ascending_volume.dart @@ -93,7 +93,7 @@ class AscendingVolumeTile extends StatelessWidget { Get.back(); }, style: ElevatedButton.styleFrom( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), ), child: Text( 'Apply Gradient'.tr, diff --git a/lib/app/modules/addOrUpdateAlarm/views/choose_ringtone_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/choose_ringtone_tile.dart index b50a368e..094fdb85 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/choose_ringtone_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/choose_ringtone_tile.dart @@ -157,7 +157,7 @@ class ChooseRingtoneTile extends StatelessWidget { 116, 111, 110) // Change this color to red - : kprimaryColor, + : getPrimaryColorTheme(), ), ), if (!defaultRingtones.contains( @@ -209,7 +209,7 @@ class ChooseRingtoneTile extends StatelessWidget { child: Text( 'Upload Ringtone'.tr, style: Theme.of(context).textTheme.bodyMedium!.copyWith( - color: kprimaryColor, + color: getPrimaryColorTheme(), ), ), ), @@ -221,7 +221,7 @@ class ChooseRingtoneTile extends StatelessWidget { Get.back(); }, style: ElevatedButton.styleFrom( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), ), child: Text( 'Done'.tr, diff --git a/lib/app/modules/addOrUpdateAlarm/views/delete_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/delete_tile.dart index b005bce4..586b7d2f 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/delete_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/delete_tile.dart @@ -53,7 +53,7 @@ class DeleteAfterGoesOff extends StatelessWidget { () { return Switch.adaptive( value: controller.deleteAfterGoesOff.value, - activeColor: ksecondaryColor, + activeColor: getSecondaryColorTheme(), onChanged: (value) { Utils.hapticFeedback(); controller.deleteAfterGoesOff.value = value; diff --git a/lib/app/modules/addOrUpdateAlarm/views/guardian_angel.dart b/lib/app/modules/addOrUpdateAlarm/views/guardian_angel.dart index 51842047..f9ebea2a 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/guardian_angel.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/guardian_angel.dart @@ -125,7 +125,7 @@ class GuardianAngel extends StatelessWidget { () { return Switch.adaptive( value: controller.isGuardian.value, - activeColor: ksecondaryColor, + activeColor: getSecondaryColorTheme(), onChanged: (value) async { Utils.hapticFeedback(); if (value) { @@ -163,7 +163,7 @@ class GuardianAngel extends StatelessWidget { decoration: BoxDecoration( color: (val == 0 && !controller.isCall.value) || (val == 1 && controller.isCall.value) - ? kprimaryColor + ? getPrimaryColorTheme() : kLightPrimaryDisabledTextColor, borderRadius: BorderRadius.circular(20), ), diff --git a/lib/app/modules/addOrUpdateAlarm/views/label_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/label_tile.dart index 64d2acdd..dde58323 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/label_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/label_tile.dart @@ -94,7 +94,7 @@ class LabelTile extends StatelessWidget { buttonColor: themeController.secondaryBackgroundColor.value, confirm: TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(kprimaryColor), + backgroundColor: MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Text( 'Save'.tr, diff --git a/lib/app/modules/addOrUpdateAlarm/views/location_activity_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/location_activity_tile.dart index 414dafb3..eb40708e 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/location_activity_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/location_activity_tile.dart @@ -59,7 +59,7 @@ class LocationTile extends StatelessWidget { fillColor: MaterialStateProperty.all( (controller.isLocationEnabled.value == true) ? themeController.primaryDisabledTextColor.value - : kprimaryColor, + : getPrimaryColorTheme(), ), value: !controller.isLocationEnabled.value, groupValue: true, @@ -131,7 +131,7 @@ class LocationTile extends StatelessWidget { const SizedBox(height: 10), TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(kprimaryColor), + backgroundColor: MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Text( 'Save', diff --git a/lib/app/modules/addOrUpdateAlarm/views/maths_challenge_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/maths_challenge_tile.dart index dd69cfa9..9bcee1b9 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/maths_challenge_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/maths_challenge_tile.dart @@ -100,8 +100,8 @@ class MathsChallenge extends StatelessWidget { Slider.adaptive( min: 0.0, max: 2.0, - thumbColor: kprimaryColor, - activeColor: kprimaryColor, + thumbColor: getPrimaryColorTheme(), + activeColor: getPrimaryColorTheme(), divisions: 2, value: controller.mathsSliderValue.value, onChanged: (newValue) { @@ -144,7 +144,7 @@ class MathsChallenge extends StatelessWidget { TextButton( style: ButtonStyle( backgroundColor: - MaterialStateProperty.all(kprimaryColor), + MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Text( 'Save'.tr, diff --git a/lib/app/modules/addOrUpdateAlarm/views/note.dart b/lib/app/modules/addOrUpdateAlarm/views/note.dart index 74cac234..299e42e1 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/note.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/note.dart @@ -93,7 +93,7 @@ class NoteTile extends StatelessWidget { buttonColor: themeController.secondaryBackgroundColor.value, confirm: TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(kprimaryColor), + backgroundColor: MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Text( 'Save'.tr, diff --git a/lib/app/modules/addOrUpdateAlarm/views/pedometer_challenge_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/pedometer_challenge_tile.dart index f6e60952..c85a8bc2 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/pedometer_challenge_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/pedometer_challenge_tile.dart @@ -107,7 +107,7 @@ class PedometerChallenge extends StatelessWidget { Get.back(); }, style: ElevatedButton.styleFrom( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), // Set the desired background color ), child: Text( diff --git a/lib/app/modules/addOrUpdateAlarm/views/quote_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/quote_tile.dart index ce3f5d67..f3015bc1 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/quote_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/quote_tile.dart @@ -34,7 +34,7 @@ class QuoteTile extends StatelessWidget { trailing: Obx( () => Switch.adaptive( value: controller.showMotivationalQuote.value, - activeColor: ksecondaryColor, + activeColor: getSecondaryColorTheme(), onChanged: (value) { controller.showMotivationalQuote.value = value; }, diff --git a/lib/app/modules/addOrUpdateAlarm/views/repeat_once_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/repeat_once_tile.dart index 7404c7c2..e09e8654 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/repeat_once_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/repeat_once_tile.dart @@ -46,7 +46,7 @@ class RepeatOnceTile extends StatelessWidget { .every((element) => element == false)) { return Switch.adaptive( value: false, - activeColor: ksecondaryColor, + activeColor: getSecondaryColorTheme(), onChanged: (value) { Utils.hapticFeedback(); controller.isOneTime.value = true; @@ -55,7 +55,7 @@ class RepeatOnceTile extends StatelessWidget { } return Switch.adaptive( value: controller.isOneTime.value, - activeColor: ksecondaryColor, + activeColor: getSecondaryColorTheme(), onChanged: (value) { Utils.hapticFeedback(); controller.isOneTime.value = value; diff --git a/lib/app/modules/addOrUpdateAlarm/views/repeat_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/repeat_tile.dart index 1c2a3432..aea1cc96 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/repeat_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/repeat_tile.dart @@ -65,7 +65,7 @@ class RepeatTile extends StatelessWidget { child: TextButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all( - kprimaryColor, + getPrimaryColorTheme(), ), ), onPressed: () { @@ -168,7 +168,7 @@ class RepeatTile extends StatelessWidget { color: themeController.primaryTextColor.value.withOpacity(0.5), ), - activeColor: kprimaryColor.withOpacity(0.8), + activeColor: getPrimaryColorTheme().withOpacity(0.8), value: controller.isDailySelected.value, onChanged: (value) { Utils.hapticFeedback(); @@ -213,7 +213,7 @@ class RepeatTile extends StatelessWidget { color: themeController.primaryTextColor.value.withOpacity(0.5), ), - activeColor: kprimaryColor.withOpacity(0.8), + activeColor: getPrimaryColorTheme().withOpacity(0.8), value: controller.repeatDays[dayIndex], onChanged: (value) { Utils.hapticFeedback(); @@ -308,7 +308,7 @@ class RepeatTile extends StatelessWidget { Get.back(); }, style: ElevatedButton.styleFrom( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), ), child: Text( 'Done'.tr, @@ -341,7 +341,7 @@ class RepeatTile extends StatelessWidget { color: themeController.primaryTextColor.value.withOpacity(0.5), ), - activeColor: kprimaryColor.withOpacity(0.8), + activeColor: getPrimaryColorTheme().withOpacity(0.8), value: controller.isCustomSelected.value, onChanged: (value) { Utils.hapticFeedback(); @@ -391,7 +391,7 @@ class RepeatTile extends StatelessWidget { color: themeController.primaryTextColor.value.withOpacity(0.5), ), - activeColor: kprimaryColor.withOpacity(0.8), + activeColor: getPrimaryColorTheme().withOpacity(0.8), value: controller.isWeekdaysSelected.value, onChanged: (value) { Utils.hapticFeedback(); diff --git a/lib/app/modules/addOrUpdateAlarm/views/screen_activity_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/screen_activity_tile.dart index a7758f3f..10482351 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/screen_activity_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/screen_activity_tile.dart @@ -47,7 +47,7 @@ class ScreenActivityTile extends StatelessWidget { children: [ Switch.adaptive( value: controller.useScreenActivity.value, - activeColor: ksecondaryColor, + activeColor: getSecondaryColorTheme(), onChanged: (value) { controller.useScreenActivity.value = value; if (!value) @@ -84,7 +84,7 @@ class ScreenActivityTile extends StatelessWidget { Get.back(); }, style: ElevatedButton.styleFrom( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), // Set the desired background color ), child: Text( @@ -116,7 +116,7 @@ class ScreenActivityTile extends StatelessWidget { Obx( () => Switch.adaptive( value: controller.useScreenActivity.value, - activeColor: ksecondaryColor, + activeColor: getSecondaryColorTheme(), onChanged: (value) { controller.useScreenActivity.value = value; if (!value) diff --git a/lib/app/modules/addOrUpdateAlarm/views/setting_selector.dart b/lib/app/modules/addOrUpdateAlarm/views/setting_selector.dart index 0541d825..94761cb7 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/setting_selector.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/setting_selector.dart @@ -59,7 +59,7 @@ class SettingSelector extends StatelessWidget { child: Container( decoration: BoxDecoration( color: controller.alarmSettingType.value == val - ? kprimaryColor + ? getPrimaryColorTheme() : controller.themeController.secondaryBackgroundColor.value, borderRadius: BorderRadius.circular(20), ), diff --git a/lib/app/modules/addOrUpdateAlarm/views/shake_to_dismiss_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/shake_to_dismiss_tile.dart index ae918f1b..9af2f7bb 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/shake_to_dismiss_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/shake_to_dismiss_tile.dart @@ -114,7 +114,7 @@ class ShakeToDismiss extends StatelessWidget { Get.back(); }, style: ElevatedButton.styleFrom( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), // Set the desired background color ), child: Text( diff --git a/lib/app/modules/addOrUpdateAlarm/views/shared_alarm_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/shared_alarm_tile.dart index a614eb81..385cbb59 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/shared_alarm_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/shared_alarm_tile.dart @@ -89,7 +89,7 @@ class SharedAlarm extends StatelessWidget { style: ButtonStyle( backgroundColor: MaterialStateProperty.all( - kprimaryColor, + getPrimaryColorTheme(), ), ), onPressed: () { @@ -133,7 +133,7 @@ class SharedAlarm extends StatelessWidget { controller.isSharedAlarmEnabled.value = value; }, value: controller.isSharedAlarmEnabled.value, - activeColor: ksecondaryColor, + activeColor: getSecondaryColorTheme(), ), ), ) @@ -170,7 +170,7 @@ class SharedAlarm extends StatelessWidget { style: ButtonStyle( backgroundColor: MaterialStateProperty.all( - kprimaryColor, + getPrimaryColorTheme(), ), ), child: FittedBox( diff --git a/lib/app/modules/addOrUpdateAlarm/views/shared_users_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/shared_users_tile.dart index 3b726ccc..89d4ef9b 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/shared_users_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/shared_users_tile.dart @@ -73,11 +73,11 @@ class SharedUsers extends StatelessWidget { ) { if (snapshot.connectionState == ConnectionState.waiting) { - return const Center( + return Center( child: CircularProgressIndicator.adaptive( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), valueColor: AlwaysStoppedAnimation( - kprimaryColor, + getPrimaryColorTheme(), ), ), ); diff --git a/lib/app/modules/addOrUpdateAlarm/views/snooze_duration_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/snooze_duration_tile.dart index 9a375ba2..74888e60 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/snooze_duration_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/snooze_duration_tile.dart @@ -79,7 +79,7 @@ class SnoozeDurationTile extends StatelessWidget { Get.back(); }, style: ElevatedButton.styleFrom( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), ), child: Text( 'Done'.tr, diff --git a/lib/app/modules/addOrUpdateAlarm/views/weather_tile.dart b/lib/app/modules/addOrUpdateAlarm/views/weather_tile.dart index fd80c1c9..c923f152 100644 --- a/lib/app/modules/addOrUpdateAlarm/views/weather_tile.dart +++ b/lib/app/modules/addOrUpdateAlarm/views/weather_tile.dart @@ -124,7 +124,7 @@ class WeatherTile extends StatelessWidget { child: TextButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all( - kprimaryColor, + getPrimaryColorTheme(), ), ), onPressed: () { @@ -225,7 +225,7 @@ class WeatherOption extends StatelessWidget { themeController.primaryTextColor.value.withOpacity(0.5), ), value: controller.selectedWeather.contains(type), - activeColor: kprimaryColor.withOpacity(0.8), + activeColor: getPrimaryColorTheme().withOpacity(0.8), onChanged: (value) { Utils.hapticFeedback(); if (controller.selectedWeather.contains(type)) { diff --git a/lib/app/modules/alarmChallenge/views/alarm_challenge_view.dart b/lib/app/modules/alarmChallenge/views/alarm_challenge_view.dart index fef97975..f4bd3d12 100644 --- a/lib/app/modules/alarmChallenge/views/alarm_challenge_view.dart +++ b/lib/app/modules/alarmChallenge/views/alarm_challenge_view.dart @@ -42,7 +42,7 @@ class AlarmChallengeView extends GetView { minHeight: 2, value: controller.progress.value, backgroundColor: Colors.grey, - valueColor: const AlwaysStoppedAnimation(kprimaryColor), + valueColor: AlwaysStoppedAnimation(getPrimaryColorTheme()), ), ), Expanded( diff --git a/lib/app/modules/alarmChallenge/views/maths_challenge_view.dart b/lib/app/modules/alarmChallenge/views/maths_challenge_view.dart index 6d6f69f0..63426907 100644 --- a/lib/app/modules/alarmChallenge/views/maths_challenge_view.dart +++ b/lib/app/modules/alarmChallenge/views/maths_challenge_view.dart @@ -35,7 +35,7 @@ class MathsChallengeView extends GetView { value: controller.progress.value, backgroundColor: Colors.grey, valueColor: - const AlwaysStoppedAnimation(kprimaryColor), + AlwaysStoppedAnimation(getPrimaryColorTheme()), ), ), Expanded( @@ -215,7 +215,7 @@ class MathsChallengeView extends GetView { } }, style: ElevatedButton.styleFrom( - backgroundColor: kprimaryColor.withOpacity(0.8), + backgroundColor: getPrimaryColorTheme().withOpacity(0.8), foregroundColor: themeController.secondaryTextColor.value, padding: const EdgeInsets.all(16), minimumSize: const Size(64, 64), diff --git a/lib/app/modules/alarmChallenge/views/pedometer_challenge_view.dart b/lib/app/modules/alarmChallenge/views/pedometer_challenge_view.dart index 2e5572d3..4400744a 100644 --- a/lib/app/modules/alarmChallenge/views/pedometer_challenge_view.dart +++ b/lib/app/modules/alarmChallenge/views/pedometer_challenge_view.dart @@ -36,7 +36,7 @@ class PedometerChallengeView extends GetView { minHeight: 2, value: controller.progress.value, backgroundColor: Colors.grey, - valueColor: const AlwaysStoppedAnimation(kprimaryColor), + valueColor: AlwaysStoppedAnimation(getPrimaryColorTheme()), ), ), Expanded( diff --git a/lib/app/modules/alarmChallenge/views/qr_challenge_view.dart b/lib/app/modules/alarmChallenge/views/qr_challenge_view.dart index bb1ffce1..06843598 100644 --- a/lib/app/modules/alarmChallenge/views/qr_challenge_view.dart +++ b/lib/app/modules/alarmChallenge/views/qr_challenge_view.dart @@ -40,7 +40,7 @@ class QRChallengeView extends GetView { minHeight: 2, value: controller.progress.value, backgroundColor: Colors.grey, - valueColor: const AlwaysStoppedAnimation(kprimaryColor), + valueColor: AlwaysStoppedAnimation(getPrimaryColorTheme()), ), ), Expanded( @@ -145,7 +145,7 @@ class QRChallengeView extends GetView { backgroundColor: MaterialStateProperty .all( - kprimaryColor, + getPrimaryColorTheme(), ), ), child: Text( diff --git a/lib/app/modules/alarmChallenge/views/shake_challenge_view.dart b/lib/app/modules/alarmChallenge/views/shake_challenge_view.dart index a5685114..3fc72348 100644 --- a/lib/app/modules/alarmChallenge/views/shake_challenge_view.dart +++ b/lib/app/modules/alarmChallenge/views/shake_challenge_view.dart @@ -39,7 +39,7 @@ class ShakeChallengeView extends GetView { minHeight: 2, value: controller.progress.value, backgroundColor: Colors.grey, - valueColor: const AlwaysStoppedAnimation(kprimaryColor), + valueColor: AlwaysStoppedAnimation(getPrimaryColorTheme()), ), ), Expanded( diff --git a/lib/app/modules/alarmRing/views/alarm_ring_view.dart b/lib/app/modules/alarmRing/views/alarm_ring_view.dart index cf86ca0f..8651a34c 100644 --- a/lib/app/modules/alarmRing/views/alarm_ring_view.dart +++ b/lib/app/modules/alarmRing/views/alarm_ring_view.dart @@ -184,7 +184,7 @@ class AlarmControlView extends GetView { child: TextButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all( - kprimaryColor, + getPrimaryColorTheme(), ), ), onPressed: () async { diff --git a/lib/app/modules/bottomNavigationBar/views/bottom_navigation_bar_view.dart b/lib/app/modules/bottomNavigationBar/views/bottom_navigation_bar_view.dart index 05c8aaec..e51f50c8 100644 --- a/lib/app/modules/bottomNavigationBar/views/bottom_navigation_bar_view.dart +++ b/lib/app/modules/bottomNavigationBar/views/bottom_navigation_bar_view.dart @@ -28,11 +28,11 @@ class BottomNavigationBarView extends GetView { }, ); } else { - return const Center( + return Center( child: CircularProgressIndicator.adaptive( backgroundColor: Colors.transparent, valueColor: AlwaysStoppedAnimation( - kprimaryColor, + getPrimaryColorTheme(), ), ), ); @@ -66,7 +66,7 @@ class BottomNavigationBarView extends GetView { }, currentIndex: controller.activeTabIndex.value, selectedLabelStyle: TextStyle( - color: kprimaryColor, + color: getPrimaryColorTheme(), fontSize: 14, decorationColor: themeController.primaryBackgroundColor.value, diff --git a/lib/app/modules/home/controllers/home_controller.dart b/lib/app/modules/home/controllers/home_controller.dart index 9fcdb7e3..a12927ac 100644 --- a/lib/app/modules/home/controllers/home_controller.dart +++ b/lib/app/modules/home/controllers/home_controller.dart @@ -638,7 +638,7 @@ class HomeController extends GetxController { TextButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all( - kprimaryColor, + getPrimaryColorTheme(), ), ), onPressed: () { @@ -721,7 +721,7 @@ class HomeController extends GetxController { Get.back(); }, style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(kprimaryColor), + backgroundColor: MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Text( 'Cancel'.tr, diff --git a/lib/app/modules/home/views/google_calender_dialog.dart b/lib/app/modules/home/views/google_calender_dialog.dart index 79d59176..2fbb7c2a 100644 --- a/lib/app/modules/home/views/google_calender_dialog.dart +++ b/lib/app/modules/home/views/google_calender_dialog.dart @@ -21,14 +21,14 @@ Future googleCalenderDialog( child: SizedBox( height: controller.scalingFactor.value * 350, child: Padding( - padding: const EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: controller.calendarFetchStatus == 'Loading' - ? const SizedBox( + ? SizedBox( child: Center( child: CircularProgressIndicator( backgroundColor: Colors.transparent, valueColor: AlwaysStoppedAnimation( - kprimaryColor, + getPrimaryColorTheme(), ), ), ), @@ -41,8 +41,8 @@ Future googleCalenderDialog( children: [ SvgPicture.asset( 'assets/images/GC.svg', - colorFilter: const ColorFilter.mode( - kprimaryColor, + colorFilter: ColorFilter.mode( + getPrimaryColorTheme(), BlendMode.srcIn, ), height: 30 * controller.scalingFactor.value, @@ -101,7 +101,7 @@ Future googleCalenderDialog( const EdgeInsets.all(8.0), child: Icon( Icons.calendar_month, - color: kprimaryColor, + color: getPrimaryColorTheme(), ), ), Text( @@ -160,12 +160,12 @@ Future googleCalenderDialog( Axis.horizontal, child: Row( children: [ - const Padding( + Padding( padding: EdgeInsets.all(8.0), child: Icon( Icons.calendar_month, - color: kprimaryColor, + color: getPrimaryColorTheme(), ), ), Text( @@ -198,7 +198,7 @@ Future googleCalenderDialog( child: Icon( Icons .watch_later_outlined, - color: kprimaryColor, + color: getPrimaryColorTheme(), ), ), Text( @@ -250,7 +250,7 @@ Future googleCalenderDialog( BorderRadius.circular( 16, ), - color: kprimaryColor, + color: getPrimaryColorTheme(), ), child: Padding( padding: diff --git a/lib/app/modules/home/views/home_view.dart b/lib/app/modules/home/views/home_view.dart index d8f8b3ae..91635c0e 100644 --- a/lib/app/modules/home/views/home_view.dart +++ b/lib/app/modules/home/views/home_view.dart @@ -98,7 +98,9 @@ class HomeView extends GetView { .textTheme .displaySmall! .copyWith( - color: themeController.primaryDisabledTextColor.value, + color: themeController + .primaryDisabledTextColor + .value, fontSize: 16 * controller.scalingFactor .value, @@ -111,10 +113,12 @@ class HomeView extends GetView { .textTheme .displaySmall! .copyWith( - color: themeController.primaryTextColor.value - .withOpacity( - 0.75, - ), + color: themeController + .primaryTextColor + .value + .withOpacity( + 0.75, + ), fontSize: 14 * controller .scalingFactor @@ -144,9 +148,8 @@ class HomeView extends GetView { }, child: SvgPicture.asset( 'assets/images/GC.svg', - colorFilter: - const ColorFilter.mode( - kprimaryColor, + colorFilter: ColorFilter.mode( + getPrimaryColorTheme(), BlendMode.srcIn, ), height: 30 * @@ -173,10 +176,12 @@ class HomeView extends GetView { icon: const Icon( Icons.menu, ), - color: themeController.primaryTextColor.value - .withOpacity(0.75), + color: themeController + .primaryTextColor.value + .withOpacity(0.75), iconSize: 27 * - controller.scalingFactor.value, + controller + .scalingFactor.value, ), // PopupMenuButton( @@ -281,8 +286,9 @@ class HomeView extends GetView { .clear(); }, icon: const Icon(Icons.close), - color: themeController.primaryTextColor.value - .withOpacity(0.75), + color: themeController + .primaryTextColor.value + .withOpacity(0.75), iconSize: 27 * controller.scalingFactor.value, ), @@ -302,7 +308,9 @@ class HomeView extends GetView { .textTheme .displaySmall! .copyWith( - color: themeController.primaryDisabledTextColor.value, + color: themeController + .primaryDisabledTextColor + .value, fontSize: 16 * controller .scalingFactor @@ -311,7 +319,10 @@ class HomeView extends GetView { ), Container( height: 35, - width: MediaQuery.of(context).size.width / 1.2, + width: MediaQuery.of(context) + .size + .width / + 1.2, child: Row( children: [ Obx(() { @@ -336,10 +347,12 @@ class HomeView extends GetView { .textTheme .displaySmall! .copyWith( - color: themeController.primaryTextColor.value - .withOpacity( - 0.75, - ), + color: themeController + .primaryTextColor + .value + .withOpacity( + 0.75, + ), fontSize: 14 * controller .scalingFactor @@ -360,11 +373,19 @@ class HomeView extends GetView { // Delete button SizedBox( - width: 30 * controller.scalingFactor.value, + width: 30 * + controller + .scalingFactor + .value, ), Obx( () => InkWell( onTap: () async { + + // Deleting the alarms + await controller + .deleteAlarms(); + if (controller.numberOfAlarmsSelected.value > 0) { bool confirm = await Get.defaultDialog( @@ -414,6 +435,7 @@ class HomeView extends GetView { ), ); + if (confirm == true) { await controller.deleteAlarms(); @@ -433,10 +455,28 @@ class HomeView extends GetView { }, child: Icon( Icons.delete, + + color: controller + .numberOfAlarmsSelected + .value > + 0 + ? Colors.red + : themeController + .primaryTextColor + .value + .withOpacity( + 0.75, + ), + size: 27 * + controller + .scalingFactor + .value, + color: controller.numberOfAlarmsSelected.value > 0 ? Colors.red : themeController.primaryTextColor.value.withOpacity(0.75), size: 27 * controller.scalingFactor.value, + ), ), ), @@ -493,11 +533,11 @@ class HomeView extends GetView { stream: streamAlarms, builder: (context, snapshot) { if (!snapshot.hasData) { - return const Center( + return Center( child: CircularProgressIndicator.adaptive( backgroundColor: Colors.transparent, valueColor: AlwaysStoppedAnimation( - kprimaryColor, + getPrimaryColorTheme(), ), ), ); @@ -526,7 +566,9 @@ class HomeView extends GetView { .textTheme .displaySmall! .copyWith( - color: themeController.primaryDisabledTextColor.value, + color: themeController + .primaryDisabledTextColor + .value, ), ), ], @@ -624,301 +666,337 @@ class HomeView extends GetView { ), ); - Utils.hapticFeedback(); - }, - onLongPressEnd: (details) { - controller - .isAnyAlarmHolded - .value = false; - }, - child: AnimatedContainer( - duration: const Duration( - milliseconds: 600, - ), - curve: Curves.easeInOut, - margin: EdgeInsets.all( - controller - .isAnyAlarmHolded - .value - ? 10 - : 0, - ), - child: Center( - child: Padding( - padding: - const EdgeInsets - .symmetric( - horizontal: 10.0, - ), - child: Card( - color: themeController.secondaryBackgroundColor.value, - shape: - RoundedRectangleBorder( - borderRadius: - BorderRadius - .circular( - 18, - ), + Utils.hapticFeedback(); + }, + onLongPressEnd: (details) { + controller + .isAnyAlarmHolded + .value = false; + }, + child: AnimatedContainer( + duration: const Duration( + milliseconds: 600, + ), + curve: Curves.easeInOut, + margin: EdgeInsets.all( + controller + .isAnyAlarmHolded + .value + ? 10 + : 0, ), child: Center( child: Padding( padding: - EdgeInsets - .only( - left: 25.0, - right: controller - .inMultipleSelectMode - .value - ? 10.0 - : 0.0, - top: controller - .inMultipleSelectMode - .value - ? Utils.isChallengeEnabled( - alarm, - ) || - Utils.isAutoDismissalEnabled( - alarm, - ) - ? 15.0 - : 18.0 - : Utils.isChallengeEnabled( - alarm, - ) || - Utils.isAutoDismissalEnabled( - alarm, - ) - ? 8.0 - : 0.0, - bottom: controller - .inMultipleSelectMode - .value - ? Utils.isChallengeEnabled( - alarm, - ) || - Utils.isAutoDismissalEnabled( - alarm, - ) - ? 15.0 - : 18.0 - : Utils.isChallengeEnabled( - alarm, - ) || - Utils.isAutoDismissalEnabled( - alarm, - ) - ? 8.0 - : 0.0, + const EdgeInsets + .symmetric( + horizontal: 10.0, ), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Expanded( - flex: 3, - child: - Column( + child: Card( + color: themeController + .secondaryBackgroundColor + .value, + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 18, + ), + ), + child: Center( + child: Padding( + padding: + EdgeInsets + .only( + left: 25.0, + right: controller + .inMultipleSelectMode + .value + ? 10.0 + : 0.0, + top: controller + .inMultipleSelectMode + .value + ? Utils.isChallengeEnabled( + alarm, + ) || + Utils.isAutoDismissalEnabled( + alarm, + ) + ? 15.0 + : 18.0 + : Utils.isChallengeEnabled( + alarm, + ) || + Utils.isAutoDismissalEnabled( + alarm, + ) + ? 8.0 + : 0.0, + bottom: controller + .inMultipleSelectMode + .value + ? Utils.isChallengeEnabled( + alarm, + ) || + Utils.isAutoDismissalEnabled( + alarm, + ) + ? 15.0 + : 18.0 + : Utils.isChallengeEnabled( + alarm, + ) || + Utils.isAutoDismissalEnabled( + alarm, + ) + ? 8.0 + : 0.0, + ), + child: Row( mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, + MainAxisAlignment + .start, children: [ - IntrinsicHeight( + Expanded( + flex: 3, child: - Row( + Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - Text( - repeatDays.replaceAll( - 'Never'.tr, - 'One Time'.tr, - ), - style: Theme.of(context).textTheme.bodySmall!.copyWith( - fontWeight: FontWeight.w500, - color: alarm.isEnabled == true - ? kprimaryColor - : themeController.primaryDisabledTextColor.value, + IntrinsicHeight( + child: + Row( + children: [ + Text( + repeatDays.replaceAll( + 'Never'.tr, + 'One Time'.tr, + ), + style: Theme.of(context).textTheme.bodySmall!.copyWith( + fontWeight: FontWeight.w500, + color: alarm.isEnabled == true ? getPrimaryColorTheme() : themeController.primaryDisabledTextColor.value, + ), ), - ), - if (alarm.label.isNotEmpty) - VerticalDivider( - color: alarm.isEnabled == true - ? kprimaryColor - : themeController.primaryDisabledTextColor.value, - thickness: 1.4, - width: 6, - indent: 3.1, - endIndent: 3.1, - ), - Expanded( - child: Container( - child: Text( - alarm.label, - overflow: TextOverflow.ellipsis, - // Set overflow property here - style: Theme.of(context).textTheme.bodySmall!.copyWith( - fontWeight: FontWeight.w500, - color: alarm.isEnabled == true - ? kprimaryColor - : themeController.primaryDisabledTextColor.value, + if (alarm.label.isNotEmpty) + VerticalDivider( + color: alarm.isEnabled == true ? getPrimaryColorTheme() : themeController.primaryDisabledTextColor.value, + thickness: 1.4, + width: 6, + indent: 3.1, + endIndent: 3.1, + ), + Expanded( + child: Container( + child: Text( + alarm.label, + overflow: TextOverflow.ellipsis, + // Set overflow property here + style: Theme.of(context).textTheme.bodySmall!.copyWith( + fontWeight: FontWeight.w500, + color: alarm.isEnabled == true ? getPrimaryColorTheme() : themeController.primaryDisabledTextColor.value, + ), ), - ), + ), + ), + ], ), ), - ], - ), - ), - Row( - children: [ - Text( - (settingsController.is24HrsEnabled.value - ? Utils.split24HourFormat(alarm.alarmTime) - : Utils.convertTo12HourFormat( - alarm.alarmTime, - ))[0], - style: Theme.of( - context, - ).textTheme.displayLarge!.copyWith( - color: alarm.isEnabled == true - ? themeController.primaryTextColor.value - : themeController.primaryDisabledTextColor.value, + Row( + children: [ + Text( + (settingsController.is24HrsEnabled.value + ? Utils.split24HourFormat(alarm.alarmTime) + : Utils.convertTo12HourFormat( + alarm.alarmTime, + ))[0], + style: Theme.of( + context, + ).textTheme.displayLarge!.copyWith( + color: alarm.isEnabled == true ? themeController.primaryTextColor.value : themeController.primaryDisabledTextColor.value, + ), ), - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 3.0, - ), - child: Text( - (settingsController.is24HrsEnabled.value - ? Utils.split24HourFormat(alarm.alarmTime) - : Utils.convertTo12HourFormat( - alarm.alarmTime, - ))[1], - style: Theme.of(context).textTheme.displayMedium!.copyWith( - color: alarm.isEnabled == true - ? themeController.primaryTextColor.value - : themeController.primaryDisabledTextColor.value, + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 3.0, + ), + child: Text( + (settingsController.is24HrsEnabled.value + ? Utils.split24HourFormat(alarm.alarmTime) + : Utils.convertTo12HourFormat( + alarm.alarmTime, + ))[1], + style: Theme.of(context).textTheme.displayMedium!.copyWith( + color: alarm.isEnabled == true ? themeController.primaryTextColor.value : themeController.primaryDisabledTextColor.value, + ), ), - ), - ), - ], - ), - if (Utils.isChallengeEnabled( - alarm, - ) || - Utils.isAutoDismissalEnabled( - alarm, - ) || - alarm.isSharedAlarmEnabled) - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - if (alarm.isSharedAlarmEnabled) - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 3.0, - ), - child: Icon( - Icons.share_arrival_time, - size: 24, - color: alarm.isEnabled == true - ? themeController.primaryTextColor.value.withOpacity(0.5) - : themeController.primaryDisabledTextColor.value, - ), - ), - if (alarm.isLocationEnabled) - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 3.0, - ), - child: Icon( - Icons.location_pin, - size: 24, - color: alarm.isEnabled == true - ? themeController.primaryTextColor.value.withOpacity(0.5) - : themeController.primaryDisabledTextColor.value, - ), - ), - if (alarm.isActivityEnabled) - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 3.0, - ), - child: Icon( - Icons.screen_lock_portrait, - size: 24, - color: alarm.isEnabled == true - ? themeController.primaryTextColor.value.withOpacity(0.5) - : themeController.primaryDisabledTextColor.value, - ), - ), - if (alarm.isWeatherEnabled) - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 3.0, - ), - child: Icon( - Icons.cloudy_snowing, - size: 24, - color: alarm.isEnabled == true - ? themeController.primaryTextColor.value.withOpacity(0.5) - : themeController.primaryDisabledTextColor.value, - ), - ), - if (alarm.isQrEnabled) - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 3.0, - ), - child: Icon( - Icons.qr_code_scanner, - size: 24, - color: alarm.isEnabled == true - ? themeController.primaryTextColor.value.withOpacity(0.5) - : themeController.primaryDisabledTextColor.value, - ), - ), - if (alarm.isShakeEnabled) - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 3.0, - ), - child: Icon( - Icons.vibration, - size: 24, - color: alarm.isEnabled == true - ? themeController.primaryTextColor.value.withOpacity(0.5) - : themeController.primaryDisabledTextColor.value, - ), - ), - if (alarm.isMathsEnabled) - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 3.0, - ), - child: Icon( - Icons.calculate, - size: 24, - color: alarm.isEnabled == true - ? themeController.primaryTextColor.value.withOpacity(0.5) - : themeController.primaryDisabledTextColor.value, - ), - ), - if (alarm.isPedometerEnabled) - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 3.0, - ), - child: Icon( - Icons.directions_walk, - size: 24, - color: alarm.isEnabled == true - ? themeController.primaryTextColor.value.withOpacity(0.5) - : themeController.primaryDisabledTextColor.value, ), + ], + ), + if (Utils.isChallengeEnabled( + alarm, + ) || + Utils.isAutoDismissalEnabled( + alarm, + ) || + alarm.isSharedAlarmEnabled) + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + if (alarm.isSharedAlarmEnabled) + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 3.0, + ), + child: Icon( + Icons.share_arrival_time, + size: 24, + color: alarm.isEnabled == true ? themeController.primaryTextColor.value.withOpacity(0.5) : themeController.primaryDisabledTextColor.value, + ), + ), + if (alarm.isLocationEnabled) + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 3.0, + ), + child: Icon( + Icons.location_pin, + size: 24, + color: alarm.isEnabled == true ? themeController.primaryTextColor.value.withOpacity(0.5) : themeController.primaryDisabledTextColor.value, + ), + ), + if (alarm.isActivityEnabled) + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 3.0, + ), + child: Icon( + Icons.screen_lock_portrait, + size: 24, + color: alarm.isEnabled == true ? themeController.primaryTextColor.value.withOpacity(0.5) : themeController.primaryDisabledTextColor.value, + ), + ), + if (alarm.isWeatherEnabled) + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 3.0, + ), + child: Icon( + Icons.cloudy_snowing, + size: 24, + color: alarm.isEnabled == true ? themeController.primaryTextColor.value.withOpacity(0.5) : themeController.primaryDisabledTextColor.value, + ), + ), + if (alarm.isQrEnabled) + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 3.0, + ), + child: Icon( + Icons.qr_code_scanner, + size: 24, + color: alarm.isEnabled == true ? themeController.primaryTextColor.value.withOpacity(0.5) : themeController.primaryDisabledTextColor.value, + ), + ), + if (alarm.isShakeEnabled) + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 3.0, + ), + child: Icon( + Icons.vibration, + size: 24, + color: alarm.isEnabled == true ? themeController.primaryTextColor.value.withOpacity(0.5) : themeController.primaryDisabledTextColor.value, + ), + ), + if (alarm.isMathsEnabled) + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 3.0, + ), + child: Icon( + Icons.calculate, + size: 24, + color: alarm.isEnabled == true ? themeController.primaryTextColor.value.withOpacity(0.5) : themeController.primaryDisabledTextColor.value, + ), + ), + if (alarm.isPedometerEnabled) + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 3.0, + ), + child: Icon( + Icons.directions_walk, + size: 24, + color: alarm.isEnabled == true ? themeController.primaryTextColor.value.withOpacity(0.5) : themeController.primaryDisabledTextColor.value, + ), + ), + ], ), ], ), + + ), + Padding( + padding: + const EdgeInsets + .symmetric( + horizontal: + 10.0, + ), + child: controller + .inMultipleSelectMode + .value + ? Column( + // Showing the toggle button + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + flex: 0, + child: ToggleButton( + controller: controller, + alarmIndex: index, + ), + ), + ], + ) + : Column( + // Showing the switch and pop up menu button + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + flex: 0, + child: Switch.adaptive( + activeColor: getSecondaryColorTheme(), + value: alarm.isEnabled, + onChanged: (bool value) async { + Utils.hapticFeedback(); + alarm.isEnabled = value; + if (alarm.isSharedAlarmEnabled == true) { + await FirestoreDb.updateAlarm(alarm.ownerId, alarm); + } else { + await IsarDb.updateAlarm(alarm); + } + controller.refreshTimer = true; + controller.refreshUpcomingAlarms(); + }, + ), + ), + Expanded( + flex: 0, + child: PopupMenuButton( + onSelected: (value) async { + Utils.hapticFeedback(); + if (value == 0) { + Get.back(); + Get.offNamed('/alarm-ring', arguments: alarm); + } else if (value == 1) { + debugPrint(alarm.isSharedAlarmEnabled.toString()); + ], ), ), @@ -980,6 +1058,7 @@ class HomeView extends GetView { } else if (value == 1) { debugPrint(alarm.isSharedAlarmEnabled.toString()); + if (alarm.isSharedAlarmEnabled == true) { await FirestoreDb.deleteAlarm(controller.userModel.value, alarm.firestoreId!); } else { @@ -1018,65 +1097,63 @@ class HomeView extends GetView { counterUpdate: CounterUpdate.decrement, ); - controller.refreshTimer = true; - controller.refreshUpcomingAlarms(); - } - }, - color: themeController.primaryBackgroundColor.value, - icon: Icon( - Icons.more_vert, - color: alarm.isEnabled == true - ? themeController.primaryTextColor.value - : themeController.primaryDisabledTextColor.value, - ), - itemBuilder: (context) { - return [ - PopupMenuItem( - value: 0, - child: Text( - 'Preview Alarm'.tr, - style: Theme.of(context).textTheme.bodyMedium, + controller.refreshTimer = true; + controller.refreshUpcomingAlarms(); + } + }, + color: themeController.primaryBackgroundColor.value, + icon: Icon( + Icons.more_vert, + color: alarm.isEnabled == true ? themeController.primaryTextColor.value : themeController.primaryDisabledTextColor.value, ), - ), - if (alarm.isSharedAlarmEnabled == false || (alarm.isSharedAlarmEnabled == true && alarm.ownerId == controller.userModel.value!.id)) - PopupMenuItem( - value: 1, - child: Text( - 'Delete Alarm'.tr, - style: Theme.of(context).textTheme.bodyMedium!.copyWith( - color: Colors.red, + itemBuilder: (context) { + return [ + PopupMenuItem( + value: 0, + child: Text( + 'Preview Alarm'.tr, + style: Theme.of(context).textTheme.bodyMedium, + ), + ), + if (alarm.isSharedAlarmEnabled == false || (alarm.isSharedAlarmEnabled == true && alarm.ownerId == controller.userModel.value!.id)) + PopupMenuItem( + value: 1, + child: Text( + 'Delete Alarm'.tr, + style: Theme.of(context).textTheme.bodyMedium!.copyWith( + color: Colors.red, + ), ), - ), - ), - ]; - }, + ), + ]; + }, + ), + ), + ], ), - ), - ], - ), + ), + ], + ), ), - ], + ), ), ), ), ), ), ), - ), - ), - ), - ) - : SizedBox(); + ) + : SizedBox(); }, ); } }, ); } else { - return const CircularProgressIndicator.adaptive( + return CircularProgressIndicator.adaptive( backgroundColor: Colors.transparent, valueColor: AlwaysStoppedAnimation( - kprimaryColor, + getPrimaryColorTheme(), ), ); } @@ -1139,7 +1216,8 @@ class HomeView extends GetView { Get.back(result: true); // User confirmed }, style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(kprimaryColor), + backgroundColor: + MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Text( 'delete'.tr, diff --git a/lib/app/modules/home/views/notification_icon.dart b/lib/app/modules/home/views/notification_icon.dart index feb82ce0..97b9fc4b 100644 --- a/lib/app/modules/home/views/notification_icon.dart +++ b/lib/app/modules/home/views/notification_icon.dart @@ -43,8 +43,8 @@ Widget notificationIcon(HomeController controller) { top: -3, child: Text( '${notif.length}', - style: const TextStyle( - color: kprimaryColor, + style: TextStyle( + color: getPrimaryColorTheme(), fontWeight: FontWeight.w700, ), ), diff --git a/lib/app/modules/home/views/profile_config.dart b/lib/app/modules/home/views/profile_config.dart index 9d8625e2..05d0ac17 100644 --- a/lib/app/modules/home/views/profile_config.dart +++ b/lib/app/modules/home/views/profile_config.dart @@ -31,11 +31,87 @@ class _ProfileSelectState extends State { @override Widget build(BuildContext context) { + + return Obx(() => AnimatedSwitcher( + duration: const Duration(milliseconds: 250), + transitionBuilder: (child, animation) { + return SizeTransition( + sizeFactor: animation, axis: Axis.horizontal, child: child,); + }, + child: !controller.expandProfile.value + ? InkWell( + onTap: () async { + controller.isProfile.value = true; + controller.isProfileUpdate.value = true; + Get.toNamed('/add-update-alarm', + arguments: controller.genFakeAlarmModel(),); + }, + child: Container( + key: const ValueKey(1), + child: Row( + children: [ + Padding( + padding: EdgeInsets.only( + left: 18 * controller.scalingFactor.value, + ), + child: Obx( + () => Container( + padding: EdgeInsets.symmetric( + horizontal: 24 * controller.scalingFactor.value, + vertical: 4 * controller.scalingFactor.value, + ), + constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 2 / 3), + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.topCenter, + stops: const [0.2, 0.2], + colors: [ + getPrimaryColorTheme(), + themeController.secondaryBackgroundColor.value, + ], + ), + borderRadius: BorderRadius.circular(18),), + child: Text( + '${controller.selectedProfile}', + style: Theme.of(context) + .textTheme + .displaySmall! + .copyWith( + color: themeController.primaryTextColor.value.withOpacity( + 0.75, + ), + fontSize: + 22 * controller.scalingFactor.value, + overflow: TextOverflow.ellipsis + ,), + ),), + ), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: InkWell( + borderRadius: BorderRadius.circular(28), + onTap: () { + controller.expandProfile.value = + !controller.expandProfile.value; + }, + child: const Padding( + padding: EdgeInsets.all(8.0), + child: Icon(Icons.arrow_forward_ios), + ), + ), + ), + InkWell( + borderRadius: BorderRadius.circular(28), + onTap: () async { + return Obx(() => Row( mainAxisAlignment: MainAxisAlignment.center, children: [ TextButton( onPressed: () async { + controller.isProfile.value = true; controller.profileModel.value = (await IsarDb.getProfile( @@ -101,7 +177,11 @@ class _ProfileSelectState extends State { ), decoration: BoxDecoration( color: profile.profileName == controller.selectedProfile.value + + ? getPrimaryColorTheme().withOpacity(0.5) + ? kprimaryColor + : themeController.secondaryBackgroundColor.value, borderRadius: BorderRadius.circular(30),), child: Text( diff --git a/lib/app/modules/notifications/views/notifications_view.dart b/lib/app/modules/notifications/views/notifications_view.dart index 6f58208d..22245680 100644 --- a/lib/app/modules/notifications/views/notifications_view.dart +++ b/lib/app/modules/notifications/views/notifications_view.dart @@ -68,7 +68,7 @@ class NotificationsView extends GetView { ? "${controller.notifications[index]['profileName']} ?" : "${controller.notifications[index]['alarmTime']} ?", style: TextStyle( - color: kprimaryColor, + color: getPrimaryColorTheme(), fontSize: controller.homeController .scalingFactor * 20, @@ -115,7 +115,7 @@ class NotificationsView extends GetView { controller .allProfiles[ index] - ? kprimaryColor + ? getPrimaryColorTheme() : ksecondaryBackgroundColor, title: Text( controller @@ -234,7 +234,7 @@ class NotificationsView extends GetView { .substring(0, 2) .toUpperCase(), style: TextStyle( - color: ksecondaryColor, + color: getSecondaryColorTheme(), fontSize: controller.homeController.scalingFactor * 20, fontWeight: FontWeight.w700, @@ -243,7 +243,7 @@ class NotificationsView extends GetView { : Icon( Icons.alarm, size: controller.homeController.scalingFactor * 20, - color: ksecondaryColor, + color: getSecondaryColorTheme(), ), ), ), @@ -275,7 +275,7 @@ class NotificationsView extends GetView { ? Text( notification['profileName'], style: TextStyle( - color: kprimaryColor, + color: getPrimaryColorTheme(), fontSize: controller.homeController.scalingFactor * 20, fontWeight: FontWeight.w700, @@ -284,7 +284,7 @@ class NotificationsView extends GetView { : Text( notification['alarmTime'], style: TextStyle( - color: kprimaryColor, + color: getPrimaryColorTheme(), fontSize: controller.homeController.scalingFactor * 20, fontWeight: FontWeight.w700, diff --git a/lib/app/modules/settings/controllers/settings_controller.dart b/lib/app/modules/settings/controllers/settings_controller.dart index d314fef5..3033a47d 100644 --- a/lib/app/modules/settings/controllers/settings_controller.dart +++ b/lib/app/modules/settings/controllers/settings_controller.dart @@ -27,6 +27,7 @@ class SettingsController extends GetxController { var isSortedAlarmListEnabled = true.obs; final _sortedAlarmListKey = 'sorted_alarm_list'; var currentLanguage = 'en_US'.obs; + var isMaterial3Enabled = true.obs; final _secureStorageProvider = SecureStorageProvider(); final apiKey = TextEditingController(); final currentPoint = LatLng(0, 0).obs; diff --git a/lib/app/modules/settings/controllers/theme_controller.dart b/lib/app/modules/settings/controllers/theme_controller.dart index 5774e31d..e6e0005f 100644 --- a/lib/app/modules/settings/controllers/theme_controller.dart +++ b/lib/app/modules/settings/controllers/theme_controller.dart @@ -2,63 +2,123 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:ultimate_alarm_clock/app/data/providers/secure_storage_provider.dart'; import 'package:ultimate_alarm_clock/app/utils/constants.dart'; +import 'package:dynamic_color/dynamic_color.dart'; class ThemeController extends GetxController { final _secureStorageProvider = SecureStorageProvider(); + + // Dynamic color schemes + Rx lightDynamicScheme = Rx(null); + Rx darkDynamicScheme = Rx(null); + + // Current theme mode + Rx currentTheme = ThemeMode.system.obs; + + // Observable theme colors + Rx primaryColor = kprimaryColor.obs; + Rx secondaryColor = kLightSecondaryColor.obs; + Rx primaryBackgroundColor = kLightPrimaryBackgroundColor.obs; + Rx secondaryBackgroundColor = kLightSecondaryBackgroundColor.obs; + Rx primaryTextColor = kLightPrimaryTextColor.obs; + Rx secondaryTextColor = kLightSecondaryTextColor.obs; + Rx primaryDisabledTextColor = kLightPrimaryDisabledTextColor.obs; + + /// Toggle theme based on theme mode + + void toggleTheme(ThemeMode themeMode) { + currentTheme.value = themeMode; + update(); // Notify GetX to rebuild UI + } @override void onInit() { _loadThemeValue(); - updateThemeColors(); + _initializeDynamicColors(); super.onInit(); } - Rx currentTheme = ThemeMode.system.obs; + /// Initialize dynamic colors based on device theme + void _initializeDynamicColors() async { + // Get dynamic color schemes if available + final dynamicColors = await DynamicColorPlugin.getCorePalette(); + + if (dynamicColors != null) { + // Create light and dark schemes from dynamic colors + lightDynamicScheme.value = ColorScheme.fromSeed( + seedColor: Color(dynamicColors.primary.get(50)), + brightness: Brightness.light, + ).harmonized(); + + darkDynamicScheme.value = ColorScheme.fromSeed( + seedColor: Color(dynamicColors.primary.get(50)), + brightness: Brightness.dark, + ).harmonized(); + } + + // Update theme colors after dynamic colors are loaded + updateThemeColors(); + } + /// Switch between light and dark theme void switchTheme() { currentTheme.value = currentTheme.value == ThemeMode.light ? ThemeMode.dark : ThemeMode.light; updateThemeColors(); + _saveThemeValuePreference(); + Get.changeThemeMode(currentTheme.value); } - Rx primaryColor = kprimaryColor.obs; - Rx secondaryColor = kLightSecondaryColor.obs; - Rx primaryBackgroundColor = kLightPrimaryBackgroundColor.obs; - Rx secondaryBackgroundColor = kLightSecondaryBackgroundColor.obs; - Rx primaryTextColor = kLightPrimaryTextColor.obs; - Rx secondaryTextColor = kLightSecondaryTextColor.obs; - Rx primaryDisabledTextColor = kLightPrimaryDisabledTextColor.obs; - + /// Update theme colors based on current theme mode and dynamic colors void updateThemeColors() { - if (currentTheme.value == ThemeMode.light) { - primaryColor.value = kprimaryColor; - secondaryColor.value = kLightSecondaryColor; - primaryBackgroundColor.value = kLightPrimaryBackgroundColor; - secondaryBackgroundColor.value = kLightSecondaryBackgroundColor; - primaryTextColor.value = kLightPrimaryTextColor; - secondaryTextColor.value = kLightSecondaryTextColor; - primaryDisabledTextColor.value = kLightPrimaryDisabledTextColor; + final ColorScheme? activeScheme = currentTheme.value == ThemeMode.light + ? lightDynamicScheme.value + : darkDynamicScheme.value; + + if (activeScheme != null) { + // Use dynamic colors if available + bool isDarkTheme = activeScheme.brightness == Brightness.dark; + primaryColor.value = activeScheme.primary; + secondaryColor.value = activeScheme.secondary; + primaryBackgroundColor.value = activeScheme.surface; + secondaryBackgroundColor.value = activeScheme.surfaceVariant; + primaryTextColor.value = activeScheme.onSurface; + secondaryTextColor.value = isDarkTheme ? Colors.black87 : Colors.white70; + primaryDisabledTextColor.value = activeScheme.onSurface.withOpacity(0.38); } else { - primaryColor.value = kprimaryColor; - secondaryColor.value = ksecondaryColor; - primaryBackgroundColor.value = kprimaryBackgroundColor; - secondaryBackgroundColor.value = ksecondaryBackgroundColor; - primaryTextColor.value = kprimaryTextColor; - secondaryTextColor.value = ksecondaryTextColor; - primaryDisabledTextColor.value = kprimaryDisabledTextColor; + // Fall back to predefined colors + if (currentTheme.value == ThemeMode.light) { + primaryColor.value = kprimaryColor; + secondaryColor.value = kLightSecondaryColor; + primaryBackgroundColor.value = kLightPrimaryBackgroundColor; + secondaryBackgroundColor.value = kLightSecondaryBackgroundColor; + primaryTextColor.value = kLightPrimaryTextColor; + secondaryTextColor.value = kLightSecondaryTextColor; + primaryDisabledTextColor.value = kLightPrimaryDisabledTextColor; + } else { + primaryColor.value = kprimaryColor; + secondaryColor.value = getSecondaryColorTheme(); + primaryBackgroundColor.value = kprimaryBackgroundColor; + secondaryBackgroundColor.value = ksecondaryBackgroundColor; + primaryTextColor.value = kprimaryTextColor; + secondaryTextColor.value = ksecondaryTextColor; + primaryDisabledTextColor.value = kprimaryDisabledTextColor; + } } } + /// Load saved theme from secure storage void _loadThemeValue() async { currentTheme.value = await _secureStorageProvider.readThemeValue() == AppTheme.light ? ThemeMode.light : ThemeMode.dark; + updateThemeColors(); Get.changeThemeMode(currentTheme.value); } + /// Save theme value to secure storage void _saveThemeValuePreference() async { await _secureStorageProvider.writeThemeValue( theme: currentTheme.value == ThemeMode.light @@ -67,9 +127,42 @@ class ThemeController extends GetxController { ); } + /// Toggle theme based on switch value void toggleThemeValue(bool enabled) { currentTheme.value = enabled ? ThemeMode.light : ThemeMode.dark; updateThemeColors(); _saveThemeValuePreference(); + Get.changeThemeMode(currentTheme.value); + } + + /// Get current theme data based on dynamic colors or fallback + ThemeData getThemeData({required bool isLight}) { + final ColorScheme? scheme = isLight ? lightDynamicScheme.value : darkDynamicScheme.value; + + if (scheme != null) { + return isLight ? _createLightTheme(scheme) : _createDarkTheme(scheme); + } else { + return isLight ? kLightThemeData : kThemeData; + } + } + + /// Create light theme based on color scheme + ThemeData _createLightTheme(ColorScheme scheme) { + return ThemeData( + useMaterial3: true, + colorScheme: scheme, + fontFamily: 'poppins', + // Add other theme properties as needed + ); + } + + /// Create dark theme based on color scheme + ThemeData _createDarkTheme(ColorScheme scheme) { + return ThemeData( + useMaterial3: true, + colorScheme: scheme, + fontFamily: 'poppins', + // Add other theme properties as needed + ); } -} +} \ No newline at end of file diff --git a/lib/app/modules/settings/views/customize_undo_duration.dart b/lib/app/modules/settings/views/customize_undo_duration.dart index 0d49abfb..9a3faffb 100644 --- a/lib/app/modules/settings/views/customize_undo_duration.dart +++ b/lib/app/modules/settings/views/customize_undo_duration.dart @@ -64,7 +64,7 @@ class CustomizeUndoDuration extends StatelessWidget{ Get.back(); }, style: ElevatedButton.styleFrom( - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), ), child: Text( 'Apply Duration'.tr, diff --git a/lib/app/modules/settings/views/enable_24Hour_format.dart b/lib/app/modules/settings/views/enable_24Hour_format.dart index 55893d46..e876f3ac 100644 --- a/lib/app/modules/settings/views/enable_24Hour_format.dart +++ b/lib/app/modules/settings/views/enable_24Hour_format.dart @@ -47,7 +47,7 @@ class _Enable24HourFormatState extends State { Obx( () => Switch.adaptive( value: widget.controller.is24HrsEnabled.value, - activeColor: ksecondaryColor, + activeColor: getSecondaryColorTheme(), onChanged: (bool value) async { widget.controller.toggle24HoursFormat(value); Utils.hapticFeedback(); diff --git a/lib/app/modules/settings/views/enable_haptic_feedback.dart b/lib/app/modules/settings/views/enable_haptic_feedback.dart index 165dc865..069d85b7 100644 --- a/lib/app/modules/settings/views/enable_haptic_feedback.dart +++ b/lib/app/modules/settings/views/enable_haptic_feedback.dart @@ -48,7 +48,7 @@ class _EnableHapticFeedbackState extends State { Obx( () => Switch.adaptive( value: widget.controller.isHapticFeedbackEnabled.value, - activeColor: ksecondaryColor, + activeColor: getSecondaryColorTheme(), onChanged: (bool value) async { widget.controller.toggleHapticFeedback(value); Utils.hapticFeedback(); diff --git a/lib/app/modules/settings/views/enable_sorted_alarm_list.dart b/lib/app/modules/settings/views/enable_sorted_alarm_list.dart index 260a458b..dc1b9b0d 100644 --- a/lib/app/modules/settings/views/enable_sorted_alarm_list.dart +++ b/lib/app/modules/settings/views/enable_sorted_alarm_list.dart @@ -52,7 +52,7 @@ class _EnableSortedAlarmListState extends State { Obx( () => Switch.adaptive( value: widget.controller.isSortedAlarmListEnabled.value, - activeColor: ksecondaryColor, + activeColor: getSecondaryColorTheme(), onChanged: (bool value) async { widget.controller.toggleSortedAlarmList(value); Utils.hapticFeedback(); diff --git a/lib/app/modules/settings/views/google_sign_in.dart b/lib/app/modules/settings/views/google_sign_in.dart index 38b14855..2a38e752 100644 --- a/lib/app/modules/settings/views/google_sign_in.dart +++ b/lib/app/modules/settings/views/google_sign_in.dart @@ -56,7 +56,7 @@ class GoogleSignIn extends StatelessWidget { ), TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(kprimaryColor), + backgroundColor: MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Obx( () => Text( @@ -97,7 +97,7 @@ class GoogleSignIn extends StatelessWidget { TextButton( style: ButtonStyle( backgroundColor: - MaterialStateProperty.all(kprimaryColor), + MaterialStateProperty.all(getPrimaryColorTheme()), ), child: Obx( () => Text( @@ -253,7 +253,7 @@ class GoogleSignIn extends StatelessWidget { child: TextButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all( - kprimaryColor, + getPrimaryColorTheme(), ), ), onPressed: () { diff --git a/lib/app/modules/settings/views/theme_value_tile.dart b/lib/app/modules/settings/views/theme_value_tile.dart index 589daf24..6bd12375 100644 --- a/lib/app/modules/settings/views/theme_value_tile.dart +++ b/lib/app/modules/settings/views/theme_value_tile.dart @@ -55,7 +55,7 @@ class _ThemeValueTileState extends State { () => Switch.adaptive( value: widget.themeController.currentTheme.value == ThemeMode.light, - activeColor: ksecondaryColor, + activeColor: getSecondaryColorTheme(), onChanged: (bool value) async { widget.themeController.toggleThemeValue(value); Get.changeThemeMode( diff --git a/lib/app/modules/timer/views/timer_animation.dart b/lib/app/modules/timer/views/timer_animation.dart index 828c44c8..8628eaba 100644 --- a/lib/app/modules/timer/views/timer_animation.dart +++ b/lib/app/modules/timer/views/timer_animation.dart @@ -63,8 +63,9 @@ class _TimerAnimatedCardState extends State widget.timer.startedOn, widget.timer.timerValue) < widget.timer.timerValue && widget.timer.isPaused == 0) { - widget.timer.timeElapsed = widget.timer.timerValue - Utils.getDifferenceMillisFromNow( - widget.timer.startedOn, widget.timer.timerValue); + widget.timer.timeElapsed = widget.timer.timerValue - + Utils.getDifferenceMillisFromNow( + widget.timer.startedOn, widget.timer.timerValue); IsarDb.updateTimerPauseStatus(widget.timer); } if (widget.timer.isPaused == 0) { @@ -85,7 +86,7 @@ class _TimerAnimatedCardState extends State horizontal: 10.0, ), child: Container( - height: context.height / 3.0, + height: context.height / 3.0, width: context.width, child: Obx( () => Card( @@ -130,7 +131,7 @@ class _TimerAnimatedCardState extends State context, ).textTheme.bodySmall!.copyWith( fontWeight: FontWeight.w500, - color: kprimaryColor, + color: getPrimaryColorTheme(), fontSize: 18), ), ), @@ -162,10 +163,10 @@ class _TimerAnimatedCardState extends State ), IconButton( onPressed: () { - controller.stopRinger( - widget.timer.timerId); - controller.deleteTimer( - widget.timer.timerId); + controller + .stopRinger(widget.timer.timerId); + controller + .deleteTimer(widget.timer.timerId); }, icon: Icon( Icons.close, @@ -188,16 +189,64 @@ class _TimerAnimatedCardState extends State duration: Duration(seconds: 1), child: Text( '${Utils.formatMilliseconds(widget.timer.timerValue - widget.timer.timeElapsed)}', + + style: Theme.of( + context, + ).textTheme.displayLarge!.copyWith( + color: themeController + .primaryTextColor.value, + style: Theme.of(context) .textTheme .displayLarge! .copyWith( color: themeController.primaryTextColor.value, + fontSize: 44, ), ), ), ), + + GestureDetector( + onTap: () { + setState(() { + widget.timer.isPaused == 0 + ? stopTimer() + : startTimer(); + widget.timer.isPaused = + widget.timer.isPaused == 0 ? 1 : 0; + IsarDb.updateTimerPauseStatus( + widget.timer); + }); + if (widget.timer.timeElapsed >= + widget.timer.timerValue) { + controller + .stopRinger(widget.timer.timerId); + setState(() { + widget.timer.timeElapsed = 0; + IsarDb.updateTimerTick(widget.timer) + .then((value) => + IsarDb.updateTimerPauseStatus( + widget.timer)); + widget.timer.isPaused = 1; + }); + } + }, + child: Container( + decoration: BoxDecoration( + color: getPrimaryColorTheme(), + borderRadius: + BorderRadius.circular(80)), + width: 80, + height: 80, + child: Icon( + widget.timer.isPaused == 0 + ? Icons.pause + : Icons.play_arrow, + size: 30, + color: Colors.white, + Row( children: [ GestureDetector( @@ -239,6 +288,7 @@ class _TimerAnimatedCardState extends State color: Colors.white, ), ), + ), ], ), diff --git a/lib/app/modules/timer/views/timer_view.dart b/lib/app/modules/timer/views/timer_view.dart index 551a9b14..cc41b225 100644 --- a/lib/app/modules/timer/views/timer_view.dart +++ b/lib/app/modules/timer/views/timer_view.dart @@ -83,7 +83,7 @@ class TimerView extends GetView { Utils.hapticFeedback(); timerSelector(context, width, height); }, - backgroundColor: kprimaryColor, + backgroundColor: getPrimaryColorTheme(), child: const Icon( Icons.add_alarm, color: ksecondaryBackgroundColor, @@ -106,10 +106,10 @@ class TimerView extends GetView { stream: IsarDb.getTimers(), builder: (context, snapshot) { if (!snapshot.hasData || snapshot.data!.isEmpty) { - return const Center( + return Center( child: CircularProgressIndicator.adaptive( backgroundColor: Colors.transparent, - valueColor: AlwaysStoppedAnimation(kprimaryColor), + valueColor: AlwaysStoppedAnimation(getPrimaryColorTheme()), ), ); } else { @@ -330,7 +330,7 @@ class TimerView extends GetView { .copyWith( fontSize: 30, fontWeight: FontWeight.bold, - color: kprimaryColor, + color: getPrimaryColorTheme(), ), textStyle: Theme.of(context) .textTheme @@ -415,7 +415,7 @@ class TimerView extends GetView { .copyWith( fontSize: 30, fontWeight: FontWeight.bold, - color: kprimaryColor, + color: getPrimaryColorTheme(), ), textStyle: Theme.of(context) .textTheme @@ -500,7 +500,7 @@ class TimerView extends GetView { .copyWith( fontSize: 30, fontWeight: FontWeight.bold, - color: kprimaryColor, + color: getPrimaryColorTheme(), ), textStyle: Theme.of(context) .textTheme diff --git a/lib/app/modules/timerRing/views/timer_ring_view.dart b/lib/app/modules/timerRing/views/timer_ring_view.dart index f42b0d7d..4e181c12 100644 --- a/lib/app/modules/timerRing/views/timer_ring_view.dart +++ b/lib/app/modules/timerRing/views/timer_ring_view.dart @@ -38,7 +38,7 @@ class TimerRingView extends GetView { child: TextButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all( - kprimaryColor, + getPrimaryColorTheme(), ), ), onPressed: () async { diff --git a/lib/app/utils/constants.dart b/lib/app/utils/constants.dart index e6773e72..afcbbeea 100644 --- a/lib/app/utils/constants.dart +++ b/lib/app/utils/constants.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:get/get.dart'; enum ApiKeys { openWeatherMap, @@ -17,7 +18,6 @@ enum WeatherKeyState { add, update, saveAdded, saveUpdated } enum CounterUpdate { increment, decrement } const Color kprimaryColor = Color(0xffAFFC41); - // Dark Theme Color Palette const Color ksecondaryColor = Color(0xffB8E9C4); const Color kprimaryBackgroundColor = Color(0xff16171c); @@ -34,12 +34,20 @@ const Color kLightPrimaryTextColor = Color(0xff444444); const Color kLightSecondaryTextColor = Color(0xff444444); const Color kLightPrimaryDisabledTextColor = Color(0xffACACAB); +Color getPrimaryColorTheme() { + return Get.theme.colorScheme.primary; +} + +Color getSecondaryColorTheme() { + return Get.theme.colorScheme.secondary; +} + // Dark ThemeData ThemeData kThemeData = ThemeData( canvasColor: kprimaryBackgroundColor, - useMaterial3: false, + useMaterial3: true, textButtonTheme: TextButtonThemeData( - style: TextButton.styleFrom(foregroundColor: ksecondaryColor), + style: TextButton.styleFrom(foregroundColor: getSecondaryColorTheme()), ), iconTheme: const IconThemeData( color: kprimaryTextColor, @@ -83,27 +91,27 @@ ThemeData kThemeData = ThemeData( scaffoldBackgroundColor: kprimaryBackgroundColor, appBarTheme: const AppBarTheme(backgroundColor: kprimaryBackgroundColor), colorScheme: ColorScheme.fromSwatch().copyWith( - secondary: ksecondaryColor, + secondary: getSecondaryColorTheme(), background: kprimaryBackgroundColor, onPrimaryContainer: ksecondaryBackgroundColor, ), inputDecorationTheme: InputDecorationTheme( hintStyle: TextStyle(color: kprimaryTextColor.withOpacity(0.5)), - labelStyle: const TextStyle(color: kprimaryTextColor), + labelStyle: TextStyle(color: kprimaryTextColor), focusColor: kprimaryTextColor, enabledBorder: OutlineInputBorder( - borderSide: const BorderSide(color: kprimaryColor), + borderSide: BorderSide(color: kprimaryColor), borderRadius: BorderRadius.circular(12), ), focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: kprimaryColor), + borderSide: BorderSide(color: kprimaryColor), borderRadius: BorderRadius.circular(12), ), ), - textSelectionTheme: const TextSelectionThemeData( + textSelectionTheme: TextSelectionThemeData( cursorColor: kprimaryColor, selectionColor: kprimaryColor, - selectionHandleColor: ksecondaryColor, + selectionHandleColor: getSecondaryColorTheme(), ), sliderTheme: SliderThemeData( thumbColor: kprimaryColor, @@ -180,7 +188,7 @@ ThemeData kThemeData = ThemeData( // Light ThemeData ThemeData kLightThemeData = ThemeData( - useMaterial3: false, + useMaterial3: true, textButtonTheme: TextButtonThemeData( style: TextButton.styleFrom(foregroundColor: kprimaryColor), ), @@ -235,11 +243,11 @@ ThemeData kLightThemeData = ThemeData( labelStyle: const TextStyle(color: kLightPrimaryTextColor), focusColor: kLightPrimaryTextColor, enabledBorder: OutlineInputBorder( - borderSide: const BorderSide(color: kprimaryColor), + borderSide: BorderSide(color: kprimaryColor), borderRadius: BorderRadius.circular(12), ), focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: kprimaryColor), + borderSide: BorderSide(color: kprimaryColor), borderRadius: BorderRadius.circular(12), ), ), @@ -321,7 +329,131 @@ ThemeData kLightThemeData = ThemeData( ), ); -const List defaultRingtones = ['Digital Alarm 1','Digital Alarm 2','Digital Alarm 3','Mystery','New Day']; +ThemeData _createLightTheme(ColorScheme? lightDynamic) { + if (lightDynamic != null) { + return ThemeData( + useMaterial3: true, + colorScheme: lightDynamic, + fontFamily: 'poppins', + brightness: Brightness.light, + textTheme: createTextTheme(lightDynamic, false), + iconTheme: IconThemeData( + color: lightDynamic.onSurface, + ), + sliderTheme: SliderThemeData( + thumbColor: lightDynamic.primary, + activeTrackColor: lightDynamic.primary, + inactiveTrackColor: lightDynamic.onSurface.withOpacity(0.3), + ), + inputDecorationTheme: InputDecorationTheme( + hintStyle: TextStyle(color: lightDynamic.onSurface.withOpacity(0.5)), + labelStyle: TextStyle(color: lightDynamic.onSurface), + focusColor: lightDynamic.onSurface, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: lightDynamic.primary), + borderRadius: BorderRadius.circular(12), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: lightDynamic.primary), + borderRadius: BorderRadius.circular(12), + ), + ), + ); + } else { + // Fall back to the app's predefined light theme + return kLightThemeData; + } +} + +ThemeData _createDarkTheme(ColorScheme? darkDynamic) { + if (darkDynamic != null) { + return ThemeData( + useMaterial3: true, + colorScheme: darkDynamic, + fontFamily: 'poppins', + brightness: Brightness.dark, + textTheme: createTextTheme(darkDynamic, true), + iconTheme: IconThemeData( + color: darkDynamic.onSurface, + ), + sliderTheme: SliderThemeData( + thumbColor: darkDynamic.primary, + activeTrackColor: darkDynamic.primary, + inactiveTrackColor: darkDynamic.onSurface.withOpacity(0.3), + ), + inputDecorationTheme: InputDecorationTheme( + hintStyle: TextStyle(color: darkDynamic.onSurface.withOpacity(0.5)), + labelStyle: TextStyle(color: darkDynamic.onSurface), + focusColor: darkDynamic.onSurface, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: darkDynamic.primary), + borderRadius: BorderRadius.circular(12), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: darkDynamic.primary), + borderRadius: BorderRadius.circular(12), + ), + ), + ); + } else { + // Fall back to the app's predefined dark theme + return kThemeData; + } +} + +TextTheme createTextTheme(ColorScheme colorScheme, bool isDark) { + final textColor = colorScheme.onSurface; + + return TextTheme( + titleSmall: TextStyle(color: textColor, letterSpacing: 0.1, fontSize: 14), + titleMedium: TextStyle(color: textColor, letterSpacing: 0.1, fontSize: 16), + titleLarge: TextStyle(color: textColor, letterSpacing: 0.1, fontSize: 18), + bodySmall: TextStyle(color: textColor, letterSpacing: 0.1, fontSize: 12), + bodyMedium: TextStyle(color: textColor, letterSpacing: 0.1, fontSize: 14), + bodyLarge: TextStyle(color: textColor, letterSpacing: 0.1, fontSize: 16), + displaySmall: TextStyle( + fontSize: 14, + color: textColor, + fontWeight: FontWeight.w500, + letterSpacing: 0.1, + ), + displayMedium: TextStyle( + fontSize: 18, + color: textColor, + fontWeight: FontWeight.w600, + letterSpacing: 0.1, + ), + displayLarge: TextStyle( + fontSize: 22, + color: textColor, + fontWeight: FontWeight.w600, + letterSpacing: 0.1, + ), + labelSmall: TextStyle( + fontSize: 10, + color: textColor, + fontWeight: FontWeight.w400, + ), + labelMedium: TextStyle( + fontSize: 12, + color: textColor, + fontWeight: FontWeight.w500, + ), + labelLarge: TextStyle( + fontSize: 14, + color: textColor, + fontWeight: FontWeight.w600, + ), + ); +} + +const List defaultRingtones = [ + 'Digital Alarm 1', + 'Digital Alarm 2', + 'Digital Alarm 3', + 'Mystery', + 'New Day' +]; const Map Holidays = { 'Christian Holidays': 'en.christian#holiday@group.v.calendar.google.com', diff --git a/lib/app/utils/custom_error_screen.dart b/lib/app/utils/custom_error_screen.dart index aa998bf0..40ef80c0 100644 --- a/lib/app/utils/custom_error_screen.dart +++ b/lib/app/utils/custom_error_screen.dart @@ -72,15 +72,15 @@ class _CustomErrorScreenState extends State { ); }, style: OutlinedButton.styleFrom( - side: const BorderSide( - color: kprimaryColor, + side: BorderSide( + color: getPrimaryColorTheme(), width: 1, ), ), child: Text( 'Navigate to Home', style: Theme.of(context).textTheme.bodyMedium!.copyWith( - color: kprimaryColor, + color: getPrimaryColorTheme(), ), ), ), diff --git a/lib/app/utils/end_drawer.dart b/lib/app/utils/end_drawer.dart index 723dd950..8d5f3c63 100644 --- a/lib/app/utils/end_drawer.dart +++ b/lib/app/utils/end_drawer.dart @@ -22,7 +22,7 @@ Widget buildEndDrawer(BuildContext context) { child: Column( children: [ DrawerHeader( - decoration: const BoxDecoration(color: kLightSecondaryColor), + decoration: BoxDecoration(color: getSecondaryColorTheme()), child: Center( child: Row( children: [ diff --git a/lib/app/utils/share_dialog.dart b/lib/app/utils/share_dialog.dart index 11780e83..2f60b4fb 100644 --- a/lib/app/utils/share_dialog.dart +++ b/lib/app/utils/share_dialog.dart @@ -43,7 +43,7 @@ class ShareDialog extends StatelessWidget { style: ButtonStyle( backgroundColor: controller.selectedEmails.isNotEmpty ? WidgetStateProperty.all( - ksecondaryColor, + getSecondaryColorTheme(), ) : WidgetStateProperty.all( kprimaryDisabledTextColor, @@ -72,7 +72,7 @@ class ShareDialog extends StatelessWidget { Icons.share, color: controller.selectedEmails.isNotEmpty ? kprimaryBackgroundColor - : kprimaryColor, + : getPrimaryColorTheme(), ), Padding( padding: const EdgeInsets.all(8.0), @@ -98,9 +98,9 @@ class ShareDialog extends StatelessWidget { RoundedRectangleBorder(borderRadius: BorderRadius.circular(18)), title: Row( children: [ - const Icon( + Icon( Icons.person, - color: ksecondaryColor, + color: getSecondaryColorTheme(), ), Padding( padding: const EdgeInsets.all(8.0), @@ -114,7 +114,7 @@ class ShareDialog extends StatelessWidget { ), IconButton( splashRadius: homeController.scalingFactor * 16, - color: kprimaryColor, + color: getPrimaryColorTheme(), onPressed: () { controller.isAddUser.value = !controller.isAddUser.value; }, @@ -145,9 +145,9 @@ class ShareDialog extends StatelessWidget { Get.snackbar('Error', 'Invalid email'); } }, - icon: const Icon( + icon: Icon( Icons.add_circle_outlined, - color: kprimaryColor, + color: getPrimaryColorTheme(), ), ), prefixIcon: const Icon(Icons.alternate_email), @@ -206,7 +206,7 @@ class ShareDialog extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), color: controller.selectedEmails.contains(email.email) - ? kprimaryColor + ? getPrimaryColorTheme() : ksecondaryBackgroundColor, ), child: Padding( @@ -218,7 +218,7 @@ class ShareDialog extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w700, fontSize: homeController.scalingFactor * 15, - color: ksecondaryColor, + color: getSecondaryColorTheme(), ), ), ), @@ -285,7 +285,7 @@ class ShareDialog extends StatelessWidget { .substring(0, 2) .toUpperCase(), style: TextStyle( - color: ksecondaryColor, + color: getSecondaryColorTheme(), fontSize: homeController.scalingFactor * 30, fontWeight: FontWeight.w700, ), @@ -313,7 +313,7 @@ class ShareDialog extends StatelessWidget { homeController.selectedProfile.value, style: TextStyle( - color: kprimaryColor, + color: getPrimaryColorTheme(), fontSize: homeController.scalingFactor * 30, fontWeight: FontWeight.w700, ), overflow: TextOverflow.ellipsis, @@ -326,7 +326,7 @@ class ShareDialog extends StatelessWidget { ), ), overflow: TextOverflow.ellipsis, style: TextStyle( - color: kprimaryColor, + color: getPrimaryColorTheme(), fontSize: homeController.scalingFactor * 30, fontWeight: FontWeight.w700, ), diff --git a/lib/app/utils/utils.dart b/lib/app/utils/utils.dart index 53c16127..e0e2e443 100644 --- a/lib/app/utils/utils.dart +++ b/lib/app/utils/utils.dart @@ -697,7 +697,7 @@ class Utils { child: TextButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all( - kprimaryColor, + getPrimaryColorTheme(), ), ), onPressed: () { diff --git a/lib/main.dart b/lib/main.dart index 000c7157..4e014282 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,11 +6,15 @@ import 'package:get/get.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:ultimate_alarm_clock/app/data/providers/get_storage_provider.dart'; import 'package:ultimate_alarm_clock/app/modules/settings/controllers/theme_controller.dart'; + + import 'package:sqflite/sqflite.dart'; + import 'package:ultimate_alarm_clock/app/utils/language.dart'; import 'package:ultimate_alarm_clock/app/utils/constants.dart'; import 'package:ultimate_alarm_clock/app/utils/custom_error_screen.dart'; import 'app/routes/app_pages.dart'; +import 'package:dynamic_color/dynamic_color.dart'; Locale? loc; @@ -21,16 +25,11 @@ void main() async { Permission.notification.request(); } }); - await Firebase.initializeApp(); - await Get.putAsync(() => GetStorageProvider().init()); - final storage = Get.find(); loc = await storage.readLocale(); - final ThemeController themeController = Get.put(ThemeController()); - AudioPlayer.global.setAudioContext( const AudioContext( android: AudioContextAndroid( @@ -41,7 +40,6 @@ void main() async { ), ), ); - SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, @@ -54,27 +52,55 @@ void main() async { ); } - class UltimateAlarmClockApp extends StatelessWidget { const UltimateAlarmClockApp({super.key}); + + ThemeData _createLightTheme(ColorScheme? lightDynamic) { + final ColorScheme lightScheme = lightDynamic ?? const ColorScheme.light(); + + return ThemeData( + colorScheme: lightScheme, + brightness: Brightness.light, + fontFamily: "Poppins", + textTheme: createTextTheme(lightScheme, false), + ); +} + +ThemeData _createDarkTheme(ColorScheme? darkDynamic) { + final ColorScheme darkScheme = darkDynamic ?? const ColorScheme.dark(); + + return ThemeData( + colorScheme: darkScheme, + brightness: Brightness.dark, + fontFamily: "Poppins", + textTheme: createTextTheme(darkScheme, true), + ); +} + @override Widget build(BuildContext context) { - return GetMaterialApp( - theme: kLightThemeData, - darkTheme: kThemeData, - themeMode: ThemeMode.system, - title: 'UltiClock', - initialRoute: AppPages.INITIAL, - getPages: AppPages.routes, - translations: AppTranslations(), - locale: loc, - fallbackLocale: Locale('en', 'US'), - builder: (BuildContext context, Widget? error) { - ErrorWidget.builder = (FlutterErrorDetails? error) { - return CustomErrorScreen(errorDetails: error!); - }; - return error!; + return DynamicColorBuilder( + builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) { + return Obx(() { + return GetMaterialApp( + theme: _createLightTheme(lightDynamic), + darkTheme: _createDarkTheme(darkDynamic), + themeMode: Get.find().currentTheme.value, + title: 'UltiClock', + initialRoute: AppPages.INITIAL, + getPages: AppPages.routes, + translations: AppTranslations(), + locale: loc, + fallbackLocale: const Locale('en', 'US'), + builder: (BuildContext context, Widget? error) { + ErrorWidget.builder = (FlutterErrorDetails? error) { + return CustomErrorScreen(errorDetails: error!); + }; + return error!; + }, + ); + }); }, ); } -} +} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index ea1939f0..3d186df8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ environment: dependencies: firebase_core: ^2.27.0 - + dynamic_color: ^1.7.0 screen_state: ^4.0.0 cupertino_icons: ^1.0.2 win32: ^5.2.0