Fixed Layout for small screens

main
Kai Mannweiler 2023-03-06 13:14:42 +01:00
parent 5795b0a4e8
commit c12053c2fa
6 changed files with 27 additions and 29 deletions

View File

@ -2,8 +2,10 @@ import 'package:flutter/material.dart';
class RoundAddButton extends StatelessWidget {
final VoidCallback onPressed;
final IconData iconData;
const RoundAddButton({super.key, required this.onPressed});
const RoundAddButton(
{super.key, required this.onPressed, required this.iconData});
@override
Widget build(BuildContext context) {
@ -16,7 +18,7 @@ class RoundAddButton extends StatelessWidget {
foregroundColor: Colors.blue, // <-- Splash color
),
child: Icon(
Icons.add_outlined,
iconData,
color: Colors.white,
size: MediaQuery.of(context).size.height * 0.05,
),

View File

@ -27,15 +27,13 @@ class HistoryList<T> extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * 0.25,
margin: const EdgeInsets.only(top: 10),
return Expanded(
child: ListView(
children: history.map((T entry) {
return EntryDetail(
date: dateSelector(entry),
entryData: entryDataSelector(entry),
icon: _getIcon(entry));
}).toList()));
return EntryDetail(
date: dateSelector(entry),
entryData: entryDataSelector(entry),
icon: _getIcon(entry));
}).toList()));
}
}

View File

@ -15,8 +15,7 @@ class MoodForm extends StatelessWidget {
Widget build(BuildContext context) {
var inputModel = context.watch<InputProvider>();
var tasksModel = context.watch<TasksProvider>();
return Column(
mainAxisAlignment: MainAxisAlignment.center,
return ListView(
children: [
const ElevatedCard(
title: 'Stimmungsbewertung',

View File

@ -17,8 +17,7 @@ class RelapseForm extends StatelessWidget {
var inputModel = context.watch<InputProvider>();
var settingsModel = context.watch<SettingsProvider>();
var tasksModel = context.watch<TasksProvider>();
return Column(
mainAxisAlignment: MainAxisAlignment.center,
return ListView(
children: [
ElevatedCard(
title: 'Rückfallkategorie',

View File

@ -18,8 +18,7 @@ class SleepForm extends StatelessWidget {
InputProvider inputModel = context.watch<InputProvider>();
TasksProvider tasksModel = context.watch<TasksProvider>();
return Column(
mainAxisAlignment: MainAxisAlignment.center,
return ListView(
children: [
const ElevatedCard(
title: 'Einschlafzeit',

View File

@ -5,6 +5,7 @@ import 'package:smoke_cess_app/widgets/buttons/round_button_widget.dart';
import 'package:smoke_cess_app/providers/input_provider.dart';
import 'package:smoke_cess_app/providers/page_provider.dart';
import 'package:smoke_cess_app/providers/tasks_provider.dart';
import 'package:smoke_cess_app/widgets/popup/popup_for_task_done.dart';
class ViewFormPage extends StatelessWidget {
final Widget form;
@ -19,23 +20,23 @@ class ViewFormPage extends StatelessWidget {
PageProvider pageProvider = context.watch<PageProvider>();
TasksProvider tasksProvider = context.watch<TasksProvider>();
return Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
pageProvider.showForm
? Center(
child: ChangeNotifierProvider(
create: (context) => InputProvider(),
child: form,
))
: Center(child: view),
Expanded(
child: Center(
child: pageProvider.showForm
? ChangeNotifierProvider(
create: (context) => InputProvider(),
child: form,
)
: view,
)),
if (!pageProvider.showForm)
Container(
height: height / 8,
width: height / 8,
margin: EdgeInsets.only(bottom: height * 0.08),
margin: EdgeInsets.symmetric(vertical: height * 0.02),
child: RoundAddButton(
onPressed: tasksProvider.tasks[page] == true
iconData: Icons.add_outlined,
onPressed: tasksProvider.tasks[page] ?? true
? () => pageProvider.swap()
: () => pageProvider.swap(),
//: () => showTaskDonePopup(context, page),
: () => showTaskDonePopup(context, page),
),
)
]);