64 lines
2.3 KiB
Dart
64 lines
2.3 KiB
Dart
/// 약속 (E6): Total Commander 모양의 아래 단추 줄 - F3 보기 · F4 편집 · F5 복사 · F6 이동 · F7 새 폴더 · F8 삭제.
|
|
/// 누르면 [onPressed] 에 그 일 ([TcKey]) 을 넘기기만 한다 (일은 탐색기의 같은 동작 - 키 F3~F8 과 같다).
|
|
/// 좁으면 글을 줄이고 (예: "F5 복사" → "F5"), 단추는 늘 같은 폭으로 한 줄을 나눠 쓴다.
|
|
library;
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../l10n/tr.dart';
|
|
import '../theme.dart';
|
|
|
|
enum TcKey {
|
|
view('F3', '보기'),
|
|
edit('F4', '편집'),
|
|
copy('F5', '복사'),
|
|
move('F6', '이동'),
|
|
newFolder('F7', '새 폴더'),
|
|
delete('F8', '삭제');
|
|
|
|
final String key;
|
|
final String label;
|
|
const TcKey(this.key, this.label);
|
|
}
|
|
|
|
class TcKeyBar extends StatelessWidget {
|
|
final void Function(TcKey key) onPressed;
|
|
const TcKeyBar({super.key, required this.onPressed});
|
|
|
|
/// 이보다 좁으면 키 이름만 ("F5")
|
|
static const shortWidth = 480.0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => LayoutBuilder(builder: (context, box) {
|
|
final short = box.maxWidth < shortWidth;
|
|
return Container(
|
|
height: 30,
|
|
decoration: BoxDecoration(color: JjColors.panel, border: Border(top: BorderSide(color: JjColors.border))),
|
|
child: Row(children: [
|
|
for (final k in TcKey.values)
|
|
Expanded(
|
|
child: Tooltip(
|
|
message: '${k.key} ${tr(k.label)}',
|
|
child: InkWell(
|
|
onTap: () => onPressed(k),
|
|
child: Container(
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(border: Border(right: BorderSide(color: JjColors.border))),
|
|
child: Text.rich(
|
|
TextSpan(children: [
|
|
TextSpan(text: k.key, style: TextStyle(fontWeight: FontWeight.w600, color: JjColors.accent)),
|
|
if (!short) TextSpan(text: ' ${tr(k.label)}'),
|
|
]),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(fontSize: 12),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
]),
|
|
);
|
|
});
|
|
}
|