chore: Resolve #356 - Reworked currency selector in General Settings
π― Description
This PR reworks the currency selector that can be found in Settings -> General Settings.
The old currency selector had some issues with the colors of the ListTiles and, taking in consideration the discussion that is happening in #333 about adding the system theme as option, I went with the updated design.
Visual implementation follows this Figma frame.
Diving a bit deeper into the changes:
-
Added
onSurfaceVarianttocustomColorSchemeanddarkCustomColorSchemeto have a lighter color that gives enough contrast when used onsurface(darkBlue6). Please check these messages ([1], [2]) for more details on this addition. -
In
lib\pages\general_options\widgetsI've added theselectorfolder. It contains two files,selector_container.dartandselector_tile.dart:SelectorContaineris a simpleWidgetresponsible for the background and the top label. It takes alabeland achild.SelectorTileis the list tile like UI element which shows the currencies list (and ideally should also be used to show the appearance options).
I've tried to make it flexible while still maintaining the convenience of use. The important part for me here was to have a widget that can give a uniform look to the settings page and that can be reused when more settings will be added to the page. I know it will need to be updated as requirements will change but I can take care of that when time comes.
It has a customisabletitle,trailing(String) andtrailingWidget. This widget is meant to handle selection between a number of options, for this purpose theisSelectedbool can be used. Also added a voidonTap.
-
The old
CurrencySelectorDialoghas been renamed toSettingsCurrencySelectorand it usesSelectorContainerandSelectorTilewhile maintaining the same currency selection state handling that was used in the previous implementation. -
SettingsCurrencySelectoris then used inlib\pages\general_options\general_settings.dart. -
For what concerns testing:
- Added some simple tests for the
SelectorTilebasic interactions. - Added a convenience
extensiononWidgetTesterintest\test_utils. It's calledpumpWidgetWithMaterialAppand as the name suggests, it's just a wrapper onpumpWidgetwhich includes aMaterialAppand theMaterialwidget. I've added an option to toggle on or off theProviderScopeas well (defaults to on).
- Added some simple tests for the
Please check the latest additions here.
Closes: #356
π± Changes
- [X] Describe key changes made
- [X] List any new features, bug fixes, or refactors
- [X] Include additional details if necessary
π§ͺ Testing Instructions
Behaviour
- Go to Settings -> General Settings
- Change your selected currency
πΈ Screenshots / Screen Recordings (if applicable)
| Before | After |
|---|---|
| https://github.com/user-attachments/assets/e949b3cc-c240-46d1-a46f-5a9b345f1f3d | https://github.com/user-attachments/assets/b4ac15cb-11c7-43df-9047-16cc669f5645 |
π Checklist for reviewers
- [X] Code is formatted correctly
- [X] Tests are passing
- [X] New tests are added (if needed)
- [X] Style matches the figma/designer requests
- Tested on:
- [ ] iOS
- [X] Android
βοΈ Additional Context
I'd appreciate if someone could test this on iOS but I'm not expecting any change π
Note that this new UI might look a bit out of place because the appearance switcher is still the same. Hopefully when both components use this new layout it'll look better as a whole π
I'll try to review this, and test on iOS, by tomorrow evening or sunday at max, thanks for the PR!
Regarding this comment I made:
Note that this new UI might look a bit out of place because the appearance switcher is still the same. Hopefully when both components use this new layout it'll look better as a whole π
I think this could be improved a bit further and make it ready for future settings by making the SelectorContainer an expandable tile.
Here's a quick demo;
https://github.com/user-attachments/assets/a649a067-4e35-4c05-bce5-a1a430d83d15
I think this could be improved a bit further and make it ready for future settings by making the
SelectorContaineran expandable tile.
I think it's a very cool design the one in the demo, why not implement it? Since we actually introduced 3 theme modes in #333?
Hey @fres-sudo
Thanks for the detailed review π I'll start to go through your comments now π
I think this could be improved a bit further and make it ready for future settings by making the
SelectorContaineran expandable tile.I think it's a very cool design the one in the demo, why not implement it? Since we actually introduced 3 theme modes in #333?
I would want to wait for @federicopozzato to approve this first. While I think it's in line with the Figma specs, it's still a bit different.
Thanks for the PR!
I tested on iOS, it works just fine, the only small issue that I found is that ambigous spacing:
You can easily spot it under the last element of the list...is it intended? bcuz I can't see it in your last video demo..
hmm, I don't think that's the separatorBuilder from ListView.separated, as you can see it's not showing in the original screenshot attached.
Let's wait for the new layout to be pushed and you can re-test
Let's wait for the new layout to be pushed and you can re-test
Wdym by the "new layout" what did I miss?
Let's wait for the new layout to be pushed and you can re-test
Wdym by the "new layout" what did I miss?
Wrong word probably as the layout is the same π I meant the new interaction, with the expansion functionality
Guys, we appreciate you effort and propositivity, but it's always a metter of process. Things has to be DESIGNED FIRST, then developed. I can't stress this enough. Multicurrency is something we have to work on for sure, but I'm not sure that here will be just a currency selector as a feature: what if I want to have multiple currencies at the same time? @theperu I don't remember what we said about it for the 1.0
@federicopozzato this is not an implementation of the multi currency feature. This was opened to align the graphic of the theme selector that has changed in #333 so that we don't have two completely different styles between the two elements
@theperu @federicopozzato Should I move forward with this? #333 is dependent on this piece of work.
The recording shows how everything should look when both the theme selector and the currency selector adopts the new UI https://github.com/RIP-Comm/sossoldi/pull/360#issuecomment-2745141974
Ok for me but I'll leave the last word to @federicopozzato
@bongio94 thanks for the details. Yes go on
PR details have changes a bit after the latest commits, I'll try to go through the latest changes with this comment and I'll link this to the PR description.
After @fres-sudo suggestions:
- I've removed all of the
Gapwidgets (gapdependency has been removed). - Added
asserts onSelectorTileconstructor for ensuring that only one betweentrailingandtrailingWidgetis used.
I've also added an optionaltrailingTextStylewhich gives the ability of customizing thetrailingtextTextStyle. - Added the expansion behaviour. In particular:
SelectorContainernow has aninitiallyExpandedproperty, which controls the initial expansion state (whether or not the container should be expanded on instantiation), and ahasTrailingChevronproperty which toggles on or off the trailing chevron which rotates when the container expands or collapses.- The
labelchanges basing on the expansion status. When collapsed the label is bigger (fontSize 14, w600), when expanded is smaller (fontSize 12, w400)
@fres-sudo Could you have a look at my comment here and close the change request if it sounds good?
Hi @bongio94π We recently merged a PR that changed the folder structure, which caused some conflicts here. When you get a chance, could you take a look and resolve them?
If thereβs no response in the next 15 days, weβll consider this PR inactive and plan to close it to keep things tidy.
Thanks!
