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(
|
||||||
entryData,
|
child: Container(
|
||||||
style:
|
padding: const EdgeInsets.symmetric(horizontal: 5.0),
|
||||||
const TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
child: Text(
|
||||||
)
|
entryData,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white, fontWeight: FontWeight.bold),
|
||||||
|
)))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,33 +22,37 @@ 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,
|
collapsedShape: shape,
|
||||||
collapsedShape: shape,
|
shape: shape,
|
||||||
shape: shape,
|
leading: icon,
|
||||||
leading: icon,
|
title: title,
|
||||||
title: title,
|
collapsedBackgroundColor: color,
|
||||||
collapsedBackgroundColor: color,
|
backgroundColor:
|
||||||
backgroundColor:
|
Theme.of(context).colorScheme.secondary.withOpacity(0.8),
|
||||||
Theme.of(context).colorScheme.secondary.withOpacity(0.8),
|
children: entryComment != null
|
||||||
children: entryComment != null
|
? [
|
||||||
? [
|
Row(mainAxisAlignment: MainAxisAlignment.start, children: [
|
||||||
Text(
|
Padding(
|
||||||
entryComment ?? '',
|
padding: const EdgeInsets.fromLTRB(10, 0, 10, 10),
|
||||||
style: const TextStyle(
|
child: Text(
|
||||||
color: Colors.white, fontWeight: FontWeight.bold),
|
entryComment ?? '',
|
||||||
)
|
style: const TextStyle(
|
||||||
]
|
color: Colors.white,
|
||||||
: [],
|
fontWeight: FontWeight.bold),
|
||||||
)
|
))
|
||||||
: ListTile(
|
])
|
||||||
shape: shape,
|
]
|
||||||
leading: icon,
|
: [],
|
||||||
title: title,
|
)
|
||||||
tileColor: color,
|
: ListTile(
|
||||||
));
|
shape: shape,
|
||||||
|
leading: icon,
|
||||||
|
title: title,
|
||||||
|
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(
|
||||||
date: dateSelector(entry),
|
padding: const EdgeInsets.only(bottom: 5),
|
||||||
entryData: entryDataSelector(entry),
|
child: EntryDetail(
|
||||||
entryComment: _getComment(entry),
|
date: dateSelector(entry),
|
||||||
iconData: _getIcon(entry));
|
entryData: entryDataSelector(entry),
|
||||||
|
entryComment: _getComment(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,18 +21,20 @@ 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: Center(
|
child: Padding(
|
||||||
child: pageProvider.showForm
|
padding: const EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||||
? ChangeNotifierProvider(
|
child: Center(
|
||||||
create: (context) => InputProvider(),
|
child: pageProvider.showForm
|
||||||
child: form,
|
? ChangeNotifierProvider(
|
||||||
)
|
create: (context) => InputProvider(),
|
||||||
: view,
|
child: form,
|
||||||
)),
|
)
|
||||||
|
: 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