Fixed Paddings
parent
30c798c15f
commit
56acb1e84c
|
@ -1,10 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class RoundAddButton extends StatelessWidget {
|
class RoundIconButton extends StatelessWidget {
|
||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
final IconData iconData;
|
final IconData iconData;
|
||||||
|
|
||||||
const RoundAddButton(
|
const RoundIconButton(
|
||||||
{super.key, required this.onPressed, required this.iconData});
|
{super.key, required this.onPressed, required this.iconData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:awesome_dialog/awesome_dialog.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:smoke_cess_app/providers/page_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 {
|
class SubmitFormButton extends StatelessWidget {
|
||||||
final Future<int> Function() submitCallback;
|
final Future<int> Function() submitCallback;
|
||||||
|
@ -14,7 +15,7 @@ class SubmitFormButton extends StatelessWidget {
|
||||||
PageProvider pageProvider = context.watch<PageProvider>();
|
PageProvider pageProvider = context.watch<PageProvider>();
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||||
child: ElevatedButton(
|
child: RoundIconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
int success = await submitCallback();
|
int success = await submitCallback();
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
|
@ -37,7 +38,7 @@ class SubmitFormButton extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: const Text('Speichern'),
|
iconData: Icons.check_outlined,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,18 +11,22 @@ class EntryDetailTitle extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
DateFormat.MMMd('de').format(date),
|
DateFormat.MMMd('de').format(date),
|
||||||
style:
|
style:
|
||||||
const TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
const TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
Text(
|
Flexible(
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 5.0),
|
||||||
|
child: Text(
|
||||||
entryData,
|
entryData,
|
||||||
style:
|
overflow: TextOverflow.ellipsis,
|
||||||
const TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
style: const TextStyle(
|
||||||
)
|
color: Colors.white, fontWeight: FontWeight.bold),
|
||||||
|
)))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,7 @@ class EntryDetail extends StatelessWidget {
|
||||||
);
|
);
|
||||||
final Color color = Theme.of(context).colorScheme.primary.withOpacity(0.8);
|
final Color color = Theme.of(context).colorScheme.primary.withOpacity(0.8);
|
||||||
final Widget title = EntryDetailTitle(date: date, entryData: entryData);
|
final Widget title = EntryDetailTitle(date: date, entryData: entryData);
|
||||||
return Card(
|
return entryComment != null
|
||||||
child: entryComment != null
|
|
||||||
? ExpansionTile(
|
? ExpansionTile(
|
||||||
iconColor: Colors.white,
|
iconColor: Colors.white,
|
||||||
collapsedIconColor: Colors.white,
|
collapsedIconColor: Colors.white,
|
||||||
|
@ -36,11 +35,16 @@ class EntryDetail extends StatelessWidget {
|
||||||
Theme.of(context).colorScheme.secondary.withOpacity(0.8),
|
Theme.of(context).colorScheme.secondary.withOpacity(0.8),
|
||||||
children: entryComment != null
|
children: entryComment != null
|
||||||
? [
|
? [
|
||||||
Text(
|
Row(mainAxisAlignment: MainAxisAlignment.start, children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(10, 0, 10, 10),
|
||||||
|
child: Text(
|
||||||
entryComment ?? '',
|
entryComment ?? '',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white, fontWeight: FontWeight.bold),
|
color: Colors.white,
|
||||||
)
|
fontWeight: FontWeight.bold),
|
||||||
|
))
|
||||||
|
])
|
||||||
]
|
]
|
||||||
: [],
|
: [],
|
||||||
)
|
)
|
||||||
|
@ -49,6 +53,6 @@ class EntryDetail extends StatelessWidget {
|
||||||
leading: icon,
|
leading: icon,
|
||||||
title: title,
|
title: title,
|
||||||
tileColor: color,
|
tileColor: color,
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,11 +39,13 @@ class HistoryList<T> extends StatelessWidget {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: history.map((T entry) {
|
children: history.map((T entry) {
|
||||||
return EntryDetail(
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 5),
|
||||||
|
child: EntryDetail(
|
||||||
date: dateSelector(entry),
|
date: dateSelector(entry),
|
||||||
entryData: entryDataSelector(entry),
|
entryData: entryDataSelector(entry),
|
||||||
entryComment: _getComment(entry),
|
entryComment: _getComment(entry),
|
||||||
iconData: _getIcon(entry));
|
iconData: _getIcon(entry)));
|
||||||
}).toList()));
|
}).toList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,6 @@ class MoodForm extends StatelessWidget {
|
||||||
title: 'Beschreibe deine Stimmung',
|
title: 'Beschreibe deine Stimmung',
|
||||||
child: MyTextFormField('Beschreibe deine Stimmung'),
|
child: MyTextFormField('Beschreibe deine Stimmung'),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 80,
|
|
||||||
),
|
|
||||||
SubmitFormButton(
|
SubmitFormButton(
|
||||||
submitCallback: inputModel.saveMood,
|
submitCallback: inputModel.saveMood,
|
||||||
updateTasks: () => tasksModel.setTaskDone(Pages.mood),
|
updateTasks: () => tasksModel.setTaskDone(Pages.mood),
|
||||||
|
|
|
@ -27,9 +27,6 @@ class RelapseForm extends StatelessWidget {
|
||||||
title: 'Beschreibe deinen Rückfall',
|
title: 'Beschreibe deinen Rückfall',
|
||||||
child: MyTextFormField('Beschreibe deinen Rückfall'),
|
child: MyTextFormField('Beschreibe deinen Rückfall'),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 80,
|
|
||||||
),
|
|
||||||
SubmitFormButton(
|
SubmitFormButton(
|
||||||
submitCallback: inputModel.saveRelapse,
|
submitCallback: inputModel.saveRelapse,
|
||||||
updateTasks: () => tasksModel.setTaskDone(Pages.mood),
|
updateTasks: () => tasksModel.setTaskDone(Pages.mood),
|
||||||
|
|
|
@ -14,7 +14,7 @@ class RelapseView extends StatelessWidget {
|
||||||
HistoryList<Relapse>(
|
HistoryList<Relapse>(
|
||||||
history: tasksModel.relapseHistory,
|
history: tasksModel.relapseHistory,
|
||||||
dateSelector: (Relapse relapse) => relapse.date,
|
dateSelector: (Relapse relapse) => relapse.date,
|
||||||
entryDataSelector: (Relapse relapse) => 'Grund: ${relapse.category}',
|
entryDataSelector: (Relapse relapse) => relapse.category,
|
||||||
entryCommentSelector: (Relapse relapse) =>
|
entryCommentSelector: (Relapse relapse) =>
|
||||||
'Kommentar: ${relapse.comment}',
|
'Kommentar: ${relapse.comment}',
|
||||||
icon: Icons.smoke_free_outlined,
|
icon: Icons.smoke_free_outlined,
|
||||||
|
|
|
@ -39,9 +39,6 @@ class SleepForm extends StatelessWidget {
|
||||||
title: 'Schlafbeschreibung',
|
title: 'Schlafbeschreibung',
|
||||||
child: MyTextFormField('Beschreibe deinen Schlaf'),
|
child: MyTextFormField('Beschreibe deinen Schlaf'),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 80,
|
|
||||||
),
|
|
||||||
SubmitFormButton(
|
SubmitFormButton(
|
||||||
submitCallback: () =>
|
submitCallback: () =>
|
||||||
inputModel.saveSleep(SleepTimes.wokeUpAt, SleepTimes.sleptAt),
|
inputModel.saveSleep(SleepTimes.wokeUpAt, SleepTimes.sleptAt),
|
||||||
|
|
|
@ -21,6 +21,8 @@ class ViewFormPage extends StatelessWidget {
|
||||||
TasksProvider tasksProvider = context.watch<TasksProvider>();
|
TasksProvider tasksProvider = context.watch<TasksProvider>();
|
||||||
return Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
return Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: pageProvider.showForm
|
child: pageProvider.showForm
|
||||||
? ChangeNotifierProvider(
|
? ChangeNotifierProvider(
|
||||||
|
@ -28,11 +30,11 @@ class ViewFormPage extends StatelessWidget {
|
||||||
child: form,
|
child: form,
|
||||||
)
|
)
|
||||||
: view,
|
: view,
|
||||||
)),
|
))),
|
||||||
if (!pageProvider.showForm)
|
if (!pageProvider.showForm)
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.symmetric(vertical: height * 0.02),
|
margin: EdgeInsets.symmetric(vertical: height * 0.02),
|
||||||
child: RoundAddButton(
|
child: RoundIconButton(
|
||||||
iconData: Icons.add_outlined,
|
iconData: Icons.add_outlined,
|
||||||
onPressed: tasksProvider.tasks[page] ?? true
|
onPressed: tasksProvider.tasks[page] ?? true
|
||||||
? () => pageProvider.swap()
|
? () => pageProvider.swap()
|
||||||
|
|
Loading…
Reference in New Issue