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

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

@@ -9,6 +9,7 @@ import 'package:superport_v2/widgets/components/filter_bar.dart';
import 'package:superport_v2/widgets/components/superport_dialog.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';
import 'package:superport_v2/widgets/components/responsive_section.dart';
import '../../../../../core/config/environment.dart';
import '../../../../../widgets/spec_page.dart';
@@ -103,7 +104,7 @@ class _CustomerEnabledPageState extends State<_CustomerEnabledPage> {
final TextEditingController _searchController = TextEditingController();
final FocusNode _searchFocus = FocusNode();
String? _lastError;
bool _routeApplied = false;
String? _lastAppliedRoute;
@override
void initState() {
@@ -115,9 +116,14 @@ class _CustomerEnabledPageState extends State<_CustomerEnabledPage> {
@override
void didChangeDependencies() {
super.didChangeDependencies();
if (!_routeApplied) {
_routeApplied = true;
_applyRouteParameters();
_applyRouteIfNeeded();
}
@override
void didUpdateWidget(covariant _CustomerEnabledPage oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.routeUri != oldWidget.routeUri) {
_applyRouteIfNeeded();
}
}
@@ -133,8 +139,17 @@ class _CustomerEnabledPageState extends State<_CustomerEnabledPage> {
}
}
void _applyRouteParameters() {
final params = widget.routeUri.queryParameters;
void _applyRouteIfNeeded() {
final current = widget.routeUri.toString();
if (_lastAppliedRoute == current) {
return;
}
_lastAppliedRoute = current;
_applyRouteParameters(widget.routeUri);
}
void _applyRouteParameters(Uri route) {
final params = route.queryParameters;
final query = params['q'] ?? '';
final type = _typeFromParam(params['type']);
final status = _statusFromParam(params['status']);
@@ -231,8 +246,8 @@ class _CustomerEnabledPageState extends State<_CustomerEnabledPage> {
),
],
children: [
SizedBox(
width: 260,
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 260),
child: ShadInput(
controller: _searchController,
focusNode: _searchFocus,
@@ -241,8 +256,8 @@ class _CustomerEnabledPageState extends State<_CustomerEnabledPage> {
onSubmitted: (_) => _applyFilters(),
),
),
SizedBox(
width: 200,
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 200),
child: ShadSelect<CustomerTypeFilter>(
key: ValueKey(_controller.typeFilter),
initialValue: _controller.typeFilter,
@@ -262,8 +277,8 @@ class _CustomerEnabledPageState extends State<_CustomerEnabledPage> {
.toList(),
),
),
SizedBox(
width: 200,
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 200),
child: ShadSelect<CustomerStatusFilter>(
key: ValueKey(_controller.statusFilter),
initialValue: _controller.statusFilter,
@@ -286,21 +301,27 @@ class _CustomerEnabledPageState extends State<_CustomerEnabledPage> {
],
),
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,
@@ -309,7 +330,6 @@ class _CustomerEnabledPageState extends State<_CustomerEnabledPage> {
: () => _goToPage(1),
child: const Text('처음'),
),
const SizedBox(width: 8),
ShadButton.outline(
size: ShadButtonSize.sm,
onPressed: _controller.isLoading || currentPage <= 1
@@ -317,7 +337,6 @@ class _CustomerEnabledPageState extends State<_CustomerEnabledPage> {
: () => _goToPage(currentPage - 1),
child: const Text('이전'),
),
const SizedBox(width: 8),
ShadButton.outline(
size: ShadButtonSize.sm,
onPressed: _controller.isLoading || !hasNext
@@ -325,18 +344,17 @@ class _CustomerEnabledPageState extends State<_CustomerEnabledPage> {
: () => _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(
@@ -703,8 +721,7 @@ class _CustomerEnabledPageState extends State<_CustomerEnabledPage> {
return ShadButton.ghost(
onPressed: isSaving
? null
: () =>
Navigator.of(context, rootNavigator: true).pop(false),
: () => Navigator.of(context, rootNavigator: true).pop(false),
child: const Text('취소'),
);
},