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/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_inputs_and_buttons/mih_dropdown_input.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);
}
@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();
MIHAction getActionButton() {
return MIHAction(
icon: Icons.arrow_back,
iconSize: 35,
onTap: () {
Navigator.of(context).pop();
},
);
}
@override
void initState() {
setState(() {
fnameController.text = widget.signedInUser.fname;
lnameController.text = widget.signedInUser.lname;
accessController.text = "Full";
});
super.initState();
MIHHeader getHeader() {
return const MIHHeader(
headerAlignment: MainAxisAlignment.center,
headerItems: [
Text(
"Add Business Profile",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
),
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
// appBar: const MIHAppBar(
// barTitle: "Add Business",
// propicFile: null,
// ),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
body: SafeArea(
child: Stack(
children: [
MIHBody getBody() {
return MIHBody(
borderOn: true,
bodyItems: [
KeyboardListener(
focusNode: _focusNode,
autofocus: true,
@@ -245,18 +240,21 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
}
},
child: SingleChildScrollView(
padding: const EdgeInsets.all(15),
child: Column(
children: [
//const SizedBox(height: 15),
const Text(
"Add Business Profile",
"My Business Details",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
),
const SizedBox(height: 25.0),
Divider(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
const SizedBox(height: 10.0),
MIHTextField(
controller: regController,
hintText: "Registration No.",
@@ -316,19 +314,22 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
),
const SizedBox(height: 15.0),
Divider(
color: MzanziInnovationHub.of(context)
?.theme
.secondaryColor(),
color:
MzanziInnovationHub.of(context)?.theme.secondaryColor(),
),
//const SizedBox(height: 15.0),
const Text(
"My Business User",
style: TextStyle(
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(
controller: titleController,
hintText: "Title",
@@ -386,12 +387,10 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
height: 50.0,
child: MIHButton(
buttonText: "Add",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
onTap: () {
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),
// ),
// )
// ],
// ),
// ),
// );
}
}