feat: 穿搭页增加场景选择(通勤/约会/聚会/运动),生成时作为依据传参

This commit is contained in:
2026-07-31 17:10:38 +08:00
parent 240f5d1114
commit 2a07f7d052
2 changed files with 24 additions and 0 deletions
+22
View File
@@ -19,8 +19,11 @@ class OutfitPage extends ConsumerStatefulWidget {
class _OutfitPageState extends ConsumerState<OutfitPage> { class _OutfitPageState extends ConsumerState<OutfitPage> {
DateTimeRange? _dateRange; DateTimeRange? _dateRange;
final _locationCtrl = TextEditingController(); final _locationCtrl = TextEditingController();
String _occasion = '通勤';
bool _submitting = false; bool _submitting = false;
static const _occasions = ['通勤', '约会', '聚会', '运动'];
@override @override
void dispose() { void dispose() {
_locationCtrl.dispose(); _locationCtrl.dispose();
@@ -62,6 +65,7 @@ class _OutfitPageState extends ConsumerState<OutfitPage> {
startDate: _fmt(range.start), startDate: _fmt(range.start),
endDate: _fmt(range.end), endDate: _fmt(range.end),
location: location, location: location,
occasion: _occasion,
); );
if (!mounted) return; if (!mounted) return;
setState(() => _submitting = false); setState(() => _submitting = false);
@@ -115,6 +119,24 @@ class _OutfitPageState extends ConsumerState<OutfitPage> {
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
const Text('场景',
style:
TextStyle(fontSize: 13, fontWeight: FontWeight.w600)),
const SizedBox(height: 8),
Wrap(
spacing: 8,
children: [
for (final o in _occasions)
ChoiceChip(
label: Text(o),
selected: _occasion == o,
onSelected: _submitting
? null
: (_) => setState(() => _occasion = o),
),
],
),
const SizedBox(height: 16),
if (gen.phase == GeneratePhase.running) if (gen.phase == GeneratePhase.running)
Padding( Padding(
padding: const EdgeInsets.only(bottom: 12), padding: const EdgeInsets.only(bottom: 12),
+2
View File
@@ -146,6 +146,7 @@ class GenerateNotifier extends Notifier<GenerateState> {
required String startDate, required String startDate,
required String endDate, required String endDate,
required String location, required String location,
required String occasion,
}) async { }) async {
state = state =
const GenerateState(phase: GeneratePhase.running, statusText: '任务创建中...'); const GenerateState(phase: GeneratePhase.running, statusText: '任务创建中...');
@@ -154,6 +155,7 @@ class GenerateNotifier extends Notifier<GenerateState> {
'start_date': startDate, 'start_date': startDate,
'end_date': endDate, 'end_date': endDate,
'location': location, 'location': location,
'occasion': occasion,
}); });
final taskId = (data['task_id'] as num).toInt(); final taskId = (data['task_id'] as num).toInt();