Skip to content

Integrate Material You Dynamic Theming for Light & Dark Modes #743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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: () {
Expand All @@ -209,7 +209,7 @@ class AddOrUpdateAlarmController extends GetxController {
),
TextButton(
style: TextButton.styleFrom(
backgroundColor: kprimaryColor,
backgroundColor: getPrimaryColorTheme(),
),
child: const Text(
'Grant Permission',
Expand Down Expand Up @@ -290,7 +290,7 @@ class AddOrUpdateAlarmController extends GetxController {
Get.back();
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(kprimaryColor),
backgroundColor: MaterialStateProperty.all(getPrimaryColorTheme()),
),
child: Text(
'Cancel'.tr,
Expand Down Expand Up @@ -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: () {
Expand All @@ -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: () {
Expand Down Expand Up @@ -465,7 +465,7 @@ class AddOrUpdateAlarmController extends GetxController {
TextButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(kprimaryColor),
MaterialStateProperty.all(getPrimaryColorTheme()),
),
child: Text(
'Save',
Expand All @@ -485,7 +485,7 @@ class AddOrUpdateAlarmController extends GetxController {
TextButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(kprimaryColor),
MaterialStateProperty.all(getPrimaryColorTheme()),
),
child: Text(
'Retake',
Expand All @@ -505,7 +505,7 @@ class AddOrUpdateAlarmController extends GetxController {
TextButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(kprimaryColor),
MaterialStateProperty.all(getPrimaryColorTheme()),
),
child: Text(
'Disable',
Expand Down Expand Up @@ -572,7 +572,7 @@ class AddOrUpdateAlarmController extends GetxController {
},
confirm: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(kprimaryColor),
backgroundColor: MaterialStateProperty.all(getPrimaryColorTheme()),
),
child: Obx(
() => Text(
Expand Down Expand Up @@ -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(
Expand All @@ -1250,6 +1255,7 @@ class AddOrUpdateAlarmController extends GetxController {
: ThemeData.dark().copyWith(
colorScheme: const ColorScheme.dark(
primary: kprimaryColor,

),
),
child: child!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class AddOrUpdateAlarmView extends GetView<AddOrUpdateAlarmController> {
TextButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(kprimaryColor),
MaterialStateProperty.all(getPrimaryColorTheme()),
),
child: Obx(
() => Text(
Expand Down Expand Up @@ -305,7 +305,7 @@ class AddOrUpdateAlarmView extends GetView<AddOrUpdateAlarmController> {
FontWeight
.bold,
color:
kprimaryColor,
getPrimaryColorTheme(),
),
textStyle: Theme.of(
context)
Expand Down Expand Up @@ -415,7 +415,7 @@ class AddOrUpdateAlarmView extends GetView<AddOrUpdateAlarmController> {
FontWeight
.bold,
color:
kprimaryColor,
getPrimaryColorTheme(),
),
textStyle: Theme.of(
context)
Expand Down Expand Up @@ -560,7 +560,7 @@ class AddOrUpdateAlarmView extends GetView<AddOrUpdateAlarmController> {
FontWeight
.bold,
color:
kprimaryColor,
getPrimaryColorTheme(),
),
textStyle: Theme.of(
context)
Expand Down Expand Up @@ -750,17 +750,17 @@ class AddOrUpdateAlarmView extends GetView<AddOrUpdateAlarmController> {
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(),
),
),
),
Expand Down Expand Up @@ -1036,7 +1036,7 @@ class AddOrUpdateAlarmView extends GetView<AddOrUpdateAlarmController> {
child: TextButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(kprimaryColor),
WidgetStateProperty.all(getPrimaryColorTheme()),
),
child: Text(
(controller.alarmRecord.value.alarmID == '')
Expand Down
2 changes: 1 addition & 1 deletion lib/app/modules/addOrUpdateAlarm/views/alarm_id_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class AlarmIDTile extends StatelessWidget {
child: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
kprimaryColor,
getPrimaryColorTheme(),
),
),
child: Text(
Expand Down
4 changes: 2 additions & 2 deletions lib/app/modules/addOrUpdateAlarm/views/alarm_offset_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -87,7 +87,7 @@ class AlarmOffset extends StatelessWidget {
style: ElevatedButton.styleFrom(
backgroundColor: (!controller
.isOffsetBefore.value)
? kprimaryColor
? getPrimaryColorTheme()
: themeController.primaryTextColor.value
.withOpacity(0.10),
foregroundColor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class AscendingVolumeTile extends StatelessWidget {
Get.back();
},
style: ElevatedButton.styleFrom(
backgroundColor: kprimaryColor,
backgroundColor: getPrimaryColorTheme(),
),
child: Text(
'Apply Gradient'.tr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class ChooseRingtoneTile extends StatelessWidget {
116,
111,
110) // Change this color to red
: kprimaryColor,
: getPrimaryColorTheme(),
),
),
if (!defaultRingtones.contains(
Expand Down Expand Up @@ -209,7 +209,7 @@ class ChooseRingtoneTile extends StatelessWidget {
child: Text(
'Upload Ringtone'.tr,
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: kprimaryColor,
color: getPrimaryColorTheme(),
),
),
),
Expand All @@ -221,7 +221,7 @@ class ChooseRingtoneTile extends StatelessWidget {
Get.back();
},
style: ElevatedButton.styleFrom(
backgroundColor: kprimaryColor,
backgroundColor: getPrimaryColorTheme(),
),
child: Text(
'Done'.tr,
Expand Down
2 changes: 1 addition & 1 deletion lib/app/modules/addOrUpdateAlarm/views/delete_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/app/modules/addOrUpdateAlarm/views/guardian_angel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/app/modules/addOrUpdateAlarm/views/label_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -144,7 +144,7 @@ class MathsChallenge extends StatelessWidget {
TextButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(kprimaryColor),
MaterialStateProperty.all(getPrimaryColorTheme()),
),
child: Text(
'Save'.tr,
Expand Down
2 changes: 1 addition & 1 deletion lib/app/modules/addOrUpdateAlarm/views/note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class PedometerChallenge extends StatelessWidget {
Get.back();
},
style: ElevatedButton.styleFrom(
backgroundColor: kprimaryColor,
backgroundColor: getPrimaryColorTheme(),
// Set the desired background color
),
child: Text(
Expand Down
2 changes: 1 addition & 1 deletion lib/app/modules/addOrUpdateAlarm/views/quote_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand Down
4 changes: 2 additions & 2 deletions lib/app/modules/addOrUpdateAlarm/views/repeat_once_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Loading