prettier console box

This commit is contained in:
Mikkeli Matlock
2026-01-28 01:01:23 +09:00
parent 3db0e04402
commit 71e2214e32
2 changed files with 66 additions and 28 deletions

View File

@@ -167,7 +167,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
wsState: _wsState, wsState: _wsState,
), ),
const SizedBox(height: 10), const SizedBox(height: 5),
// Main content area - big stat boxes // Main content area - big stat boxes
Expanded( Expanded(
@@ -203,28 +203,28 @@ class _DashboardScreenState extends State<DashboardScreen> {
const SizedBox(width: 32), const SizedBox(width: 32),
// Right side: Navigator with debug console overlay // Right side: Navigator on top, debug console below
Expanded( Expanded(
flex: 1, flex: 1,
child: Stack( child: Column(
children: [ children: [
// Bottom layer: Navigator // Navigator
Center( Expanded(
child: NavigatorWidget(key: _navigatorKey), flex: 3,
child: Center(
child: NavigatorWidget(key: _navigatorKey),
),
), ),
// Top layer: Debug console on lower half only // Debug console
Column( Expanded(
mainAxisAlignment: MainAxisAlignment.end, flex: 1,
children: [ child:
const Spacer(), // Top half - empty DebugConsole(
Expanded( messageStream: WebSocketService.instance.debugStream,
child: DebugConsole( initialMessages: WebSocketService.instance.debugMessages,
messageStream: WebSocketService.instance.debugStream, maxLines: 6,
initialMessages: WebSocketService.instance.debugMessages, title: 'WebSocket messages',
maxLines: 8, ),
),
),
],
), ),
], ],
), ),

View File

@@ -17,11 +17,15 @@ class DebugConsole extends StatefulWidget {
/// Maximum lines to display /// Maximum lines to display
final int maxLines; final int maxLines;
/// Optional title for the console (shown in title bar)
final String? title;
const DebugConsole({ const DebugConsole({
super.key, super.key,
required this.messageStream, required this.messageStream,
this.initialMessages = const [], this.initialMessages = const [],
this.maxLines = 8, this.maxLines = 8,
this.title,
}); });
@override @override
@@ -66,15 +70,49 @@ class _DebugConsoleState extends State<DebugConsole> {
final theme = AppTheme.of(context); final theme = AppTheme.of(context);
return Container( return Container(
padding: const EdgeInsets.all(4), decoration: BoxDecoration(
child: Text( color: theme.background.withAlpha(64),
_messages.isEmpty ? '(no messages)' : _messages.join('\n'), border: Border.all(color: theme.subdued, width: 2),
style: TextStyle( borderRadius: BorderRadius.circular(8),
fontFamily: 'monospace', ),
fontSize: 34, child: Column(
color: theme.foreground, mainAxisSize: MainAxisSize.max,
height: 1.2, crossAxisAlignment: CrossAxisAlignment.stretch,
), children: [
// Title bar (optional)
if (widget.title != null)
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(color: theme.subdued, width: 1),
),
),
child: Text(
widget.title!,
style: TextStyle(
fontFamily: 'monospace',
fontSize: 24,
color: theme.subdued,
),
),
),
// Console content
Expanded(
child: Padding(
padding: const EdgeInsets.all(8),
child: Text(
_messages.isEmpty ? '(no messages)' : _messages.join('\n'),
style: TextStyle(
fontFamily: 'monospace',
fontSize: 30,
color: theme.foreground,
height: 1.0,
),
),
),
),
],
), ),
); );
} }