mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Refactor calendar on dashboard
The scrollable list view is now removed. There can't be that many different types of events for a single day anyway.
This commit is contained in:
@@ -124,10 +124,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
DashboardWorkoutWidget(),
|
||||
DashboardNutritionWidget(),
|
||||
DashboardWeightWidget(),
|
||||
Container(
|
||||
height: 650, // TODO: refactor calendar so we can get rid of size
|
||||
child: DashboardCalendarWidget(),
|
||||
),
|
||||
DashboardCalendarWidget(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -226,36 +226,30 @@ class _DashboardCalendarWidgetState extends State<DashboardCalendarWidget>
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Expanded(
|
||||
child: ValueListenableBuilder<List<Event>>(
|
||||
valueListenable: _selectedEvents,
|
||||
builder: (context, value, _) {
|
||||
return ListView.builder(
|
||||
itemCount: value.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
child: ListTile(
|
||||
title: Text((() {
|
||||
switch (value[index].type) {
|
||||
case EventType.caloriesDiary:
|
||||
return AppLocalizations.of(context)!.nutritionalDiary;
|
||||
ValueListenableBuilder<List<Event>>(
|
||||
valueListenable: _selectedEvents,
|
||||
builder: (context, value, _) => Column(
|
||||
children: [
|
||||
...value
|
||||
.map((event) => ListTile(
|
||||
title: Text((() {
|
||||
switch (event.type) {
|
||||
case EventType.caloriesDiary:
|
||||
return AppLocalizations.of(context)!.nutritionalDiary;
|
||||
|
||||
case EventType.session:
|
||||
return AppLocalizations.of(context)!.workoutSession;
|
||||
case EventType.session:
|
||||
return AppLocalizations.of(context)!.workoutSession;
|
||||
|
||||
case EventType.weight:
|
||||
return AppLocalizations.of(context)!.weight;
|
||||
}
|
||||
return value[index].description.toString();
|
||||
})()),
|
||||
subtitle: Text(value[index].description.toString()),
|
||||
onTap: () => print('${value[index]} tapped!'),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
case EventType.weight:
|
||||
return AppLocalizations.of(context)!.weight;
|
||||
}
|
||||
return event.description.toString();
|
||||
})()),
|
||||
subtitle: Text(event.description.toString()),
|
||||
//onTap: () => print('$event tapped!'),
|
||||
))
|
||||
.toList()
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user