사용하지 않는 파일 정리 전 백업 (Phase 10 완료 후 상태)
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import 'package:superport/screens/common/templates/form_layout_template.dart';
|
||||
import 'package:superport/utils/constants.dart';
|
||||
import 'package:superport/utils/currency_formatter.dart';
|
||||
import 'package:superport/screens/common/widgets/remark_input.dart';
|
||||
import 'package:superport/core/widgets/category_cascade_form_field.dart';
|
||||
import 'controllers/equipment_in_form_controller.dart';
|
||||
import 'widgets/equipment_vendor_model_selector.dart';
|
||||
import 'package:superport/utils/formatters/number_formatter.dart';
|
||||
|
||||
/// 새로운 Equipment 입고 폼 (Lookup API 기반)
|
||||
class EquipmentInFormScreen extends StatefulWidget {
|
||||
@@ -21,6 +20,9 @@ class EquipmentInFormScreen extends StatefulWidget {
|
||||
|
||||
class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
late EquipmentInFormController _controller;
|
||||
late TextEditingController _serialNumberController;
|
||||
late TextEditingController _initialStockController;
|
||||
late TextEditingController _purchasePriceController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -28,10 +30,26 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
_controller = EquipmentInFormController(equipmentInId: widget.equipmentInId);
|
||||
_controller.addListener(_onControllerUpdated);
|
||||
|
||||
// TextEditingController 초기화
|
||||
_serialNumberController = TextEditingController(text: _controller.serialNumber);
|
||||
_serialNumberController = TextEditingController(text: _controller.serialNumber);
|
||||
_initialStockController = TextEditingController(text: _controller.initialStock.toString());
|
||||
_purchasePriceController = TextEditingController(
|
||||
text: _controller.purchasePrice != null
|
||||
? CurrencyFormatter.formatKRW(_controller.purchasePrice)
|
||||
: ''
|
||||
);
|
||||
|
||||
// 수정 모드일 때 데이터 로드
|
||||
if (_controller.isEditMode) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
await _controller.initializeForEdit();
|
||||
// 데이터 로드 후 컨트롤러 업데이트
|
||||
_serialNumberController.text = _controller.serialNumber;
|
||||
_serialNumberController.text = _controller.serialNumber;
|
||||
_purchasePriceController.text = _controller.purchasePrice != null
|
||||
? CurrencyFormatter.formatKRW(_controller.purchasePrice)
|
||||
: '';
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -40,6 +58,10 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
void dispose() {
|
||||
_controller.removeListener(_onControllerUpdated);
|
||||
_controller.dispose();
|
||||
_serialNumberController.dispose();
|
||||
_serialNumberController.dispose();
|
||||
_initialStockController.dispose();
|
||||
_purchasePriceController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -47,25 +69,7 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
|
||||
// 유효한 제조사 값 반환 (드롭다운 assertion 오류 방지)
|
||||
String? _getValidManufacturer() {
|
||||
if (_controller.manufacturer.isEmpty) return null;
|
||||
|
||||
final isValid = _controller.manufacturers.contains(_controller.manufacturer);
|
||||
print('DEBUG [_getValidManufacturer] manufacturer: "${_controller.manufacturer}", isValid: $isValid, available: ${_controller.manufacturers.take(5).toList()}');
|
||||
|
||||
return isValid ? _controller.manufacturer : null;
|
||||
}
|
||||
|
||||
// 유효한 모델명 값 반환 (드롭다운 assertion 오류 방지)
|
||||
String? _getValidModelName() {
|
||||
if (_controller.modelName.isEmpty) return null;
|
||||
|
||||
final isValid = _controller.equipmentNames.contains(_controller.modelName);
|
||||
print('DEBUG [_getValidModelName] modelName: "${_controller.modelName}", isValid: $isValid, available: ${_controller.equipmentNames.take(5).toList()}');
|
||||
|
||||
return isValid ? _controller.modelName : null;
|
||||
}
|
||||
// Legacy 필드 제거 - Vendor/Model cascade selector 사용
|
||||
|
||||
// 유효한 구매처 ID 반환 (드롭다운 assertion 오류 방지)
|
||||
int? _getValidCompanyId() {
|
||||
@@ -94,10 +98,10 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
if (success && mounted) {
|
||||
Navigator.pop(context, true);
|
||||
} else if (_controller.error != null && mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(_controller.error!),
|
||||
backgroundColor: Colors.red,
|
||||
ShadToaster.of(context).show(
|
||||
ShadToast.destructive(
|
||||
title: const Text('오류'),
|
||||
description: Text(_controller.error!),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -106,7 +110,7 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 간소화된 디버깅
|
||||
print('🎯 [UI] canSave: ${_controller.canSave} | 장비번호: "${_controller.equipmentNumber}" | 제조사: "${_controller.manufacturer}"');
|
||||
print('🎯 [UI] canSave: ${_controller.canSave} | 장비번호: "${_controller.serialNumber}" | 제조사: "${_controller.manufacturer}"');
|
||||
|
||||
return FormLayoutTemplate(
|
||||
title: _controller.isEditMode ? '장비 수정' : '장비 입고',
|
||||
@@ -114,7 +118,7 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
onCancel: () => Navigator.of(context).pop(),
|
||||
isLoading: _controller.isSaving,
|
||||
child: _controller.isLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
? const Center(child: ShadProgress())
|
||||
: Form(
|
||||
key: _controller.formKey,
|
||||
child: SingleChildScrollView(
|
||||
@@ -138,7 +142,7 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
}
|
||||
|
||||
Widget _buildBasicFields() {
|
||||
return Card(
|
||||
return ShadCard(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -153,142 +157,50 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 장비 번호 (필수)
|
||||
TextFormField(
|
||||
initialValue: _controller.equipmentNumber,
|
||||
readOnly: _controller.isFieldReadOnly('equipmentNumber'),
|
||||
decoration: InputDecoration(
|
||||
labelText: _controller.isFieldReadOnly('equipmentNumber')
|
||||
? '장비 번호 * 🔒' : '장비 번호 *',
|
||||
// 🔧 [UI FIX] ReadOnly 필드에서도 의미 있는 hintText 표시
|
||||
hintText: _controller.isFieldReadOnly('equipmentNumber')
|
||||
? (_controller.equipmentNumber.isNotEmpty ? null : '장비 번호 없음')
|
||||
: '장비 번호를 입력하세요',
|
||||
border: const OutlineInputBorder(),
|
||||
filled: _controller.isFieldReadOnly('equipmentNumber'),
|
||||
fillColor: _controller.isFieldReadOnly('equipmentNumber')
|
||||
? Colors.grey[100] : null,
|
||||
),
|
||||
style: TextStyle(
|
||||
color: _controller.isFieldReadOnly('equipmentNumber')
|
||||
? Colors.grey[600] : null,
|
||||
),
|
||||
ShadInputFormField(
|
||||
controller: _serialNumberController,
|
||||
readOnly: _controller.isFieldReadOnly('serialNumber'),
|
||||
placeholder: Text(_controller.isFieldReadOnly('serialNumber')
|
||||
? (_controller.serialNumber.isNotEmpty ? _controller.serialNumber : '장비 번호 없음')
|
||||
: '장비 번호를 입력하세요'),
|
||||
label: Text(_controller.isFieldReadOnly('serialNumber')
|
||||
? '장비 번호 * 🔒' : '장비 번호 *'),
|
||||
validator: (value) {
|
||||
if (value?.trim().isEmpty ?? true) {
|
||||
if (value.trim().isEmpty ?? true) {
|
||||
return '장비 번호는 필수입니다';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onChanged: _controller.isFieldReadOnly('equipmentNumber') ? null : (value) {
|
||||
_controller.equipmentNumber = value?.trim() ?? '';
|
||||
onChanged: _controller.isFieldReadOnly('serialNumber') ? null : (value) {
|
||||
_controller.serialNumber = value.trim() ?? '';
|
||||
setState(() {});
|
||||
print('DEBUG [장비번호 입력] value: "$value", controller.equipmentNumber: "${_controller.equipmentNumber}"');
|
||||
},
|
||||
onSaved: (value) {
|
||||
_controller.equipmentNumber = value?.trim() ?? '';
|
||||
print('DEBUG [장비번호 입력] value: "$value", controller.serialNumber: "${_controller.serialNumber}"');
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 제조사 (필수, Dropdown)
|
||||
DropdownButtonFormField<String>(
|
||||
value: _getValidManufacturer(),
|
||||
items: _controller.manufacturers.map((String manufacturer) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: manufacturer,
|
||||
child: Text(
|
||||
manufacturer,
|
||||
style: TextStyle(
|
||||
color: _controller.isFieldReadOnly('manufacturer')
|
||||
? Colors.grey[600] : null,
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
decoration: InputDecoration(
|
||||
labelText: _controller.isFieldReadOnly('manufacturer')
|
||||
? '제조사 * 🔒' : '제조사 *',
|
||||
hintText: _controller.isFieldReadOnly('manufacturer')
|
||||
? '수정불가' : '제조사를 선택하세요',
|
||||
border: const OutlineInputBorder(),
|
||||
filled: _controller.isFieldReadOnly('manufacturer'),
|
||||
fillColor: _controller.isFieldReadOnly('manufacturer')
|
||||
? Colors.grey[100] : null,
|
||||
),
|
||||
validator: (value) {
|
||||
if (value?.trim().isEmpty ?? true) {
|
||||
return '제조사는 필수입니다';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onChanged: _controller.isFieldReadOnly('manufacturer') ? null : (value) {
|
||||
setState(() {
|
||||
_controller.manufacturer = value?.trim() ?? '';
|
||||
});
|
||||
print('🔧 DEBUG [제조사 선택] value: "$value", controller.manufacturer: "${_controller.manufacturer}", canSave: ${_controller.canSave}');
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 모델명 (선택, Dropdown)
|
||||
DropdownButtonFormField<String>(
|
||||
value: _getValidModelName(),
|
||||
items: _controller.equipmentNames.map((String equipmentName) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: equipmentName,
|
||||
child: Text(
|
||||
equipmentName,
|
||||
style: TextStyle(
|
||||
color: _controller.isFieldReadOnly('modelName')
|
||||
? Colors.grey[600] : null,
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
decoration: InputDecoration(
|
||||
labelText: _controller.isFieldReadOnly('modelName')
|
||||
? '모델명 🔒' : '모델명',
|
||||
hintText: _controller.isFieldReadOnly('modelName')
|
||||
? '수정불가' : '모델명을 선택하세요',
|
||||
border: const OutlineInputBorder(),
|
||||
filled: _controller.isFieldReadOnly('modelName'),
|
||||
fillColor: _controller.isFieldReadOnly('modelName')
|
||||
? Colors.grey[100] : null,
|
||||
),
|
||||
onChanged: _controller.isFieldReadOnly('modelName') ? null : (value) {
|
||||
setState(() {
|
||||
_controller.modelName = value?.trim() ?? '';
|
||||
});
|
||||
print('DEBUG [모델명 선택] value: "$value", controller.modelName: "${_controller.modelName}"');
|
||||
},
|
||||
// Vendor→Model cascade 선택기
|
||||
EquipmentVendorModelSelector(
|
||||
initialVendorId: _controller.vendorId,
|
||||
initialModelId: _controller.modelsId,
|
||||
onChanged: _controller.onVendorModelChanged,
|
||||
isReadOnly: _controller.isFieldReadOnly('modelsId'),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 시리얼 번호 (선택)
|
||||
TextFormField(
|
||||
initialValue: _controller.serialNumber,
|
||||
ShadInputFormField(
|
||||
controller: _serialNumberController,
|
||||
readOnly: _controller.isFieldReadOnly('serialNumber'),
|
||||
decoration: InputDecoration(
|
||||
labelText: _controller.isFieldReadOnly('serialNumber')
|
||||
? '시리얼 번호 🔒' : '시리얼 번호',
|
||||
hintText: _controller.isFieldReadOnly('serialNumber')
|
||||
? '수정불가' : '시리얼 번호를 입력하세요',
|
||||
border: const OutlineInputBorder(),
|
||||
filled: _controller.isFieldReadOnly('serialNumber'),
|
||||
fillColor: _controller.isFieldReadOnly('serialNumber')
|
||||
? Colors.grey[100] : null,
|
||||
),
|
||||
style: TextStyle(
|
||||
color: _controller.isFieldReadOnly('serialNumber')
|
||||
? Colors.grey[600] : null,
|
||||
),
|
||||
placeholder: Text(_controller.isFieldReadOnly('serialNumber')
|
||||
? '수정불가' : '시리얼 번호를 입력하세요'),
|
||||
label: Text(_controller.isFieldReadOnly('serialNumber')
|
||||
? '시리얼 번호 🔒' : '시리얼 번호'),
|
||||
onChanged: _controller.isFieldReadOnly('serialNumber') ? null : (value) {
|
||||
_controller.serialNumber = value?.trim() ?? '';
|
||||
_controller.serialNumber = value.trim() ?? '';
|
||||
setState(() {});
|
||||
print('DEBUG [시리얼번호 입력] value: "$value", controller.serialNumber: "${_controller.serialNumber}"');
|
||||
},
|
||||
onSaved: (value) {
|
||||
_controller.serialNumber = value?.trim() ?? '';
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -297,7 +209,7 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
}
|
||||
|
||||
Widget _buildCategorySection() {
|
||||
return Card(
|
||||
return ShadCard(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -328,7 +240,7 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
}
|
||||
|
||||
Widget _buildLocationSection() {
|
||||
return Card(
|
||||
return ShadCard(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -343,55 +255,73 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 구매처 (드롭다운 전용)
|
||||
DropdownButtonFormField<int>(
|
||||
value: _getValidCompanyId(),
|
||||
items: _controller.companies.entries.map((entry) {
|
||||
return DropdownMenuItem<int>(
|
||||
ShadSelect<int>(
|
||||
initialValue: _getValidCompanyId(),
|
||||
placeholder: const Text('구매처를 선택하세요'),
|
||||
options: _controller.companies.entries.map((entry) =>
|
||||
ShadOption(
|
||||
value: entry.key,
|
||||
child: Text(entry.value),
|
||||
);
|
||||
}).toList(),
|
||||
decoration: const InputDecoration(
|
||||
labelText: '구매처',
|
||||
hintText: '구매처를 선택하세요',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
)
|
||||
).toList(),
|
||||
selectedOptionBuilder: (context, value) =>
|
||||
Text(_controller.companies[value] ?? '선택하세요'),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_controller.selectedCompanyId = value;
|
||||
});
|
||||
print('DEBUG [구매처 선택] value: $value, companies: ${_controller.companies.length}');
|
||||
},
|
||||
onSaved: (value) {
|
||||
_controller.selectedCompanyId = value;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 입고지 (드롭다운 전용)
|
||||
DropdownButtonFormField<int>(
|
||||
value: _getValidWarehouseId(),
|
||||
items: _controller.warehouses.entries.map((entry) {
|
||||
return DropdownMenuItem<int>(
|
||||
ShadSelect<int>(
|
||||
initialValue: _getValidWarehouseId(),
|
||||
placeholder: const Text('입고지를 선택하세요'),
|
||||
options: _controller.warehouses.entries.map((entry) =>
|
||||
ShadOption(
|
||||
value: entry.key,
|
||||
child: Text(entry.value),
|
||||
);
|
||||
}).toList(),
|
||||
decoration: const InputDecoration(
|
||||
labelText: '입고지',
|
||||
hintText: '입고지를 선택하세요',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
)
|
||||
).toList(),
|
||||
selectedOptionBuilder: (context, value) =>
|
||||
Text(_controller.warehouses[value] ?? '선택하세요'),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_controller.selectedWarehouseId = value;
|
||||
});
|
||||
print('DEBUG [입고지 선택] value: $value, warehouses: ${_controller.warehouses.length}');
|
||||
},
|
||||
onSaved: (value) {
|
||||
_controller.selectedWarehouseId = value;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 초기 재고 수량 (신규 등록 시에만 표시)
|
||||
if (!_controller.isEditMode)
|
||||
ShadInputFormField(
|
||||
controller: _initialStockController,
|
||||
label: const Text('초기 재고 수량 *'),
|
||||
placeholder: const Text('입고할 수량을 입력하세요'),
|
||||
description: const Text('장비 등록 시 자동으로 입고 처리됩니다'),
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
],
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return '재고 수량은 필수입니다';
|
||||
}
|
||||
final quantity = int.tryParse(value);
|
||||
if (quantity == null || quantity <= 0) {
|
||||
return '1개 이상의 수량을 입력하세요';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onChanged: (value) {
|
||||
final quantity = int.tryParse(value) ?? 1;
|
||||
_controller.initialStock = quantity;
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -399,7 +329,7 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
}
|
||||
|
||||
Widget _buildPurchaseSection() {
|
||||
return Card(
|
||||
return ShadCard(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -431,29 +361,39 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
});
|
||||
}
|
||||
},
|
||||
child: InputDecorator(
|
||||
decoration: InputDecoration(
|
||||
labelText: _controller.isFieldReadOnly('purchaseDate')
|
||||
? '구매일 🔒' : '구매일',
|
||||
suffixIcon: Icon(
|
||||
Icons.calendar_today,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: _controller.isFieldReadOnly('purchaseDate')
|
||||
? Colors.grey[600] : null,
|
||||
? Colors.grey[300]!
|
||||
: Theme.of(context).dividerColor,
|
||||
),
|
||||
border: const OutlineInputBorder(),
|
||||
filled: _controller.isFieldReadOnly('purchaseDate'),
|
||||
fillColor: _controller.isFieldReadOnly('purchaseDate')
|
||||
? Colors.grey[100] : null,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
color: _controller.isFieldReadOnly('purchaseDate')
|
||||
? Colors.grey[50]
|
||||
: null,
|
||||
),
|
||||
child: Text(
|
||||
// 🔧 [UI FIX] ReadOnly 필드에서도 의미 있는 텍스트 표시
|
||||
_controller.purchaseDate != null
|
||||
? '${_controller.purchaseDate!.year}-${_controller.purchaseDate!.month.toString().padLeft(2, '0')}-${_controller.purchaseDate!.day.toString().padLeft(2, '0')}'
|
||||
: _controller.isFieldReadOnly('purchaseDate') ? '구매일 미설정' : '날짜 선택',
|
||||
style: TextStyle(
|
||||
color: _controller.isFieldReadOnly('purchaseDate')
|
||||
? Colors.grey[600] : null,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
_controller.purchaseDate != null
|
||||
? '${_controller.purchaseDate!.year}-${_controller.purchaseDate!.month.toString().padLeft(2, '0')}-${_controller.purchaseDate!.day.toString().padLeft(2, '0')}'
|
||||
: _controller.isFieldReadOnly('purchaseDate') ? '구매일 미설정' : '날짜 선택',
|
||||
style: TextStyle(
|
||||
color: _controller.isFieldReadOnly('purchaseDate')
|
||||
? Colors.grey[600]
|
||||
: null,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.calendar_today,
|
||||
size: 16,
|
||||
color: _controller.isFieldReadOnly('purchaseDate')
|
||||
? Colors.grey[600] : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -462,31 +402,21 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
|
||||
// 구매 가격
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
initialValue: _controller.purchasePrice != null
|
||||
? CurrencyFormatter.formatKRW(_controller.purchasePrice)
|
||||
: '',
|
||||
child: ShadInputFormField(
|
||||
controller: _purchasePriceController,
|
||||
readOnly: _controller.isFieldReadOnly('purchasePrice'),
|
||||
decoration: InputDecoration(
|
||||
labelText: _controller.isFieldReadOnly('purchasePrice')
|
||||
? '구매 가격 🔒' : '구매 가격',
|
||||
hintText: _controller.isFieldReadOnly('purchasePrice')
|
||||
? '수정불가' : '₩2,000,000',
|
||||
border: const OutlineInputBorder(),
|
||||
filled: _controller.isFieldReadOnly('purchasePrice'),
|
||||
fillColor: _controller.isFieldReadOnly('purchasePrice')
|
||||
? Colors.grey[100] : null,
|
||||
),
|
||||
style: TextStyle(
|
||||
color: _controller.isFieldReadOnly('purchasePrice')
|
||||
? Colors.grey[600] : null,
|
||||
),
|
||||
label: Text(_controller.isFieldReadOnly('purchasePrice')
|
||||
? '구매 가격 🔒' : '구매 가격'),
|
||||
placeholder: Text(_controller.isFieldReadOnly('purchasePrice')
|
||||
? '수정불가' : '₩2,000,000'),
|
||||
keyboardType: _controller.isFieldReadOnly('purchasePrice')
|
||||
? null : TextInputType.number,
|
||||
inputFormatters: _controller.isFieldReadOnly('purchasePrice')
|
||||
? null : [KRWTextInputFormatter()],
|
||||
onSaved: (value) {
|
||||
_controller.purchasePrice = CurrencyFormatter.parseKRW(value);
|
||||
? null : [CurrencyInputFormatter()], // 새로운 통화 포맷터
|
||||
onChanged: (value) {
|
||||
// 숫자만 추출하여 저장
|
||||
final digitsOnly = value.replaceAll(RegExp(r'[^\d]'), '');
|
||||
_controller.purchasePrice = int.tryParse(digitsOnly)?.toDouble();
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -499,7 +429,7 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
}
|
||||
|
||||
Widget _buildRemarkSection() {
|
||||
return Card(
|
||||
return ShadCard(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -513,13 +443,10 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
TextFormField(
|
||||
ShadInputFormField(
|
||||
controller: _controller.remarkController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '비고',
|
||||
hintText: '비고사항을 입력하세요',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
label: const Text('비고'),
|
||||
placeholder: const Text('비고사항을 입력하세요'),
|
||||
maxLines: 3,
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user