Fixed Layout for small screens
parent
5795b0a4e8
commit
c12053c2fa
|
@ -2,8 +2,10 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class RoundAddButton extends StatelessWidget {
|
class RoundAddButton extends StatelessWidget {
|
||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
|
final IconData iconData;
|
||||||
|
|
||||||
const RoundAddButton({super.key, required this.onPressed});
|
const RoundAddButton(
|
||||||
|
{super.key, required this.onPressed, required this.iconData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -16,7 +18,7 @@ class RoundAddButton extends StatelessWidget {
|
||||||
foregroundColor: Colors.blue, // <-- Splash color
|
foregroundColor: Colors.blue, // <-- Splash color
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.add_outlined,
|
iconData,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
size: MediaQuery.of(context).size.height * 0.05,
|
size: MediaQuery.of(context).size.height * 0.05,
|
||||||
),
|
),
|
||||||
|
|
|
@ -27,15 +27,13 @@ class HistoryList<T> extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Expanded(
|
||||||
height: MediaQuery.of(context).size.height * 0.25,
|
|
||||||
margin: const EdgeInsets.only(top: 10),
|
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: history.map((T entry) {
|
children: history.map((T entry) {
|
||||||
return EntryDetail(
|
return EntryDetail(
|
||||||
date: dateSelector(entry),
|
date: dateSelector(entry),
|
||||||
entryData: entryDataSelector(entry),
|
entryData: entryDataSelector(entry),
|
||||||
icon: _getIcon(entry));
|
icon: _getIcon(entry));
|
||||||
}).toList()));
|
}).toList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,7 @@ class MoodForm extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var inputModel = context.watch<InputProvider>();
|
var inputModel = context.watch<InputProvider>();
|
||||||
var tasksModel = context.watch<TasksProvider>();
|
var tasksModel = context.watch<TasksProvider>();
|
||||||
return Column(
|
return ListView(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
const ElevatedCard(
|
const ElevatedCard(
|
||||||
title: 'Stimmungsbewertung',
|
title: 'Stimmungsbewertung',
|
||||||
|
|
|
@ -17,8 +17,7 @@ class RelapseForm extends StatelessWidget {
|
||||||
var inputModel = context.watch<InputProvider>();
|
var inputModel = context.watch<InputProvider>();
|
||||||
var settingsModel = context.watch<SettingsProvider>();
|
var settingsModel = context.watch<SettingsProvider>();
|
||||||
var tasksModel = context.watch<TasksProvider>();
|
var tasksModel = context.watch<TasksProvider>();
|
||||||
return Column(
|
return ListView(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
ElevatedCard(
|
ElevatedCard(
|
||||||
title: 'Rückfallkategorie',
|
title: 'Rückfallkategorie',
|
||||||
|
|
|
@ -18,8 +18,7 @@ class SleepForm extends StatelessWidget {
|
||||||
InputProvider inputModel = context.watch<InputProvider>();
|
InputProvider inputModel = context.watch<InputProvider>();
|
||||||
TasksProvider tasksModel = context.watch<TasksProvider>();
|
TasksProvider tasksModel = context.watch<TasksProvider>();
|
||||||
|
|
||||||
return Column(
|
return ListView(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
const ElevatedCard(
|
const ElevatedCard(
|
||||||
title: 'Einschlafzeit',
|
title: 'Einschlafzeit',
|
||||||
|
|
|
@ -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/input_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/providers/tasks_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 {
|
class ViewFormPage extends StatelessWidget {
|
||||||
final Widget form;
|
final Widget form;
|
||||||
|
@ -19,23 +20,23 @@ class ViewFormPage extends StatelessWidget {
|
||||||
PageProvider pageProvider = context.watch<PageProvider>();
|
PageProvider pageProvider = context.watch<PageProvider>();
|
||||||
TasksProvider tasksProvider = context.watch<TasksProvider>();
|
TasksProvider tasksProvider = context.watch<TasksProvider>();
|
||||||
return Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
return Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
pageProvider.showForm
|
Expanded(
|
||||||
? Center(
|
child: Center(
|
||||||
child: ChangeNotifierProvider(
|
child: pageProvider.showForm
|
||||||
create: (context) => InputProvider(),
|
? ChangeNotifierProvider(
|
||||||
child: form,
|
create: (context) => InputProvider(),
|
||||||
))
|
child: form,
|
||||||
: Center(child: view),
|
)
|
||||||
|
: view,
|
||||||
|
)),
|
||||||
if (!pageProvider.showForm)
|
if (!pageProvider.showForm)
|
||||||
Container(
|
Container(
|
||||||
height: height / 8,
|
margin: EdgeInsets.symmetric(vertical: height * 0.02),
|
||||||
width: height / 8,
|
|
||||||
margin: EdgeInsets.only(bottom: height * 0.08),
|
|
||||||
child: RoundAddButton(
|
child: RoundAddButton(
|
||||||
onPressed: tasksProvider.tasks[page] == true
|
iconData: Icons.add_outlined,
|
||||||
|
onPressed: tasksProvider.tasks[page] ?? true
|
||||||
? () => pageProvider.swap()
|
? () => pageProvider.swap()
|
||||||
: () => pageProvider.swap(),
|
: () => showTaskDonePopup(context, page),
|
||||||
//: () => showTaskDonePopup(context, page),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in New Issue