taskwarrior-flutter icon indicating copy to clipboard operation
taskwarrior-flutter copied to clipboard

refactor: theme checks accross application replaced with central theme

Open SGI-CAPP-AT2 opened this issue 11 months ago • 26 comments

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:

  1. Search bar bg and color was having white n black color irrespective of theme
  2. Constant color scheme was not being used for DatePicker and TimePicker ( refer #411 )
  3. 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_no with the issue number which is fixed in this PR

Screenshots

image image

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

SGI-CAPP-AT2 avatar Dec 16 '24 13:12 SGI-CAPP-AT2

@BrawlerXull PR is ready to review, let me know if you find any flaw

SGI-CAPP-AT2 avatar Dec 16 '24 14:12 SGI-CAPP-AT2

Good one @SGI-CAPP-AT2 I'll test it locally and let you know

BrawlerXull avatar Dec 17 '24 12:12 BrawlerXull

Yet there are many instances where old logic is used please refactor it too

BrawlerXull avatar Dec 17 '24 13:12 BrawlerXull

@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

SGI-CAPP-AT2 avatar Dec 17 '24 14:12 SGI-CAPP-AT2

@BrawlerXull , Now you can review and test I refactored all of the checks with ThemeExtensions.

SGI-CAPP-AT2 avatar Dec 18 '24 10:12 SGI-CAPP-AT2

Will this change also apply to the widget?? ( see #415 )

linuxcaffe avatar Dec 20 '24 04:12 linuxcaffe

Hey @linuxcaffe , I think no. Since widgets are handled with native framework we must find some workaround to apply themes on widget.

SGI-CAPP-AT2 avatar Dec 20 '24 05:12 SGI-CAPP-AT2

https://developer.android.com/develop/ui/views/appwidgets/enhance

Pavel401 avatar Dec 20 '24 05:12 Pavel401

@Pavel401 Thanks for sharing, Let me try that as well

SGI-CAPP-AT2 avatar Dec 20 '24 05:12 SGI-CAPP-AT2

Update: Some of Unexpected changes are fixed now, This PR is ready to test and merge

SGI-CAPP-AT2 avatar Dec 25 '24 05:12 SGI-CAPP-AT2

Screenshot 2024-12-27 at 10 34 11 PM Screenshot 2024-12-27 at 10 35 38 PM Screenshot 2024-12-27 at 10 36 42 PM > Screenshot 2024-12-27 at 10 40 37 PM

  1. **Update the button colors to align with the design specifications.
  2. Correct the onselect theme for the AM/PM indicator.
  3. Fix the snackbar appearing completely white in dark mode on the task details page.
  4. Perform thorough testing of all UI components in both dark and light modes to ensure consistency.**

Pavel401 avatar Dec 27 '24 17:12 Pavel401

Screenshot 2024-12-27 at 10 47 49 PM Keep the old floating button theme

Pavel401 avatar Dec 27 '24 17:12 Pavel401

Hey thanks for testing, I will fix all issues and will check If there are any areas where issues exists.

SGI-CAPP-AT2 avatar Dec 27 '24 17:12 SGI-CAPP-AT2

@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.

Pavel401 avatar Dec 27 '24 17:12 Pavel401

@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

SGI-CAPP-AT2 avatar Dec 27 '24 18:12 SGI-CAPP-AT2

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 avatar Jan 02 '25 07:01 SGI-CAPP-AT2

@SGI-CAPP-AT2 resolve the conflict and push the commit.

Pavel401 avatar Jan 11 '25 16:01 Pavel401

@Pavel401 Done !

SGI-CAPP-AT2 avatar Jan 11 '25 16:01 SGI-CAPP-AT2

@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

SGI-CAPP-AT2 avatar Jan 11 '25 16:01 SGI-CAPP-AT2

@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.

rohansen856 avatar Jan 11 '25 17:01 rohansen856

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.

SGI-CAPP-AT2 avatar Jan 11 '25 17:01 SGI-CAPP-AT2

update: This PR now has no conflicts also theme checks in #432 and #443 are now replaced with global theme extension.

cc: @Pavel401 @BrawlerXull

SGI-CAPP-AT2 avatar Jan 26 '25 10:01 SGI-CAPP-AT2

@rohansen856 , Now I think tests are passing without any problem

SGI-CAPP-AT2 avatar Jan 26 '25 12:01 SGI-CAPP-AT2

@SGI-CAPP-AT2 fix the conflicts !

Pavel401 avatar Feb 18 '25 06:02 Pavel401

@SGI-CAPP-AT2 can u make sure u refactor AppSettings logic everywhere in the project? image

BrawlerXull avatar Feb 25 '25 10:02 BrawlerXull

@SGI-CAPP-AT2 can u make sure u refactor AppSettings logic everywhere in the project? image

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.

SGI-CAPP-AT2 avatar Feb 25 '25 10:02 SGI-CAPP-AT2