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
fix: RankingFloatingActionButton partially off-screen for some translations #5117
fix: RankingFloatingActionButton partially off-screen for some translations #5117
Conversation
…d it's childs inside a FittedBox widget
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5117 +/- ##
==========================================
- Coverage 9.54% 8.62% -0.93%
==========================================
Files 325 329 +4
Lines 16411 16713 +302
==========================================
- Hits 1567 1441 -126
- Misses 14844 15272 +428 ☔ View full report in Codecov by Sentry. |
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.
Hi @gmmoraes!
To be honest I'm not 100% convinced by your fix :(
First: in the case of this specific issue/PR, screenshots would be a better option than video, if we want to check the alignments and the sizes of buttons.
Second: we already use AutoSizeText
in other parts of the code, so that texts fit in a box. I would recommend using it, with maxLines: 2
for instance.
I would also summarize what we try to achieve here:
- "top" behavior: a "floating action button like" button with an icon and a text that takes all the screen width (minus padding)
- "bottom" behavior
- a row of the same height and width as in top scenario
- with an "icon+text" button the same height as before, with an
AutoSizeText
, that takes as much space as possible, width-wise - then some padding
- then the up arrow button
Hey @monsieurtanuki ! Thank you for the feedback! I will take a look at the AutoSizeText package, and later this week, I will try to refactor the PR code following these instructions. |
Hey @monsieurtanuki ! I've pushed a new commit. Please let me know if it's okay or if it requires any changes. I've added Thanks in advance. |
Hi @gmmoraes!
|
@monsieurtanuki , I am going send this weekend without fail! |
Hey @monsieurtanuki! After running the tests, I am not sure if the current code solves this problem. Instead of breaking to a new line, it is reducing the font size. Is it necessary to use With that being said, I have added below pictures of the current commit and pictures of using Current commit Screen
With ElevatedButton
|
Hi @gmmoraes! Thank you for your screenshots! If I put the versions side by side, it's obvious that the
Here are my suggestions to display relevant heights:
Here are my suggestions to display consistent layouts:
@gmmoraes What do you think of that? |
@gmmoraes Still working on it? |
@monsieurtanuki , Apologies for the delayed response; I wasn't able to work on this task for the past month. Regarding the suggestion, absolutely, it makes sense! Let's implement it as you've outlined. Thanks for the input! I will try to implement the required changes this week. Next week, It will also begin my 10 days of holidays, so in a worst-case scenario, I will have a lot of time to work on this. Does that sound okay? |
@gmmoraes No problem, take your time! |
@monsieurtanuki, regarding the previous suggestions, if you don't mind, I would like to confirm two pieces of information: Concerning the Regarding the alignment requirement, should there be no horizontal space between the |
@gmmoraes Your latest screenshot looks ok to me:
|
…nkingFloatingActionButton
…ing alignment logic
@monsieurtanuki , I've pushed a new commit. Please let me know if it's okay or if it requires any changes.
Cheers |
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.
Thank you @gmmoraes for your latest version! I guess we're very close to the solution.
Please have a look at my comments, that are suggestions about simplifying the code.
Please also attach screenshots in the 4 interesting cases:
- big label, no arrow button
- big label, arrow button
- small label, no arrow button
- small label, arrow button
? MainAxisAlignment.end | ||
: MainAxisAlignment.end, |
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.
In that case the test doesn't make sense anymore, does it?
It's always .end
, right?
color: themeData.colorScheme.onSecondary, | ||
child: SizedBox( | ||
height: MINIMUM_TOUCH_SIZE, | ||
child: ElevatedButton( |
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.
I guess IconButton
would make more sense and the code would be less verbose.
Would you please try it?
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.
I guess
IconButton
would make more sense and the code would be less verbose. Would you please try it?
If we do use the IconButton
, I believe it will need to be embedded inside an InkResponse
widget for a circular ripple effect and inside a Material
widget for background and elevation.
Perhaps something like this:
ClipOval(
child: Material(
elevation: 2.0,
color: themeData.colorScheme.secondary,
child: InkResponse(
containedInkWell: true,
child: SizedBox(
height: MINIMUM_TOUCH_SIZE,
child: IconButton(
icon: const Icon(
Icons.arrow_upward,
),
color: themeData.colorScheme.onSecondary,
onPressed: onPressed,
),
),
),
),
);
Perhaps it could be added inside a private method that returns a widget:
Widget _getBackToTopButton(ThemeData themeData, void Function()? onPressed) =>
ClipOval(
child: Material(
elevation: 2.0,
color: themeData.colorScheme.secondary,
child: InkResponse(
containedInkWell: true,
child: SizedBox(
height: MINIMUM_TOUCH_SIZE,
child: IconButton(
icon: const Icon(
Icons.arrow_upward,
),
color: themeData.colorScheme.onSecondary,
onPressed: onPressed,
),
),
),
),
);
What do you think?
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.
@gmmoraes My assumption was that it was easy to use (and to maintain) an IconButton
in order to display a clickable disk with an icon inside. Easier than an ElevatedButton
.
If it's not the case, don't waste time with the hard to read/maintain solution you've just suggested, and ignore my suggestion about using an IconButton
.
barcodes: _model.displayBarcodes, | ||
title: widget.name, | ||
Expanded( | ||
child: Padding( |
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.
The padding
is pointless here and probably causes confusion. Please try to remove it.
style: ButtonStyle( | ||
shape: MaterialStateProperty.all<RoundedRectangleBorder>( | ||
const RoundedRectangleBorder( | ||
borderRadius: BorderRadius.all(Radius.circular(40))), |
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.
borderRadius: BorderRadius.all(Radius.circular(40))), | |
borderRadius: CIRCULAR_RADIUS, |
label: Text(AppLocalizations.of(context).myPersonalizedRanking), | ||
onPressed: onPressed, | ||
), | ||
Flexible( |
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.
Generally speaking I'm not sure we need that Row
and especially that SizedBox
.
@monsieurtanuki , Cheers, |
… and removed redundant Padding
@monsieurtanuki , I've pushed a new commit. Please let me know if it's okay or if it requires any changes. Edit: Each text below is a toggle button, to show the image just need to click on it. Cheers! |
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.
Thank you @gmmoraes for the good work!
Perhaps there will be minor cosmetic changes later, but now we have a stable code that manages typical cases with different text lengths.
What
Screenshot
After:
Screen.Recording.2024-03-13.at.00.13.38.mov
Fixes bug(s)