@@ -99,9 +99,14 @@ class AssetPickerAppBar extends StatelessWidget implements PreferredSizeWidget {
99
99
100
100
@override
101
101
Widget build (BuildContext context) {
102
- Widget ? titleWidget = title;
102
+ final ThemeData theme = Theme .of (context);
103
+ final AppBarTheme appBarTheme = theme.appBarTheme;
104
+ final IconThemeData iconTheme = this .iconTheme ?? theme.iconTheme;
105
+ final Widget ? titleWidget;
103
106
if (centerTitle) {
104
107
titleWidget = Center (child: title);
108
+ } else {
109
+ titleWidget = title;
105
110
}
106
111
Widget child = Container (
107
112
width: double .maxFinite,
@@ -126,10 +131,7 @@ class AssetPickerAppBar extends StatelessWidget implements PreferredSizeWidget {
126
131
? Alignment .center
127
132
: AlignmentDirectional .centerStart,
128
133
child: DefaultTextStyle (
129
- style: Theme .of (context)
130
- .textTheme
131
- .headline6!
132
- .copyWith (fontSize: 23.0 ),
134
+ style: theme.textTheme.headline6! .copyWith (fontSize: 23.0 ),
133
135
maxLines: 1 ,
134
136
softWrap: false ,
135
137
overflow: TextOverflow .ellipsis,
@@ -163,18 +165,26 @@ class AssetPickerAppBar extends StatelessWidget implements PreferredSizeWidget {
163
165
);
164
166
}
165
167
166
- if (iconTheme != null ) {
167
- child = IconTheme .merge (data: iconTheme! , child: child);
168
- }
168
+ /// Apply the icon theme data.
169
+ child = IconTheme .merge (data: iconTheme, child: child);
170
+
171
+ final Color effectiveBackgroundColor =
172
+ backgroundColor ?? theme.colorScheme.surface;
169
173
170
174
// Set [SystemUiOverlayStyle] according to the brightness.
171
175
final Brightness effectiveBrightness = brightness ??
172
- Theme .of (context).appBarTheme.systemOverlayStyle? .statusBarBrightness ??
173
- Theme .of (context).brightness;
176
+ appBarTheme.systemOverlayStyle? .statusBarBrightness ??
177
+ theme.brightness;
178
+ final bool isDark = effectiveBrightness == Brightness .dark;
179
+ final SystemUiOverlayStyle overlayStyle = appBarTheme.systemOverlayStyle ??
180
+ SystemUiOverlayStyle (
181
+ statusBarColor: effectiveBackgroundColor,
182
+ systemNavigationBarIconBrightness: Brightness .light,
183
+ statusBarIconBrightness: isDark ? Brightness .light : Brightness .dark,
184
+ statusBarBrightness: isDark ? Brightness .dark : Brightness .light,
185
+ );
174
186
child = AnnotatedRegion <SystemUiOverlayStyle >(
175
- value: effectiveBrightness == Brightness .dark
176
- ? SystemUiOverlayStyle .light
177
- : SystemUiOverlayStyle .dark,
187
+ value: overlayStyle,
178
188
child: Column (
179
189
mainAxisSize: MainAxisSize .min,
180
190
children: < Widget > [
@@ -187,7 +197,7 @@ class AssetPickerAppBar extends StatelessWidget implements PreferredSizeWidget {
187
197
final Widget result = Material (
188
198
// Wrap to ensure the child rendered correctly
189
199
color: Color .lerp (
190
- backgroundColor ?? Theme . of (context).colorScheme.surface ,
200
+ effectiveBackgroundColor ,
191
201
Colors .transparent,
192
202
blurRadius > 0.0 ? 0.1 : 0.0 ,
193
203
),
0 commit comments