Update loyout Builder and update all widgets that call it

This commit is contained in:
2024-10-01 11:52:02 +02:00
parent 2f05d66a95
commit 0c85d560a0
17 changed files with 71 additions and 11 deletions

View File

@@ -33,13 +33,11 @@ class _MIHActionState extends State<MIHAction> {
left: 5, left: 5,
width: 50, width: 50,
height: 50, height: 50,
child: Builder( child: IconButton(
builder: (context) => IconButton( iconSize: widget.iconSize,
iconSize: widget.iconSize, padding: const EdgeInsets.all(0),
padding: const EdgeInsets.all(0), onPressed: widget.onTap,
onPressed: widget.onTap, icon: widget.icon,
icon: widget.icon,
),
), ),
); );
} }

View File

@@ -1,17 +1,24 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:patient_manager/mih_components/mih_layout/mih_action.dart'; import 'package:patient_manager/mih_components/mih_layout/mih_app_drawer.dart';
import 'package:patient_manager/mih_components/mih_layout/mih_body.dart'; import 'package:patient_manager/mih_components/mih_layout/mih_body.dart';
import 'package:patient_manager/mih_components/mih_layout/mih_header.dart'; import 'package:patient_manager/mih_components/mih_layout/mih_header.dart';
class MIHLayoutBuilder extends StatefulWidget { class MIHLayoutBuilder extends StatefulWidget {
final MIHAction actionButton; final Widget actionButton;
final MIHHeader header; final MIHHeader header;
final MIHBody body; final MIHBody body;
final MIHAppDrawer? rightDrawer;
final Widget? bottomNavBar;
//final String type;
const MIHLayoutBuilder({ const MIHLayoutBuilder({
super.key, super.key,
required this.actionButton, required this.actionButton,
required this.header, required this.header,
required this.body, required this.body,
required this.rightDrawer,
required this.bottomNavBar,
//required this.type,
}); });
@override @override
@@ -26,6 +33,10 @@ class _MIHLayoutBuilderState extends State<MIHLayoutBuilder> {
return temp; return temp;
} }
// openTheDrawer() {
// _scaffoldKey.currentState!.openEndDrawer();
// }
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
@@ -40,13 +51,17 @@ class _MIHLayoutBuilderState extends State<MIHLayoutBuilder> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
Size screenSize = MediaQuery.sizeOf(context); Size screenSize = MediaQuery.sizeOf(context);
return Scaffold( return Scaffold(
//drawerEnableOpenDragGesture: true,
drawer: widget.rightDrawer,
body: SafeArea( body: SafeArea(
child: SizedBox( child: SizedBox(
width: screenSize.width, width: screenSize.width,
height: screenSize.height, height: screenSize.height,
child: Stack( child: Stack(
children: [ children: [
widget.actionButton, Builder(builder: (context) {
return widget.actionButton;
}),
Column( Column(
children: [ children: [
widget.header, widget.header,
@@ -57,6 +72,7 @@ class _MIHLayoutBuilderState extends State<MIHLayoutBuilder> {
), ),
), ),
), ),
bottomNavigationBar: widget.bottomNavBar,
); );
} }
} }

View File

@@ -326,6 +326,8 @@ class _MIHAboutState extends State<MIHAbout> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
} }
} }

View File

@@ -350,6 +350,8 @@ class _PatientAccessRequestState extends State<PatientAccessRequest> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
// return Scaffold( // return Scaffold(
// // appBar: const MIHAppBar( // // appBar: const MIHAppBar(

View File

@@ -355,6 +355,8 @@ class _ForgotPasswordState extends State<ForgotPassword> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
} }
} }

View File

@@ -411,6 +411,8 @@ class _RegisterState extends State<Register> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
} }
} }

View File

@@ -413,6 +413,8 @@ class _ResetPasswordState extends State<ResetPassword> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
} }
} }

View File

@@ -578,6 +578,8 @@ class _SignInState extends State<SignIn> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
} }
} }

View File

@@ -372,6 +372,8 @@ class _ManageBusinessProfileState extends State<ManageBusinessProfile> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
// return Scaffold( // return Scaffold(
// // appBar: const MIHAppBar( // // appBar: const MIHAppBar(

View File

@@ -437,6 +437,8 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
// return Scaffold( // return Scaffold(

View File

@@ -416,6 +416,22 @@ class _HomeTileGridState extends State<HomeTileGrid> {
p: getPrim(), p: getPrim(),
s: getSec(), s: getSec(),
)); ));
tileList.add(MIHTile(
onTap: () {
Navigator.of(context).popAndPushNamed(
'/homev2',
arguments: widget.signedInUser,
);
},
tileName: "HomeV2 - Dev",
tileIcon: Icon(
Icons.home,
color: getSec(),
size: 200,
),
p: getPrim(),
s: getSec(),
));
} }
} }

View File

@@ -439,6 +439,8 @@ class _ProfileUserUpdateState extends State<ProfileUserUpdate> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
} }
} }

View File

@@ -396,6 +396,8 @@ class _AddPatientState extends State<AddPatient> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
// return Scaffold( // return Scaffold(
// // appBar: const MIHAppBar( // // appBar: const MIHAppBar(

View File

@@ -660,6 +660,8 @@ class _EditPatientState extends State<EditPatient> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
// return Scaffold( // return Scaffold(
// // appBar: const MIHAppBar( // // appBar: const MIHAppBar(

View File

@@ -416,6 +416,8 @@ class _PatientManagerState extends State<PatientManager> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
// return Scaffold( // return Scaffold(
// // appBar: const MIHAppBar( // // appBar: const MIHAppBar(

View File

@@ -180,6 +180,8 @@ class _PatientViewState extends State<PatientView> {
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
body: getBody(), body: getBody(),
rightDrawer: null,
bottomNavBar: null,
); );
// return Scaffold( // return Scaffold(
// body: SafeArea( // body: SafeArea(

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:patient_manager/mih_packages/authentication/auth_check.dart'; import 'package:patient_manager/mih_packages/authentication/auth_check.dart';
import 'package:patient_manager/mih_packages/mih_home/MIH_Profile_Getter.dart';
import 'package:patient_manager/mih_packages/patient_profile/add_or_view_patient.dart'; import 'package:patient_manager/mih_packages/patient_profile/add_or_view_patient.dart';
import 'package:patient_manager/mih_packages/patient_profile/patient_add.dart'; import 'package:patient_manager/mih_packages/patient_profile/patient_add.dart';
import 'package:patient_manager/mih_packages/patient_profile/patient_edit.dart'; import 'package:patient_manager/mih_packages/patient_profile/patient_edit.dart';
@@ -44,7 +45,10 @@ class RouteGenerator {
settings: settings, builder: (_) => const ForgotPassword()); settings: settings, builder: (_) => const ForgotPassword());
//http://mzansi-innovation-hub.co.za/auth/reset-password //http://mzansi-innovation-hub.co.za/auth/reset-password
//=============================================================== //===============================================================
//Home v2
case '/homev2':
return MaterialPageRoute(
settings: settings, builder: (_) => const MIHProfileGetter());
//About MIH //About MIH
case '/about': case '/about':
return MaterialPageRoute( return MaterialPageRoute(