Skip to content

Commit

Permalink
refactor: theme checks accross application replaced with central them…
Browse files Browse the repository at this point in the history
…e extensions
  • Loading branch information
SGI-CAPP-AT2 committed Dec 24, 2024
1 parent d1d4ca2 commit bac8414
Show file tree
Hide file tree
Showing 51 changed files with 676 additions and 1,248 deletions.
2 changes: 0 additions & 2 deletions lib/app/modules/about/views/about_page_app_bar.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:taskwarrior/app/modules/about/controllers/about_controller.dart';


import 'package:taskwarrior/app/utils/constants/taskwarrior_colors.dart';
import 'package:taskwarrior/app/utils/gen/fonts.gen.dart';
import 'package:taskwarrior/app/utils/language/sentence_manager.dart';
Expand Down
60 changes: 18 additions & 42 deletions lib/app/modules/about/views/about_page_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import 'package:taskwarrior/app/modules/about/controllers/about_controller.dart'
import 'package:taskwarrior/app/utils/gen/assets.gen.dart';
import 'package:taskwarrior/app/utils/gen/fonts.gen.dart';
import 'package:taskwarrior/app/utils/language/sentence_manager.dart';
import 'package:taskwarrior/app/utils/themes/theme_extension.dart';
import 'package:url_launcher/url_launcher.dart';

import 'package:taskwarrior/app/utils/constants/taskwarrior_colors.dart';
import 'package:taskwarrior/app/utils/constants/taskwarrior_fonts.dart';
import 'package:taskwarrior/app/utils/app_settings/app_settings.dart';

class AboutPageBody extends StatelessWidget {
final AboutController aboutController;
const AboutPageBody({required this.aboutController, super.key});

@override
Widget build(BuildContext context) {
TaskwarriorColorTheme tColors = Theme.of(context).extension<TaskwarriorColorTheme>()!;
String introduction =
SentenceManager(currentLanguage: aboutController.selectedLanguage.value)
.sentences
Expand Down Expand Up @@ -51,9 +51,7 @@ class AboutPageBody extends StatelessWidget {
fontFamily: FontFamily.poppins,
fontWeight: TaskWarriorFonts.bold,
fontSize: TaskWarriorFonts.fontSizeExtraLarge,
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
color: tColors.primaryTextColor,
),
),
SizedBox(
Expand Down Expand Up @@ -84,19 +82,15 @@ class AboutPageBody extends StatelessWidget {
fontFamily: FontFamily.poppins,
fontWeight: TaskWarriorFonts.bold,
fontSize: TaskWarriorFonts.fontSizeMedium,
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
color: tColors.primaryTextColor,
),
),
TextSpan(
text: appInfoLines[1],
style: TextStyle(
fontFamily: FontFamily.poppins,
fontSize: TaskWarriorFonts.fontSizeMedium,
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
color: tColors.primaryTextColor,
),
),
],
Expand All @@ -116,9 +110,7 @@ class AboutPageBody extends StatelessWidget {
fontWeight: TaskWarriorFonts.bold,
fontSize:
TaskWarriorFonts.fontSizeMedium,
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
color: tColors.primaryTextColor,
),
),
TextSpan(
Expand All @@ -127,9 +119,7 @@ class AboutPageBody extends StatelessWidget {
fontFamily: FontFamily.poppins,
fontSize:
TaskWarriorFonts.fontSizeMedium,
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
color: tColors.primaryTextColor,
),
),
],
Expand All @@ -154,9 +144,7 @@ class AboutPageBody extends StatelessWidget {
fontFamily: FontFamily.poppins,
fontWeight: TaskWarriorFonts.medium,
fontSize: TaskWarriorFonts.fontSizeSmall,
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
color: tColors.primaryTextColor,
),
),
SizedBox(
Expand All @@ -170,9 +158,7 @@ class AboutPageBody extends StatelessWidget {
height: Get.height * 0.05,
child: ElevatedButton.icon(
style: ElevatedButton.styleFrom(
backgroundColor: AppSettings.isDarkMode
? TaskWarriorColors.kLightSecondaryBackgroundColor
: TaskWarriorColors.ksecondaryBackgroundColor,
backgroundColor: tColors.secondaryTextColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
Expand All @@ -190,19 +176,15 @@ class AboutPageBody extends StatelessWidget {
width: 20,
height: 20,
colorFilter: ColorFilter.mode(
AppSettings.isDarkMode
? TaskWarriorColors.black
: TaskWarriorColors.white,
tColors.secondaryBackgroundColor!,
BlendMode.srcIn)),
label: Text(
"GitHub",
style: TextStyle(
fontFamily: FontFamily.poppins,
fontWeight: TaskWarriorFonts.medium,
fontSize: TaskWarriorFonts.fontSizeSmall,
color: AppSettings.isDarkMode
? TaskWarriorColors.black
: TaskWarriorColors.white,
color: tColors.secondaryBackgroundColor,
),
),
),
Expand All @@ -212,9 +194,7 @@ class AboutPageBody extends StatelessWidget {
height: Get.height * 0.05,
child: ElevatedButton.icon(
style: ElevatedButton.styleFrom(
backgroundColor: AppSettings.isDarkMode
? TaskWarriorColors.kLightSecondaryBackgroundColor
: TaskWarriorColors.ksecondaryBackgroundColor,
backgroundColor: tColors.secondaryTextColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
Expand All @@ -229,19 +209,17 @@ class AboutPageBody extends StatelessWidget {
width: 20,
height: 20,
colorFilter: ColorFilter.mode(
AppSettings.isDarkMode
? TaskWarriorColors.black
: TaskWarriorColors.white,
BlendMode.srcIn)),
tColors.secondaryBackgroundColor!,
BlendMode.srcIn
)
),
label: Text(
"CCExtractor",
style: TextStyle(
fontFamily: FontFamily.poppins,
fontWeight: TaskWarriorFonts.medium,
fontSize: TaskWarriorFonts.fontSizeSmall,
color: AppSettings.isDarkMode
? TaskWarriorColors.black
: TaskWarriorColors.white,
color: tColors.secondaryBackgroundColor,
),
),
),
Expand All @@ -261,9 +239,7 @@ class AboutPageBody extends StatelessWidget {
fontFamily: FontFamily.poppins,
fontWeight: TaskWarriorFonts.semiBold,
fontSize: TaskWarriorFonts.fontSizeMedium,
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
color: tColors.primaryTextColor,
),
),
SizedBox(
Expand Down
8 changes: 3 additions & 5 deletions lib/app/modules/about/views/about_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ import 'package:get/get.dart';

import 'package:taskwarrior/app/modules/about/views/about_page_app_bar.dart';
import 'package:taskwarrior/app/modules/about/views/about_page_body.dart';
import 'package:taskwarrior/app/utils/themes/theme_extension.dart';

import '../controllers/about_controller.dart';
import 'package:taskwarrior/app/utils/constants/taskwarrior_colors.dart';
import 'package:taskwarrior/app/utils/app_settings/app_settings.dart';

class AboutView extends GetView<AboutController> {
const AboutView({super.key});
@override
Widget build(BuildContext context) {
TaskwarriorColorTheme tColors = Theme.of(context).extension<TaskwarriorColorTheme>()!;
return Scaffold(
appBar: AboutPageAppBar(aboutController: controller,),
backgroundColor: AppSettings.isDarkMode
? TaskWarriorColors.kprimaryBackgroundColor
: TaskWarriorColors.white,
backgroundColor: tColors.primaryBackgroundColor,
body: AboutPageBody(
aboutController: controller,
),
Expand Down
44 changes: 13 additions & 31 deletions lib/app/modules/detailRoute/views/dateTimePicker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:intl/intl.dart';

import 'package:taskwarrior/app/utils/constants/constants.dart';
import 'package:taskwarrior/app/utils/gen/fonts.gen.dart';
import 'package:taskwarrior/app/utils/app_settings/app_settings.dart';
import 'package:taskwarrior/app/utils/themes/theme_extension.dart';

class DateTimeWidget extends StatelessWidget {
const DateTimeWidget({
Expand All @@ -25,15 +25,12 @@ class DateTimeWidget extends StatelessWidget {

@override
Widget build(BuildContext context) {
TaskwarriorColorTheme tColors = Theme.of(context).extension<TaskwarriorColorTheme>()!;
return Card(
key: globalKey,
color: AppSettings.isDarkMode
? const Color.fromARGB(255, 57, 57, 57)
: Colors.white,
color: tColors.secondaryBackgroundColor,
child: ListTile(
textColor: AppSettings.isDarkMode
? Colors.white
: const Color.fromARGB(255, 48, 46, 46),
textColor: tColors.primaryTextColor,
title: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
Expand All @@ -54,9 +51,7 @@ class DateTimeWidget extends StatelessWidget {
fontFamily: FontFamily.poppins,
fontWeight: TaskWarriorFonts.bold,
fontSize: TaskWarriorFonts.fontSizeMedium,
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
color: tColors.primaryTextColor,
),
),
TextSpan(
Expand All @@ -70,9 +65,7 @@ class DateTimeWidget extends StatelessWidget {
style: TextStyle(
fontFamily: FontFamily.poppins,
fontSize: TaskWarriorFonts.fontSizeMedium,
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
color: tColors.primaryTextColor,
),
),
],
Expand Down Expand Up @@ -170,14 +163,10 @@ class DateTimeWidget extends StatelessWidget {
content: Text(
"Can't set times in the past",
style: TextStyle(
color: AppSettings.isDarkMode
? TaskWarriorColors.kprimaryTextColor
: TaskWarriorColors.kLightPrimaryTextColor,
color: tColors.primaryTextColor,
),
),
backgroundColor: AppSettings.isDarkMode
? TaskWarriorColors.ksecondaryBackgroundColor
: TaskWarriorColors.kLightSecondaryBackgroundColor,
backgroundColor: tColors.primaryTextColor,
duration: const Duration(seconds: 2),
),
);
Expand Down Expand Up @@ -208,14 +197,11 @@ class StartWidget extends StatelessWidget {

@override
Widget build(BuildContext context) {
TaskwarriorColorTheme tColors = Theme.of(context).extension<TaskwarriorColorTheme>()!;
return Card(
color: AppSettings.isDarkMode
? const Color.fromARGB(255, 57, 57, 57)
: Colors.white,
color: tColors.secondaryBackgroundColor,
child: ListTile(
textColor: AppSettings.isDarkMode
? Colors.white
: const Color.fromARGB(255, 48, 46, 46),
textColor: tColors.secondaryBackgroundColor,
title: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
Expand All @@ -236,9 +222,7 @@ class StartWidget extends StatelessWidget {
fontFamily: FontFamily.poppins,
fontWeight: TaskWarriorFonts.bold,
fontSize: TaskWarriorFonts.fontSizeMedium,
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
color: tColors.primaryTextColor,
),
),
TextSpan(
Expand All @@ -252,9 +236,7 @@ class StartWidget extends StatelessWidget {
style: TextStyle(
fontFamily: FontFamily.poppins,
fontSize: TaskWarriorFonts.fontSizeMedium,
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
color: tColors.primaryTextColor,
),
),
],
Expand Down
Loading

0 comments on commit bac8414

Please sign in to comment.