재고 상세 다이얼로그화 및 마스터 레이아웃 개선

This commit is contained in:
JiWoong Sul
2025-10-22 18:52:21 +09:00
parent a14133df52
commit 09c31b2503
20 changed files with 1187 additions and 923 deletions

View File

@@ -8,6 +8,7 @@ import 'package:superport_v2/widgets/app_layout.dart';
import 'package:superport_v2/widgets/components/filter_bar.dart';
import 'package:superport_v2/widgets/components/superport_dialog.dart';
import 'package:superport_v2/widgets/components/superport_table.dart';
import 'package:superport_v2/widgets/components/responsive_section.dart';
import 'package:superport_v2/features/util/postal_search/presentation/models/postal_search_result.dart';
import 'package:superport_v2/features/util/postal_search/presentation/widgets/postal_search_dialog.dart';
@@ -99,7 +100,7 @@ class _WarehouseEnabledPageState extends State<_WarehouseEnabledPage> {
final FocusNode _searchFocus = FocusNode();
final DateFormat _dateFormat = DateFormat('yyyy-MM-dd HH:mm');
String? _lastError;
bool _routeApplied = false;
String? _lastAppliedRoute;
@override
void initState() {
@@ -112,9 +113,14 @@ class _WarehouseEnabledPageState extends State<_WarehouseEnabledPage> {
@override
void didChangeDependencies() {
super.didChangeDependencies();
if (!_routeApplied) {
_routeApplied = true;
_applyRouteParameters();
_applyRouteIfNeeded();
}
@override
void didUpdateWidget(covariant _WarehouseEnabledPage oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.routeUri != oldWidget.routeUri) {
_applyRouteIfNeeded();
}
}
@@ -205,8 +211,8 @@ class _WarehouseEnabledPageState extends State<_WarehouseEnabledPage> {
),
],
children: [
SizedBox(
width: 260,
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 260),
child: ShadInput(
controller: _searchController,
focusNode: _searchFocus,
@@ -215,8 +221,8 @@ class _WarehouseEnabledPageState extends State<_WarehouseEnabledPage> {
onSubmitted: (_) => _applyFilters(),
),
),
SizedBox(
width: 200,
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 200),
child: ShadSelect<WarehouseStatusFilter>(
key: ValueKey(_controller.statusFilter),
initialValue: _controller.statusFilter,
@@ -240,21 +246,27 @@ class _WarehouseEnabledPageState extends State<_WarehouseEnabledPage> {
],
),
child: ShadCard(
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('창고 목록', style: theme.textTheme.h3),
Text('$totalCount건', style: theme.textTheme.muted),
],
title: ResponsiveStackedRow(
leading: Text('창고 목록', style: theme.textTheme.h3),
trailing: Align(
alignment: Alignment.centerRight,
child: Text('$totalCount건', style: theme.textTheme.muted),
),
),
footer: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'페이지 $currentPage / $totalPages',
style: theme.textTheme.small,
),
Row(
footer: ResponsiveStackedRow(
gap: 8,
breakpoint: 420,
leading: Text(
'페이지 $currentPage / $totalPages',
style: theme.textTheme.small,
),
trailing: Align(
alignment: Alignment.centerRight,
child: Wrap(
spacing: 8,
runSpacing: 8,
alignment: WrapAlignment.end,
runAlignment: WrapAlignment.end,
children: [
ShadButton.outline(
size: ShadButtonSize.sm,
@@ -263,7 +275,6 @@ class _WarehouseEnabledPageState extends State<_WarehouseEnabledPage> {
: () => _goToPage(1),
child: const Text('처음'),
),
const SizedBox(width: 8),
ShadButton.outline(
size: ShadButtonSize.sm,
onPressed: _controller.isLoading || currentPage <= 1
@@ -271,7 +282,6 @@ class _WarehouseEnabledPageState extends State<_WarehouseEnabledPage> {
: () => _goToPage(currentPage - 1),
child: const Text('이전'),
),
const SizedBox(width: 8),
ShadButton.outline(
size: ShadButtonSize.sm,
onPressed: _controller.isLoading || !hasNext
@@ -279,18 +289,17 @@ class _WarehouseEnabledPageState extends State<_WarehouseEnabledPage> {
: () => _goToPage(currentPage + 1),
child: const Text('다음'),
),
const SizedBox(width: 8),
ShadButton.outline(
size: ShadButtonSize.sm,
onPressed:
_controller.isLoading || currentPage >= totalPages
? null
: () => _goToPage(totalPages),
? null
: () => _goToPage(totalPages),
child: const Text('마지막'),
),
],
),
],
),
),
child: _controller.isLoading
? const Padding(
@@ -323,6 +332,15 @@ class _WarehouseEnabledPageState extends State<_WarehouseEnabledPage> {
);
}
void _applyRouteIfNeeded() {
final current = widget.routeUri.toString();
if (_lastAppliedRoute == current) {
return;
}
_lastAppliedRoute = current;
_applyRouteParameters();
}
void _applyFilters() {
final keyword = _searchController.text.trim();
_controller.updateQuery(keyword);
@@ -576,8 +594,7 @@ class _WarehouseEnabledPageState extends State<_WarehouseEnabledPage> {
return ShadButton.ghost(
onPressed: isSaving
? null
: () =>
Navigator.of(context, rootNavigator: true).pop(false),
: () => Navigator.of(context, rootNavigator: true).pop(false),
child: const Text('취소'),
);
},