set up business layout builder enhancement

This commit is contained in:
2024-09-18 12:18:43 +02:00
parent f13cfc6f2d
commit b1c7ecd8dc

View File

@@ -2,6 +2,10 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:patient_manager/mih_components/mih_layout/mih_action.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_layout_builder.dart';
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart';
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart';
@@ -197,44 +201,35 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
return regex.hasMatch(text); return regex.hasMatch(text);
} }
@override MIHAction getActionButton() {
void dispose() { return MIHAction(
nameController.dispose(); icon: Icons.arrow_back,
typeController.dispose(); iconSize: 35,
regController.dispose(); onTap: () {
logonameController.dispose(); Navigator.of(context).pop();
fnameController.dispose(); },
lnameController.dispose(); );
titleController.dispose();
signtureController.dispose();
accessController.dispose();
contactController.dispose();
emailController.dispose();
_focusNode.dispose();
super.dispose();
} }
@override MIHHeader getHeader() {
void initState() { return const MIHHeader(
setState(() { headerAlignment: MainAxisAlignment.center,
fnameController.text = widget.signedInUser.fname; headerItems: [
lnameController.text = widget.signedInUser.lname; Text(
accessController.text = "Full"; "Add Business Profile",
}); style: TextStyle(
super.initState(); fontWeight: FontWeight.bold,
fontSize: 25,
),
),
],
);
} }
@override MIHBody getBody() {
Widget build(BuildContext context) { return MIHBody(
return Scaffold( borderOn: true,
// appBar: const MIHAppBar( bodyItems: [
// barTitle: "Add Business",
// propicFile: null,
// ),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
body: SafeArea(
child: Stack(
children: [
KeyboardListener( KeyboardListener(
focusNode: _focusNode, focusNode: _focusNode,
autofocus: true, autofocus: true,
@@ -245,18 +240,21 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
} }
}, },
child: SingleChildScrollView( child: SingleChildScrollView(
padding: const EdgeInsets.all(15),
child: Column( child: Column(
children: [ children: [
//const SizedBox(height: 15), //const SizedBox(height: 15),
const Text( const Text(
"Add Business Profile", "My Business Details",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 25, fontSize: 25,
), ),
), ),
const SizedBox(height: 25.0), Divider(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
const SizedBox(height: 10.0),
MIHTextField( MIHTextField(
controller: regController, controller: regController,
hintText: "Registration No.", hintText: "Registration No.",
@@ -316,19 +314,22 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
), ),
const SizedBox(height: 15.0), const SizedBox(height: 15.0),
Divider( Divider(
color: MzanziInnovationHub.of(context) color:
?.theme MzanziInnovationHub.of(context)?.theme.secondaryColor(),
.secondaryColor(),
), ),
//const SizedBox(height: 15.0), //const SizedBox(height: 15.0),
const Text( const Text(
"My Business User", "My Business User",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 25, fontSize: 22,
), ),
), ),
const SizedBox(height: 25.0), Divider(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
const SizedBox(height: 10.0),
MIHDropdownField( MIHDropdownField(
controller: titleController, controller: titleController,
hintText: "Title", hintText: "Title",
@@ -386,12 +387,10 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
height: 50.0, height: 50.0,
child: MIHButton( child: MIHButton(
buttonText: "Add", buttonText: "Add",
buttonColor: MzanziInnovationHub.of(context)! buttonColor:
.theme MzanziInnovationHub.of(context)!.theme.secondaryColor(),
.secondaryColor(), textColor:
textColor: MzanziInnovationHub.of(context)! MzanziInnovationHub.of(context)!.theme.primaryColor(),
.theme
.primaryColor(),
onTap: () { onTap: () {
submitForm(); submitForm();
}, },
@@ -401,21 +400,235 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
), ),
), ),
), ),
Positioned(
top: 10,
left: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: const Icon(Icons.arrow_back),
),
)
], ],
),
),
); );
} }
@override
void dispose() {
nameController.dispose();
typeController.dispose();
regController.dispose();
logonameController.dispose();
fnameController.dispose();
lnameController.dispose();
titleController.dispose();
signtureController.dispose();
accessController.dispose();
contactController.dispose();
emailController.dispose();
_focusNode.dispose();
super.dispose();
}
@override
void initState() {
setState(() {
fnameController.text = widget.signedInUser.fname;
lnameController.text = widget.signedInUser.lname;
accessController.text = "Full";
});
super.initState();
}
@override
Widget build(BuildContext context) {
return MIHLayoutBuilder(
actionButton: getActionButton(),
header: getHeader(),
body: getBody(),
);
// return Scaffold(
// // appBar: const MIHAppBar(
// // barTitle: "Add Business",
// // propicFile: null,
// // ),
// //drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
// body: SafeArea(
// child: Stack(
// children: [
// KeyboardListener(
// focusNode: _focusNode,
// autofocus: true,
// onKeyEvent: (event) async {
// if (event is KeyDownEvent &&
// event.logicalKey == LogicalKeyboardKey.enter) {
// submitForm();
// }
// },
// child: SingleChildScrollView(
// padding: const EdgeInsets.all(15),
// child: Column(
// children: [
// //const SizedBox(height: 15),
// const Text(
// "Add Business Profile",
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: 25,
// ),
// ),
// const SizedBox(height: 25.0),
// MIHTextField(
// controller: regController,
// hintText: "Registration No.",
// editable: true,
// required: true,
// ),
// const SizedBox(height: 10.0),
// MIHTextField(
// controller: nameController,
// hintText: "Business Name",
// editable: true,
// required: true,
// ),
// const SizedBox(height: 10.0),
// MIHDropdownField(
// controller: typeController,
// hintText: "Business Type",
// dropdownOptions: const ["Doctors Office", "Other"],
// required: true,
// editable: true,
// ),
// const SizedBox(height: 10.0),
// MIHTextField(
// controller: contactController,
// hintText: "Contact Number",
// editable: true,
// required: true,
// ),
// const SizedBox(height: 10.0),
// MIHTextField(
// controller: emailController,
// hintText: "Email",
// editable: true,
// required: true,
// ),
// const SizedBox(height: 10.0),
// MIHFileField(
// controller: logonameController,
// hintText: "Logo",
// editable: false,
// required: true,
// onPressed: () async {
// FilePickerResult? result =
// await FilePicker.platform.pickFiles(
// type: FileType.custom,
// allowedExtensions: ['jpg', 'png', 'pdf'],
// );
// if (result == null) return;
// final selectedFile = result.files.first;
// setState(() {
// selectedLogo = selectedFile;
// });
// setState(() {
// logonameController.text = selectedFile.name;
// });
// },
// ),
// const SizedBox(height: 15.0),
// Divider(
// color: MzanziInnovationHub.of(context)
// ?.theme
// .secondaryColor(),
// ),
// //const SizedBox(height: 15.0),
// const Text(
// "My Business User",
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: 25,
// ),
// ),
// const SizedBox(height: 25.0),
// MIHDropdownField(
// controller: titleController,
// hintText: "Title",
// dropdownOptions: const ["Doctor", "Assistant"],
// required: true,
// editable: true,
// ),
// const SizedBox(height: 10.0),
// MIHTextField(
// controller: fnameController,
// hintText: "Name",
// editable: false,
// required: true,
// ),
// const SizedBox(height: 10.0),
// MIHTextField(
// controller: lnameController,
// hintText: "Surname",
// editable: false,
// required: true,
// ),
// const SizedBox(height: 10.0),
// MIHFileField(
// controller: signtureController,
// hintText: "Signature",
// editable: false,
// required: true,
// onPressed: () async {
// FilePickerResult? result =
// await FilePicker.platform.pickFiles(
// type: FileType.custom,
// allowedExtensions: ['jpg', 'png', 'pdf'],
// );
// if (result == null) return;
// final selectedFile = result.files.first;
// setState(() {
// selectedSignature = selectedFile;
// });
// setState(() {
// signtureController.text = selectedFile.name;
// });
// },
// ),
// const SizedBox(height: 15.0),
// MIHDropdownField(
// controller: accessController,
// hintText: "Access",
// dropdownOptions: const ["Full", "Partial"],
// required: true,
// editable: false,
// ),
// const SizedBox(height: 30.0),
// SizedBox(
// width: 500.0,
// height: 50.0,
// child: MIHButton(
// buttonText: "Add",
// buttonColor: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// textColor: MzanziInnovationHub.of(context)!
// .theme
// .primaryColor(),
// onTap: () {
// submitForm();
// },
// ),
// ),
// ],
// ),
// ),
// ),
// Positioned(
// top: 10,
// left: 5,
// width: 50,
// height: 50,
// child: IconButton(
// onPressed: () {
// Navigator.of(context).pop();
// },
// icon: const Icon(Icons.arrow_back),
// ),
// )
// ],
// ),
// ),
// );
}
} }