100 lines
3.7 KiB
Dart
100 lines
3.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../app/tor_service.dart';
|
|
import '../../l10n/tr.dart';
|
|
import '../theme.dart';
|
|
|
|
/// 66-2: 화면 옮기기 안내 한 줄 (처음 한 번, ✕ 로 닫음)
|
|
class SwipeHintBar extends StatelessWidget {
|
|
final VoidCallback onClose;
|
|
const SwipeHintBar({super.key, required this.onClose});
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Material(
|
|
color: JjColors.accent.withValues(alpha: 0.14),
|
|
child: Padding(
|
|
padding: const EdgeInsets.fromLTRB(12, 2, 4, 2),
|
|
child: Row(children: [
|
|
Icon(Icons.swipe, size: 16, color: JjColors.accent),
|
|
const SizedBox(width: 8),
|
|
Expanded(
|
|
child: Text(tr('웹 브라우저에서는 위쪽 막대를 좌우로 밀면 다른 화면으로 옮깁니다 (가운데는 페이지가 밀립니다).'),
|
|
style: const TextStyle(fontSize: 12))),
|
|
IconButton(
|
|
tooltip: tr('안내 닫기'),
|
|
visualDensity: VisualDensity.compact,
|
|
iconSize: 16,
|
|
icon: const Icon(Icons.close),
|
|
onPressed: onClose,
|
|
),
|
|
]),
|
|
),
|
|
);
|
|
}
|
|
|
|
/// 226: Tor 화면을 떠난 뒤 tor 를 잠시 켜 두는 중 (이 브라우저는 Tor 를 쓰지 않음) - 언제 끄는지 · 지금 끄기
|
|
class TorIdleBanner extends StatelessWidget {
|
|
final DateTime at;
|
|
const TorIdleBanner({super.key, required this.at});
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Material(
|
|
color: JjColors.panel,
|
|
child: Padding(
|
|
padding: const EdgeInsets.fromLTRB(12, 2, 4, 2),
|
|
child: Row(children: [
|
|
Icon(Icons.timer_outlined, size: 16, color: JjColors.textDim),
|
|
const SizedBox(width: 8),
|
|
Expanded(
|
|
child: Text(
|
|
trf('Tor 대기 중 ({0}분 뒤 끔) - 이 브라우저는 Tor 를 쓰지 않습니다', [(at.difference(DateTime.now()).inSeconds / 60).ceil().clamp(0, 60)]),
|
|
style: TextStyle(fontSize: 12, color: JjColors.textDim),
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
TextButton(onPressed: () => TorService.instance.stop(), child: Text(tr('지금 끄기'))),
|
|
]),
|
|
),
|
|
);
|
|
}
|
|
|
|
/// Android: Tor 화면이 열려 있는 동안은 웹 뷰 프록시가 앱 전체라 이 브라우저도 Tor 로 (관리자 결정 10/10)
|
|
class TorBanner extends StatelessWidget {
|
|
const TorBanner({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Material(
|
|
color: const Color(0xFF9C6ADE).withValues(alpha: 0.18),
|
|
child: Padding(
|
|
padding: const EdgeInsets.fromLTRB(12, 4, 12, 4),
|
|
child: Row(children: [
|
|
const Icon(Icons.vpn_lock_outlined, size: 16, color: Color(0xFF9C6ADE)),
|
|
const SizedBox(width: 8),
|
|
Expanded(child: Text(tr('Tor 화면이 열려 있는 동안 이 브라우저도 Tor 로 나갑니다'), style: const TextStyle(fontSize: 12))),
|
|
]),
|
|
),
|
|
);
|
|
}
|
|
|
|
/// 브라우저 ↔ 작업 현황 사이 끌어서 너비 바꾸는 막대
|
|
class SplitHandle extends StatelessWidget {
|
|
final ValueChanged<double> onDrag;
|
|
const SplitHandle({super.key, required this.onDrag});
|
|
|
|
@override
|
|
Widget build(BuildContext context) => MouseRegion(
|
|
cursor: SystemMouseCursors.resizeColumn,
|
|
child: GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onHorizontalDragUpdate: (d) => onDrag(d.delta.dx),
|
|
child: Container(
|
|
width: 6,
|
|
color: JjColors.bg,
|
|
alignment: Alignment.center,
|
|
child: Container(width: 1, color: JjColors.border),
|
|
),
|
|
),
|
|
);
|
|
}
|