diff --git a/lib/ui/update_dialog.dart b/lib/ui/update_dialog.dart index 4424089..b679951 100644 --- a/lib/ui/update_dialog.dart +++ b/lib/ui/update_dialog.dart @@ -1,3 +1,4 @@ +import 'dart:math' as math; import 'dart:io'; import 'package:flutter/material.dart'; @@ -211,10 +212,7 @@ class _VersionPickerState extends State<_VersionPicker> { final all = snap.data!; if (all.isEmpty) return Center(child: Text(tr('올려 둔 버전이 없습니다.'))); final newest = all.first.version; - return Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - width: 300, - child: ListView(children: [ + final list = ListView(children: [ Padding( padding: const EdgeInsets.fromLTRB(4, 0, 4, 8), child: Text(trf('지금 쓰는 버전: v{0}', [widget.current]), @@ -236,11 +234,8 @@ class _VersionPickerState extends State<_VersionPicker> { enabled: r.zipUrl != null, onTap: () => setState(() => _sel = r), ), - ]), - ), - const VerticalDivider(width: 16), - Expanded( - child: _sel == null + ]); + final detail = _sel == null ? const SizedBox() : Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('v${_sel!.version}', style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)), @@ -262,9 +257,21 @@ class _VersionPickerState extends State<_VersionPicker> { Text(tr('바뀐 내용'), style: const TextStyle(fontWeight: FontWeight.w600)), const SizedBox(height: 4), Expanded(child: _Notes(_sel!.notes)), - ]), - ), - ]); + ]); + // 168: 좁은 화면 (폰) 에서는 목록 위 · 고른 버전의 바뀐 내용 아래 (나란히 두면 바뀐 내용 칸이 너무 좁았다) + return LayoutBuilder( + builder: (context, box) => box.maxWidth < 560 + ? Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox(height: math.min(200, box.maxHeight * 0.4), child: list), + const Divider(height: 16), + Expanded(child: detail), + ]) + : Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox(width: 300, child: list), + const VerticalDivider(width: 16), + Expanded(child: detail), + ]), + ); }, ), ), diff --git a/test/update_ui_test.dart b/test/update_ui_test.dart index 8b06fbe..f4dead9 100644 --- a/test/update_ui_test.dart +++ b/test/update_ui_test.dart @@ -217,8 +217,8 @@ void main() { data.deleteSync(recursive: true); }); - Future openPicker(WidgetTester tester) async { - tester.view.physicalSize = const Size(1200, 900); + Future openPicker(WidgetTester tester, {Size size = const Size(1200, 900)}) async { + tester.view.physicalSize = size; tester.view.devicePixelRatio = 1; addTearDown(tester.view.reset); await tester.pumpWidget(MaterialApp( @@ -230,6 +230,19 @@ void main() { await tester.pumpAndSettle(); } + testWidgets('168: 좁은 화면 (폰) 에서는 목록 위 · 바뀐 내용 아래 (넓으면 나란히)', (tester) async { + await openPicker(tester, size: const Size(400, 800)); + final list = tester.getTopLeft(find.text('v1.0.0').first); + final notes = tester.getTopLeft(find.text('바뀐 내용')); + expect(notes.dy, greaterThan(list.dy), reason: '바뀐 내용은 목록 아래'); + expect(tester.getSize(find.text('바뀐 내용')).width, lessThan(400)); + await tester.tap(find.text('닫기')); + await tester.pumpAndSettle(); + await openPicker(tester); + expect(tester.getTopLeft(find.text('바뀐 내용')).dx, greaterThan(tester.getTopLeft(find.text('v1.0.0').first).dx + 200), + reason: '넓으면 나란히 (오른쪽)'); + }); + testWidgets('올려 둔 모든 버전 · 지금 · 최신 표시 → 예전 버전으로 되돌리기 (설치 전 설정 보관, 비밀 값 빼고)', (tester) async { await openPicker(tester); expect(find.text('버전 고르기'), findsOneWidget);