feat: 穿搭页增加场景选择(通勤/约会/聚会/运动),生成时作为依据传参
This commit is contained in:
@@ -19,8 +19,11 @@ class OutfitPage extends ConsumerStatefulWidget {
|
||||
class _OutfitPageState extends ConsumerState<OutfitPage> {
|
||||
DateTimeRange? _dateRange;
|
||||
final _locationCtrl = TextEditingController();
|
||||
String _occasion = '通勤';
|
||||
bool _submitting = false;
|
||||
|
||||
static const _occasions = ['通勤', '约会', '聚会', '运动'];
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_locationCtrl.dispose();
|
||||
@@ -62,6 +65,7 @@ class _OutfitPageState extends ConsumerState<OutfitPage> {
|
||||
startDate: _fmt(range.start),
|
||||
endDate: _fmt(range.end),
|
||||
location: location,
|
||||
occasion: _occasion,
|
||||
);
|
||||
if (!mounted) return;
|
||||
setState(() => _submitting = false);
|
||||
@@ -115,6 +119,24 @@ class _OutfitPageState extends ConsumerState<OutfitPage> {
|
||||
),
|
||||
),
|
||||
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)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
|
||||
@@ -146,6 +146,7 @@ class GenerateNotifier extends Notifier<GenerateState> {
|
||||
required String startDate,
|
||||
required String endDate,
|
||||
required String location,
|
||||
required String occasion,
|
||||
}) async {
|
||||
state =
|
||||
const GenerateState(phase: GeneratePhase.running, statusText: '任务创建中...');
|
||||
@@ -154,6 +155,7 @@ class GenerateNotifier extends Notifier<GenerateState> {
|
||||
'start_date': startDate,
|
||||
'end_date': endDate,
|
||||
'location': location,
|
||||
'occasion': occasion,
|
||||
});
|
||||
final taskId = (data['task_id'] as num).toInt();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user