Skip to content

Commit 87c8a59

Browse files
author
Miroslav Mazel
committed
Homescreen: new details icon + tweaked padding
1 parent 814acd1 commit 87c8a59

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

lib/widgets/dashboard/widgets.dart

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,6 @@ class _DashboardNutritionWidgetState extends State<DashboardNutritionWidget> {
146146
return out;
147147
}
148148

149-
Widget getTrailing() {
150-
if (!_hasContent) {
151-
return const Text('');
152-
}
153-
154-
return _showDetail ? const Icon(Icons.expand_less) : const Icon(Icons.expand_more);
155-
}
156-
157149
@override
158150
Widget build(BuildContext context) {
159151
return Card(
@@ -174,24 +166,34 @@ class _DashboardNutritionWidgetState extends State<DashboardNutritionWidget> {
174166
Icons.restaurant,
175167
color: Theme.of(context).textTheme.headlineSmall!.color,
176168
),
177-
trailing: getTrailing(),
169+
trailing: _hasContent
170+
? Tooltip(
171+
message: AppLocalizations.of(context).toggleDetails,
172+
child: _showDetail
173+
? const Icon(
174+
Icons.info,
175+
)
176+
: const Icon(Icons.info_outline))
177+
: const SizedBox(),
178178
onTap: () {
179179
setState(() {
180180
_showDetail = !_showDetail;
181181
});
182182
},
183183
),
184184
if (_hasContent)
185-
Column(
186-
children: [
187-
...getContent(),
188-
Container(
189-
padding: const EdgeInsets.all(15),
190-
height: 180,
191-
child: FlNutritionalPlanPieChartWidget(_plan!.nutritionalValues),
192-
)
193-
],
194-
)
185+
Padding(
186+
padding: const EdgeInsets.symmetric(horizontal: 10),
187+
child: Column(
188+
children: [
189+
...getContent(),
190+
Container(
191+
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 15),
192+
height: 180,
193+
child: FlNutritionalPlanPieChartWidget(_plan!.nutritionalValues),
194+
)
195+
],
196+
))
195197
else
196198
NothingFound(
197199
AppLocalizations.of(context).noNutritionalPlans,
@@ -441,14 +443,6 @@ class _DashboardWorkoutWidgetState extends State<DashboardWorkoutWidget> {
441443
_hasContent = _workoutPlan != null;
442444
}
443445

444-
Widget getTrailing() {
445-
if (!_hasContent) {
446-
return const Text('');
447-
}
448-
449-
return _showDetail ? const Icon(Icons.expand_less) : const Icon(Icons.expand_more);
450-
}
451-
452446
List<Widget> getContent() {
453447
final List<Widget> out = [];
454448

@@ -540,16 +534,24 @@ class _DashboardWorkoutWidgetState extends State<DashboardWorkoutWidget> {
540534
Icons.fitness_center,
541535
color: Theme.of(context).textTheme.headlineSmall!.color,
542536
),
543-
trailing: getTrailing(),
537+
trailing: _hasContent
538+
? Tooltip(
539+
message: AppLocalizations.of(context).toggleDetails,
540+
child: _showDetail
541+
? const Icon(
542+
Icons.info,
543+
)
544+
: const Icon(Icons.info_outline))
545+
: const SizedBox(),
544546
onTap: () {
545547
setState(() {
546548
_showDetail = !_showDetail;
547549
});
548550
},
549551
),
550552
if (_hasContent)
551-
Container(
552-
padding: const EdgeInsets.only(left: 10),
553+
Padding(
554+
padding: const EdgeInsets.symmetric(horizontal: 10),
553555
child: Column(
554556
children: [
555557
...getContent(),

0 commit comments

Comments
 (0)