chore: 프로젝트 정리 및 문서 업데이트
- 창고 위치 폼 UI 개선 - 테스트 리포트 업데이트 - API 이슈 문서 추가 - 폼 레이아웃 템플릿 추가 - main.dart 정리 - 상수 업데이트 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:superport/models/address_model.dart';
|
||||
import 'package:superport/screens/common/widgets/address_input.dart';
|
||||
import 'package:superport/screens/common/widgets/remark_input.dart';
|
||||
import 'package:superport/screens/common/theme_tailwind.dart';
|
||||
import 'package:superport/screens/common/templates/form_layout_template.dart';
|
||||
import 'controllers/warehouse_location_form_controller.dart';
|
||||
|
||||
/// 입고지 추가/수정 폼 화면 (SRP 적용, 상태/로직 분리)
|
||||
@@ -37,30 +38,61 @@ class _WarehouseLocationFormScreenState
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// 저장 메소드
|
||||
Future<void> _onSave() async {
|
||||
setState(() {}); // 저장 중 상태 갱신
|
||||
final success = await _controller.save();
|
||||
setState(() {}); // 저장 완료 후 상태 갱신
|
||||
|
||||
if (success) {
|
||||
// 성공 메시지 표시
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(_controller.isEditMode ? '입고지가 수정되었습니다' : '입고지가 추가되었습니다'),
|
||||
backgroundColor: AppThemeTailwind.success,
|
||||
),
|
||||
);
|
||||
// 리스트 화면으로 돌아가기
|
||||
Navigator.of(context).pop(true);
|
||||
}
|
||||
} else {
|
||||
// 실패 메시지 표시
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(_controller.error ?? '저장에 실패했습니다'),
|
||||
backgroundColor: AppThemeTailwind.danger,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(_controller.isEditMode ? '입고지 수정' : '입고지 추가'),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
onPressed: () => Navigator.of(context).maybePop(),
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Form(
|
||||
key: _controller.formKey,
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 32),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 입고지명 입력
|
||||
TextFormField(
|
||||
return FormLayoutTemplate(
|
||||
title: _controller.isEditMode ? '입고지 수정' : '입고지 추가',
|
||||
onSave: _controller.isSaving ? null : _onSave,
|
||||
saveButtonText: '저장',
|
||||
isLoading: _controller.isSaving,
|
||||
child: Form(
|
||||
key: _controller.formKey,
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(UIConstants.formPadding),
|
||||
child: FormSection(
|
||||
title: '입고지 정보',
|
||||
subtitle: '입고지의 기본 정보를 입력하세요',
|
||||
children: [
|
||||
// 입고지명 입력
|
||||
FormFieldWrapper(
|
||||
label: '입고지명',
|
||||
required: true,
|
||||
child: TextFormField(
|
||||
controller: _controller.nameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '입고지명',
|
||||
hintText: '입고지명을 입력하세요',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null || value.trim().isEmpty) {
|
||||
@@ -69,9 +101,12 @@ class _WarehouseLocationFormScreenState
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// 주소 입력 (공통 위젯)
|
||||
AddressInput(
|
||||
),
|
||||
// 주소 입력 (공통 위젯)
|
||||
FormFieldWrapper(
|
||||
label: '주소',
|
||||
required: true,
|
||||
child: AddressInput(
|
||||
initialZipCode: _controller.address.zipCode,
|
||||
initialRegion: _controller.address.region,
|
||||
initialDetailAddress: _controller.address.detailAddress,
|
||||
@@ -88,74 +123,13 @@ class _WarehouseLocationFormScreenState
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// 비고 입력
|
||||
RemarkInput(controller: _controller.remarkController),
|
||||
const SizedBox(height: 80), // 하단 버튼 여백 확보
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(24, 0, 24, 24),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 48,
|
||||
child: ElevatedButton(
|
||||
onPressed:
|
||||
_controller.isSaving
|
||||
? null
|
||||
: () async {
|
||||
setState(() {}); // 저장 중 상태 갱신
|
||||
final success = await _controller.save();
|
||||
setState(() {}); // 저장 완료 후 상태 갱신
|
||||
|
||||
if (success) {
|
||||
// 성공 메시지 표시
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(_controller.isEditMode ? '입고지가 수정되었습니다' : '입고지가 추가되었습니다'),
|
||||
backgroundColor: AppThemeTailwind.success,
|
||||
),
|
||||
);
|
||||
// 리스트 화면으로 돌아가기
|
||||
Navigator.of(context).pop(true);
|
||||
}
|
||||
} else {
|
||||
// 실패 메시지 표시
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(_controller.error ?? '저장에 실패했습니다'),
|
||||
backgroundColor: AppThemeTailwind.danger,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppThemeTailwind.primary,
|
||||
minimumSize: const Size.fromHeight(48),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child:
|
||||
_controller.isSaving
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Text(
|
||||
'저장',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
// 비고 입력
|
||||
FormFieldWrapper(
|
||||
label: '비고',
|
||||
child: RemarkInput(controller: _controller.remarkController),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user