Skip to content

Commit

Permalink
Homescreen: new details icon + tweaked padding
Browse files Browse the repository at this point in the history
  • Loading branch information
Miroslav Mazel committed Nov 24, 2023
1 parent 814acd1 commit 87c8a59
Showing 1 changed file with 32 additions and 30 deletions.
62 changes: 32 additions & 30 deletions lib/widgets/dashboard/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,6 @@ class _DashboardNutritionWidgetState extends State<DashboardNutritionWidget> {
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(
Expand All @@ -174,24 +166,34 @@ class _DashboardNutritionWidgetState extends State<DashboardNutritionWidget> {
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;
});
},
),
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,
Expand Down Expand Up @@ -441,14 +443,6 @@ class _DashboardWorkoutWidgetState extends State<DashboardWorkoutWidget> {
_hasContent = _workoutPlan != null;
}

Widget getTrailing() {
if (!_hasContent) {
return const Text('');
}

return _showDetail ? const Icon(Icons.expand_less) : const Icon(Icons.expand_more);
}

List<Widget> getContent() {
final List<Widget> out = [];

Expand Down Expand Up @@ -540,16 +534,24 @@ class _DashboardWorkoutWidgetState extends State<DashboardWorkoutWidget> {
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;
});
},
),
if (_hasContent)
Container(
padding: const EdgeInsets.only(left: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
children: [
...getContent(),
Expand Down

0 comments on commit 87c8a59

Please sign in to comment.