-
Notifications
You must be signed in to change notification settings - Fork 174
Improve directory buttons UI in settings screen #623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1ba9853
ff8964b
8b277e6
2b54158
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:get/get.dart'; | ||
|
|
||
| import 'package:taskwarrior/app/modules/home/controllers/home_controller.dart'; | ||
| import 'package:google_fonts/google_fonts.dart'; | ||
| import 'package:taskwarrior/app/utils/app_settings/app_settings.dart'; | ||
| import 'package:taskwarrior/app/utils/constants/taskwarrior_fonts.dart'; | ||
|
|
@@ -63,24 +64,58 @@ class ProjectsColumn extends StatelessWidget { | |
| ], | ||
| ), | ||
| ), | ||
| Padding( | ||
| padding: const EdgeInsets.only(left: 10, right: 10, top: 10), | ||
| GestureDetector( | ||
| onTap: () => callback(''), | ||
| child: Row( | ||
| mainAxisAlignment: MainAxisAlignment.start, | ||
| children: [ | ||
| Text(SentenceManager( | ||
| currentLanguage: AppSettings.selectedLanguage).sentences.allProjects, | ||
| style: TextStyle( | ||
| fontFamily: FontFamily.poppins, | ||
| fontSize: TaskWarriorFonts.fontSizeSmall, | ||
| color: tColors.primaryTextColor, | ||
| )), | ||
| Radio( | ||
| activeColor: tColors.primaryTextColor, | ||
| focusColor: tColors.secondaryTextColor, | ||
| toggleable: true, | ||
| value: '', | ||
| groupValue: projectFilter, | ||
| onChanged: (_) => callback(''), | ||
| ), | ||
| Text( | ||
| SentenceManager(currentLanguage: AppSettings.selectedLanguage) | ||
| .sentences | ||
| .allProjects, | ||
| style: GoogleFonts.poppins( | ||
| color: tColors.primaryTextColor, | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| GestureDetector( | ||
| onTap: () => callback(HomeController.noProjectValue), | ||
| child: Row( | ||
| mainAxisAlignment: MainAxisAlignment.start, | ||
| children: [ | ||
| Radio( | ||
| activeColor: tColors.primaryTextColor, | ||
| focusColor: tColors.secondaryTextColor, | ||
| toggleable: true, | ||
| value: HomeController.noProjectValue, | ||
| groupValue: projectFilter, | ||
| onChanged: (_) => callback(HomeController.noProjectValue), | ||
| ), | ||
| Text( | ||
| SentenceManager(currentLanguage: AppSettings.selectedLanguage) | ||
| .sentences | ||
| .noProject, | ||
|
Comment on lines
+91
to
+107
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Map Line 92/Line 100 sets 🐛 Suggested fix `@override`
Widget build(BuildContext context) {
TaskwarriorColorTheme tColors = Theme.of(context).extension<TaskwarriorColorTheme>()!;
+ final sentences =
+ SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences;
+ final selectedProjectLabel = projectFilter.isEmpty
+ ? sentences.notSelected
+ : projectFilter == HomeController.noProjectValue
+ ? sentences.noProject
+ : projectFilter;
return Column(
children: [
@@
Text(
- "${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.project} : ",
+ "${sentences.project} : ",
@@
Text(
- projectFilter == "" ? SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.notSelected : projectFilter,
+ selectedProjectLabel,
style: TextStyle(🤖 Prompt for AI Agents |
||
| style: GoogleFonts.poppins( | ||
| color: tColors.primaryTextColor, | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| if (projects.isNotEmpty) | ||
| ...projects.entries | ||
| .where((entry) => entry.value.parent == null) | ||
| .where((entry) => | ||
| entry.value.parent == null && entry.key.isNotEmpty) | ||
| .map((entry) => ProjectTile( | ||
| project: entry.key, | ||
| projects: projects, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:taskwarrior/app/modules/home/controllers/home_controller.dart'; | ||
| import 'package:taskwarrior/app/utils/app_settings/app_settings.dart'; | ||
| import 'package:taskwarrior/app/utils/constants/taskwarrior_fonts.dart'; | ||
| import 'package:taskwarrior/app/utils/gen/fonts.gen.dart'; | ||
|
|
@@ -65,17 +66,27 @@ class ProjectColumnTaskc extends StatelessWidget { | |
| ), | ||
| ), | ||
| ProjectTileTaskc( | ||
| project: SentenceManager( | ||
| project: '', | ||
| projectFilter: projectFilter, | ||
| callback: callback, | ||
| displayName: SentenceManager( | ||
| currentLanguage: AppSettings.selectedLanguage, | ||
| ).sentences.allProjects, | ||
| ).sentences.allProjects), | ||
| ProjectTileTaskc( | ||
| project: HomeController.noProjectValue, | ||
| projectFilter: projectFilter, | ||
| callback: callback), | ||
| callback: (val) => callback(val), | ||
| displayName: SentenceManager( | ||
| currentLanguage: AppSettings.selectedLanguage, | ||
| ).sentences.noProject), | ||
|
Comment on lines
+76
to
+81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Translate the selected Line 76 sets the sentinel 🐛 Suggested fix `@override`
Widget build(BuildContext context) {
TaskwarriorColorTheme tColors =
Theme.of(context).extension<TaskwarriorColorTheme>()!;
+ final sentences =
+ SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences;
+ final selectedProjectLabel = projectFilter.isEmpty
+ ? sentences.notSelected
+ : projectFilter == HomeController.noProjectValue
+ ? sentences.noProject
+ : projectFilter;
return Column(
@@
child: Text(
- projectFilter.isEmpty
- ? SentenceManager(
- currentLanguage: AppSettings.selectedLanguage)
- .sentences
- .notSelected
- : projectFilter,
+ selectedProjectLabel,
style: TextStyle(🤖 Prompt for AI Agents |
||
| if (projects.isNotEmpty) | ||
| ...projects.map((entry) => ProjectTileTaskc( | ||
| project: entry, | ||
| projectFilter: projectFilter, | ||
| callback: callback, | ||
| )) | ||
| ...projects | ||
| .where((entry) => entry.isNotEmpty) | ||
| .map((entry) => ProjectTileTaskc( | ||
| project: entry, | ||
| projectFilter: projectFilter, | ||
| callback: callback, | ||
| )) | ||
| else | ||
| Column( | ||
| children: [ | ||
|
|
@@ -105,11 +116,13 @@ class ProjectTileTaskc extends StatelessWidget { | |
| required this.project, | ||
| required this.projectFilter, | ||
| required this.callback, | ||
| this.displayName, | ||
| }); | ||
|
|
||
| final String project; | ||
| final String projectFilter; | ||
| final void Function(String) callback; | ||
| final String? displayName; | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
|
|
@@ -126,7 +139,7 @@ class ProjectTileTaskc extends StatelessWidget { | |
| onChanged: (_) => callback(project), | ||
| ), | ||
| Text( | ||
| project, | ||
| displayName ?? project, | ||
| style: TextStyle( | ||
| color: tColors.primaryTextColor, | ||
| ), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a stable internal key instead of display text for the no-project sentinel.
Line 44 currently uses a UI string (
" (No Project) ") as internal filter state. That makes filtering fragile (collision with real project names and whitespace sensitivity), and Line 266 depends on that exact formatted text.♻️ Proposed refactor
Keep localized display labels in the view layer, and keep this controller value purely internal.
Also applies to: 266-268
🤖 Prompt for AI Agents