@@ -118,14 +118,15 @@ class LogPanelVisibilityNotifier extends StateNotifier<bool> {
118
118
}
119
119
}
120
120
121
- class LoggingPanel extends ConsumerStatefulWidget {
122
- const LoggingPanel ({super .key});
121
+ class _LoggingPanel extends ConsumerStatefulWidget {
122
+ final bool safeArea;
123
+ const _LoggingPanel ({this .safeArea = false });
123
124
124
125
@override
125
- ConsumerState <LoggingPanel > createState () => _LoggingPanelState ();
126
+ ConsumerState <_LoggingPanel > createState () => _LoggingPanelState ();
126
127
}
127
128
128
- class _LoggingPanelState extends ConsumerState <LoggingPanel > {
129
+ class _LoggingPanelState extends ConsumerState <_LoggingPanel > {
129
130
bool _runningDiagnostics = false ;
130
131
131
132
List <Widget > _buildChipsList (Level logLevel) {
@@ -217,14 +218,10 @@ class _LoggingPanelState extends ConsumerState<LoggingPanel> {
217
218
final logLevel = ref.watch (logLevelProvider);
218
219
final sensitiveLogs = ref.watch (
219
220
logLevelProvider.select ((level) => level.value <= Level .CONFIG .value));
220
- final visible = ref.watch (logPanelVisibilityProvider);
221
-
222
- if (! visible) {
223
- return const SizedBox ();
224
- }
225
221
226
222
return _Panel (
227
223
sensitive: sensitiveLogs,
224
+ safeArea: widget.safeArea,
228
225
child: Wrap (
229
226
alignment: WrapAlignment .spaceBetween,
230
227
runSpacing: 4.0 ,
@@ -269,43 +266,40 @@ class _LoggingPanelState extends ConsumerState<LoggingPanel> {
269
266
}
270
267
}
271
268
272
- class WarningPanel extends ConsumerWidget {
273
- const WarningPanel ({super .key});
269
+ class _WarningPanel extends StatelessWidget {
270
+ final bool safeArea;
271
+ const _WarningPanel ({this .safeArea = false });
274
272
275
273
@override
276
- Widget build (BuildContext context, WidgetRef ref ) {
274
+ Widget build (BuildContext context) {
277
275
final l10n = AppLocalizations .of (context);
278
- final allowScreenshots =
279
- isAndroid ? ref.watch (androidAllowScreenshotsProvider) : false ;
280
-
281
- if (! allowScreenshots) {
282
- return SizedBox ();
283
- }
284
276
285
277
return _Panel (
286
- sensitive: allowScreenshots,
287
- child: Row (
288
- mainAxisSize: MainAxisSize .min,
289
- children: [
290
- Padding (
291
- padding: const EdgeInsets .only (left: 12.0 , top: 8.0 , bottom: 8.0 ),
292
- child: Icon (
293
- Symbols .warning_amber,
294
- size: 24 ,
278
+ sensitive: true ,
279
+ safeArea: safeArea,
280
+ child: Row (
281
+ mainAxisSize: MainAxisSize .min,
282
+ children: [
283
+ Padding (
284
+ padding: const EdgeInsets .only (left: 12.0 , top: 8.0 , bottom: 8.0 ),
285
+ child: Icon (
286
+ Symbols .warning_amber,
287
+ size: 24 ,
288
+ ),
295
289
),
296
- ),
297
- const SizedBox (width: 8.0 ),
298
- Flexible (child: Text (l10n.l_warning_allow_screenshots))
299
- ],
300
- ),
301
- );
290
+ const SizedBox (width: 8.0 ),
291
+ Flexible (child: Text (l10n.l_warning_allow_screenshots))
292
+ ],
293
+ ));
302
294
}
303
295
}
304
296
305
297
class _Panel extends StatelessWidget {
306
298
final Widget child;
307
299
final bool sensitive;
308
- const _Panel ({required this .child, required this .sensitive});
300
+ final bool safeArea;
301
+ const _Panel (
302
+ {required this .child, required this .sensitive, this .safeArea = true });
309
303
310
304
@override
311
305
Widget build (BuildContext context) {
@@ -346,18 +340,48 @@ class _Panel extends StatelessWidget {
346
340
? sensitiveColor.withValues (alpha: 0.3 )
347
341
: colorScheme.secondaryContainer.withValues (alpha: 0.3 );
348
342
343
+ final content = Padding (
344
+ padding: const EdgeInsets .all (4.0 ),
345
+ child: child,
346
+ );
347
+
349
348
return ColoredBox (
350
349
color: colorScheme.surface,
351
350
child: Theme (
352
351
data: localThemeData,
353
352
child: ColoredBox (
354
353
color: panelBackgroundColor,
355
- child: Padding (
356
- padding: const EdgeInsets .all (4.0 ),
357
- child: child,
358
- ),
354
+ child: safeArea ? SafeArea (child: content) : content,
359
355
),
360
356
),
361
357
);
362
358
}
363
359
}
360
+
361
+ class PanelList extends ConsumerWidget {
362
+ const PanelList ({super .key});
363
+
364
+ @override
365
+ Widget build (BuildContext context, WidgetRef ref) {
366
+ final logPanelVisible = ref.watch (logPanelVisibilityProvider);
367
+ final allowScreenshots =
368
+ isAndroid ? ref.watch (androidAllowScreenshotsProvider) : false ;
369
+ return Column (
370
+ mainAxisSize: MainAxisSize .min,
371
+ crossAxisAlignment: CrossAxisAlignment .stretch,
372
+ children: [
373
+ if (allowScreenshots)
374
+ Flexible (
375
+ child: _WarningPanel (
376
+ safeArea: ! logPanelVisible,
377
+ ),
378
+ ),
379
+ if (allowScreenshots && logPanelVisible) const SizedBox (height: 4.0 ),
380
+ if (logPanelVisible)
381
+ Flexible (
382
+ child: _LoggingPanel (safeArea: true ),
383
+ )
384
+ ],
385
+ );
386
+ }
387
+ }
0 commit comments