mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-30 17:52:35 +01:00
Also put the list tile to add exercises in a card
This makes it look the same as the one to add new days and makes for a more consistent behaviour
This commit is contained in:
@@ -574,29 +574,31 @@ class _SlotFormWidgetStateNg extends State<ReorderableSlotList> {
|
||||
},
|
||||
),
|
||||
if (!widget.day.isRest)
|
||||
ListTile(
|
||||
leading: isAddingSlot ? const FormProgressIndicator() : const Icon(Icons.add),
|
||||
title: Text(
|
||||
i18n.addExercise,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
onTap: isAddingSlot
|
||||
? null
|
||||
: () async {
|
||||
setState(() => isAddingSlot = true);
|
||||
Card(
|
||||
child: ListTile(
|
||||
leading: isAddingSlot ? const FormProgressIndicator() : const Icon(Icons.add),
|
||||
title: Text(
|
||||
i18n.addExercise,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
onTap: isAddingSlot
|
||||
? null
|
||||
: () async {
|
||||
setState(() => isAddingSlot = true);
|
||||
|
||||
final newSlot = await provider.addSlot(
|
||||
Slot.withData(
|
||||
day: widget.day.id,
|
||||
order: widget.slots.length + 1,
|
||||
),
|
||||
widget.day.routineId,
|
||||
);
|
||||
if (mounted) {
|
||||
setState(() => isAddingSlot = false);
|
||||
setState(() => selectedSlotId = newSlot.id);
|
||||
}
|
||||
},
|
||||
final newSlot = await provider.addSlot(
|
||||
Slot.withData(
|
||||
day: widget.day.id,
|
||||
order: widget.slots.length + 1,
|
||||
),
|
||||
widget.day.routineId,
|
||||
);
|
||||
if (mounted) {
|
||||
setState(() => isAddingSlot = false);
|
||||
setState(() => selectedSlotId = newSlot.id);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -99,7 +99,6 @@ void main() {
|
||||
.having((d) => d.name, 'name', 'Day 1')
|
||||
.having((d) => d.description, 'description', 'Day 1 description'),
|
||||
),
|
||||
refresh: true,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -86,6 +86,7 @@ void main() {
|
||||
expect(find.text('second day'), findsOneWidget);
|
||||
expect(find.text('legs'), findsOneWidget);
|
||||
|
||||
expect(find.byType(Card), findsNWidgets(4));
|
||||
expect(find.byType(Card), findsWidgets);
|
||||
// expect(find.byType(Card), findsNWidgets(4));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user