Skip to content
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

refactor: theme checks accross application replaced with central Theme #402

Open
wants to merge 5 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
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.primaryBackgroundColor,
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
Loading