58 lines
1.8 KiB
Dart
58 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'app_scope.dart';
|
|
import 'log_list_view.dart';
|
|
|
|
/// Compact log panel on the Dashboard tab. Filters by severity using the
|
|
/// set configured in Settings (default ERROR + FATAL). Rebuilds when the
|
|
/// severity set changes.
|
|
class MiniLogPanel extends StatelessWidget {
|
|
const MiniLogPanel({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final scope = AppScope.of(context);
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: Theme.of(context).colorScheme.outlineVariant,
|
|
),
|
|
borderRadius: BorderRadius.circular(6),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
|
child: Row(
|
|
children: [
|
|
Text('Filtered log',
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w500, fontSize: 12)),
|
|
SizedBox(width: 6),
|
|
Text('· severities from settings',
|
|
style: TextStyle(fontSize: 11, color: Colors.grey)),
|
|
],
|
|
),
|
|
),
|
|
const Divider(height: 1),
|
|
Expanded(
|
|
child: ListenableBuilder(
|
|
listenable: scope.settings,
|
|
builder: (_, __) {
|
|
final severities = scope.settings.miniLogSeverities;
|
|
return LogListView(
|
|
session: scope.session,
|
|
filter: (e) => severities.contains(
|
|
e.hasSeverity() ? e.severity.value : 0,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|