diff --git a/lib/widgets/buttons/round_button_widget.dart b/lib/widgets/buttons/round_button_widget.dart index 14efe2d..9e8d7ac 100644 --- a/lib/widgets/buttons/round_button_widget.dart +++ b/lib/widgets/buttons/round_button_widget.dart @@ -1,10 +1,10 @@ import 'package:flutter/material.dart'; -class RoundAddButton extends StatelessWidget { +class RoundIconButton extends StatelessWidget { final VoidCallback onPressed; final IconData iconData; - const RoundAddButton( + const RoundIconButton( {super.key, required this.onPressed, required this.iconData}); @override diff --git a/lib/widgets/buttons/submit_form_button.dart b/lib/widgets/buttons/submit_form_button.dart index f9cb784..f338339 100644 --- a/lib/widgets/buttons/submit_form_button.dart +++ b/lib/widgets/buttons/submit_form_button.dart @@ -2,6 +2,7 @@ import 'package:awesome_dialog/awesome_dialog.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:smoke_cess_app/providers/page_provider.dart'; +import 'package:smoke_cess_app/widgets/buttons/round_button_widget.dart'; class SubmitFormButton extends StatelessWidget { final Future Function() submitCallback; @@ -14,7 +15,7 @@ class SubmitFormButton extends StatelessWidget { PageProvider pageProvider = context.watch(); return Padding( padding: const EdgeInsets.symmetric(vertical: 16.0), - child: ElevatedButton( + child: RoundIconButton( onPressed: () async { int success = await submitCallback(); if (context.mounted) { @@ -37,7 +38,7 @@ class SubmitFormButton extends StatelessWidget { } } }, - child: const Text('Speichern'), + iconData: Icons.check_outlined, ), ); } diff --git a/lib/widgets/entry_detail_title.dart b/lib/widgets/entry_detail_title.dart index 4bdff97..110e38f 100644 --- a/lib/widgets/entry_detail_title.dart +++ b/lib/widgets/entry_detail_title.dart @@ -11,18 +11,22 @@ class EntryDetailTitle extends StatelessWidget { @override Widget build(BuildContext context) { return Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisAlignment: MainAxisAlignment.start, children: [ Text( DateFormat.MMMd('de').format(date), style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), - Text( - entryData, - style: - const TextStyle(color: Colors.white, fontWeight: FontWeight.bold), - ) + Flexible( + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 5.0), + child: Text( + entryData, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + color: Colors.white, fontWeight: FontWeight.bold), + ))) ], ); } diff --git a/lib/widgets/entry_detail_widget.dart b/lib/widgets/entry_detail_widget.dart index c75d895..0f7a70e 100644 --- a/lib/widgets/entry_detail_widget.dart +++ b/lib/widgets/entry_detail_widget.dart @@ -22,33 +22,37 @@ class EntryDetail extends StatelessWidget { ); final Color color = Theme.of(context).colorScheme.primary.withOpacity(0.8); final Widget title = EntryDetailTitle(date: date, entryData: entryData); - return Card( - child: entryComment != null - ? ExpansionTile( - iconColor: Colors.white, - collapsedIconColor: Colors.white, - collapsedShape: shape, - shape: shape, - leading: icon, - title: title, - collapsedBackgroundColor: color, - backgroundColor: - Theme.of(context).colorScheme.secondary.withOpacity(0.8), - children: entryComment != null - ? [ - Text( - entryComment ?? '', - style: const TextStyle( - color: Colors.white, fontWeight: FontWeight.bold), - ) - ] - : [], - ) - : ListTile( - shape: shape, - leading: icon, - title: title, - tileColor: color, - )); + return entryComment != null + ? ExpansionTile( + iconColor: Colors.white, + collapsedIconColor: Colors.white, + collapsedShape: shape, + shape: shape, + leading: icon, + title: title, + collapsedBackgroundColor: color, + backgroundColor: + Theme.of(context).colorScheme.secondary.withOpacity(0.8), + children: entryComment != null + ? [ + Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + Padding( + padding: const EdgeInsets.fromLTRB(10, 0, 10, 10), + child: Text( + entryComment ?? '', + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold), + )) + ]) + ] + : [], + ) + : ListTile( + shape: shape, + leading: icon, + title: title, + tileColor: color, + ); } } diff --git a/lib/widgets/history_list_widget.dart b/lib/widgets/history_list_widget.dart index 8a32963..4251568 100644 --- a/lib/widgets/history_list_widget.dart +++ b/lib/widgets/history_list_widget.dart @@ -39,11 +39,13 @@ class HistoryList extends StatelessWidget { return Expanded( child: ListView( children: history.map((T entry) { - return EntryDetail( - date: dateSelector(entry), - entryData: entryDataSelector(entry), - entryComment: _getComment(entry), - iconData: _getIcon(entry)); + return Padding( + padding: const EdgeInsets.only(bottom: 5), + child: EntryDetail( + date: dateSelector(entry), + entryData: entryDataSelector(entry), + entryComment: _getComment(entry), + iconData: _getIcon(entry))); }).toList())); } } diff --git a/lib/widgets/view_form/mood_form.dart b/lib/widgets/view_form/mood_form.dart index 9985b9b..ccebb1b 100644 --- a/lib/widgets/view_form/mood_form.dart +++ b/lib/widgets/view_form/mood_form.dart @@ -26,9 +26,6 @@ class MoodForm extends StatelessWidget { title: 'Beschreibe deine Stimmung', child: MyTextFormField('Beschreibe deine Stimmung'), ), - const SizedBox( - height: 80, - ), SubmitFormButton( submitCallback: inputModel.saveMood, updateTasks: () => tasksModel.setTaskDone(Pages.mood), diff --git a/lib/widgets/view_form/relapse_form.dart b/lib/widgets/view_form/relapse_form.dart index 3d1a1ab..675e738 100644 --- a/lib/widgets/view_form/relapse_form.dart +++ b/lib/widgets/view_form/relapse_form.dart @@ -27,9 +27,6 @@ class RelapseForm extends StatelessWidget { title: 'Beschreibe deinen Rückfall', child: MyTextFormField('Beschreibe deinen Rückfall'), ), - const SizedBox( - height: 80, - ), SubmitFormButton( submitCallback: inputModel.saveRelapse, updateTasks: () => tasksModel.setTaskDone(Pages.mood), diff --git a/lib/widgets/view_form/relapse_view.dart b/lib/widgets/view_form/relapse_view.dart index ab70de8..98c011b 100644 --- a/lib/widgets/view_form/relapse_view.dart +++ b/lib/widgets/view_form/relapse_view.dart @@ -14,7 +14,7 @@ class RelapseView extends StatelessWidget { HistoryList( history: tasksModel.relapseHistory, dateSelector: (Relapse relapse) => relapse.date, - entryDataSelector: (Relapse relapse) => 'Grund: ${relapse.category}', + entryDataSelector: (Relapse relapse) => relapse.category, entryCommentSelector: (Relapse relapse) => 'Kommentar: ${relapse.comment}', icon: Icons.smoke_free_outlined, diff --git a/lib/widgets/view_form/sleep_form.dart b/lib/widgets/view_form/sleep_form.dart index bb01e37..8958eeb 100644 --- a/lib/widgets/view_form/sleep_form.dart +++ b/lib/widgets/view_form/sleep_form.dart @@ -39,9 +39,6 @@ class SleepForm extends StatelessWidget { title: 'Schlafbeschreibung', child: MyTextFormField('Beschreibe deinen Schlaf'), ), - const SizedBox( - height: 80, - ), SubmitFormButton( submitCallback: () => inputModel.saveSleep(SleepTimes.wokeUpAt, SleepTimes.sleptAt), diff --git a/lib/widgets/view_form/view_form_page.dart b/lib/widgets/view_form/view_form_page.dart index 0b348b6..2e961e2 100644 --- a/lib/widgets/view_form/view_form_page.dart +++ b/lib/widgets/view_form/view_form_page.dart @@ -21,18 +21,20 @@ class ViewFormPage extends StatelessWidget { TasksProvider tasksProvider = context.watch(); return Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( - child: Center( - child: pageProvider.showForm - ? ChangeNotifierProvider( - create: (context) => InputProvider(), - child: form, - ) - : view, - )), + child: Padding( + padding: const EdgeInsets.fromLTRB(10, 10, 10, 10), + child: Center( + child: pageProvider.showForm + ? ChangeNotifierProvider( + create: (context) => InputProvider(), + child: form, + ) + : view, + ))), if (!pageProvider.showForm) Container( margin: EdgeInsets.symmetric(vertical: height * 0.02), - child: RoundAddButton( + child: RoundIconButton( iconData: Icons.add_outlined, onPressed: tasksProvider.tasks[page] ?? true ? () => pageProvider.swap()