taskwarrior-flutter
taskwarrior-flutter copied to clipboard
refactor: theme checks accross application replaced with central theme
Description
The theme was being managed by checks at each elements local scope to avoid those redundant checks This PR has refactored it with ThemeExtensions with ThemeData for dark theme and light theme
These color schemes can be accessed through Theme.of(context).extensions<TaskwarriorThemeColors>().
For future color related changes:
Custom Colors to be added inside TaskwarriorThemeColors class with common attribute for light and dark.
After doing such changes also add colors for corresponding attribute specific to Dark Theme and Light Theme inside TaskwarriorColors class.
Also fixed following problems:
- Search bar bg and color was having white n black color irrespective of theme
- Constant color scheme was not being used for DatePicker and TimePicker ( refer #411 )
- Color of tags in filter drawer was BnW scheme irrespective of theme
Fixes #400
closes: #400 closes: #411
Currently Across application there are multiple theme checks being done for every widget build. Replace
issue_nowith the issue number which is fixed in this PR
Screenshots
Checklist
- [X] Tests have been added or updated to cover the changes
- [X] Documentation has been updated to reflect the changes
- [X] Code follows the established coding style guidelines
- [X] All tests are passing
@BrawlerXull PR is ready to review, let me know if you find any flaw
Good one @SGI-CAPP-AT2 I'll test it locally and let you know
Yet there are many instances where old logic is used please refactor it too
@BrawlerXull , Yes I think We'll need extension to ThemeDatas, Let me do that changes. Once done I'll mention you. Thanks for pointing out
@BrawlerXull , Now you can review and test I refactored all of the checks with ThemeExtensions.
Will this change also apply to the widget?? ( see #415 )
Hey @linuxcaffe , I think no. Since widgets are handled with native framework we must find some workaround to apply themes on widget.
https://developer.android.com/develop/ui/views/appwidgets/enhance
@Pavel401 Thanks for sharing, Let me try that as well
Update: Some of Unexpected changes are fixed now, This PR is ready to test and merge
- **Update the button colors to align with the design specifications.
- Correct the onselect theme for the AM/PM indicator.
- Fix the snackbar appearing completely white in dark mode on the task details page.
- Perform thorough testing of all UI components in both dark and light modes to ensure consistency.**
Hey thanks for testing, I will fix all issues and will check If there are any areas where issues exists.
@SGI-CAPP-AT2 Can you also fix the calendar theme in the task details page , right now in the dark mode it shows the light theme of the calendar.
@SGI-CAPP-AT2 Can you also fix the calendar theme in the task details page , right now in the dark mode it shows the light theme of the calendar.
Oh I was using same color scheme for all of the pickers, so I thought it's fixed
Let me do that as well
update: fixes made as per https://github.com/CCExtractor/taskwarrior-flutter/pull/402#issuecomment-2563885288 also tested all use cases of application known to me
@SGI-CAPP-AT2 resolve the conflict and push the commit.
@Pavel401 Done !
@rohansen856 , Any Idea about following failing test cases?
❌ /home/runner/work/taskwarrior-flutter/taskwarrior-flutter/test/api_service_test.dart: TaskDatabase insertTask adds a task to the database (failed)
SqfliteFfiException(error, Invalid argument(s): Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory}) DatabaseException(Invalid argument(s): Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory)
package:sqflite_common_ffi/src/method_call.dart 125:9 responseToResultOrThrow
package:sqflite_common_ffi/src/isolate.dart 33:12 SqfliteIsolate.handle
❌ /home/runner/work/taskwarrior-flutter/taskwarrior-flutter/test/api_service_test.dart: TaskDatabase deleteAllTasksInDB removes all tasks (failed)
SqfliteFfiException(error, Invalid argument(s): Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory}) DatabaseException(Invalid argument(s): Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory)
package:sqflite_common_ffi/src/method_call.dart 125:9 responseToResultOrThrow
package:sqflite_common_ffi/src/isolate.dart 33:12 SqfliteIsolate.handle
@rohansen856 , Any Idea about following failing test cases?
❌ /home/runner/work/taskwarrior-flutter/taskwarrior-flutter/test/api_service_test.dart: TaskDatabase insertTask adds a task to the database (failed) SqfliteFfiException(error, Invalid argument(s): Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory}) DatabaseException(Invalid argument(s): Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory) package:sqflite_common_ffi/src/method_call.dart 125:9 responseToResultOrThrow package:sqflite_common_ffi/src/isolate.dart 33:12 SqfliteIsolate.handle ❌ /home/runner/work/taskwarrior-flutter/taskwarrior-flutter/test/api_service_test.dart: TaskDatabase deleteAllTasksInDB removes all tasks (failed) SqfliteFfiException(error, Invalid argument(s): Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory}) DatabaseException(Invalid argument(s): Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory) package:sqflite_common_ffi/src/method_call.dart 125:9 responseToResultOrThrow package:sqflite_common_ffi/src/isolate.dart 33:12 SqfliteIsolate.handle
Yes actually... as i mentioned in PR #389 the sqlite3 and libsqlite3-dev binaries are needed in the CI CD environment to be able to use sqlite3 database functionalities. without those two libraries the tests would fail in this environment... Would recommend @Pavel401 @BrawlerXull to either add those to the CI CD env or let me remove tests for those mocking the Sqlite3 database.
I think I can work on the workflow to add those binaries if @Pavel401 allows I'll make a PR to fix this.
And this PR can be merged as the Tests failing aren't related to changes in the PR.
update: This PR now has no conflicts also theme checks in #432 and #443 are now replaced with global theme extension.
cc: @Pavel401 @BrawlerXull
@rohansen856 , Now I think tests are passing without any problem
@SGI-CAPP-AT2 fix the conflicts !
@SGI-CAPP-AT2 can u make sure u refactor AppSettings logic everywhere in the project?
@SGI-CAPP-AT2 can u make sure u refactor AppSettings logic everywhere in the project?
Yes, sure
I think the code in shared screenshot was added by the commit https://github.com/CCExtractor/taskwarrior-flutter/commit/c78e5ed20f88a7f303d08589b94c07cb07334881
Let me check again for all files.