Skip to content

Commit 0842772

Browse files
style: improve TerminalShortcutBar UI and refactor key handling
1 parent 36c3096 commit 0842772

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

lib/presentation/screens/terminal/terminal_shortcut_bar.dart

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import 'package:flutter/cupertino.dart';
12
import 'package:flutter/material.dart';
23
import 'package:flutter_riverpod/flutter_riverpod.dart';
3-
import 'package:sysadmin/core/utils/color_extension.dart';
44
import 'package:sysadmin/presentation/screens/terminal/shortcut_key.dart';
55
import 'package:xterm/xterm.dart';
66

@@ -34,7 +34,8 @@ class _TerminalShortcutBarState extends ConsumerState<TerminalShortcutBar> {
3434
if (key.isModifier) {
3535
if (key.label == 'CTRL') {
3636
ref.read(modifierStateProvider.notifier).setCtrl(!modifierState.ctrlPressed);
37-
} else if (key.label == 'ALT') {
37+
}
38+
else if (key.label == 'ALT') {
3839
ref.read(modifierStateProvider.notifier).setAlt(!modifierState.altPressed);
3940
}
4041
return;
@@ -103,29 +104,29 @@ class _TerminalShortcutBarState extends ConsumerState<TerminalShortcutBar> {
103104
}
104105

105106
Widget _buildShortcutKey(ShortcutKey key) {
107+
final theme = Theme.of(context);
106108
final modifierState = ref.watch(modifierStateProvider);
107109
bool isActive = (key.label == 'CTRL' && modifierState.ctrlPressed) || (key.label == 'ALT' && modifierState.altPressed);
108110

109111
return Expanded(
110112
child: Container(
111-
margin: const EdgeInsets.symmetric(horizontal: 1.5),
113+
color: Colors.transparent,
114+
margin: const EdgeInsets.symmetric(horizontal: 1),
112115
child: Material(
113-
color: isActive
114-
? Colors.red.useOpacity(0.8)
115-
: Colors.grey[800]?.useOpacity(0.9),
116-
borderRadius: BorderRadius.circular(6),
116+
color: Colors.transparent,
117117
child: InkWell(
118-
borderRadius: BorderRadius.circular(6),
119118
onTap: () => _handleKeyPress(key),
120119
child: Container(
121-
height: 40,
120+
color: Colors.transparent,
121+
height: 28,
122122
alignment: Alignment.center,
123123
child: Text(
124124
key.label,
125125
style: TextStyle(
126-
color: isActive ? Colors.white : Colors.grey[300],
127-
fontSize: key.label.length > 3 ? 10 : 12,
128-
fontWeight: isActive ? FontWeight.bold : FontWeight.normal,
126+
fontFamily: "JetBrainsMonoNerd",
127+
color: isActive ? CupertinoColors.destructiveRed : theme.colorScheme.inverseSurface,
128+
fontSize: 15,
129+
fontWeight: isActive ? FontWeight.w900 : FontWeight.bold,
129130
),
130131
textAlign: TextAlign.center,
131132
),
@@ -142,19 +143,13 @@ class _TerminalShortcutBarState extends ConsumerState<TerminalShortcutBar> {
142143

143144
return Container(
144145
decoration: BoxDecoration(
145-
color: Colors.black.useOpacity(0.95),
146-
border: Border(
147-
top: BorderSide(
148-
color: Colors.grey[700]!,
149-
width: 0.5,
150-
),
151-
),
146+
color: Theme.of(context).colorScheme.surfaceDim,
152147
),
153148
child: SafeArea(
154149
top: false,
155150
bottom: true,
156151
child: Padding(
157-
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 4),
152+
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 4),
158153
child: Column(
159154
spacing: 6,
160155
mainAxisSize: MainAxisSize.min,

0 commit comments

Comments
 (0)