diff --git a/lib/config/taskwarriorcolors.dart b/lib/config/taskwarriorcolors.dart index 11fa148b..4c5134ef 100644 --- a/lib/config/taskwarriorcolors.dart +++ b/lib/config/taskwarriorcolors.dart @@ -1,10 +1,37 @@ // ignore_for_file: file_names import 'package:flutter/material.dart'; +import 'package:taskwarrior/widgets/pallete.dart'; -class Appcolors { +class TaskWarriorColors { + // Normal Colors static Color red = Colors.red; static Color green = Colors.green; static Color yellow = Colors.yellow; static Color white = Colors.white; + static Color black = Colors.black; + static Color grey = Colors.grey; + static Color? lightGrey = Colors.grey[600]; + static Color purple = Colors.purple; + static Color borderColor = Colors.grey.shade300; + static Color deepPurpleAccent = Colors.deepPurpleAccent; + static Color deepPurple = Colors.deepPurple; + + // Dark Theme Color Palette + static Color kprimaryBackgroundColor = Palette.kToDark.shade200; + static Color ksecondaryBackgroundColor = + const Color.fromARGB(255, 48, 46, 46); + static Color kprimaryTextColor = Colors.white; + static Color ksecondaryTextColor = Colors.white; + static Color kprimaryDisabledTextColor = const Color(0xff595f6b); + static Color kdialogBackGroundColor = const Color.fromARGB(255, 25, 25, 25); + + // Light Theme Color Palette + static Color kLightPrimaryBackgroundColor = Colors.white; + static Color kLightSecondaryBackgroundColor = + const Color.fromARGB(255, 220, 216, 216); + static Color kLightPrimaryTextColor = Colors.black; + static Color kLightSecondaryTextColor = const Color.fromARGB(255, 48, 46, 46); + static Color kLightPrimaryDisabledTextColor = const Color(0xffACACAB); + static Color kLightDialogBackGroundColor = Colors.white; } diff --git a/lib/config/taskwarriorfonts.dart b/lib/config/taskwarriorfonts.dart new file mode 100644 index 00000000..1ce29ef2 --- /dev/null +++ b/lib/config/taskwarriorfonts.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; + +class TaskWarriorFonts { + // Font weights + static const FontWeight thin = FontWeight.w100; + static const FontWeight extraLight = FontWeight.w200; + static const FontWeight light = FontWeight.w300; + static const FontWeight regular = FontWeight.w400; + static const FontWeight medium = FontWeight.w500; + static const FontWeight semiBold = FontWeight.w600; + static const FontWeight bold = FontWeight.w700; + static const FontWeight extraBold = FontWeight.w800; + static const FontWeight black = FontWeight.w900; + + // Font sizes + static const double fontSizeSmall = 12.0; + static const double fontSizeMedium = 16.0; + static const double fontSizeLarge = 20.0; + static const double fontSizeExtraLarge = 24.0; +} diff --git a/lib/config/theme_switcher_clipper.dart b/lib/config/theme_switcher_clipper.dart index aae6779a..bcea6e6e 100644 --- a/lib/config/theme_switcher_clipper.dart +++ b/lib/config/theme_switcher_clipper.dart @@ -1,6 +1,7 @@ // ignore_for_file: library_private_types_in_public_api import 'package:flutter/material.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; class ThemeSwitcherClipper extends StatefulWidget { final bool isDarkMode; @@ -36,7 +37,9 @@ class _ThemeSwitcherClipperState extends State { child: Icon( widget.isDarkMode ? Icons.dark_mode : Icons.light_mode, key: UniqueKey(), - color: widget.isDarkMode ? Colors.white : Colors.black, + color: widget.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, size: 40, ), )), diff --git a/lib/controller/WidgetController.dart b/lib/controller/WidgetController.dart index 30e7f382..d705be9e 100644 --- a/lib/controller/WidgetController.dart +++ b/lib/controller/WidgetController.dart @@ -7,8 +7,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:get/get.dart'; // Import the GetX package import 'package:home_widget/home_widget.dart'; -// ignore: depend_on_referenced_packages -import 'package:path_provider/path_provider.dart'; import 'package:syncfusion_flutter_charts/charts.dart'; import 'package:taskwarrior/views/home/home.dart'; import 'package:taskwarrior/widgets/taskdetails/profiles_widget.dart'; @@ -36,7 +34,7 @@ class WidgetController extends GetxController { storageWidget = StorageWidget.of(context!); // Use Get.context from GetX var currentProfile = ProfilesWidget.of(context!).currentProfile; - baseDirectory = await getApplicationDocumentsDirectory(); + baseDirectory = ProfilesWidget.of(context!).getBaseDirectory(); storage = Storage(Directory('${baseDirectory!.path}/profiles/$currentProfile')); diff --git a/lib/drawer/filter_drawer.dart b/lib/drawer/filter_drawer.dart index 9c308e90..a99e9ba8 100644 --- a/lib/drawer/filter_drawer.dart +++ b/lib/drawer/filter_drawer.dart @@ -4,6 +4,8 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/controller/filter_drawer_tour_controller.dart'; import 'package:taskwarrior/drawer/filter_drawer_tour.dart'; import 'package:taskwarrior/model/storage/storage_widget.dart'; @@ -30,8 +32,8 @@ class _FilterDrawerState extends State { bool isSaved = false; var tileColor = AppSettings.isDarkMode - ? const Color.fromARGB(255, 48, 46, 46) - : const Color.fromARGB(255, 220, 216, 216); + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor; late TutorialCoachMark tutorialCoachMark; void _initFilterDrawerTour() { @@ -42,7 +44,7 @@ class _FilterDrawerState extends State { filterTagKey: filterTagKey, sortByKey: sortByKey, ), - colorShadow: Colors.black, + colorShadow: TaskWarriorColors.black, paddingFocus: 10, opacityShadow: 1.00, hideSkip: true, @@ -83,8 +85,11 @@ class _FilterDrawerState extends State { var storageWidget = StorageWidget.of(context); return Drawer( backgroundColor: AppSettings.isDarkMode - ? Color.fromARGB(255, 29, 29, 29) - : Colors.white, + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, + surfaceTintColor: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, child: SafeArea( child: Padding( padding: const EdgeInsets.all(8), @@ -103,11 +108,11 @@ class _FilterDrawerState extends State { child: Text( 'Apply Filters', style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, + fontWeight: TaskWarriorFonts.bold, color: (AppSettings.isDarkMode - ? Colors.white - : Color.fromARGB(255, 48, 46, 46)), - fontSize: 25), + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor), + fontSize: TaskWarriorFonts.fontSizeExtraLarge), ), ), ), @@ -120,7 +125,7 @@ class _FilterDrawerState extends State { decoration: BoxDecoration( color: tileColor, borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey.shade300), + border: Border.all(color: TaskWarriorColors.borderColor), ), child: ListTile( contentPadding: EdgeInsets.only( @@ -134,11 +139,11 @@ class _FilterDrawerState extends State { TextSpan( text: 'Status : ', style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), TextSpan( @@ -146,10 +151,10 @@ class _FilterDrawerState extends State { ? 'pending' : 'completed', style: GoogleFonts.poppins( - fontSize: 15, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), ], @@ -157,8 +162,8 @@ class _FilterDrawerState extends State { ), onTap: widget.filters.togglePendingFilter, textColor: AppSettings.isDarkMode - ? Colors.white - : Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightSecondaryTextColor, ), ), const Divider( @@ -171,7 +176,7 @@ class _FilterDrawerState extends State { decoration: BoxDecoration( color: tileColor, borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey.shade300), + border: Border.all(color: TaskWarriorColors.borderColor), ), child: ProjectsColumn( widget.filters.projects, @@ -189,7 +194,7 @@ class _FilterDrawerState extends State { decoration: BoxDecoration( color: tileColor, borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey.shade300), + border: Border.all(color: TaskWarriorColors.borderColor), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -203,10 +208,10 @@ class _FilterDrawerState extends State { 'Filter Tag By:', style: GoogleFonts.poppins( color: (AppSettings.isDarkMode - ? Colors.white - : Color.fromARGB(255, 48, 46, 46)), + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightSecondaryTextColor), // - fontSize: 18), + fontSize: TaskWarriorFonts.fontSizeLarge), //textAlign: TextAlign.right, ), ), @@ -233,7 +238,7 @@ class _FilterDrawerState extends State { decoration: BoxDecoration( color: tileColor, borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey.shade300), + border: Border.all(color: TaskWarriorColors.borderColor), ), //height: 30, child: Column( @@ -247,9 +252,9 @@ class _FilterDrawerState extends State { 'Sort By', style: GoogleFonts.poppins( color: (AppSettings.isDarkMode - ? Colors.white - : Color.fromARGB(255, 48, 46, 46)), - fontSize: 18), + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor), + fontSize: TaskWarriorFonts.fontSizeLarge), // textAlign: TextAlign.right, ), ), @@ -292,11 +297,12 @@ class _FilterDrawerState extends State { }, labelStyle: GoogleFonts.poppins( color: AppSettings.isDarkMode - ? Colors.black - : Colors.white), + ? TaskWarriorColors.black + : TaskWarriorColors.white), backgroundColor: AppSettings.isDarkMode - ? Color.fromARGB(255, 220, 216, 216) - : Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors + .kLightSecondaryBackgroundColor + : TaskWarriorColors.ksecondaryBackgroundColor, ), ], ), @@ -307,11 +313,10 @@ class _FilterDrawerState extends State { Container( width: 200, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: AppSettings.isDarkMode - ? Color.fromARGB(255, 220, 216, 216) - : Color.fromARGB(255, 48, 46, 46), - ), + borderRadius: BorderRadius.circular(10), + color: AppSettings.isDarkMode + ? TaskWarriorColors.kLightSecondaryBackgroundColor + : TaskWarriorColors.ksecondaryBackgroundColor), child: TextButton( onPressed: () { if (storageWidget.selectedSort.endsWith('+') || @@ -324,10 +329,10 @@ class _FilterDrawerState extends State { child: Text( 'Reset Sort', style: GoogleFonts.poppins( - fontSize: 15, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode - ? Color.fromARGB(255, 48, 46, 46) - : Colors.white), + ? TaskWarriorColors.kLightSecondaryTextColor + : TaskWarriorColors.ksecondaryTextColor), )), ), const Divider( diff --git a/lib/drawer/filter_drawer_tour.dart b/lib/drawer/filter_drawer_tour.dart index 6ee498f7..b2bd7e78 100644 --- a/lib/drawer/filter_drawer_tour.dart +++ b/lib/drawer/filter_drawer_tour.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; import 'package:tutorial_coach_mark/tutorial_coach_mark.dart'; List filterDrawer({ @@ -31,7 +32,7 @@ List filterDrawer({ "Filter tasks based on their completion status", textAlign: TextAlign.center, style: GoogleFonts.poppins( - color: Colors.white, + color: TaskWarriorColors.white, ), ), ], @@ -64,7 +65,7 @@ List filterDrawer({ "Filter tasks based on the projects", textAlign: TextAlign.center, style: GoogleFonts.poppins( - color: Colors.white, + color: TaskWarriorColors.white, ), ), ], @@ -97,7 +98,7 @@ List filterDrawer({ "Toggle between AND and OR tag union types", textAlign: TextAlign.center, style: GoogleFonts.poppins( - color: Colors.white, + color: TaskWarriorColors.white, ), ), ], @@ -130,7 +131,7 @@ List filterDrawer({ "Sort tasks based on time of creation, urgency, due date, start date, etc.", textAlign: TextAlign.center, style: GoogleFonts.poppins( - color: Colors.white, + color: TaskWarriorColors.white, ), ), ], diff --git a/lib/drawer/nav_drawer.dart b/lib/drawer/nav_drawer.dart index 1444c1af..cecf0765 100644 --- a/lib/drawer/nav_drawer.dart +++ b/lib/drawer/nav_drawer.dart @@ -5,7 +5,10 @@ import 'package:flutter/services.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:sizer/sizer.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/model/storage/storage_widget.dart'; +import 'package:taskwarrior/utility/utilities.dart'; import 'package:taskwarrior/views/about/about.dart'; import 'package:taskwarrior/views/profile/profile.dart'; import 'package:taskwarrior/views/reports/reports_home.dart'; @@ -30,14 +33,23 @@ class _NavDrawerState extends State { @override Widget build(BuildContext context) { return Drawer( - backgroundColor: AppSettings.isDarkMode ? Colors.black : Colors.white, + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, + surfaceTintColor: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, child: Container( - color: AppSettings.isDarkMode ? Colors.black : Colors.white, + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, child: ListView( padding: EdgeInsets.zero, children: [ Container( - color: AppSettings.isDarkMode ? Colors.black : Colors.white, + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, padding: const EdgeInsets.only(top: 50, left: 15, right: 10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -45,10 +57,11 @@ class _NavDrawerState extends State { Text( 'Menu', style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: - AppSettings.isDarkMode ? Colors.white : Colors.black, + fontSize: TaskWarriorFonts.fontSizeExtraLarge, + fontWeight: TaskWarriorFonts.bold, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), Padding( @@ -66,8 +79,8 @@ class _NavDrawerState extends State { ? Icons.dark_mode : Icons.light_mode, color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, + ? TaskWarriorColors.white + : TaskWarriorColors.black, size: 15, ), ), @@ -76,7 +89,9 @@ class _NavDrawerState extends State { ), ), Container( - color: AppSettings.isDarkMode ? Colors.black : Colors.white, + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, height: 3.h, ), buildMenuItem( @@ -119,8 +134,7 @@ class _NavDrawerState extends State { onTap: () async { bool syncOnStart = false; bool syncOnTaskCreate = false; - bool delaytask= false; - + bool delaytask = false; ///check if auto sync is on or off final SharedPreferences prefs = @@ -129,8 +143,7 @@ class _NavDrawerState extends State { syncOnStart = prefs.getBool('sync-onStart') ?? false; syncOnTaskCreate = prefs.getBool('sync-OnTaskCreate') ?? false; - delaytask = - prefs.getBool('delaytask') ?? false; + delaytask = prefs.getBool('delaytask') ?? false; }); // print(syncOnStart); // print(syncOnTaskCreate); @@ -165,20 +178,26 @@ class _NavDrawerState extends State { return InkWell( onTap: onTap, child: Container( - color: AppSettings.isDarkMode ? Colors.black : Colors.white, + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 10), child: Row( children: [ Icon( icon, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), const SizedBox(width: 10), Text( text, style: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, - fontSize: 18, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + fontSize: TaskWarriorFonts.fontSizeMedium, ), ), ], @@ -193,18 +212,46 @@ Future _showExitConfirmationDialog(BuildContext context) async { context: context, barrierDismissible: false, // Prevents closing the dialog by tapping outside builder: (BuildContext context) { - return AlertDialog( - title: const Text('Exit App'), - content: const Text('Are you sure you want to exit the app?'), + return Utils.showAlertDialog( + title: Text( + 'Exit App', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + content: Text( + 'Are you sure you want to exit the app?', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), actions: [ TextButton( - child: const Text('Cancel'), + child: Text( + 'Cancel', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), onPressed: () { Navigator.of(context).pop(); // Close the dialog }, ), TextButton( - child: const Text('Exit'), + child: Text( + 'Exit', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), onPressed: () { Navigator.of(context).pop(); // Close the dialog SystemNavigator.pop(); // Exit the app diff --git a/lib/main.dart b/lib/main.dart index a8089ba8..7eb747ee 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -10,6 +10,7 @@ import 'package:home_widget/home_widget.dart'; import 'package:loggy/loggy.dart'; import 'package:path_provider/path_provider.dart'; import 'package:permission_handler/permission_handler.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import 'package:sizer/sizer.dart'; import 'package:taskwarrior/config/app_settings.dart'; import 'package:taskwarrior/controller/WidgetController.dart'; @@ -52,17 +53,30 @@ Future main([List args = const []]) async { } SystemChrome.setPreferredOrientations( [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]) - .then((value) => runApp( - FutureBuilder( - future: getApplicationDocumentsDirectory(), - builder: (context, snapshot) => (snapshot.hasData) - ? ProfilesWidget( - baseDirectory: testingDirectory ?? snapshot.data!, - child: const MyApp(), - ) - : const AppSetupPlaceholder(), - ), - )); + .then((value) => runApp(FutureBuilder>( + future: getDirectories(), + builder: (context, snapshot) { + if (snapshot.hasData) { + return ProfilesWidget( + defaultDirectory: snapshot.data![0], + baseDirectory: testingDirectory ?? snapshot.data![1], + child: const MyApp(), + ); + } else { + return const AppSetupPlaceholder(); + } + }))); + +} + +Future> getDirectories() async { + Directory defaultDirectory = await getApplicationDocumentsDirectory(); + SharedPreferences prefs = await SharedPreferences.getInstance(); + String? directory = prefs.getString('baseDirectory'); + Directory baseDirectory = + (directory != null) ? Directory(directory) : defaultDirectory; + return [defaultDirectory, baseDirectory]; + } Future init() async { diff --git a/lib/model/storage/storage_widget.dart b/lib/model/storage/storage_widget.dart index 52d5030d..0e80d7cd 100644 --- a/lib/model/storage/storage_widget.dart +++ b/lib/model/storage/storage_widget.dart @@ -9,6 +9,9 @@ import 'package:get/get.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:loggy/loggy.dart'; +import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/model/json.dart'; import 'package:taskwarrior/model/storage.dart'; @@ -250,12 +253,19 @@ class _StorageWidgetState extends State { try { final connectivityResult = await Connectivity().checkConnectivity(); if (connectivityResult == ConnectivityResult.none) { - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( + ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text( - 'You are not connected to the internet. Please check your network connection.'), - ), - ); + 'You are not connected to the internet. Please check your network connection.', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), + ), + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); } else { if (isDialogNeeded) { showDialog( @@ -277,16 +287,16 @@ class _StorageWidgetState extends State { Text( "Syncing", style: GoogleFonts.poppins( - fontSize: 18.0, - fontWeight: FontWeight.bold, + fontSize: TaskWarriorFonts.fontSizeLarge, + fontWeight: TaskWarriorFonts.bold, ), ), const SizedBox(height: 8.0), Text( "Please wait...", style: GoogleFonts.poppins( - fontSize: 12.0, - fontWeight: FontWeight.normal, + fontSize: TaskWarriorFonts.fontSizeSmall, + fontWeight: TaskWarriorFonts.regular, ), ), ], @@ -307,11 +317,19 @@ class _StorageWidgetState extends State { Get.back(); } - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text('${header['code']}: ${header['status']}'), - ), - ); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text( + '${header['code']}: ${header['status']}', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), + ), + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); } } catch (e, trace) { if (isDialogNeeded) { diff --git a/lib/services/task_details.dart b/lib/services/task_details.dart index 65621115..3f764fe6 100644 --- a/lib/services/task_details.dart +++ b/lib/services/task_details.dart @@ -7,13 +7,15 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:intl/intl.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/model/storage/storage_widget.dart'; +import 'package:taskwarrior/utility/utilities.dart'; import 'package:taskwarrior/views/home/home.dart'; import 'package:taskwarrior/widgets/pallete.dart'; import 'package:taskwarrior/widgets/taskdetails.dart'; import 'package:taskwarrior/widgets/taskw.dart'; - class DetailRoute extends StatefulWidget { const DetailRoute(this.uuid, {super.key}); @@ -45,7 +47,6 @@ class _DetailRouteState extends State { }; } - void saveChanges() async { var now = DateTime.now().toUtc(); @@ -56,10 +57,17 @@ class _DetailRouteState extends State { setState(() {}); Navigator.of(context).pop(); ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: const Text('Task Updated'), + content: Text( + 'Task Updated', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), + ), backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 61, 61, 61) - : const Color.fromARGB(255, 39, 39, 39), + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, duration: const Duration(seconds: 2))); } @@ -79,8 +87,15 @@ class _DetailRouteState extends State { return showDialog( context: context, builder: (context) { - return AlertDialog( - title: const Text('Do you want to save changes?'), + return Utils.showAlertDialog( + title: Text( + 'Do you want to save changes?', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), actions: [ TextButton( onPressed: () { @@ -91,7 +106,14 @@ class _DetailRouteState extends State { ); setState(() {}); }, - child: const Text('Yes'), + child: Text( + 'Yes', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), ), TextButton( onPressed: () { @@ -100,13 +122,27 @@ class _DetailRouteState extends State { (route) => false, ); }, - child: const Text('No'), + child: Text( + 'No', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), ), TextButton( onPressed: () { Navigator.of(context).pop(); }, - child: const Text('Cancel'), + child: Text( + 'Cancel', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), ), ], ); @@ -115,14 +151,16 @@ class _DetailRouteState extends State { }, child: Scaffold( backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 29, 29, 29) - : Colors.white, + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, appBar: AppBar( - leading: const BackButton(color: Colors.white), + leading: BackButton(color: TaskWarriorColors.white), backgroundColor: Palette.kToDark, title: Text( 'id: ${(modify.id == 0) ? '-' : modify.id}', - style: GoogleFonts.poppins(color: Colors.white), + style: TextStyle( + color: TaskWarriorColors.white, + ), ), ), body: Padding( @@ -159,14 +197,30 @@ class _DetailRouteState extends State { floatingActionButton: (modify.changes.isEmpty) ? null : FloatingActionButton( + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.black + : TaskWarriorColors.white, + foregroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + splashColor: AppSettings.isDarkMode + ? TaskWarriorColors.black + : TaskWarriorColors.white, heroTag: "btn1", onPressed: () { showDialog( context: context, builder: (context) { - return AlertDialog( + return Utils.showAlertDialog( scrollable: true, - title: const Text('Review changes:'), + title: Text( + 'Review changes:', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), content: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Text( @@ -176,7 +230,11 @@ class _DetailRouteState extends State { ' new: ${entry.value['new']}') .toList() .join('\n'), - style: GoogleFonts.poppins(), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), ), actions: [ @@ -184,13 +242,27 @@ class _DetailRouteState extends State { onPressed: () { Navigator.of(context).pop(); }, - child: const Text('Cancel'), + child: Text( + 'Cancel', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), ), ElevatedButton( onPressed: () { saveChanges(); }, - child: const Text('Submit'), + child: Text( + 'Submit', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.black + : TaskWarriorColors.black, + ), + ), ), ], ); @@ -286,33 +358,32 @@ class AttributeWidget extends StatelessWidget { default: return Card( color: AppSettings.isDarkMode - ? const Color.fromARGB(255, 57, 57, 57) - : Colors.white, + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, child: ListTile( textColor: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightSecondaryTextColor, title: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( children: [ Text( '$name:'.padRight(13), - style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, - color: - AppSettings.isDarkMode ? Colors.white : Colors.black, + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), Text( localValue?.toString() ?? "not selected", - style: GoogleFonts.poppins( - fontSize: 15, - color: - AppSettings.isDarkMode ? Colors.white : Colors.black, + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), - ) + ), ], ), ), @@ -337,12 +408,12 @@ class TagsWidget extends StatelessWidget { Widget build(BuildContext context) { return Card( color: AppSettings.isDarkMode - ? const Color.fromARGB(255, 57, 57, 57) - : Colors.white, + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, child: ListTile( textColor: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.ksecondaryTextColor, title: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( @@ -353,23 +424,22 @@ class TagsWidget extends StatelessWidget { TextSpan( text: '$name:'.padRight(13), style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), TextSpan( text: '${(value as ListBuilder?)?.build() ?? 'not selected'}', - style: GoogleFonts.poppins( - fontSize: 15, + style: TextStyle( color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), - ) + ), ], ), ), diff --git a/lib/services/task_list_tem.dart b/lib/services/task_list_tem.dart index f31612e3..199da67b 100644 --- a/lib/services/task_list_tem.dart +++ b/lib/services/task_list_tem.dart @@ -1,6 +1,9 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/model/json.dart'; import 'package:taskwarrior/widgets/taskw.dart'; @@ -45,10 +48,19 @@ class _TaskListItemState extends State { modify.save( modified: () => now, ); - ScaffoldMessenger.of(context).showSnackBar(const SnackBar( - content: Text('Task Updated'), - duration: Duration(seconds: 2), - )); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text( + 'Task Updated', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), + ), + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); } @override @@ -130,7 +142,7 @@ class _TaskListItemState extends State { overflow: TextOverflow.ellipsis, style: GoogleFonts.poppins( color: dimColor, - fontSize: 12, + fontSize: TaskWarriorFonts.fontSizeSmall, ), ), ), @@ -187,7 +199,7 @@ class _TaskListItemState extends State { overflow: TextOverflow.ellipsis, style: GoogleFonts.poppins( color: dimColor, - fontSize: 12, + fontSize: TaskWarriorFonts.fontSizeSmall, ), ), ), diff --git a/lib/taskserver/ntaskserver.dart b/lib/taskserver/ntaskserver.dart index 72a8cf8a..ec6a2a96 100644 --- a/lib/taskserver/ntaskserver.dart +++ b/lib/taskserver/ntaskserver.dart @@ -1,6 +1,9 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:loggy/loggy.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; +import 'package:taskwarrior/utility/utilities.dart'; import 'package:taskwarrior/widgets/taskdetails/profiles_widget.dart'; // ignore_for_file: use_build_context_synchronously @@ -15,7 +18,6 @@ import 'package:taskwarrior/model/storage/set_config.dart'; import 'package:taskwarrior/model/storage/storage_widget.dart'; import 'package:taskwarrior/widgets/fingerprint.dart'; import 'package:taskwarrior/widgets/home_paths.dart' as rc; -import 'package:taskwarrior/widgets/pallete.dart'; import 'package:taskwarrior/widgets/taskdetails.dart'; import 'package:taskwarrior/widgets/taskserver.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -76,9 +78,9 @@ class _ManageTaskServerState extends State { context: context, barrierDismissible: false, builder: (context) { - return const AlertDialog( - title: Text('Fetching statistics...'), - content: Column( + return Utils.showAlertDialog( + title: const Text('Fetching statistics...'), + content: const Column( mainAxisSize: MainAxisSize.min, children: [ CircularProgressIndicator(), @@ -104,9 +106,16 @@ class _ManageTaskServerState extends State { // Show statistics in a dialog await showDialog( context: context, - builder: (context) => AlertDialog( + builder: (context) => Utils.showAlertDialog( scrollable: true, - title: const Text('Statistics:'), + title: Text( + 'Statistics:', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), content: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( @@ -118,7 +127,11 @@ class _ManageTaskServerState extends State { for (var key in header.keys.toList()) Text( '${'$key:'.padRight(maxKeyLength + 1)} ${header[key]}', - style: GoogleFonts.firaMono(), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), ], ), @@ -130,7 +143,14 @@ class _ManageTaskServerState extends State { onPressed: () { Navigator.of(context).pop(); }, - child: const Text('Ok'), + child: Text( + 'Ok', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), ), ], ), @@ -139,9 +159,24 @@ class _ManageTaskServerState extends State { // Dismiss the loading dialog Navigator.of(context).pop(); + //Displaying Error message. + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text( + trace.toString().startsWith("#0") + ? "Please set up your TaskServer." + : e.toString(), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), + ), + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); // Log the error and trace logError(e, trace); - // Refresh the state of ProfilesWidget ProfilesWidget.of(context).setState(() {}); } @@ -164,11 +199,9 @@ class _ManageTaskServerState extends State { server = Taskrc.fromString(contents).server; credentials = Taskrc.fromString(contents).credentials; } - var color = - AppSettings.isDarkMode ? Colors.white : Palette.kToDark.shade200; var tileColor = AppSettings.isDarkMode - ? const Color.fromARGB(255, 48, 46, 46) - : const Color.fromARGB(255, 220, 216, 216); + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor; if (contents != null) { server = Taskrc.fromString(contents).server; credentials = Taskrc.fromString(contents).credentials; @@ -224,27 +257,53 @@ class _ManageTaskServerState extends State { // Handle the case when server or credentials are missing in the Taskrc object Navigator.pop(context); - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text( - 'Success: Server or credentials are verified in taskrc file')), - ); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text( + 'Success: Server or credentials are verified in taskrc file', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); } else { Navigator.pop(context); // Handle the case when server or credentials are missing in the Taskrc object - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text( - 'Error: Server or credentials are missing in taskrc file')), - ); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text( + 'Error: Server or credentials are missing in taskrc file', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); } } else { Navigator.pop(context); // Handle the case when there is an error reading the taskrc file - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text('Error: Failed to read taskrc file')), - ); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text( + 'Error: Failed to read taskrc file', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); } } } @@ -252,7 +311,7 @@ class _ManageTaskServerState extends State { var height = MediaQuery.of(context).size.height; return Scaffold( appBar: AppBar( - backgroundColor: Palette.kToDark.shade200, + backgroundColor: TaskWarriorColors.kprimaryBackgroundColor, titleSpacing: 0, // Reduce the spacing between the title and leading/back button title: Column( @@ -260,23 +319,29 @@ class _ManageTaskServerState extends State { children: [ Text( "Configure TaskServer", - style: GoogleFonts.poppins(color: Colors.white, fontSize: 18), + style: GoogleFonts.poppins( + color: TaskWarriorColors.white, + fontSize: TaskWarriorFonts.fontSizeLarge, + ), ), Text( alias ?? profile, - style: GoogleFonts.poppins(color: Colors.white, fontSize: 12), + style: GoogleFonts.poppins( + color: TaskWarriorColors.white, + fontSize: TaskWarriorFonts.fontSizeSmall, + ), ), ], ), actions: [ IconButton( - icon: const Icon( + icon: Icon( Icons.info, - color: Colors.white, + color: TaskWarriorColors.white, ), onPressed: () async { String url = - "https://github.com/Pavel401/taskwarrior-flutter/blob/main/README.md#taskserver-setup"; + "https://github.com/CCExtractor/taskwarrior-flutter?tab=readme-ov-file#taskwarrior-mobile-app"; if (!await launchUrl(Uri.parse(url))) { throw Exception('Could not launch $url'); } @@ -284,26 +349,27 @@ class _ManageTaskServerState extends State { ), if (kDebugMode) IconButton( - icon: const Icon( + icon: Icon( Icons.bug_report, - color: Colors.white, + color: TaskWarriorColors.white, ), onPressed: _setConfigurationFromFixtureForDebugging, ), IconButton( - icon: const Icon( + icon: Icon( Icons.show_chart, - color: Colors.white, + color: TaskWarriorColors.white, ), onPressed: () => _showStatistics(context), ), ], - leading: const BackButton( - color: Colors.white, + leading: BackButton( + color: TaskWarriorColors.white, ), ), - backgroundColor: - AppSettings.isDarkMode ? Palette.kToDark.shade200 : Colors.white, + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, body: Padding( padding: const EdgeInsets.only(left: 20, right: 20), child: ListView( @@ -321,8 +387,11 @@ class _ManageTaskServerState extends State { children: [ Text( "Configure TASKRC", - style: GoogleFonts.poppins( - fontWeight: FontWeight.w500, color: color), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), const SizedBox(height: 10), GestureDetector( @@ -358,17 +427,19 @@ class _ManageTaskServerState extends State { children: [ Text( 'Configure TaskRc', - style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - color: color, + style: TextStyle( + fontWeight: TaskWarriorFonts.bold, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), Text( 'Paste the taskrc content or select taskrc file', - style: GoogleFonts.poppins( - fontWeight: FontWeight.w400, - color: color, - fontSize: 10, + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), const SizedBox(height: 16.0), @@ -377,42 +448,70 @@ class _ManageTaskServerState extends State { child: SizedBox( height: height * 0.15, child: TextField( + style: TextStyle( + color: + AppSettings.isDarkMode + ? TaskWarriorColors + .white + : TaskWarriorColors + .black), controller: taskrcContentController, maxLines: 8, - style: GoogleFonts.poppins( - color: Colors.white), decoration: InputDecoration( - suffixIconConstraints: - const BoxConstraints( - maxHeight: 24, - maxWidth: 24, - ), - isDense: true, - suffix: IconButton( - onPressed: () async { - setContent(); - }, - icon: const Icon( - Icons.content_paste), - ), - border: - const OutlineInputBorder(), - labelStyle: - GoogleFonts.poppins( - color: color), - labelText: - 'Paste your taskrc contents here', - ), + counterStyle: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors + .white + : TaskWarriorColors + .black), + suffixIconConstraints: + const BoxConstraints( + maxHeight: 24, + maxWidth: 24, + ), + isDense: true, + suffix: IconButton( + onPressed: () async { + setContent(); + }, + icon: const Icon( + Icons.content_paste), + ), + border: + const OutlineInputBorder(), + labelStyle: GoogleFonts + .poppins( + color: AppSettings + .isDarkMode + ? TaskWarriorColors + .white + : TaskWarriorColors + .black), + labelText: + 'Paste your taskrc contents here'), ), ), ), Text( "Or", - style: GoogleFonts.poppins( - color: color), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), FilledButton.tonal( + style: ButtonStyle( + backgroundColor: AppSettings + .isDarkMode + ? MaterialStateProperty.all< + Color>( + TaskWarriorColors.black) + : MaterialStateProperty.all< + Color>( + TaskWarriorColors + .white)), onPressed: () async { await setConfig( storage: storage, @@ -421,8 +520,14 @@ class _ManageTaskServerState extends State { setState(() {}); Get.back(); }, - child: const Text( - 'Select TASKRC file'), + child: Text( + 'Select TASKRC file', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), ), ], ), @@ -442,7 +547,8 @@ class _ManageTaskServerState extends State { decoration: BoxDecoration( color: tileColor, borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey.shade300), + border: + Border.all(color: TaskWarriorColors.borderColor), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -451,29 +557,33 @@ class _ManageTaskServerState extends State { taskrcContentController.text.isEmpty ? "Set TaskRc" : "Taskrc file is verified", - style: GoogleFonts.poppins( - fontWeight: FontWeight.w400, color: color), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), Container( height: 30, width: 30, decoration: BoxDecoration( color: AppSettings.isDarkMode - ? const Color.fromARGB(255, 220, 216, 216) - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors + .kLightSecondaryBackgroundColor + : TaskWarriorColors.ksecondaryBackgroundColor, shape: BoxShape.circle, ), child: Center( child: taskrcContentController.text.isNotEmpty - ? const Icon( + ? Icon( Icons.check, - color: Colors.green, + color: TaskWarriorColors.green, ) : Icon( Icons.chevron_right_rounded, color: AppSettings.isDarkMode - ? Colors.black - : Colors.white, + ? TaskWarriorColors.black + : TaskWarriorColors.white, ), ), ), @@ -499,8 +609,11 @@ class _ManageTaskServerState extends State { children: [ Text( "TaskD Server Info", - style: GoogleFonts.poppins( - fontWeight: FontWeight.w500, color: color), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), const SizedBox(height: 10), GestureDetector( @@ -512,7 +625,9 @@ class _ManageTaskServerState extends State { decoration: BoxDecoration( color: tileColor, borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey.shade300), + border: Border.all( + color: TaskWarriorColors.borderColor, + ), ), child: Row( mainAxisAlignment: @@ -521,38 +636,42 @@ class _ManageTaskServerState extends State { server == null ? Text( 'Not Configured', - style: GoogleFonts.poppins( - fontWeight: FontWeight.w400, - color: color), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ) : Text( '$server', - style: GoogleFonts.poppins( - fontWeight: FontWeight.w400, - color: color), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), Container( height: 30, width: 30, decoration: BoxDecoration( color: AppSettings.isDarkMode - ? const Color.fromARGB( - 255, 220, 216, 216) - : const Color.fromARGB( - 255, 48, 46, 46), + ? TaskWarriorColors + .kLightSecondaryBackgroundColor + : TaskWarriorColors + .ksecondaryBackgroundColor, shape: BoxShape.circle, ), child: Center( child: server != null - ? const Icon( + ? Icon( Icons.check, - color: Colors.green, + color: TaskWarriorColors.green, ) : Icon( Icons.chevron_right_rounded, color: AppSettings.isDarkMode - ? Colors.black - : Colors.white, + ? TaskWarriorColors.black + : TaskWarriorColors.white, ), ), ), @@ -574,8 +693,11 @@ class _ManageTaskServerState extends State { children: [ Text( "TaskD Server Credentials", - style: GoogleFonts.poppins( - fontWeight: FontWeight.w500, color: color), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), const SizedBox(height: 10), GestureDetector( @@ -587,7 +709,8 @@ class _ManageTaskServerState extends State { decoration: BoxDecoration( color: tileColor, borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey.shade300), + border: Border.all( + color: TaskWarriorColors.borderColor), ), child: Row( mainAxisAlignment: @@ -596,9 +719,11 @@ class _ManageTaskServerState extends State { credentialsString == null ? Text( 'Not Configured', - style: GoogleFonts.poppins( - fontWeight: FontWeight.w400, - color: color), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ) : SizedBox( width: MediaQuery.of(context) @@ -609,9 +734,11 @@ class _ManageTaskServerState extends State { scrollDirection: Axis.horizontal, child: Text( credentialsString, - style: GoogleFonts.poppins( - fontWeight: FontWeight.w400, - color: color), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), ), ), @@ -625,26 +752,26 @@ class _ManageTaskServerState extends State { width: 30, decoration: BoxDecoration( color: AppSettings.isDarkMode - ? const Color.fromARGB( - 255, 220, 216, 216) - : const Color.fromARGB( - 255, 48, 46, 46), + ? TaskWarriorColors + .kLightPrimaryBackgroundColor + : TaskWarriorColors + .kprimaryBackgroundColor, shape: BoxShape.circle, ), child: credentials == null ? Icon( Icons.chevron_right_rounded, color: AppSettings.isDarkMode - ? Colors.black - : Colors.white, + ? TaskWarriorColors.black + : TaskWarriorColors.white, ) : Icon( hideKey ? Icons.visibility_off : Icons.visibility, color: AppSettings.isDarkMode - ? Colors.green - : Colors.green, + ? TaskWarriorColors.green + : TaskWarriorColors.green, ), ), ), @@ -707,20 +834,20 @@ class PemWidget extends StatefulWidget { class _PemWidgetState extends State { @override Widget build(BuildContext context) { - var color = - AppSettings.isDarkMode ? Colors.white : Palette.kToDark.shade200; var contents = widget.storage.guiPemFiles.pemContents(widget.pem); var name = widget.storage.guiPemFiles.pemFilename(widget.pem); String identifier = ""; try { - identifier = fingerprint(contents!).toUpperCase(); + if (contents != null) { + identifier = fingerprint(contents).toUpperCase(); // Null check removed + } } catch (e) { debugPrint(e.toString()); } var tileColor = AppSettings.isDarkMode - ? const Color.fromARGB(255, 48, 46, 46) - : const Color.fromARGB(255, 220, 216, 216); + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor; return Padding( padding: const EdgeInsets.only( @@ -733,8 +860,11 @@ class _PemWidgetState extends State { children: [ Text( widget.optionString, - style: - GoogleFonts.poppins(fontWeight: FontWeight.w500, color: color), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), const SizedBox( height: 10, @@ -771,7 +901,7 @@ class _PemWidgetState extends State { decoration: BoxDecoration( color: tileColor, borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey.shade300), + border: Border.all(color: TaskWarriorColors.borderColor), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -788,8 +918,11 @@ class _PemWidgetState extends State { : (widget.pem == 'server.cert') ? '' : "$name = ", - style: GoogleFonts.poppins( - fontWeight: FontWeight.w400, color: color), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), Text( widget.pem == 'taskd.key' @@ -797,8 +930,11 @@ class _PemWidgetState extends State { ? "private.key.pem" : "" : identifier, - style: GoogleFonts.poppins( - fontWeight: FontWeight.w400, color: color), + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), ], ), @@ -809,8 +945,8 @@ class _PemWidgetState extends State { width: 30, decoration: BoxDecoration( color: AppSettings.isDarkMode - ? const Color.fromARGB(255, 220, 216, 216) - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.kLightSecondaryBackgroundColor + : TaskWarriorColors.ksecondaryBackgroundColor, shape: BoxShape.circle, ), child: Center( @@ -818,12 +954,12 @@ class _PemWidgetState extends State { ? Icon( Icons.chevron_right_rounded, color: AppSettings.isDarkMode - ? Colors.black - : Colors.white, + ? TaskWarriorColors.black + : TaskWarriorColors.white, ) - : const Icon( + : Icon( Icons.check, - color: Colors.green, + color: TaskWarriorColors.green, ), ), ), diff --git a/lib/utility/utilities.dart b/lib/utility/utilities.dart index 54b1dfe6..5fe07669 100644 --- a/lib/utility/utilities.dart +++ b/lib/utility/utilities.dart @@ -1,4 +1,7 @@ +import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; +import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; class Utils { static String getWeekNumber(DateTime? date) { @@ -48,4 +51,65 @@ class Utils { return ''; } } + + static AlertDialog showAlertDialog({ + Key? key, + Widget? icon, + EdgeInsetsGeometry? iconPadding, + Color? iconColor, + Widget? title, + EdgeInsetsGeometry? titlePadding, + TextStyle? titleTextStyle, + Widget? content, + EdgeInsetsGeometry? contentPadding, + TextStyle? contentTextStyle, + List? actions, + EdgeInsetsGeometry? actionsPadding, + MainAxisAlignment? actionsAlignment, + OverflowBarAlignment? actionsOverflowAlignment, + VerticalDirection? actionsOverflowDirection, + double? actionsOverflowButtonSpacing, + EdgeInsetsGeometry? buttonPadding, + Color? backgroundColor, + double? elevation, + Color? shadowColor, + Color? surfaceTintColor, + String? semanticLabel, + Clip clipBehavior = Clip.none, + ShapeBorder? shape, + AlignmentGeometry? alignment, + bool scrollable = false, + }) { + return AlertDialog( + surfaceTintColor: AppSettings.isDarkMode + ? TaskWarriorColors.kdialogBackGroundColor + : TaskWarriorColors.kLightDialogBackGroundColor, + shadowColor: AppSettings.isDarkMode + ? TaskWarriorColors.kdialogBackGroundColor + : TaskWarriorColors.kLightDialogBackGroundColor, + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.kdialogBackGroundColor + : TaskWarriorColors.kLightDialogBackGroundColor, + key: key, + title: title, + titlePadding: titlePadding, + titleTextStyle: titleTextStyle, + content: content, + contentPadding: contentPadding, + contentTextStyle: contentTextStyle, + actions: actions, + actionsPadding: actionsPadding, + actionsAlignment: actionsAlignment, + actionsOverflowAlignment: actionsOverflowAlignment, + actionsOverflowDirection: actionsOverflowDirection, + actionsOverflowButtonSpacing: actionsOverflowButtonSpacing, + buttonPadding: buttonPadding, + elevation: elevation, + semanticLabel: semanticLabel, + clipBehavior: clipBehavior, + shape: shape, + alignment: alignment, + scrollable: scrollable, + ); + } } diff --git a/lib/views/Onboarding/onboarding_screen.dart b/lib/views/Onboarding/onboarding_screen.dart index a6d33b18..9f539e84 100644 --- a/lib/views/Onboarding/onboarding_screen.dart +++ b/lib/views/Onboarding/onboarding_screen.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/controller/onboarding_controller.dart'; import 'package:taskwarrior/views/Onboarding/Model/onboarding_contents.dart'; import 'package:taskwarrior/views/Onboarding/Components/size_config.dart'; @@ -27,9 +29,9 @@ class _OnboardingScreenState extends State { AnimatedContainer _buildDots({int? index}) { return AnimatedContainer( duration: const Duration(milliseconds: 200), - decoration: const BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(50)), - color: Color(0xFF000000), + decoration: BoxDecoration( + borderRadius: const BorderRadius.all(Radius.circular(50)), + color: TaskWarriorColors.black, ), margin: const EdgeInsets.only(right: 5), height: 10, @@ -61,7 +63,9 @@ class _OnboardingScreenState extends State { }, ), ), - SizedBox(height: height*5/100,), + SizedBox( + height: height * 5 / 100, + ), Expanded( flex: 1, child: SingleChildScrollView(child: _buildBottomSection(width)), @@ -90,21 +94,25 @@ class _OnboardingScreenState extends State { content.title, textAlign: TextAlign.center, style: GoogleFonts.poppins( - fontWeight: FontWeight.w600, + fontWeight: TaskWarriorFonts.semiBold, fontSize: (width <= 550) ? 30 : 35, ), ), - SizedBox(height: height*2/100,), + SizedBox( + height: height * 2 / 100, + ), // Flexible(flex: 1, child: Container()), Text( content.desc, style: GoogleFonts.poppins( - fontWeight: FontWeight.w300, + fontWeight: TaskWarriorFonts.light, fontSize: (width <= 550) ? 17 : 17, ), textAlign: TextAlign.center, ), - SizedBox(height: height*2/100,) + SizedBox( + height: height * 2 / 100, + ) // Flexible(flex: 1, child: Container()), ], ), @@ -143,7 +151,7 @@ class _OnboardingScreenState extends State { (Route route) => false); }, style: ElevatedButton.styleFrom( - backgroundColor: Colors.black, + backgroundColor: TaskWarriorColors.black, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(50), ), @@ -155,8 +163,8 @@ class _OnboardingScreenState extends State { child: Text( "Start", style: GoogleFonts.poppins( - fontWeight: FontWeight.w300, - color: Colors.white, + fontWeight: TaskWarriorFonts.light, + color: TaskWarriorColors.white, fontSize: (width <= 550) ? 17 : 17, ), ), @@ -177,15 +185,15 @@ class _OnboardingScreenState extends State { style: TextButton.styleFrom( elevation: 0, textStyle: TextStyle( - fontWeight: FontWeight.w600, + fontWeight: TaskWarriorFonts.semiBold, fontSize: (width <= 550) ? 13 : 17, ), ), child: Text( "Skip", style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - color: Colors.black, + fontWeight: TaskWarriorFonts.bold, + color: TaskWarriorColors.black, fontSize: (width <= 550) ? 12 : 12, ), ), @@ -198,7 +206,7 @@ class _OnboardingScreenState extends State { ); }, style: ElevatedButton.styleFrom( - backgroundColor: Colors.black, + backgroundColor: TaskWarriorColors.black, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(50), ), @@ -211,8 +219,8 @@ class _OnboardingScreenState extends State { child: Text( "Next", style: GoogleFonts.poppins( - fontWeight: FontWeight.w300, - color: Colors.white, + fontWeight: TaskWarriorFonts.light, + color: TaskWarriorColors.white, fontSize: (width <= 550) ? 12 : 12, ), ), diff --git a/lib/views/about/about.dart b/lib/views/about/about.dart index 95783467..b8cea767 100644 --- a/lib/views/about/about.dart +++ b/lib/views/about/about.dart @@ -5,7 +5,7 @@ import 'package:package_info_plus/package_info_plus.dart'; import 'package:sizer/sizer.dart'; import 'package:taskwarrior/config/app_settings.dart'; import 'package:taskwarrior/config/taskwarriorcolors.dart'; -import 'package:taskwarrior/widgets/pallete.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:url_launcher/url_launcher.dart'; class AboutPage extends StatefulWidget { @@ -24,10 +24,10 @@ class _AboutPageState extends State { return Scaffold( appBar: AppBar( centerTitle: true, - backgroundColor: Palette.kToDark.shade200, + backgroundColor: TaskWarriorColors.kprimaryBackgroundColor, title: Text( 'About', - style: GoogleFonts.poppins(color: Colors.white), + style: GoogleFonts.poppins(color: TaskWarriorColors.white), ), leading: GestureDetector( onTap: () { @@ -35,12 +35,13 @@ class _AboutPageState extends State { }, child: Icon( Icons.chevron_left, - color: Appcolors.white, + color: TaskWarriorColors.white, ), ), ), - backgroundColor: - AppSettings.isDarkMode ? Palette.kToDark.shade200 : Colors.white, + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.white, body: Padding( padding: EdgeInsets.only(top: 1.h, left: 2.w, right: 2.w), child: SingleChildScrollView( @@ -59,9 +60,11 @@ class _AboutPageState extends State { Text( "Taskwarrior", style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 18, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeLarge, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), SizedBox( @@ -89,48 +92,56 @@ class _AboutPageState extends State { TextSpan( text: 'Version: ', style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), TextSpan( text: appInfoLines[1], style: GoogleFonts.poppins( - fontSize: 15, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), ], ), ), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'Package: ', - style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, - color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, - ), + SizedBox( + width: 85.w, + child: FittedBox( + fit: BoxFit.fitWidth, + child: RichText( + text: TextSpan( + children: [ + TextSpan( + text: 'Package: ', + style: GoogleFonts.poppins( + fontWeight: TaskWarriorFonts.bold, + fontSize: + TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + TextSpan( + text: appInfoLines[0], + style: GoogleFonts.poppins( + fontSize: + TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + ], ), - TextSpan( - text: appInfoLines[0], - style: GoogleFonts.poppins( - fontSize: 15, - color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, - ), - ), - ], + ), ), ), ], @@ -147,9 +158,11 @@ class _AboutPageState extends State { introduction, textAlign: TextAlign.center, style: GoogleFonts.poppins( - fontWeight: FontWeight.w500, - fontSize: 12, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.medium, + fontSize: TaskWarriorFonts.fontSizeSmall, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), SizedBox( @@ -164,8 +177,8 @@ class _AboutPageState extends State { child: ElevatedButton.icon( style: ElevatedButton.styleFrom( backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 220, 216, 216) - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.kLightSecondaryBackgroundColor + : TaskWarriorColors.ksecondaryBackgroundColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), @@ -184,17 +197,17 @@ class _AboutPageState extends State { height: 15.sp, colorFilter: ColorFilter.mode( AppSettings.isDarkMode - ? Colors.black - : Colors.white, + ? TaskWarriorColors.black + : TaskWarriorColors.white, BlendMode.srcIn)), label: Text( "GitHub", style: GoogleFonts.poppins( - fontWeight: FontWeight.w500, - fontSize: 12, + fontWeight: TaskWarriorFonts.medium, + fontSize: TaskWarriorFonts.fontSizeSmall, color: AppSettings.isDarkMode - ? Colors.black - : Colors.white, + ? TaskWarriorColors.black + : TaskWarriorColors.white, ), ), ), @@ -205,8 +218,8 @@ class _AboutPageState extends State { child: ElevatedButton.icon( style: ElevatedButton.styleFrom( backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 220, 216, 216) - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.kLightSecondaryBackgroundColor + : TaskWarriorColors.ksecondaryBackgroundColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), @@ -222,17 +235,17 @@ class _AboutPageState extends State { height: 15.sp, colorFilter: ColorFilter.mode( AppSettings.isDarkMode - ? Colors.black - : Colors.white, + ? TaskWarriorColors.black + : TaskWarriorColors.white, BlendMode.srcIn)), label: Text( "CCExtractor", style: GoogleFonts.poppins( - fontWeight: FontWeight.w500, - fontSize: 12, + fontWeight: TaskWarriorFonts.medium, + fontSize: TaskWarriorFonts.fontSizeSmall, color: AppSettings.isDarkMode - ? Colors.black - : Colors.white, + ? TaskWarriorColors.black + : TaskWarriorColors.white, ), ), ), @@ -246,9 +259,11 @@ class _AboutPageState extends State { "Eager to enhance this project? Visit our GitHub repository.", textAlign: TextAlign.center, style: GoogleFonts.poppins( - fontWeight: FontWeight.w600, - fontSize: 12, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.semiBold, + fontSize: TaskWarriorFonts.fontSizeSmall, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), SizedBox( diff --git a/lib/views/home/home.dart b/lib/views/home/home.dart index a613463c..de352595 100644 --- a/lib/views/home/home.dart +++ b/lib/views/home/home.dart @@ -8,6 +8,7 @@ import 'package:home_widget/home_widget.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; import 'package:taskwarrior/controller/home_tour_controller.dart'; import 'package:taskwarrior/drawer/filter_drawer.dart'; import 'package:taskwarrior/drawer/nav_drawer.dart'; @@ -72,7 +73,7 @@ class _HomePageState extends State { menuKey: menuKey, refreshKey: refreshKey, ), - colorShadow: Colors.black, + colorShadow: TaskWarriorColors.black, paddingFocus: 10, opacityShadow: 0.8, hideSkip: true, @@ -93,7 +94,7 @@ class _HomePageState extends State { else { // ignore: avoid_print - print('User has seen this page'), + debugPrint('User has seen this page'), // User has seen this page } }); @@ -223,32 +224,43 @@ class _HomePageState extends State { return isHomeWidgetTaskTapped == false ? Scaffold( appBar: AppBar( - backgroundColor: Palette.kToDark.shade200, - title: - Text('Home Page', style: GoogleFonts.poppins(color: Colors.white)), + backgroundColor: TaskWarriorColors.kprimaryBackgroundColor, + surfaceTintColor: TaskWarriorColors.kprimaryBackgroundColor, + title: Text('Home Page', + style: GoogleFonts.poppins(color: TaskWarriorColors.white)), actions: [ IconButton( key: searchKey1, icon: (storageWidget.searchVisible) - ? const Tooltip( + ? Tooltip( message: 'Cancel', - child: Icon(Icons.cancel, color: Colors.white)) - : const Tooltip( + child: Icon(Icons.cancel, color: TaskWarriorColors.white)) + : Tooltip( message: 'Search', - child: Icon(Icons.search, color: Colors.white)), + child: Icon(Icons.search, color: TaskWarriorColors.white)), onPressed: storageWidget.toggleSearch, ), Builder( builder: (context) => IconButton( key: refreshKey, - icon: const Icon(Icons.refresh, color: Colors.white), + icon: Icon(Icons.refresh, color: TaskWarriorColors.white), onPressed: () { if (server != null || credentials != null) { storageWidget.synchronize(context, true); } else { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: const Text('TaskServer is not configured'), + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + content: Text( + 'TaskServer is not configured', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), action: SnackBarAction( label: 'Set Up', onPressed: () { @@ -260,7 +272,7 @@ class _HomePageState extends State { setState(() {}); }); }, - textColor: Colors.purple, + textColor: TaskWarriorColors.purple, ), ), ); @@ -271,9 +283,9 @@ class _HomePageState extends State { Builder( builder: (context) => IconButton( key: filterKey, - icon: const Tooltip( + icon: Tooltip( message: 'Filters', - child: Icon(Icons.filter_list, color: Colors.white), + child: Icon(Icons.filter_list, color: TaskWarriorColors.white), ), onPressed: () => Scaffold.of(context).openEndDrawer(), ), @@ -282,8 +294,9 @@ class _HomePageState extends State { leading: Builder( builder: (context) => IconButton( key: menuKey, - icon: const Tooltip( - message: 'Menu', child: Icon(Icons.menu, color: Colors.white)), + icon: Tooltip( + message: 'Menu', + child: Icon(Icons.menu, color: TaskWarriorColors.white)), onPressed: () => Scaffold.of(context).openDrawer(), ), ), @@ -292,8 +305,9 @@ class _HomePageState extends State { body: DoubleBackToCloseApp( snackBar: const SnackBar(content: Text('Tap back again to exit')), child: Container( - color: - AppSettings.isDarkMode ? Palette.kToDark.shade200 : Colors.white, + color: AppSettings.isDarkMode + ? Palette.kToDark.shade200 + : TaskWarriorColors.white, child: Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: Column( @@ -304,6 +318,10 @@ class _HomePageState extends State { margin: const EdgeInsets.symmetric( horizontal: 10, vertical: 10), child: SearchBar( + backgroundColor: MaterialStateProperty.all( + (TaskWarriorColors.kLightPrimaryBackgroundColor)), + surfaceTintColor: MaterialStateProperty.all( + (TaskWarriorColors.kLightPrimaryBackgroundColor)), controller: storageWidget.searchController, // shape:, onChanged: (value) { @@ -315,14 +333,18 @@ class _HomePageState extends State { if (states.contains(MaterialState.focused)) { return RoundedRectangleBorder( borderRadius: BorderRadius.circular(12.0), - side: const BorderSide( - color: Colors.black, width: 2.0), + side: BorderSide( + color: TaskWarriorColors.black, + width: 2.0, + ), ); } else { return RoundedRectangleBorder( borderRadius: BorderRadius.circular(12.0), - side: const BorderSide( - color: Colors.black, width: 1.5), + side: BorderSide( + color: TaskWarriorColors.black, + width: 1.5, + ), ); } }, @@ -332,8 +354,8 @@ class _HomePageState extends State { (storageWidget.searchController.text.isNotEmpty) ? IconButton( key: GlobalKey(), - icon: const Icon(Icons.cancel, - color: Colors.black), + icon: Icon(Icons.cancel, + color: TaskWarriorColors.black), onPressed: () { storageWidget.searchController.clear(); storageWidget.search( @@ -367,15 +389,16 @@ class _HomePageState extends State { floatingActionButton: FloatingActionButton( key: addKey, heroTag: "btn3", - backgroundColor: - AppSettings.isDarkMode ? Colors.white : Palette.kToDark.shade200, + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.kLightPrimaryBackgroundColor + : TaskWarriorColors.kprimaryBackgroundColor, child: Tooltip( message: 'Add Task', child: Icon( Icons.add, color: AppSettings.isDarkMode - ? Palette.kToDark.shade200 - : Colors.white, + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.white, ), ), onPressed: () => showDialog( diff --git a/lib/views/profile/profile.dart b/lib/views/profile/profile.dart index 8a5416d9..fed6d722 100644 --- a/lib/views/profile/profile.dart +++ b/lib/views/profile/profile.dart @@ -2,8 +2,10 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; import 'package:taskwarrior/model/storage/savefile.dart'; import 'package:taskwarrior/taskserver/ntaskserver.dart'; +import 'package:taskwarrior/utility/utilities.dart'; import 'package:taskwarrior/widgets/pallete.dart'; import 'package:taskwarrior/widgets/profilefunctions.dart'; import 'package:taskwarrior/widgets/taskdetails.dart'; @@ -30,23 +32,24 @@ class _ProfilePageState extends State { backgroundColor: Palette.kToDark.shade200, title: Text( profilesMap.length == 1 ? 'Profile' : 'Profiles', - style: GoogleFonts.poppins(color: Colors.white), + style: GoogleFonts.poppins(color: TaskWarriorColors.white), ), leading: IconButton( onPressed: () { // Navigator.pushReplacementNamed(context, PageRoutes.home); Navigator.of(context).pop(); }, - icon: const Icon( + icon: Icon( Icons.chevron_left, - color: Colors.white, + color: TaskWarriorColors.white, size: 30, ), ), ), //primary: false, - backgroundColor: - AppSettings.isDarkMode ? Palette.kToDark.shade200 : Colors.white, + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, body: SingleChildScrollView( child: Column( children: [ @@ -83,12 +86,33 @@ class _ProfilePageState extends State { showDialog( context: context, builder: (BuildContext context) { - return AlertDialog( - title: const Text("Export Format"), - content: const Text("Choose the export format:"), + return Utils.showAlertDialog( + title: Text( + "Export Format", + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + content: Text( + "Choose the export format:", + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), actions: [ TextButton( - child: const Text("JSON"), + child: Text( + "JSON", + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), onPressed: () { Navigator.of(context).pop(); exportTasks( @@ -98,7 +122,14 @@ class _ProfilePageState extends State { }, ), TextButton( - child: const Text("TXT"), + child: Text( + "TXT", + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), onPressed: () { Navigator.of(context).pop(); exportTasks( @@ -116,17 +147,31 @@ class _ProfilePageState extends State { try { profilesWidget.copyConfigToNewProfile(currentProfile); ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: const Text('Profile Config Copied'), + content: Text( + 'Profile Config Copied', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 61, 61, 61) - : const Color.fromARGB(255, 39, 39, 39), + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, duration: const Duration(seconds: 2))); } catch (e) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: const Text('Profile Config Copy Failed'), + content: Text( + 'Profile Config Copy Failed', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 61, 61, 61) - : const Color.fromARGB(255, 39, 39, 39), + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, duration: const Duration(seconds: 2))); } }, @@ -189,36 +234,51 @@ class ProfilesColumn extends StatelessWidget { try { addProfile(); ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: const Text('Profile Added Successfully'), + content: Text( + 'Profile Added Successfully', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), + ), backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 61, 61, 61) - : const Color.fromARGB(255, 39, 39, 39), + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, duration: const Duration(seconds: 2))); } catch (e) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: const Text('Profile Additon Failed'), + content: Text( + 'Profile Additon Failed', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), + ), backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 61, 61, 61) - : const Color.fromARGB(255, 39, 39, 39), + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, duration: const Duration(seconds: 2))); } }, style: ButtonStyle( backgroundColor: MaterialStateProperty.all( AppSettings.isDarkMode - ? const Color.fromARGB(255, 61, 61, 61) - : Colors.white, + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, ), ), icon: Icon(Icons.add, color: AppSettings.isDarkMode - ? Colors.deepPurpleAccent - : Colors.deepPurple), + ? TaskWarriorColors.deepPurpleAccent + : TaskWarriorColors.deepPurple), label: Text( 'Add new Profile', style: TextStyle( - color: - AppSettings.isDarkMode ? Colors.white : Colors.deepPurple, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), ) diff --git a/lib/views/reports/pages/burndown_daily.dart b/lib/views/reports/pages/burndown_daily.dart index 2939c607..61f85045 100644 --- a/lib/views/reports/pages/burndown_daily.dart +++ b/lib/views/reports/pages/burndown_daily.dart @@ -1,4 +1,4 @@ -// ignore_for_file: depend_on_referenced_packages, prefer_typing_uninitialized_variables +// ignore_for_file: prefer_typing_uninitialized_variables import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -7,6 +7,7 @@ import 'package:taskwarrior/config/taskwarriorcolors.dart'; import 'dart:io'; import 'package:syncfusion_flutter_charts/charts.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/model/chart.dart'; import 'package:taskwarrior/model/json/task.dart'; import 'package:taskwarrior/model/storage.dart'; @@ -15,7 +16,6 @@ import 'package:taskwarrior/utility/utilities.dart'; import 'package:taskwarrior/views/home/home.dart'; import 'package:taskwarrior/views/reports/widgets/commonChartIndicator.dart'; import 'package:taskwarrior/widgets/taskdetails/profiles_widget.dart'; -import 'package:path_provider/path_provider.dart'; class BurnDownDaily extends StatefulWidget { const BurnDownDaily({super.key}); @@ -63,7 +63,7 @@ class _BurnDownDailyState extends State Text( 'Date: $date', style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, + fontWeight: TaskWarriorFonts.bold, ), ), Text( @@ -83,23 +83,21 @@ class _BurnDownDailyState extends State storageWidget = StorageWidget.of(context); var currentProfile = ProfilesWidget.of(context).currentProfile; - getApplicationDocumentsDirectory().then((directory) { - setState(() { - baseDirectory = directory; - storage = Storage( - Directory('${baseDirectory!.path}/profiles/$currentProfile'), - ); - }); - - ///fetch all data contains all the tasks - allData = storage.data.allData(); - - ///check if allData is not empty - if (allData.isNotEmpty) { - ///sort the data by daily burn down - sortBurnDownDaily(); - } + Directory baseDirectory = ProfilesWidget.of(context).getBaseDirectory(); + setState(() { + storage = Storage( + Directory('${baseDirectory.path}/profiles/$currentProfile'), + ); }); + + ///fetch all data contains all the tasks + allData = storage.data.allData(); + + ///check if allData is not empty + if (allData.isNotEmpty) { + ///sort the data by daily burn down + sortBurnDownDaily(); + } }); } @@ -161,9 +159,9 @@ class _BurnDownDailyState extends State title: AxisTitle( text: 'Day - Month', textStyle: GoogleFonts.poppins( - fontWeight: FontWeight.bold, + fontWeight: TaskWarriorFonts.bold, color: AppSettings.isDarkMode ? Colors.white : Colors.black, - fontSize: 12, + fontSize: TaskWarriorFonts.fontSizeSmall, ), ), ), @@ -171,8 +169,8 @@ class _BurnDownDailyState extends State title: AxisTitle( text: 'Tasks', textStyle: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 12, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeSmall, color: AppSettings.isDarkMode ? Colors.white : Colors.black, ), ), @@ -183,7 +181,7 @@ class _BurnDownDailyState extends State StackedColumnSeries( groupName: 'Group A', enableTooltip: true, - color: Appcolors.green, + color: TaskWarriorColors.green, dataSource: dailyInfo.entries .map((entry) => ChartData( entry.key, @@ -199,7 +197,7 @@ class _BurnDownDailyState extends State /// This is the pending tasks StackedColumnSeries( groupName: 'Group A', - color: Appcolors.yellow, + color: TaskWarriorColors.yellow, enableTooltip: true, dataSource: dailyInfo.entries .map((entry) => ChartData( diff --git a/lib/views/reports/pages/burndown_monthly.dart b/lib/views/reports/pages/burndown_monthly.dart index 5066c1fb..4d5eed7b 100644 --- a/lib/views/reports/pages/burndown_monthly.dart +++ b/lib/views/reports/pages/burndown_monthly.dart @@ -1,10 +1,10 @@ -// ignore_for_file: depend_on_referenced_packages, prefer_typing_uninitialized_variables +// ignore_for_file: prefer_typing_uninitialized_variables import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:syncfusion_flutter_charts/charts.dart'; -import 'package:path_provider/path_provider.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/model/chart.dart'; import 'dart:io'; @@ -61,7 +61,7 @@ class _BurnDownMonthltState extends State Text( 'Month-Year: $monthYear', style: const TextStyle( - fontWeight: FontWeight.bold, + fontWeight: TaskWarriorFonts.bold, ), ), Text( @@ -81,23 +81,21 @@ class _BurnDownMonthltState extends State storageWidget = StorageWidget.of(context); var currentProfile = ProfilesWidget.of(context).currentProfile; - getApplicationDocumentsDirectory().then((directory) { - setState(() { - baseDirectory = directory; - storage = Storage( - Directory('${baseDirectory!.path}/profiles/$currentProfile'), - ); - }); - - ///fetch all data contains all the tasks - allData = storage.data.allData(); - - ///check if allData is not empty - if (allData.isNotEmpty) { - ///sort the data by weekly burn down - sortBurnDownMonthly(); - } + Directory baseDirectory = ProfilesWidget.of(context).getBaseDirectory(); + setState(() { + storage = Storage( + Directory('${baseDirectory.path}/profiles/$currentProfile'), + ); }); + + ///fetch all data contains all the tasks + allData = storage.data.allData(); + + ///check if allData is not empty + if (allData.isNotEmpty) { + ///sort the data by weekly burn down + sortBurnDownMonthly(); + } }); } @@ -145,8 +143,8 @@ class _BurnDownMonthltState extends State title: AxisTitle( text: 'Month - Year', textStyle: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 12, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeSmall, color: AppSettings.isDarkMode ? Colors.white : Colors.black, ), ), @@ -155,8 +153,8 @@ class _BurnDownMonthltState extends State title: AxisTitle( text: 'Tasks', textStyle: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 12, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeSmall, color: AppSettings.isDarkMode ? Colors.white : Colors.black, ), ), diff --git a/lib/views/reports/pages/burndown_weekly.dart b/lib/views/reports/pages/burndown_weekly.dart index 3ea9d262..f88d5767 100644 --- a/lib/views/reports/pages/burndown_weekly.dart +++ b/lib/views/reports/pages/burndown_weekly.dart @@ -1,4 +1,4 @@ -// ignore_for_file: depend_on_referenced_packages, prefer_typing_uninitialized_variables +// ignore_for_file: prefer_typing_uninitialized_variables import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -7,6 +7,7 @@ import 'package:taskwarrior/config/taskwarriorcolors.dart'; import 'dart:io'; import 'package:syncfusion_flutter_charts/charts.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/model/chart.dart'; import 'package:taskwarrior/model/json/task.dart'; import 'package:taskwarrior/model/storage.dart'; @@ -15,7 +16,6 @@ import 'package:taskwarrior/utility/utilities.dart'; import 'package:taskwarrior/views/home/home.dart'; import 'package:taskwarrior/views/reports/widgets/commonChartIndicator.dart'; import 'package:taskwarrior/widgets/taskdetails/profiles_widget.dart'; -import 'package:path_provider/path_provider.dart'; class BurnDownWeekly extends StatefulWidget { const BurnDownWeekly({super.key}); @@ -62,7 +62,7 @@ class _BurnDownWeeklyState extends State Text( weekNumber, style: const TextStyle( - fontWeight: FontWeight.bold, + fontWeight: TaskWarriorFonts.bold, ), ), Text( @@ -82,23 +82,21 @@ class _BurnDownWeeklyState extends State storageWidget = StorageWidget.of(context); var currentProfile = ProfilesWidget.of(context).currentProfile; - getApplicationDocumentsDirectory().then((directory) { - setState(() { - baseDirectory = directory; - storage = Storage( - Directory('${baseDirectory!.path}/profiles/$currentProfile'), - ); - }); - - ///fetch all data contains all the tasks - allData = storage.data.allData(); - - ///check if allData is not empty - if (allData.isNotEmpty) { - ///sort the data by weekly burn down - sortBurnDownWeekLy(); - } + Directory baseDirectory = ProfilesWidget.of(context).getBaseDirectory(); + setState(() { + storage = Storage( + Directory('${baseDirectory.path}/profiles/$currentProfile'), + ); }); + + ///fetch all data contains all the tasks + allData = storage.data.allData(); + + ///check if allData is not empty + if (allData.isNotEmpty) { + ///sort the data by weekly burn down + sortBurnDownWeekLy(); + } }); } @@ -161,8 +159,8 @@ class _BurnDownWeeklyState extends State title: AxisTitle( text: 'Weeks - Year', textStyle: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 12, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeSmall, color: AppSettings.isDarkMode ? Colors.white : Colors.black, ), ), @@ -171,9 +169,9 @@ class _BurnDownWeeklyState extends State title: AxisTitle( text: 'Tasks', textStyle: GoogleFonts.poppins( - fontWeight: FontWeight.bold, + fontWeight: TaskWarriorFonts.bold, color: AppSettings.isDarkMode ? Colors.white : Colors.black, - fontSize: 12, + fontSize: TaskWarriorFonts.fontSizeSmall, ), ), ), @@ -183,7 +181,7 @@ class _BurnDownWeeklyState extends State StackedColumnSeries( groupName: 'Group A', enableTooltip: true, - color: Appcolors.green, + color: TaskWarriorColors.green, dataSource: allData .map((task) => ChartData( 'Week ${Utils.getWeekNumbertoInt(task.entry)}, ${task.entry.year}', @@ -203,7 +201,7 @@ class _BurnDownWeeklyState extends State ///this is the pending tasks StackedColumnSeries( groupName: 'Group A', - color: Appcolors.yellow, + color: TaskWarriorColors.yellow, enableTooltip: true, dataSource: allData .map((task) => ChartData( diff --git a/lib/views/reports/reports_home.dart b/lib/views/reports/reports_home.dart index 2da67e8d..0cd428a6 100644 --- a/lib/views/reports/reports_home.dart +++ b/lib/views/reports/reports_home.dart @@ -1,4 +1,4 @@ -// ignore_for_file: depend_on_referenced_packages, prefer_typing_uninitialized_variables +// ignore_for_file: prefer_typing_uninitialized_variables import 'dart:io'; @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:taskwarrior/config/app_settings.dart'; import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/controller/reports_tour_controller.dart'; import 'package:taskwarrior/model/json/task.dart'; import 'package:taskwarrior/model/storage.dart'; @@ -15,9 +16,7 @@ import 'package:taskwarrior/views/reports/pages/burndown_daily.dart'; import 'package:taskwarrior/views/reports/pages/burndown_monthly.dart'; import 'package:taskwarrior/views/reports/pages/burndown_weekly.dart'; import 'package:taskwarrior/views/reports/reports_tour.dart'; -import 'package:taskwarrior/widgets/pallete.dart'; import 'package:taskwarrior/widgets/taskdetails/profiles_widget.dart'; -import 'package:path_provider/path_provider.dart'; import 'package:tutorial_coach_mark/tutorial_coach_mark.dart'; class ReportsHome extends StatefulWidget { @@ -54,7 +53,7 @@ class _ReportsHomeState extends State weekly: weekly, monthly: monthly, ), - colorShadow: Colors.black, + colorShadow: TaskWarriorColors.black, paddingFocus: 10, opacityShadow: 0.8, hideSkip: true, @@ -96,17 +95,15 @@ class _ReportsHomeState extends State storageWidget = StorageWidget.of(context); var currentProfile = ProfilesWidget.of(context).currentProfile; - getApplicationDocumentsDirectory().then((directory) { - setState(() { - baseDirectory = directory; - storage = Storage( - Directory('${baseDirectory!.path}/profiles/$currentProfile'), - ); - }); - - ///fetch all data contains all the tasks - allData = storage.data.allData(); + Directory baseDirectory = ProfilesWidget.of(context).getBaseDirectory(); + setState(() { + storage = Storage( + Directory('${baseDirectory.path}/profiles/$currentProfile'), + ); }); + + ///fetch all data contains all the tasks + allData = storage.data.allData(); }); } @@ -117,10 +114,10 @@ class _ReportsHomeState extends State return Scaffold( appBar: AppBar( - backgroundColor: Palette.kToDark.shade200, + backgroundColor: TaskWarriorColors.kprimaryBackgroundColor, title: Text( 'Reports', - style: GoogleFonts.poppins(color: Colors.white), + style: GoogleFonts.poppins(color: TaskWarriorColors.white), ), leading: GestureDetector( onTap: () { @@ -128,7 +125,7 @@ class _ReportsHomeState extends State }, child: Icon( Icons.chevron_left, - color: Appcolors.white, + color: TaskWarriorColors.white, ), ), bottom: PreferredSize( @@ -136,13 +133,13 @@ class _ReportsHomeState extends State height * 0.1), // Adjust the preferred height as needed child: TabBar( controller: _tabController, - labelColor: Appcolors.white, + labelColor: TaskWarriorColors.white, labelStyle: GoogleFonts.poppins( - fontWeight: FontWeight.w500, - fontSize: 12, + fontWeight: TaskWarriorFonts.medium, + fontSize: TaskWarriorFonts.fontSizeSmall, ), unselectedLabelStyle: GoogleFonts.poppins( - fontWeight: FontWeight.w300, + fontWeight: TaskWarriorFonts.light, ), onTap: (value) { setState(() { @@ -172,8 +169,9 @@ class _ReportsHomeState extends State ), ), ), - backgroundColor: - AppSettings.isDarkMode ? Palette.kToDark.shade200 : Colors.white, + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.white, body: allData.isEmpty ? Column( mainAxisAlignment: MainAxisAlignment.center, @@ -181,7 +179,9 @@ class _ReportsHomeState extends State children: [ Icon( Icons.heart_broken, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), Row( mainAxisAlignment: MainAxisAlignment.center, @@ -189,11 +189,11 @@ class _ReportsHomeState extends State Text( 'No Task found', style: GoogleFonts.poppins( - fontWeight: FontWeight.w500, - fontSize: 12, + fontWeight: TaskWarriorFonts.medium, + fontSize: TaskWarriorFonts.fontSizeSmall, color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), ], @@ -204,11 +204,11 @@ class _ReportsHomeState extends State Text( 'Add a task to see reports', style: GoogleFonts.poppins( - fontWeight: FontWeight.w500, - fontSize: 12, + fontWeight: TaskWarriorFonts.light, + fontSize: TaskWarriorFonts.fontSizeSmall, color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), ], diff --git a/lib/views/reports/widgets/commonChartIndicator.dart b/lib/views/reports/widgets/commonChartIndicator.dart index 535ad6c2..021ba92d 100644 --- a/lib/views/reports/widgets/commonChartIndicator.dart +++ b/lib/views/reports/widgets/commonChartIndicator.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:taskwarrior/config/app_settings.dart'; import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; ///Common widget for Report chart indicator class CommonChartIndicator extends StatelessWidget { @@ -20,9 +21,11 @@ class CommonChartIndicator extends StatelessWidget { Text( title, style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 16, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ) ], @@ -38,14 +41,16 @@ class CommonChartIndicator extends StatelessWidget { Container( height: 20, width: 80, - decoration: BoxDecoration(color: Appcolors.green), + decoration: BoxDecoration(color: TaskWarriorColors.green), ), Text( "Completed", style: GoogleFonts.poppins( - fontWeight: FontWeight.w400, - fontSize: 16, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.regular, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), ], @@ -55,14 +60,16 @@ class CommonChartIndicator extends StatelessWidget { Container( height: 20, width: 80, - decoration: BoxDecoration(color: Appcolors.yellow), + decoration: BoxDecoration(color: TaskWarriorColors.yellow), ), Text( "Pending", style: GoogleFonts.poppins( - fontWeight: FontWeight.w400, - fontSize: 16, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.regular, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), ], diff --git a/lib/views/settings/settings.dart b/lib/views/settings/settings.dart index 7dd0682d..c8c0cc7d 100644 --- a/lib/views/settings/settings.dart +++ b/lib/views/settings/settings.dart @@ -1,11 +1,18 @@ -// ignore_for_file: library_private_types_in_public_api, must_be_immutable +// ignore_for_file: library_private_types_in_public_api, must_be_immutable, depend_on_referenced_packages + +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:path/path.dart' as path; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:taskwarrior/config/app_settings.dart'; import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; +import 'package:taskwarrior/utility/utilities.dart'; import 'package:taskwarrior/widgets/pallete.dart'; +import 'package:taskwarrior/widgets/taskdetails/profiles_widget.dart'; class SettingsPage extends StatefulWidget { SettingsPage({ @@ -23,6 +30,19 @@ class SettingsPage extends StatefulWidget { } class _SettingsPageState extends State { + bool isMovingDirectory = false; + + String getBaseDirectory() { + InheritedProfiles profilesWidget = ProfilesWidget.of(context); + Directory baseDirectory = profilesWidget.getBaseDirectory(); + Directory defaultDirectory = profilesWidget.getDefaultDirectory(); + if (baseDirectory.path == defaultDirectory.path) { + return 'Default'; + } else { + return baseDirectory.path; + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -36,15 +56,15 @@ class _SettingsPageState extends State { Text( 'Settings', style: GoogleFonts.poppins( - color: Colors.white, - fontSize: 20, + color: TaskWarriorColors.white, + fontSize: TaskWarriorFonts.fontSizeLarge, ), ), Text( 'Configure your preferences', style: GoogleFonts.poppins( - color: Colors.white70, - fontSize: 14, + color: TaskWarriorColors.white, + fontSize: TaskWarriorFonts.fontSizeSmall, ), ), ], @@ -55,105 +75,423 @@ class _SettingsPageState extends State { }, child: Icon( Icons.chevron_left, - color: Appcolors.white, + color: TaskWarriorColors.white, ), ), ), - backgroundColor: - AppSettings.isDarkMode ? Palette.kToDark.shade200 : Colors.white, - body: ListView( - children: [ - ListTile( - title: Text( - 'Sync on Start', - style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 18, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, - ), - ), - subtitle: Text( - 'Automatically sync data on app startup', - style: GoogleFonts.poppins( - color: Colors.grey, - fontSize: 14, - ), - ), - trailing: Switch( - value: widget.isSyncOnStartActivel, - onChanged: (bool value) async { - setState(() { - widget.isSyncOnStartActivel = value; - }); - - final SharedPreferences prefs = - await SharedPreferences.getInstance(); - await prefs.setBool('sync-onStart', value); - }, - ), - ), - const Divider(), - ListTile( - title: Text( - 'Sync on Task Create', - style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 16, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, - ), - ), - subtitle: Text( - 'Enable automatic syncing when creating a new task', - style: GoogleFonts.poppins( - color: Colors.grey, - fontSize: 14, - ), - ), - trailing: Switch( - value: widget.isSyncOnTaskCreateActivel, - onChanged: (bool value) async { - setState(() { - widget.isSyncOnTaskCreateActivel = value; - }); - - final SharedPreferences prefs = - await SharedPreferences.getInstance(); - await prefs.setBool('sync-OnTaskCreate', value); - }, - ), - ), - const Divider(), - ListTile( - title: Text( - 'Highlight the task', - style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 16, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, - ), - ), - subtitle: Text( - 'Make the border of task if only one day left', - style: GoogleFonts.poppins( - color: Colors.grey, - fontSize: 14, - ), - ), - trailing: Switch( - value: widget.delaytask, - onChanged: (bool value) async { - setState(() { - widget.delaytask = value; - }); - - final SharedPreferences prefs = - await SharedPreferences.getInstance(); - await prefs.setBool('delaytask', value); - }, + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.white, + body: (isMovingDirectory) + ? Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const CircularProgressIndicator(), + const SizedBox( + height: 10, + ), + Text( + 'Moving data to new directory', + style: GoogleFonts.poppins( + fontWeight: FontWeight.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ) + ], + )) + : ListView( + children: [ + ListTile( + title: Text( + 'Sync on Start', + style: GoogleFonts.poppins( + fontWeight: FontWeight.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + subtitle: Text( + 'Automatically sync data on app startup', + style: GoogleFonts.poppins( + color: TaskWarriorColors.grey, + fontSize: TaskWarriorFonts.fontSizeSmall, + ), + ), + trailing: Switch( + value: widget.isSyncOnStartActivel, + onChanged: (bool value) async { + setState(() { + widget.isSyncOnStartActivel = value; + }); + + final SharedPreferences prefs = + await SharedPreferences.getInstance(); + await prefs.setBool('sync-onStart', value); + }, + ), + ), + const Divider(), + ListTile( + title: Text( + 'Sync on Task Create', + style: GoogleFonts.poppins( + fontWeight: FontWeight.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + subtitle: Text( + 'Enable automatic syncing when creating a new task', + style: GoogleFonts.poppins( + color: TaskWarriorColors.grey, + fontSize: TaskWarriorFonts.fontSizeSmall, + ), + ), + trailing: Switch( + value: widget.isSyncOnTaskCreateActivel, + onChanged: (bool value) async { + setState(() { + widget.isSyncOnTaskCreateActivel = value; + }); + + final SharedPreferences prefs = + await SharedPreferences.getInstance(); + await prefs.setBool('sync-OnTaskCreate', value); + }, + ), + ), + const Divider(), + ListTile( + title: Text( + 'Highlight the task', + style: GoogleFonts.poppins( + fontWeight: FontWeight.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + subtitle: Text( + 'Make the border of task if only one day left', + style: GoogleFonts.poppins( + color: TaskWarriorColors.grey, + fontSize: TaskWarriorFonts.fontSizeSmall, + ), + ), + trailing: Switch( + value: widget.delaytask, + onChanged: (bool value) async { + setState(() { + widget.delaytask = value; + }); + + final SharedPreferences prefs = + await SharedPreferences.getInstance(); + await prefs.setBool('delaytask', value); + }, + ), + ), + const Divider(), + ListTile( + title: Text( + 'Select directory', + style: GoogleFonts.poppins( + fontWeight: FontWeight.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + subtitle: Column( + children: [ + Text( + 'Select the directory where the TaskWarrior data is stored\nCurrent directory: ${getBaseDirectory()}', + style: GoogleFonts.poppins( + color: TaskWarriorColors.grey, + fontSize: TaskWarriorFonts.fontSizeSmall, + ), + ), + const SizedBox( + height: 10, + ), + Row( + children: [ + //Reset to default + TextButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + AppSettings.isDarkMode + ? TaskWarriorColors + .ksecondaryBackgroundColor + : TaskWarriorColors + .kLightSecondaryBackgroundColor, + ), + ), + onPressed: () { + if (getBaseDirectory() == "Default") { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + 'Already default', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors + .kprimaryTextColor + : TaskWarriorColors + .kLightPrimaryTextColor, + ), + ), + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors + .ksecondaryBackgroundColor + : TaskWarriorColors + .kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); + } else { + showDialog( + context: context, + builder: (BuildContext context) { + return Utils.showAlertDialog( + title: Text( + 'Reset to default', + style: GoogleFonts.poppins( + fontWeight: FontWeight.bold, + fontSize: + TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + content: Text( + "Are you sure you want to reset the directory to the default?", + style: GoogleFonts.poppins( + color: TaskWarriorColors.grey, + fontSize: + TaskWarriorFonts.fontSizeMedium, + ), + ), + actions: [ + TextButton( + onPressed: () { + Navigator.pop(context); + }, + child: Text( + 'No', + style: GoogleFonts.poppins( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + ), + TextButton( + onPressed: () { + Navigator.pop(context); + isMovingDirectory = true; + setState(() {}); + InheritedProfiles profilesWidget = + ProfilesWidget.of(context); + Directory source = profilesWidget + .getBaseDirectory(); + Directory destination = + profilesWidget + .getDefaultDirectory(); + moveDirectory(source.path, + destination.path) + .then((value) async { + profilesWidget.setBaseDirectory( + destination); + SharedPreferences prefs = + await SharedPreferences + .getInstance(); + await prefs + .remove('baseDirectory'); + isMovingDirectory = false; + setState(() {}); + }); + }, + child: Text( + 'Yes', + style: GoogleFonts.poppins( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + ), + ], + ); + }, + ); + } + }, + child: Text( + 'Reset to default', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.deepPurple, + ), + ), + ), + const Spacer(), + //Change directory + TextButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + AppSettings.isDarkMode + ? TaskWarriorColors + .ksecondaryBackgroundColor + : TaskWarriorColors + .kLightSecondaryBackgroundColor, + ), + ), + onPressed: () { + pickDirectory(); + }, + child: Text( + 'Change directory', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.deepPurple, + ), + ), + ), + ], + ), + ], + ), + ) + ], ), - ), - ], - ), ); } + + void pickDirectory() { + FilePicker.platform.getDirectoryPath().then((value) async { + if (value != null) { + isMovingDirectory = true; + setState(() {}); + InheritedProfiles profilesWidget = ProfilesWidget.of(context); + Directory source = profilesWidget.getBaseDirectory(); + Directory destination = Directory(value); + moveDirectory(source.path, destination.path).then((value) async { + isMovingDirectory = false; + setState(() {}); + if (value == "same") { + return; + } else if (value == "success") { + profilesWidget.setBaseDirectory(destination); + SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.setString('baseDirectory', destination.path); + } else { + showDialog( + context: context, + builder: (BuildContext context) { + return Utils.showAlertDialog( + title: Text( + 'Error', + style: GoogleFonts.poppins( + fontWeight: FontWeight.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + content: Text( + value == "nested" + ? "Cannot move to a nested directory" + : value == "not-empty" + ? "Destination directory is not empty" + : "An error occurred", + style: GoogleFonts.poppins( + color: TaskWarriorColors.grey, + fontSize: TaskWarriorFonts.fontSizeSmall, + ), + ), + actions: [ + TextButton( + onPressed: () { + Navigator.pop(context); + }, + child: Text( + 'OK', + style: GoogleFonts.poppins( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + ) + ], + ); + }, + ); + } + }); + } + }); + } + + Future moveDirectory(String fromDirectory, String toDirectory) async { + if (path.canonicalize(fromDirectory) == path.canonicalize(toDirectory)) { + return "same"; + } + + if (path.isWithin(fromDirectory, toDirectory)) { + return "nested"; + } + + Directory toDir = Directory(toDirectory); + final length = await toDir.list().length; + if (length > 0) { + return "not-empty"; + } + + await moveDirectoryRecurse(fromDirectory, toDirectory); + return "success"; + } + + Future moveDirectoryRecurse( + String fromDirectory, String toDirectory) async { + Directory fromDir = Directory(fromDirectory); + Directory toDir = Directory(toDirectory); + + // Create the toDirectory if it doesn't exist + await toDir.create(recursive: true); + + // Loop through each file and directory and move it to the toDirectory + await for (final entity in fromDir.list()) { + if (entity is File) { + // If it's a file, move it to the toDirectory + File file = entity; + String newPath = path.join( + toDirectory, path.relative(file.path, from: fromDirectory)); + await File(newPath).writeAsBytes(await file.readAsBytes()); + await file.delete(); + } else if (entity is Directory) { + // If it's a directory, create it in the toDirectory and recursively move its contents + Directory dir = entity; + String newPath = path.join( + toDirectory, path.relative(dir.path, from: fromDirectory)); + Directory newDir = Directory(newPath); + await newDir.create(recursive: true); + await moveDirectoryRecurse(dir.path, newPath); + await dir.delete(); + } + } + } } diff --git a/lib/widgets/add_Task.dart b/lib/widgets/add_Task.dart index 3e72be70..ba21a7a8 100644 --- a/lib/widgets/add_Task.dart +++ b/lib/widgets/add_Task.dart @@ -1,13 +1,14 @@ // ignore_for_file: library_private_types_in_public_api, use_build_context_synchronously, file_names import 'dart:developer'; - import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:intl/intl.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/controller/WidgetController.dart'; import 'package:taskwarrior/model/storage/storage_widget.dart'; import 'package:taskwarrior/widgets/taskfunctions/taskparser.dart'; @@ -28,6 +29,7 @@ class _AddTaskBottomSheetState extends State { String priority = 'M'; final tagcontroller = TextEditingController(); List tags = []; + bool inThePast = false; @override void initState() { @@ -44,46 +46,53 @@ class _AddTaskBottomSheetState extends State { @override Widget build(BuildContext context) { const title = 'Add Task'; - - return Center( - child: SingleChildScrollView( - child: AlertDialog( - surfaceTintColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 25, 25, 25) - : Colors.white, - backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 25, 25, 25) - : Colors.white, - title: Center( - child: Text( - title, - style: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + return Scaffold( + backgroundColor: Colors.transparent, + body: Center( + child: SingleChildScrollView( + child: AlertDialog( + surfaceTintColor: AppSettings.isDarkMode + ? TaskWarriorColors.kdialogBackGroundColor + : TaskWarriorColors.kLightDialogBackGroundColor, + shadowColor: AppSettings.isDarkMode + ? TaskWarriorColors.kdialogBackGroundColor + : TaskWarriorColors.kLightDialogBackGroundColor, + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.kdialogBackGroundColor + : TaskWarriorColors.kLightDialogBackGroundColor, + title: Center( + child: Text( + title, + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), ), - ), - content: Form( - key: formKey, - child: SizedBox( - width: MediaQuery.of(context).size.width * 0.8, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - const SizedBox(height: 8), - buildName(), - const SizedBox(height: 12), - buildDueDate(context), - const SizedBox(height: 8), - buildPriority(), - buildTags(), - ], + content: Form( + key: formKey, + child: SizedBox( + width: MediaQuery.of(context).size.width * 0.8, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const SizedBox(height: 8), + buildName(), + const SizedBox(height: 12), + buildDueDate(context), + const SizedBox(height: 8), + buildPriority(), + buildTags(), + ], + ), ), ), + actions: [ + buildCancelButton(context), + buildAddButton(context), + ], ), - actions: [ - buildCancelButton(context), - buildAddButton(context), - ], ), ), ); @@ -104,12 +113,16 @@ class _AddTaskBottomSheetState extends State { child: TextFormField( controller: tagcontroller, style: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), decoration: InputDecoration( hintText: 'Add tags', hintStyle: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.red, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), onFieldSubmitted: (tag) { @@ -145,12 +158,16 @@ class _AddTaskBottomSheetState extends State { autofocus: true, controller: namecontroller, style: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), decoration: InputDecoration( hintText: 'Enter Task', hintStyle: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), validator: (name) => name != null && name.isEmpty @@ -163,26 +180,36 @@ class _AddTaskBottomSheetState extends State { Text( "Due : ", style: GoogleFonts.poppins( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, - fontWeight: FontWeight.bold, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + fontWeight: TaskWarriorFonts.bold, height: 3.3, ), ), Expanded( child: GestureDetector( child: TextFormField( - style: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, - ), + style: inThePast + ? TextStyle(color: TaskWarriorColors.red) + : TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), readOnly: true, controller: TextEditingController( text: (due != null) ? dueString : null, ), decoration: InputDecoration( hintText: 'Select due date', - hintStyle: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, - ), + hintStyle: inThePast + ? TextStyle(color: TaskWarriorColors.red) + : TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), ), onTap: () async { var date = await showDatePicker( @@ -190,31 +217,31 @@ class _AddTaskBottomSheetState extends State { return Theme( data: Theme.of(context).copyWith( colorScheme: AppSettings.isDarkMode - ? const ColorScheme( + ? ColorScheme( brightness: Brightness.dark, - primary: Colors.white, - onPrimary: Colors.black, - secondary: Colors.black, - onSecondary: Colors.white, - error: Colors.red, - onError: Colors.black, - background: Colors.black, - onBackground: Colors.white, - surface: Colors.black, - onSurface: Colors.white, + primary: TaskWarriorColors.white, + onPrimary: TaskWarriorColors.black, + secondary: TaskWarriorColors.black, + onSecondary: TaskWarriorColors.white, + error: TaskWarriorColors.red, + onError: TaskWarriorColors.black, + background: TaskWarriorColors.black, + onBackground: TaskWarriorColors.white, + surface: TaskWarriorColors.black, + onSurface: TaskWarriorColors.white, ) - : const ColorScheme( + : ColorScheme( brightness: Brightness.light, - primary: Colors.black, - onPrimary: Colors.white, - secondary: Colors.white, - onSecondary: Colors.black, - error: Colors.red, - onError: Colors.white, - background: Colors.white, - onBackground: Colors.black, - surface: Colors.white, - onSurface: Colors.black, + primary: TaskWarriorColors.black, + onPrimary: TaskWarriorColors.white, + secondary: TaskWarriorColors.white, + onSecondary: TaskWarriorColors.black, + error: TaskWarriorColors.red, + onError: TaskWarriorColors.white, + background: TaskWarriorColors.white, + onBackground: TaskWarriorColors.black, + surface: TaskWarriorColors.white, + onSurface: TaskWarriorColors.black, ), ), child: child!, @@ -233,31 +260,31 @@ class _AddTaskBottomSheetState extends State { data: Theme.of(context).copyWith( textTheme: const TextTheme(), colorScheme: AppSettings.isDarkMode - ? const ColorScheme( + ? ColorScheme( brightness: Brightness.dark, - primary: Colors.white, - onPrimary: Colors.black, - secondary: Color.fromARGB(255, 70, 68, 68), - onSecondary: Colors.white, - error: Colors.red, - onError: Colors.black, - background: Colors.black, - onBackground: Colors.white, - surface: Colors.black, - onSurface: Colors.white, + primary: TaskWarriorColors.white, + onPrimary: TaskWarriorColors.black, + secondary: TaskWarriorColors.black, + onSecondary: TaskWarriorColors.white, + error: TaskWarriorColors.red, + onError: TaskWarriorColors.black, + background: TaskWarriorColors.black, + onBackground: TaskWarriorColors.white, + surface: TaskWarriorColors.black, + onSurface: TaskWarriorColors.white, ) - : const ColorScheme( + : ColorScheme( brightness: Brightness.light, - primary: Colors.black, - onPrimary: Colors.white, - secondary: Colors.white, - onSecondary: Colors.black, - error: Colors.red, - onError: Colors.white, - background: Colors.white, - onBackground: Colors.black, - surface: Colors.white, - onSurface: Colors.black, + primary: TaskWarriorColors.black, + onPrimary: TaskWarriorColors.white, + secondary: TaskWarriorColors.white, + onSecondary: TaskWarriorColors.black, + error: TaskWarriorColors.red, + onError: TaskWarriorColors.white, + background: TaskWarriorColors.white, + onBackground: TaskWarriorColors.black, + surface: TaskWarriorColors.white, + onSurface: TaskWarriorColors.black, ), ), child: child!, @@ -274,28 +301,36 @@ class _AddTaskBottomSheetState extends State { minutes: time.minute, ), ); - if (dateTime.isAfter(DateTime.now())) { - due = dateTime.toUtc(); + due = dateTime.toUtc(); + dueString = + DateFormat("dd-MM-yyyy HH:mm").format(dateTime); + if (dateTime.isBefore(DateTime.now())) { + //Try changing the color. in the settings and Due display. + setState(() { + inThePast = true; + }); - dueString = - DateFormat("dd-MM-yyyy HH:mm").format(dateTime); - setState(() {}); - } else { ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - 'Please select a due date and time in the future.', - style: TextStyle( - color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, + content: Text( + "The selected time is in the past.", + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), ), - ), - backgroundColor: AppSettings.isDarkMode - ? Colors.black - : Colors.white, - duration: const Duration(seconds: 2), - )); + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors + .kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); + } else { + setState(() { + inThePast = false; + }); } + + // setState(() {}); } } }, @@ -314,25 +349,29 @@ class _AddTaskBottomSheetState extends State { Text( 'Priority : ', style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.bold, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), textAlign: TextAlign.left, ), DropdownButton( dropdownColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 25, 25, 25) - : Colors.white, + ? TaskWarriorColors.kdialogBackGroundColor + : TaskWarriorColors.kLightDialogBackGroundColor, value: priority, elevation: 16, style: GoogleFonts.poppins( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), underline: Container( height: 1.5, color: AppSettings.isDarkMode - ? const Color.fromARGB(255, 25, 25, 25) - : Colors.white, + ? TaskWarriorColors.kdialogBackGroundColor + : TaskWarriorColors.kLightDialogBackGroundColor, ), onChanged: (String? newValue) { setState(() { @@ -356,7 +395,9 @@ class _AddTaskBottomSheetState extends State { child: Text( 'Cancel', style: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), onPressed: () => Navigator.of(context).pop("cancel"), @@ -369,7 +410,9 @@ class _AddTaskBottomSheetState extends State { child: Text( "Add", style: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), onPressed: () async { @@ -396,16 +439,18 @@ class _AddTaskBottomSheetState extends State { widgetController.fetchAllData(); ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - 'Task Added Successfully, Tap to Edit', - style: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + content: Text( + 'Task Added Successfully. Tap to Edit', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), ), - ), - backgroundColor: - AppSettings.isDarkMode ? Colors.black : Colors.white, - duration: const Duration(seconds: 2), - )); + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); final SharedPreferences prefs = await SharedPreferences.getInstance(); @@ -418,17 +463,18 @@ class _AddTaskBottomSheetState extends State { } } on FormatException catch (e) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - e.message, - style: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + content: Text( + e.message, + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), ), - ), - backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 61, 61, 61) - : const Color.fromARGB(255, 39, 39, 39), - duration: const Duration(seconds: 2), - )); + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); log(e.toString()); } } diff --git a/lib/widgets/app_placeholder.dart b/lib/widgets/app_placeholder.dart index 04d85311..2541e809 100644 --- a/lib/widgets/app_placeholder.dart +++ b/lib/widgets/app_placeholder.dart @@ -2,7 +2,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:taskwarrior/config/app_settings.dart'; -import 'package:taskwarrior/widgets/pallete.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; class AppSetupPlaceholder extends StatelessWidget { const AppSetupPlaceholder({super.key}); @@ -11,8 +12,9 @@ class AppSetupPlaceholder extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - backgroundColor: - AppSettings.isDarkMode ? Palette.kToDark.shade200 : Colors.white, + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -29,9 +31,11 @@ class AppSetupPlaceholder extends StatelessWidget { Text( "Setting up the app...", style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 18, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeLarge, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), ], diff --git a/lib/widgets/buildTasks.dart b/lib/widgets/buildTasks.dart index 2e8f695f..f10e19ac 100644 --- a/lib/widgets/buildTasks.dart +++ b/lib/widgets/buildTasks.dart @@ -8,6 +8,8 @@ import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/model/json.dart'; import 'package:taskwarrior/model/storage/storage_widget.dart'; import 'package:taskwarrior/services/task_details.dart'; @@ -34,6 +36,10 @@ class _TasksBuilderState extends State { late Modify modify; ScrollController scrollController = ScrollController(); bool showbtn = false; + Task? lastDeletedTask; + Task? lastCompletedTask; + bool isUndoInProgress = false; // track undo action + @override void initState() { scrollController.addListener(() { @@ -72,12 +78,48 @@ class _TasksBuilderState extends State { modify.save( modified: () => now, ); + + // Show a snackbar with an undo action ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: const Text('Task Updated'), - backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 61, 61, 61) - : const Color.fromARGB(255, 39, 39, 39), - duration: const Duration(seconds: 2))); + content: Text( + 'Task Updated', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), + ), + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2), + action: SnackBarAction( + label: 'Undo', + onPressed: () { + // Undo the task status change + undoChanges(); + }, + ), + )); + } + + void undoChanges() { + if (isUndoInProgress) { + return; // If undo is already in progress, do nothing + } + isUndoInProgress = true; + ScaffoldMessenger.of(context).removeCurrentSnackBar(); + + if (lastDeletedTask != null) { + setStatus('pending', lastDeletedTask!.uuid); + lastDeletedTask = null; + } + + if (lastCompletedTask != null) { + setStatus('pending', lastCompletedTask!.uuid); + lastCompletedTask = null; + } + isUndoInProgress = false; } // final bool darkmode; @@ -101,13 +143,13 @@ class _TasksBuilderState extends State { ); }, backgroundColor: AppSettings.isDarkMode - ? Colors.white - : Palette.kToDark.shade200, + ? TaskWarriorColors.kLightPrimaryBackgroundColor + : TaskWarriorColors.kprimaryBackgroundColor, child: Icon( Icons.arrow_upward, color: AppSettings.isDarkMode - ? Palette.kToDark.shade200 - : Colors.white, + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, ), ), ), @@ -122,10 +164,10 @@ class _TasksBuilderState extends State { : 'Click on the bottom right button to start adding tasks', textAlign: TextAlign.center, style: GoogleFonts.poppins( - fontSize: 20, + fontSize: TaskWarriorFonts.fontSizeLarge, color: AppSettings.isDarkMode - ? Colors.white - : Palette.kToDark.shade200, + ? TaskWarriorColors.kLightPrimaryBackgroundColor + : TaskWarriorColors.kprimaryBackgroundColor, ), ), ), @@ -143,54 +185,31 @@ class _TasksBuilderState extends State { children: [ SlidableAction( onPressed: (context) { - showDialog( - context: context, - builder: (context) { - return AlertDialog( - title: const Text( - 'Do you want to save changes?'), - actions: [ - TextButton( - onPressed: () { - setStatus( - 'completed', task.uuid); - if (task.due != null) { - DateTime? dtb = task.due; - dtb = dtb!.add(const Duration( - minutes: 1)); - final FlutterLocalNotificationsPlugin - flutterLocalNotificationsPlugin = - FlutterLocalNotificationsPlugin(); - flutterLocalNotificationsPlugin - .cancel(dtb.day * 100 + - dtb.hour * 10 + - dtb.minute); - if (kDebugMode) { - print("Task due is $dtb"); - print(dtb.day * 100 + - dtb.hour * 10 + - dtb.minute); - } - } - - Navigator.of(context).pop(); - }, - child: const Text('Yes'), - ), - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text('No'), - ), - ], - ); - }, - ); + // Complete task without confirmation + setStatus('completed', task.uuid); + if (task.due != null) { + DateTime? dtb = task.due; + dtb = + dtb!.add(const Duration(minutes: 1)); + final FlutterLocalNotificationsPlugin + flutterLocalNotificationsPlugin = + FlutterLocalNotificationsPlugin(); + flutterLocalNotificationsPlugin.cancel( + dtb.day * 100 + + dtb.hour * 10 + + dtb.minute); + if (kDebugMode) { + print("Task due is $dtb"); + print(dtb.day * 100 + + dtb.hour * 10 + + dtb.minute); + } + } + lastCompletedTask = task; }, icon: Icons.done, label: "COMPLETE", - backgroundColor: Colors.green, + backgroundColor: TaskWarriorColors.green, ), ], ), @@ -199,64 +218,42 @@ class _TasksBuilderState extends State { children: [ SlidableAction( onPressed: (context) { - showDialog( - context: context, - builder: (context) { - return AlertDialog( - title: const Text( - 'Do you want to save changes?'), - actions: [ - TextButton( - onPressed: () { - setStatus('deleted', task.uuid); - if (task.due != null) { - DateTime? dtb = task.due; - dtb = dtb!.add(const Duration( - minutes: 1)); - final FlutterLocalNotificationsPlugin - flutterLocalNotificationsPlugin = - FlutterLocalNotificationsPlugin(); - flutterLocalNotificationsPlugin - .cancel(dtb.day * 100 + - dtb.hour * 10 + - dtb.minute); - if (kDebugMode) { - print("Task due is $dtb"); - print(dtb.day * 100 + - dtb.hour * 10 + - dtb.minute); - } - } - - Navigator.of(context).pop(); - }, - child: const Text('Yes'), - ), - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text('No'), - ), - ], - ); - }, - ); + // Delete task without confirmation + setStatus('deleted', task.uuid); + if (task.due != null) { + DateTime? dtb = task.due; + dtb = + dtb!.add(const Duration(minutes: 1)); + final FlutterLocalNotificationsPlugin + flutterLocalNotificationsPlugin = + FlutterLocalNotificationsPlugin(); + flutterLocalNotificationsPlugin.cancel( + dtb.day * 100 + + dtb.hour * 10 + + dtb.minute); + if (kDebugMode) { + print("Task due is $dtb"); + print(dtb.day * 100 + + dtb.hour * 10 + + dtb.minute); + } + } + lastDeletedTask = task; }, icon: Icons.delete, label: "DELETE", - backgroundColor: Colors.red, + backgroundColor: TaskWarriorColors.red, ), ], ), child: Card( color: AppSettings.isDarkMode ? Palette.kToDark - : Colors.white, + : TaskWarriorColors.white, child: InkWell( splashColor: AppSettings.isDarkMode - ? Colors.black - : Colors.grey.shade200, + ? TaskWarriorColors.black + : TaskWarriorColors.borderColor, onTap: () => Navigator.push( context, MaterialPageRoute( @@ -275,11 +272,11 @@ class _TasksBuilderState extends State { : Card( color: AppSettings.isDarkMode ? Palette.kToDark - : Colors.white, + : TaskWarriorColors.white, child: InkWell( splashColor: AppSettings.isDarkMode - ? Colors.black - : Colors.grey.shade200, + ? TaskWarriorColors.black + : TaskWarriorColors.borderColor, onTap: () => Navigator.push( context, MaterialPageRoute( diff --git a/lib/widgets/createDrawerHeader.dart b/lib/widgets/createDrawerHeader.dart index f03f76ff..102a48ab 100644 --- a/lib/widgets/createDrawerHeader.dart +++ b/lib/widgets/createDrawerHeader.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; Widget createDrawerHeader() { return ListTile( @@ -11,7 +12,10 @@ Widget createDrawerHeader() { ), title: Text( 'Taskwarrior', - style: GoogleFonts.poppins(fontSize: 30.0, fontWeight: FontWeight.w500), + style: GoogleFonts.poppins( + fontSize: 30.0, + fontWeight: TaskWarriorFonts.medium, + ), ), ); } diff --git a/lib/widgets/profilefunctions/deleteprofiledialog.dart b/lib/widgets/profilefunctions/deleteprofiledialog.dart index 4b48d197..50d58654 100644 --- a/lib/widgets/profilefunctions/deleteprofiledialog.dart +++ b/lib/widgets/profilefunctions/deleteprofiledialog.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/utility/utilities.dart'; import 'package:taskwarrior/widgets/taskdetails/profiles_widget.dart'; class DeleteProfileDialog extends StatelessWidget { @@ -18,16 +20,30 @@ class DeleteProfileDialog extends StatelessWidget { return Center( child: SingleChildScrollView( child: Center( - child: AlertDialog( + child: Utils.showAlertDialog( scrollable: true, - title: const Text('Delete Profile?'), + title: Text( + 'Delete Profile?', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), // content: TextField(controller: controller), actions: [ TextButton( onPressed: () { Navigator.of(context).pop(); }, - child: const Text('Cancel'), + child: Text( + 'Cancel', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), ), ElevatedButton( onPressed: () { @@ -36,22 +52,41 @@ class DeleteProfileDialog extends StatelessWidget { Navigator.of(context).pop(); ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text( - 'Profile: ${profile.characters} Deleted Successfully'), + 'Profile: ${profile.characters} Deleted Successfully', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), + ), backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 61, 61, 61) - : const Color.fromARGB(255, 39, 39, 39), + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, duration: const Duration(seconds: 2))); } catch (e) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text( - 'Profile: ${profile.characters} Deletion Failed'), + 'Profile: ${profile.characters} Deletion Failed', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), + ), backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 61, 61, 61) - : const Color.fromARGB(255, 39, 39, 39), + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, duration: const Duration(seconds: 2))); } }, - child: const Text('Confirm'), + child: Text( + 'Confirm', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.black + : TaskWarriorColors.black, + ), + ), ), ], ), diff --git a/lib/widgets/profilefunctions/manageprofile.dart b/lib/widgets/profilefunctions/manageprofile.dart index 1387cfa7..829ed1c8 100644 --- a/lib/widgets/profilefunctions/manageprofile.dart +++ b/lib/widgets/profilefunctions/manageprofile.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:tuple/tuple.dart'; @@ -33,32 +35,40 @@ class ManageProfile extends StatelessWidget { return ExpansionTile( backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 48, 46, 46) - : const Color.fromARGB(255, 220, 216, 216), - iconColor: AppSettings.isDarkMode ? Colors.white : Colors.black, - collapsedIconColor: AppSettings.isDarkMode ? Colors.white : Colors.black, + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + iconColor: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + collapsedIconColor: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, collapsedTextColor: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), - textColor: AppSettings.isDarkMode ? Colors.white : Colors.black, + ? TaskWarriorColors.white + : TaskWarriorColors.ksecondaryBackgroundColor, + textColor: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, key: const PageStorageKey('manage-profile'), title: Text( 'Manage selected profile', style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), children: [ for (var triple in triples) ListTile( textColor: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.ksecondaryTextColor + : TaskWarriorColors.kLightSecondaryTextColor, iconColor: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.white + : TaskWarriorColors.kLightSecondaryTextColor, leading: Padding( padding: const EdgeInsets.all(12), child: Icon(triple.item1), diff --git a/lib/widgets/profilefunctions/renameprofiledialog.dart b/lib/widgets/profilefunctions/renameprofiledialog.dart index f6b9aebd..54d7afee 100644 --- a/lib/widgets/profilefunctions/renameprofiledialog.dart +++ b/lib/widgets/profilefunctions/renameprofiledialog.dart @@ -1,4 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/utility/utilities.dart'; import 'package:taskwarrior/widgets/taskdetails.dart'; @@ -20,16 +23,36 @@ class RenameProfileDialog extends StatelessWidget { return SingleChildScrollView( child: Center( - child: AlertDialog( + child: Utils.showAlertDialog( scrollable: true, - title: const Text('Rename Alias'), - content: TextField(controller: controller), + title: Text( + 'Rename Alias', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), + content: TextField( + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + controller: controller), actions: [ TextButton( onPressed: () { Navigator.of(context).pop(); }, - child: const Text('Cancel'), + child: Text( + 'Cancel', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), ), ElevatedButton( onPressed: () { @@ -39,7 +62,14 @@ class RenameProfileDialog extends StatelessWidget { ); Navigator.of(context).pop(); }, - child: const Text('Submit'), + child: Text( + 'Submit', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.black + : TaskWarriorColors.black, + ), + ), ), ], ), diff --git a/lib/widgets/profilefunctions/selectprofile.dart b/lib/widgets/profilefunctions/selectprofile.dart index 262d5628..1d446e10 100644 --- a/lib/widgets/profilefunctions/selectprofile.dart +++ b/lib/widgets/profilefunctions/selectprofile.dart @@ -4,6 +4,8 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:sizer/sizer.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; class SelectProfile extends StatelessWidget { const SelectProfile( @@ -22,14 +24,20 @@ class SelectProfile extends StatelessWidget { return ExpansionTile( key: const PageStorageKey('task-list'), backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 48, 46, 46) - : const Color.fromARGB(255, 220, 216, 216), - iconColor: AppSettings.isDarkMode ? Colors.white : Colors.black, - collapsedIconColor: AppSettings.isDarkMode ? Colors.white : Colors.black, + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + iconColor: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + collapsedIconColor: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, collapsedTextColor: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), - textColor: AppSettings.isDarkMode ? Colors.white : Colors.black, + ? TaskWarriorColors.ksecondaryTextColor + : TaskWarriorColors.kLightSecondaryTextColor, + textColor: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, title: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -37,9 +45,11 @@ class SelectProfile extends StatelessWidget { 'Current Profile:', overflow: TextOverflow.fade, style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), SizedBox( @@ -47,8 +57,10 @@ class SelectProfile extends StatelessWidget { ), Text(currentProfile, style: GoogleFonts.poppins( - fontSize: 12, - color: AppSettings.isDarkMode ? Colors.grey : Colors.grey[600], + fontSize: TaskWarriorFonts.fontSizeSmall, + color: AppSettings.isDarkMode + ? TaskWarriorColors.grey + : TaskWarriorColors.lightGrey, )) ], ), @@ -64,9 +76,11 @@ class SelectProfile extends StatelessWidget { 'All Profiles:', overflow: TextOverflow.fade, style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, - color: AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), ], @@ -114,15 +128,25 @@ class SelectProfileListTile extends StatelessWidget { select(); ScaffoldMessenger.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text('Switched to Profile ${alias ?? uuid}'), - )); + content: Text( + 'Switched to Profile ${alias ?? uuid}', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), + ), + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); }, activeColor: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.white + : TaskWarriorColors.ksecondaryBackgroundColor, focusColor: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.white + : TaskWarriorColors.ksecondaryBackgroundColor, ), Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -140,8 +164,8 @@ class SelectProfileListTile extends StatelessWidget { overflow: TextOverflow.fade, style: GoogleFonts.poppins( color: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.ksecondaryTextColor + : TaskWarriorColors.kLightSecondaryTextColor, ), ), ), @@ -153,8 +177,8 @@ class SelectProfileListTile extends StatelessWidget { uuid, style: GoogleFonts.poppins( color: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.ksecondaryTextColor + : TaskWarriorColors.kLightSecondaryTextColor, ), ), ), diff --git a/lib/widgets/project_filter.dart b/lib/widgets/project_filter.dart index 75d1aa8a..a5b04610 100644 --- a/lib/widgets/project_filter.dart +++ b/lib/widgets/project_filter.dart @@ -4,6 +4,8 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:sizer/sizer.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; import 'package:taskwarrior/widgets/taskw.dart'; class InheritedProjects extends InheritedWidget { @@ -56,10 +58,11 @@ class ProjectsColumn extends StatelessWidget { Text( "Project : ", style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, - color: - AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), SizedBox( @@ -74,10 +77,10 @@ class ProjectsColumn extends StatelessWidget { ? "Not selected" : projectFilter, style: GoogleFonts.poppins( - fontSize: 12, + fontSize: TaskWarriorFonts.fontSizeSmall, color: AppSettings.isDarkMode - ? Colors.white - : Colors.black, + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), ], @@ -95,10 +98,11 @@ class ProjectsColumn extends StatelessWidget { Text( "All Projects", style: GoogleFonts.poppins( - fontWeight: FontWeight.w600, - fontSize: 12, - color: - AppSettings.isDarkMode ? Colors.white : Colors.black, + fontWeight: TaskWarriorFonts.semiBold, + fontSize: TaskWarriorFonts.fontSizeSmall, + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, ), ), ], @@ -115,9 +119,9 @@ class ProjectsColumn extends StatelessWidget { "No Projects Found", style: GoogleFonts.poppins( color: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), - fontSize: 14, + ? TaskWarriorColors.white + : TaskWarriorColors.black, + fontSize: TaskWarriorFonts.fontSizeSmall, ), ), SizedBox( @@ -149,25 +153,28 @@ class ProjectTile extends StatelessWidget { Flexible( child: Text(project, style: GoogleFonts.poppins( - color: - AppSettings.isDarkMode ? Colors.white : Colors.black))), + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black))), Text( (node.children.isEmpty) ? '${node.subtasks}' : '(${node.tasks}) ${node.subtasks}', style: GoogleFonts.poppins( - color: AppSettings.isDarkMode ? Colors.white : Colors.black), + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black), ) ], ); var radio = Radio( activeColor: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.white + : TaskWarriorColors.ksecondaryBackgroundColor, focusColor: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.white + : TaskWarriorColors.ksecondaryBackgroundColor, toggleable: true, value: project, groupValue: projectFilter, @@ -185,16 +192,16 @@ class ProjectTile extends StatelessWidget { maxLines: 3, style: GoogleFonts.poppins( color: AppSettings.isDarkMode - ? Colors.white - : Colors.black)), + ? TaskWarriorColors.white + : TaskWarriorColors.black)), const Spacer(), Container( padding: const EdgeInsets.symmetric(horizontal: 4), margin: const EdgeInsets.only(right: 10), decoration: BoxDecoration( color: (AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46)), + ? TaskWarriorColors.white + : TaskWarriorColors.ksecondaryBackgroundColor), ), child: Text( (node.children.isEmpty) @@ -203,8 +210,8 @@ class ProjectTile extends StatelessWidget { maxLines: 1, style: GoogleFonts.poppins( color: AppSettings.isDarkMode - ? Colors.black - : Colors.white), + ? TaskWarriorColors.black + : TaskWarriorColors.white), ), ), ], @@ -216,11 +223,11 @@ class ProjectTile extends StatelessWidget { leading: radio, title: title, backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 48, 46, 46) - : const Color.fromARGB(255, 220, 216, 216), + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.ksecondaryBackgroundColor, textColor: AppSettings.isDarkMode - ? Colors.white - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.white + : TaskWarriorColors.ksecondaryBackgroundColor, children: node.children.map(ProjectTile.new).toList(), ); } diff --git a/lib/widgets/tag_filter.dart b/lib/widgets/tag_filter.dart index 3b2de9c7..2402fe18 100644 --- a/lib/widgets/tag_filter.dart +++ b/lib/widgets/tag_filter.dart @@ -3,6 +3,8 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; class TagFilterMetadata { const TagFilterMetadata({ @@ -42,10 +44,12 @@ class TagFiltersWrap extends StatelessWidget { onSelected: (_) => filters.toggleTagUnion(), label: Text(filters.tagUnion ? 'OR' : 'AND', style: GoogleFonts.poppins( - color: AppSettings.isDarkMode ? Colors.black : Colors.white)), + color: AppSettings.isDarkMode + ? TaskWarriorColors.black + : TaskWarriorColors.white)), backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 220, 216, 216) - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.kLightSecondaryBackgroundColor + : TaskWarriorColors.ksecondaryBackgroundColor, ), for (var entry in filters.tags.entries) FilterChip( @@ -53,12 +57,15 @@ class TagFiltersWrap extends StatelessWidget { label: Text( entry.value.display, style: GoogleFonts.poppins( - fontWeight: entry.value.selected ? FontWeight.w700 : null, - color: AppSettings.isDarkMode ? Colors.black : Colors.white), + fontWeight: + entry.value.selected ? TaskWarriorFonts.bold : null, + color: AppSettings.isDarkMode + ? TaskWarriorColors.black + : TaskWarriorColors.white), ), backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 220, 216, 216) - : const Color.fromARGB(255, 48, 46, 46), + ? TaskWarriorColors.kLightSecondaryBackgroundColor + : TaskWarriorColors.kprimaryBackgroundColor, ), ], ); diff --git a/lib/widgets/taskdetails/dateTimePicker.dart b/lib/widgets/taskdetails/dateTimePicker.dart index d2514799..ad31f9a2 100644 --- a/lib/widgets/taskdetails/dateTimePicker.dart +++ b/lib/widgets/taskdetails/dateTimePicker.dart @@ -6,6 +6,8 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:intl/intl.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; class DateTimeWidget extends StatelessWidget { const DateTimeWidget({ @@ -39,8 +41,8 @@ class DateTimeWidget extends StatelessWidget { TextSpan( text: '$name:'.padRight(13), style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode ? Colors.white : Colors.black, @@ -49,7 +51,7 @@ class DateTimeWidget extends StatelessWidget { TextSpan( text: value ?? "not selected", style: GoogleFonts.poppins( - fontSize: 15, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode ? Colors.white : Colors.black, @@ -93,9 +95,19 @@ class DateTimeWidget extends StatelessWidget { // Check if the selected time is in the past if (dateTime.isBefore(DateTime.now())) { // Show a message that past times can't be set - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text("Can't set times in the past")), - ); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text( + "Can't set times in the past", + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor, + ), + ), + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.ksecondaryBackgroundColor + : TaskWarriorColors.kLightSecondaryBackgroundColor, + duration: const Duration(seconds: 2))); } else { // If the time is not in the past, proceed as usual return callback(dateTime.toUtc()); @@ -141,8 +153,8 @@ class StartWidget extends StatelessWidget { TextSpan( text: '$name:'.padRight(13), style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode ? Colors.white : Colors.black, @@ -151,7 +163,7 @@ class StartWidget extends StatelessWidget { TextSpan( text: value ?? "not selected", style: GoogleFonts.poppins( - fontSize: 15, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode ? Colors.white : Colors.black, diff --git a/lib/widgets/taskdetails/description_widget.dart b/lib/widgets/taskdetails/description_widget.dart index e2651d2c..260ab04c 100644 --- a/lib/widgets/taskdetails/description_widget.dart +++ b/lib/widgets/taskdetails/description_widget.dart @@ -4,6 +4,9 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:loggy/loggy.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; +import 'package:taskwarrior/utility/utilities.dart'; class DescriptionWidget extends StatelessWidget { const DescriptionWidget( @@ -36,8 +39,8 @@ class DescriptionWidget extends StatelessWidget { TextSpan( text: '$name:'.padRight(13), style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode ? Colors.white : Colors.black, @@ -46,7 +49,7 @@ class DescriptionWidget extends StatelessWidget { TextSpan( text: value ?? "not selected", style: GoogleFonts.poppins( - fontSize: 15, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode ? Colors.white : Colors.black, @@ -64,10 +67,22 @@ class DescriptionWidget extends StatelessWidget { ); showDialog( context: context, - builder: (context) => AlertDialog( + builder: (context) => Utils.showAlertDialog( scrollable: true, - title: const Text('Edit description'), + title: Text( + 'Edit description', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), content: TextField( + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), autofocus: true, maxLines: null, controller: controller, @@ -77,7 +92,14 @@ class DescriptionWidget extends StatelessWidget { onPressed: () { Navigator.of(context).pop(); }, - child: const Text('Cancel'), + child: Text( + 'Cancel', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), ), ElevatedButton( onPressed: () { @@ -88,7 +110,14 @@ class DescriptionWidget extends StatelessWidget { logError(e, trace); } }, - child: const Text('Submit'), + child: Text( + 'Submit', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.black + : TaskWarriorColors.black, + ), + ), ), ], ), @@ -130,8 +159,8 @@ class ProjectWidget extends StatelessWidget { TextSpan( text: '$name:'.padRight(13), style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode ? Colors.white : Colors.black, @@ -140,7 +169,7 @@ class ProjectWidget extends StatelessWidget { TextSpan( text: value ?? "not selected", style: GoogleFonts.poppins( - fontSize: 15, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode ? Colors.white : Colors.black, @@ -158,10 +187,22 @@ class ProjectWidget extends StatelessWidget { ); showDialog( context: context, - builder: (context) => AlertDialog( + builder: (context) => Utils.showAlertDialog( scrollable: true, - title: const Text('Edit project'), + title: Text( + 'Edit project', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), content: TextField( + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), autofocus: true, maxLines: null, controller: controller, @@ -171,7 +212,14 @@ class ProjectWidget extends StatelessWidget { onPressed: () { Navigator.of(context).pop(); }, - child: const Text('Cancel'), + child: Text( + 'Cancel', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), ), ElevatedButton( onPressed: () { @@ -183,7 +231,14 @@ class ProjectWidget extends StatelessWidget { logError(e, trace); } }, - child: const Text('Submit'), + child: Text( + 'Submit', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.black + : TaskWarriorColors.black, + ), + ), ), ], ), diff --git a/lib/widgets/taskdetails/priority_widget.dart b/lib/widgets/taskdetails/priority_widget.dart index 21a70378..7dab467c 100644 --- a/lib/widgets/taskdetails/priority_widget.dart +++ b/lib/widgets/taskdetails/priority_widget.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; class PriorityWidget extends StatelessWidget { const PriorityWidget( @@ -34,8 +35,8 @@ class PriorityWidget extends StatelessWidget { TextSpan( text: '$name:'.padRight(13), style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode ? Colors.white : Colors.black, @@ -44,7 +45,7 @@ class PriorityWidget extends StatelessWidget { TextSpan( text: value ?? "not selected", style: GoogleFonts.poppins( - fontSize: 15, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode ? Colors.white : Colors.black, diff --git a/lib/widgets/taskdetails/profiles_widget.dart b/lib/widgets/taskdetails/profiles_widget.dart index bd7c78de..e5b78e2e 100644 --- a/lib/widgets/taskdetails/profiles_widget.dart +++ b/lib/widgets/taskdetails/profiles_widget.dart @@ -15,10 +15,12 @@ import 'package:taskwarrior/widgets/taskw.dart'; class ProfilesWidget extends StatefulWidget { const ProfilesWidget({ Key? key, + required this.defaultDirectory, required this.baseDirectory, required this.child, }) : super(key: key); + final Directory defaultDirectory; final Directory baseDirectory; final Widget child; @@ -31,14 +33,16 @@ class ProfilesWidget extends StatefulWidget { } class _ProfilesWidgetState extends State { + late Directory baseDirectory; late Map profilesMap; late String currentProfile; - Profiles get _profiles => Profiles(widget.baseDirectory); + Profiles get _profiles => Profiles(baseDirectory); @override void initState() { super.initState(); + baseDirectory = widget.baseDirectory; _checkProfiles(); profilesMap = _profiles.profilesMap(); currentProfile = _profiles.getCurrentProfile()!; @@ -55,6 +59,20 @@ class _ProfilesWidgetState extends State { } } + Directory getDefaultDirectory() { + return widget.defaultDirectory; + } + + Directory getBaseDirectory() { + return baseDirectory; + } + + void setBaseDirectory(Directory newBaseDirectory) { + baseDirectory = newBaseDirectory; + profilesMap = _profiles.profilesMap(); + setState(() {}); + } + void addProfile() { _profiles.addProfile(); profilesMap = _profiles.profilesMap(); @@ -94,6 +112,9 @@ class _ProfilesWidgetState extends State { @override Widget build(BuildContext context) { return InheritedProfiles( + getDefaultDirectory: getDefaultDirectory, + getBaseDirectory: getBaseDirectory, + setBaseDirectory: setBaseDirectory, addProfile: addProfile, copyConfigToNewProfile: copyConfigToNewProfile, deleteProfile: deleteProfile, @@ -105,7 +126,7 @@ class _ProfilesWidgetState extends State { setState: setState, child: StorageWidget( profile: Directory( - '${widget.baseDirectory.path}/profiles/$currentProfile', + '${baseDirectory.path}/profiles/$currentProfile', ), child: widget.child, ), @@ -116,6 +137,9 @@ class _ProfilesWidgetState extends State { class InheritedProfiles extends InheritedModel { const InheritedProfiles({ super.key, + required this.getDefaultDirectory, + required this.getBaseDirectory, + required this.setBaseDirectory, required this.addProfile, required this.copyConfigToNewProfile, required this.deleteProfile, @@ -128,6 +152,9 @@ class InheritedProfiles extends InheritedModel { required child, }) : super(child: child); + final Directory Function() getDefaultDirectory; + final Directory Function() getBaseDirectory; + final void Function(Directory) setBaseDirectory; final Function() addProfile; final Function(String) copyConfigToNewProfile; final Function(String) deleteProfile; diff --git a/lib/widgets/taskdetails/status_widget.dart b/lib/widgets/taskdetails/status_widget.dart index 65af70a9..8ceb725a 100644 --- a/lib/widgets/taskdetails/status_widget.dart +++ b/lib/widgets/taskdetails/status_widget.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorfonts.dart'; class StatusWidget extends StatelessWidget { const StatusWidget( @@ -37,8 +38,8 @@ class StatusWidget extends StatelessWidget { TextSpan( text: '$name:'.padRight(13), style: GoogleFonts.poppins( - fontWeight: FontWeight.bold, - fontSize: 15, + fontWeight: TaskWarriorFonts.bold, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode ? Colors.white : Colors.black, @@ -47,7 +48,7 @@ class StatusWidget extends StatelessWidget { TextSpan( text: value ?? "not selected", style: GoogleFonts.poppins( - fontSize: 15, + fontSize: TaskWarriorFonts.fontSizeMedium, color: AppSettings.isDarkMode ? Colors.white : Colors.black, diff --git a/lib/widgets/taskdetails/tags_widget.dart b/lib/widgets/taskdetails/tags_widget.dart index ac1dd078..be41b3ba 100644 --- a/lib/widgets/taskdetails/tags_widget.dart +++ b/lib/widgets/taskdetails/tags_widget.dart @@ -6,16 +6,17 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:loggy/loggy.dart'; import 'package:taskwarrior/config/app_settings.dart'; +import 'package:taskwarrior/config/taskwarriorcolors.dart'; import 'package:taskwarrior/model/storage/storage_widget.dart'; +import 'package:taskwarrior/utility/utilities.dart'; import 'package:taskwarrior/widgets/taskw.dart'; -import '../pallete.dart'; class TagsWidget extends StatelessWidget { - const TagsWidget({ - required this.name, - required this.value, - required this.callback, - super.key, + const TagsWidget({ + required this.name, + required this.value, + required this.callback, + super.key, }); final String name; @@ -28,9 +29,9 @@ class TagsWidget extends StatelessWidget { child: ListTile( tileColor: AppSettings.isDarkMode ? const Color.fromARGB(255, 55, 54, 54) - : Colors.white, + : TaskWarriorColors.white, textColor: AppSettings.isDarkMode - ? Colors.white + ? TaskWarriorColors.white : const Color.fromARGB(255, 48, 46, 46), title: SingleChildScrollView( scrollDirection: Axis.horizontal, @@ -59,7 +60,6 @@ class TagsWidget extends StatelessWidget { class TagsRoute extends StatefulWidget { const TagsRoute({required this.value, required this.callback, super.key}); - final ListBuilder? value; final void Function(ListBuilder?) callback; @@ -72,7 +72,8 @@ class TagsRouteState extends State { ListBuilder? draftTags; void _addTag(String tag) { - if (tag.isNotEmpty) { // Add this condition to ensure the tag is not empty + if (tag.isNotEmpty) { + // Add this condition to ensure the tag is not empty if (draftTags == null) { draftTags = ListBuilder([tag]); } else { @@ -115,24 +116,24 @@ class TagsRouteState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - backgroundColor: Palette.kToDark.shade200, + backgroundColor: TaskWarriorColors.kprimaryBackgroundColor, title: Text( 'Tags', - style: GoogleFonts.poppins(color: Colors.white), + style: GoogleFonts.poppins(color: TaskWarriorColors.white), ), - leading: const BackButton( - color: Colors.white, + leading: BackButton( + color: TaskWarriorColors.white, ), ), backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 31, 31, 31) - : Colors.white, + ? TaskWarriorColors.kprimaryBackgroundColor + : TaskWarriorColors.kLightPrimaryBackgroundColor, body: SafeArea( child: Padding( padding: const EdgeInsets.all(4), child: SingleChildScrollView( padding: - const EdgeInsets.only(left: 10, top: 10, right: 10, bottom: 0), + const EdgeInsets.only(left: 10, top: 10, right: 10, bottom: 0), child: Wrap( spacing: 8, runSpacing: 4, @@ -140,7 +141,7 @@ class TagsRouteState extends State { if (draftTags != null) for (var tag in draftTags!.build()) FilterChip( - backgroundColor: Colors.grey.shade200, + backgroundColor: TaskWarriorColors.lightGrey, onSelected: (_) => _removeTag(tag), label: Text( '+$tag ${_pendingTags?[tag]?.frequency ?? 0}', @@ -154,20 +155,20 @@ class TagsRouteState extends State { style: GoogleFonts.poppins( fontStyle: FontStyle.italic, color: AppSettings.isDarkMode - ? Colors.white - : Colors.black), + ? TaskWarriorColors.kprimaryTextColor + : TaskWarriorColors.kLightPrimaryTextColor), ), ), Divider( color: AppSettings.isDarkMode ? const Color.fromARGB(255, 192, 192, 192) - : Palette.kToDark.shade200, + : TaskWarriorColors.kprimaryBackgroundColor, ), if (_pendingTags != null) - for (var tag in _pendingTags!.entries - .where((tag) => !(draftTags?.build().contains(tag.key) ?? false))) + for (var tag in _pendingTags!.entries.where((tag) => + !(draftTags?.build().contains(tag.key) ?? false))) FilterChip( - backgroundColor: Colors.grey.shade200, + backgroundColor: TaskWarriorColors.grey, onSelected: (_) => _addTag(tag.key), label: Text( '${tag.key} ${tag.value.frequency}', @@ -179,21 +180,39 @@ class TagsRouteState extends State { ), ), floatingActionButton: FloatingActionButton( + backgroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.black + : TaskWarriorColors.white, + foregroundColor: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + splashColor: AppSettings.isDarkMode + ? TaskWarriorColors.black + : TaskWarriorColors.white, heroTag: "btn4", onPressed: () { final formKey = GlobalKey(); var controller = TextEditingController(); showDialog( context: context, - builder: (context) => AlertDialog( - backgroundColor: AppSettings.isDarkMode - ? const Color.fromARGB(255, 220, 216, 216) - : Colors.white, + builder: (context) => Utils.showAlertDialog( scrollable: true, - title: const Text('Add tag'), + title: Text( + 'Add tag', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), content: Form( key: formKey, child: TextFormField( + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), validator: (value) { if (value != null) { if (value.isNotEmpty && value.contains(" ")) { @@ -211,7 +230,14 @@ class TagsRouteState extends State { onPressed: () { Navigator.of(context).pop(); }, - child: const Text('Cancel'), + child: Text( + 'Cancel', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.white + : TaskWarriorColors.black, + ), + ), ), ElevatedButton( onPressed: () { @@ -225,7 +251,14 @@ class TagsRouteState extends State { } } }, - child: const Text('Submit'), + child: Text( + 'Submit', + style: TextStyle( + color: AppSettings.isDarkMode + ? TaskWarriorColors.black + : TaskWarriorColors.black, + ), + ), ), ], ), diff --git a/pubspec.lock b/pubspec.lock index b0599e2b..af864631 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -281,6 +281,14 @@ packages: url: "https://pub.dev" source: hosted version: "7.0.0" + file_picker: + dependency: "direct main" + description: + name: file_picker + sha256: "4e42aacde3b993c5947467ab640882c56947d9d27342a5b6f2895b23956954a6" + url: "https://pub.dev" + source: hosted + version: "6.1.1" file_picker_writable: dependency: "direct main" description: @@ -430,6 +438,14 @@ packages: url: "https://pub.dev" source: hosted version: "6.0.2" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da + url: "https://pub.dev" + source: hosted + version: "2.0.17" flutter_slidable: dependency: "direct main" description: @@ -608,6 +624,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.8.1" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" lints: dependency: transitive description: @@ -636,26 +676,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" mime: dependency: transitive description: @@ -700,10 +740,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_parsing: dependency: transitive description: @@ -1226,6 +1266,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + url: "https://pub.dev" + source: hosted + version: "13.0.0" watcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 00fb4976..87d220f8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -55,6 +55,7 @@ dependencies: uuid: ^4.2.2 crypto: ^3.0.1 flutter_platform_widgets: ^6.0.2 + file_picker: ^6.1.1 dev_dependencies: build_runner: ^2.1.11