@@ -25,12 +25,15 @@ class StatusLine extends StatelessWidget {
25
25
super .key,
26
26
required this .currentScreen,
27
27
required this .isEmbedded,
28
- required bool isConnected,
28
+ required this . isConnected,
29
29
}) : highlightForConnection = isConnected && ! isEmbedded;
30
30
31
31
final Screen currentScreen;
32
+
32
33
final bool isEmbedded;
33
34
35
+ final bool isConnected;
36
+
34
37
/// Whether to highlight the footer when DevTools is connected to an app.
35
38
final bool highlightForConnection;
36
39
@@ -45,16 +48,20 @@ class StatusLine extends StatelessWidget {
45
48
@override
46
49
Widget build (BuildContext context) {
47
50
final theme = Theme .of (context);
48
- final color = highlightForConnection ? theme.colorScheme.onPrimary : null ;
51
+ final backgroundColor =
52
+ highlightForConnection ? theme.colorScheme.primary : null ;
53
+ final foregroundColor =
54
+ highlightForConnection ? theme.colorScheme.onPrimary : null ;
49
55
final height = statusLineHeight + padding.top + padding.bottom;
50
56
return ValueListenableBuilder <bool >(
51
57
valueListenable: currentScreen.showIsolateSelector,
52
58
builder: (context, showIsolateSelector, _) {
59
+ showIsolateSelector = showIsolateSelector && isConnected;
53
60
return DefaultTextStyle .merge (
54
- style: TextStyle (color: color ),
61
+ style: TextStyle (color: foregroundColor ),
55
62
child: Container (
56
63
decoration: BoxDecoration (
57
- color: highlightForConnection ? theme.colorScheme.primary : null ,
64
+ color: backgroundColor ,
58
65
border: Border (
59
66
top: Divider .createBorderSide (context, width: 1.0 ),
60
67
),
@@ -74,7 +81,8 @@ class StatusLine extends StatelessWidget {
74
81
75
82
List <Widget > _getStatusItems (BuildContext context, bool showIsolateSelector) {
76
83
final theme = Theme .of (context);
77
- final color = highlightForConnection ? theme.colorScheme.onPrimary : null ;
84
+ final foregroundColor =
85
+ highlightForConnection ? theme.colorScheme.onPrimary : null ;
78
86
final screenWidth = ScreenSize (context).width;
79
87
// TODO(https://github.com/flutter/devtools/issues/8913): this builds the
80
88
// wrong status items for offline mode.
@@ -92,7 +100,7 @@ class StatusLine extends StatelessWidget {
92
100
highlightForConnection: highlightForConnection,
93
101
),
94
102
if (showVideoTutorial) ...[
95
- BulletSpacer (color: color ),
103
+ BulletSpacer (color: foregroundColor ),
96
104
VideoTutorialLink (
97
105
screenMetaData: screenMetaData! ,
98
106
screenWidth: screenWidth,
@@ -101,21 +109,21 @@ class StatusLine extends StatelessWidget {
101
109
],
102
110
],
103
111
),
104
- BulletSpacer (color: color ),
112
+ BulletSpacer (color: foregroundColor ),
105
113
if (widerThanXxs && showIsolateSelector) ...[
106
- const IsolateSelector (),
107
- BulletSpacer (color: color ),
114
+ IsolateSelector (foregroundColor : foregroundColor ),
115
+ BulletSpacer (color: foregroundColor ),
108
116
],
109
117
if (screenWidth > MediaSize .xs && pageStatus != null ) ...[
110
118
pageStatus,
111
- BulletSpacer (color: color ),
119
+ BulletSpacer (color: foregroundColor ),
112
120
],
113
121
buildConnectionStatus (context, screenWidth),
114
122
if (widerThanXxs && isEmbedded) ...[
115
- BulletSpacer (color: color ),
123
+ BulletSpacer (color: foregroundColor ),
116
124
Row (
117
125
crossAxisAlignment: CrossAxisAlignment .end,
118
- children: DevToolsScaffold .defaultActions (color: color ),
126
+ children: DevToolsScaffold .defaultActions (color: foregroundColor ),
119
127
),
120
128
],
121
129
];
@@ -266,15 +274,16 @@ class VideoTutorialLink extends StatelessWidget {
266
274
}
267
275
268
276
class IsolateSelector extends StatelessWidget {
269
- const IsolateSelector ({super .key});
277
+ const IsolateSelector ({super .key, required this .foregroundColor});
278
+
279
+ final Color ? foregroundColor;
270
280
271
281
@override
272
282
Widget build (BuildContext context) {
273
283
final isolateManager = serviceConnection.serviceManager.isolateManager;
274
284
return MultiValueListenableBuilder (
275
285
listenables: [isolateManager.isolates, isolateManager.selectedIsolate],
276
286
builder: (context, values, _) {
277
- final theme = Theme .of (context);
278
287
final isolates = values.first as List <IsolateRef >;
279
288
final selectedIsolateRef = values.second as IsolateRef ? ;
280
289
return PopupMenuButton <IsolateRef ?>(
@@ -286,28 +295,29 @@ class IsolateSelector extends StatelessWidget {
286
295
isolates.map ((ref) {
287
296
return PopupMenuItem <IsolateRef >(
288
297
value: ref,
289
- child: IsolateOption (
298
+ child: _IsolateOption (
290
299
ref,
291
- color: theme.colorScheme.onSurface,
300
+ // This is always rendered against the background color
301
+ // for the pop up menu, which is the `surface` color.
302
+ color: Theme .of (context).colorScheme.onSurface,
292
303
),
293
304
);
294
305
}).toList (),
295
- child: IsolateOption (
306
+ child: _IsolateOption (
296
307
isolateManager.selectedIsolate.value,
297
- color: theme.colorScheme.onPrimary ,
308
+ color: foregroundColor ,
298
309
),
299
310
);
300
311
},
301
312
);
302
313
}
303
314
}
304
315
305
- class IsolateOption extends StatelessWidget {
306
- const IsolateOption (this .ref, {required this .color, super .key });
316
+ class _IsolateOption extends StatelessWidget {
317
+ const _IsolateOption (this .ref, {required this .color});
307
318
308
319
final IsolateRef ? ref;
309
-
310
- final Color color;
320
+ final Color ? color;
311
321
312
322
@override
313
323
Widget build (BuildContext context) {
0 commit comments