-
Notifications
You must be signed in to change notification settings - Fork 7
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
Change the color and visibility of the icons on the status bar for the Overview and MyPICOS #144
Change the color and visibility of the icons on the status bar for the Overview and MyPICOS #144
Conversation
The status bar in Overview is changed when scrolling up or down. The status bar in MyPICOS has the same color as the app bar.
Set the color of the StatusBar from LoginScreen. Use SafeArea to enable changing the color of the StatusBar of MyPICOS from HomeScreen. Delete the "appBarElevation" attribute from PicosScreenFrame. Delete the "appBarElevation" parameter from QuestionnaireScreen.
return SafeArea( | ||
child: PicosScreenFrame( |
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.
PicosScreenFrame already includes a SafeArea so there are now technically two SafeArea's. Isn't there another way to solve this?
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.
Resolved in 13a3e1d
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.
There is a bug.
If you change to another screen without scrolling down the status bar continues to be white.
final double appBarHeight = AppBar().preferredSize.height; | ||
final double statusBarHeight = MediaQuery.of(context).padding.top; |
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.
As I understand _handleScroll gets executed for each little bit that get scrolled.
So if you scroll 1000 pixel these variables gets calculated 1000 times, but they never change.
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.
Resolved in 815ddb2
statusBarColor: _isScrolled | ||
? Theme.of(context).extension<GlobalTheme>()!.darkGreen1 | ||
: Theme.of(context).bottomNavigationBarTheme.backgroundColor ?? | ||
Theme.of(context).canvasColor, | ||
statusBarIconBrightness: | ||
_isScrolled ? Brightness.light : Brightness.dark, |
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.
You check for _isScrolled twice in the same place.
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.
Resolved in 61e017e
|
||
@override | ||
Widget build(BuildContext context) { | ||
final GlobalTheme theme = Theme.of(context).extension<GlobalTheme>()!; |
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.
Since you are using a stateful widget the theme variable can be turned into an static class attribute.
setState(() { | ||
_isScrolled = | ||
_scrollController.offset >= (appBarHeight + statusBarHeight); | ||
}); |
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.
setState is also called for every pixel scrolled.
Every time you call setState the widget gets rebuild which is very inefficient.
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.
Resolved in 4f3ab78
lib/screens/login_screen.dart
Outdated
TextSpan( | ||
text: AppLocalizations.of(context)! | ||
.thankYouForParticipation, | ||
_setSystemNavigationBarColor(context); |
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.
This gets executed on each widget rebuild. You should consider making this execute only once, since it never changes here.
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.
Resolved in 25f3d72
return SafeArea( | ||
child: Scaffold( | ||
appBar: PreferredSize( | ||
preferredSize: const Size.fromHeight(0.0), | ||
child: AppBar(), |
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.
Since we have now multiple deviations from PicosScreenFrame it might be a good idea making PicosScreenFrame adjustable, so it can be used in more cases.
preferredSize: const Size.fromHeight(0.0), | ||
child: AppBar(), | ||
), | ||
body: Center( |
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 think this Center widget can be removed.
children: <TextSpan>[ | ||
TextSpan( | ||
text: | ||
'${AppLocalizations.of(context)!.welcomeToPICOS},\n', |
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.
Try not to make lines above 80 characters.
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.
Resolved in e9c442a
So: