- 将 AddItemScreen 中的各个字段提取为独立的 Widget - 新增 CategoryDropdown、DatePickerField、DescriptionField 等组件 - 优化 Item 模型,使用 ItemIsUse 枚举替代字符串表示是否使用 - 在数据库中添加 price 字段- 重构表单提交逻辑,使用新的组件进行数据采集
22 lines
543 B
Dart
22 lines
543 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class SubmitButton extends StatelessWidget {
|
|
final VoidCallback onPressed;
|
|
const SubmitButton({required this.onPressed});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ElevatedButton(
|
|
onPressed: onPressed,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Text('提交'),
|
|
),
|
|
style: ElevatedButton.styleFrom(
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
|
elevation: 4,
|
|
),
|
|
);
|
|
}
|
|
}
|