- 将 AddItemScreen 中的各个字段提取为独立的 Widget - 新增 CategoryDropdown、DatePickerField、DescriptionField 等组件 - 优化 Item 模型,使用 ItemIsUse 枚举替代字符串表示是否使用 - 在数据库中添加 price 字段- 重构表单提交逻辑,使用新的组件进行数据采集
20 lines
467 B
Dart
20 lines
467 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class LocationInputField extends StatelessWidget {
|
|
final ValueChanged<String> onChanged;
|
|
|
|
const LocationInputField({required this.onChanged});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return TextFormField(
|
|
onChanged: onChanged,
|
|
decoration: InputDecoration(
|
|
labelText: "物品位置",
|
|
hintText: "请输入物品位置",
|
|
border: OutlineInputBorder(),
|
|
),
|
|
);
|
|
}
|
|
}
|