From 87c8a599f0ed7b863d6614da3820fd9944f8152c Mon Sep 17 00:00:00 2001 From: Miroslav Mazel Date: Fri, 24 Nov 2023 13:02:25 +0100 Subject: [PATCH] Homescreen: new details icon + tweaked padding --- lib/widgets/dashboard/widgets.dart | 62 +++++++++++++++--------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index b5565c840..349eea65c 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -146,14 +146,6 @@ class _DashboardNutritionWidgetState extends State { return out; } - Widget getTrailing() { - if (!_hasContent) { - return const Text(''); - } - - return _showDetail ? const Icon(Icons.expand_less) : const Icon(Icons.expand_more); - } - @override Widget build(BuildContext context) { return Card( @@ -174,7 +166,15 @@ class _DashboardNutritionWidgetState extends State { Icons.restaurant, color: Theme.of(context).textTheme.headlineSmall!.color, ), - trailing: getTrailing(), + trailing: _hasContent + ? Tooltip( + message: AppLocalizations.of(context).toggleDetails, + child: _showDetail + ? const Icon( + Icons.info, + ) + : const Icon(Icons.info_outline)) + : const SizedBox(), onTap: () { setState(() { _showDetail = !_showDetail; @@ -182,16 +182,18 @@ class _DashboardNutritionWidgetState extends State { }, ), if (_hasContent) - Column( - children: [ - ...getContent(), - Container( - padding: const EdgeInsets.all(15), - height: 180, - child: FlNutritionalPlanPieChartWidget(_plan!.nutritionalValues), - ) - ], - ) + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Column( + children: [ + ...getContent(), + Container( + padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 15), + height: 180, + child: FlNutritionalPlanPieChartWidget(_plan!.nutritionalValues), + ) + ], + )) else NothingFound( AppLocalizations.of(context).noNutritionalPlans, @@ -441,14 +443,6 @@ class _DashboardWorkoutWidgetState extends State { _hasContent = _workoutPlan != null; } - Widget getTrailing() { - if (!_hasContent) { - return const Text(''); - } - - return _showDetail ? const Icon(Icons.expand_less) : const Icon(Icons.expand_more); - } - List getContent() { final List out = []; @@ -540,7 +534,15 @@ class _DashboardWorkoutWidgetState extends State { Icons.fitness_center, color: Theme.of(context).textTheme.headlineSmall!.color, ), - trailing: getTrailing(), + trailing: _hasContent + ? Tooltip( + message: AppLocalizations.of(context).toggleDetails, + child: _showDetail + ? const Icon( + Icons.info, + ) + : const Icon(Icons.info_outline)) + : const SizedBox(), onTap: () { setState(() { _showDetail = !_showDetail; @@ -548,8 +550,8 @@ class _DashboardWorkoutWidgetState extends State { }, ), if (_hasContent) - Container( - padding: const EdgeInsets.only(left: 10), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), child: Column( children: [ ...getContent(),