add safearea

This commit is contained in:
2024-08-28 12:05:25 +02:00
parent fb9f525cc3
commit 12dd69b5d7
9 changed files with 764 additions and 735 deletions

View File

@@ -387,119 +387,127 @@ class _HomeTileGridState extends State<HomeTileGrid> {
final Size size = MediaQuery.sizeOf(context);
final double width = size.width;
//final double height = size.height;
return Scaffold(
appBar: const MIHAppBar(barTitle: "Mzansi Innovation\nHub"),
drawer: MIHAppDrawer(
signedInUser: widget.signedInUser,
),
body: Column(
children: [
const SizedBox(height: 10),
Padding(
padding: EdgeInsets.symmetric(horizontal: width / 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
onPressed: () {
setState(() {
appSearch = "";
searchController.clear();
});
},
icon: const Icon(
Icons.apps,
size: 50,
),
),
KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
setState(() {
appSearch = searchController.text;
});
}
},
child: SizedBox(
width: width - ((width / 10) * 2) - 70,
child: MIHSearchField(
controller: searchController,
hintText: "Search Apps",
required: false,
editable: true,
onTap: () {
return PopScope(
canPop: false,
child: Scaffold(
appBar: const MIHAppBar(barTitle: "Mzansi Innovation\nHub"),
drawer: MIHAppDrawer(
signedInUser: widget.signedInUser,
),
body: SafeArea(
child: Column(
children: [
const SizedBox(height: 10),
Padding(
padding: EdgeInsets.symmetric(horizontal: width / 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
onPressed: () {
setState(() {
appSearch = searchController.text;
appSearch = "";
searchController.clear();
});
},
icon: const Icon(
Icons.apps,
size: 50,
),
),
),
KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
setState(() {
appSearch = searchController.text;
});
}
},
child: SizedBox(
width: width - ((width / 10) * 2) - 70,
child: MIHSearchField(
controller: searchController,
hintText: "Search Apps",
required: false,
editable: true,
onTap: () {
setState(() {
appSearch = searchController.text;
});
},
),
),
),
],
),
],
),
),
Expanded(
child: GridView.builder(
padding: EdgeInsets.only(
left: width / 10,
right: width / 10,
//bottom: height / 5,
top: 20,
),
// physics: ,
// shrinkWrap: true,
itemCount: searchApp(pbswitch[_selectedIndex], appSearch).length,
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200),
itemBuilder: (context, index) {
return searchApp(pbswitch[_selectedIndex], appSearch)[index];
},
),
),
],
),
//),
// ],
// ),
bottomNavigationBar: Visibility(
visible: isBusinessUser(widget.signedInUser),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: GNav(
//hoverColor: Colors.lightBlueAccent,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
iconSize: 35.0,
activeColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
tabBackgroundColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
//gap: 20,
//padding: EdgeInsets.all(15),
tabs: [
GButton(
icon: Icons.perm_identity,
text: "Personal",
onPressed: () {
setState(() {
_selectedIndex = 0;
});
},
),
GButton(
icon: Icons.business_center,
text: "Business",
onPressed: () {
setState(() {
_selectedIndex = 1;
});
},
Expanded(
child: GridView.builder(
padding: EdgeInsets.only(
left: width / 10,
right: width / 10,
//bottom: height / 5,
top: 20,
),
// physics: ,
// shrinkWrap: true,
itemCount:
searchApp(pbswitch[_selectedIndex], appSearch).length,
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200),
itemBuilder: (context, index) {
return searchApp(
pbswitch[_selectedIndex], appSearch)[index];
},
),
),
],
selectedIndex: _selectedIndex,
),
),
//),
// ],
// ),
bottomNavigationBar: Visibility(
visible: isBusinessUser(widget.signedInUser),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: GNav(
//hoverColor: Colors.lightBlueAccent,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
iconSize: 35.0,
activeColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
tabBackgroundColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
//gap: 20,
//padding: EdgeInsets.all(15),
tabs: [
GButton(
icon: Icons.perm_identity,
text: "Personal",
onPressed: () {
setState(() {
_selectedIndex = 0;
});
},
),
GButton(
icon: Icons.business_center,
text: "Business",
onPressed: () {
setState(() {
_selectedIndex = 1;
});
},
),
],
selectedIndex: _selectedIndex,
),
),
),
),

View File

@@ -59,187 +59,191 @@ class _FullScreenFileViewerState extends State<FullScreenFileViewer> {
if (getExtType(widget.arguments.path).toLowerCase() == "pdf") {
return Scaffold(
body: Stack(
children: [
Container(
width: width,
padding: const EdgeInsets.only(top: 20.0),
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 50),
SizedBox(
width: width - zoomOut,
height: height - 70,
child: SfPdfViewerTheme(
data: SfPdfViewerThemeData(
backgroundColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
),
child: SfPdfViewer.network(
widget.arguments.link,
controller: pdfViewerController,
initialZoomLevel: startZoomLevel,
pageSpacing: 2,
maxZoomLevel: 5,
interactionMode: PdfInteractionMode.pan,
onDocumentLoaded: (details) {
setState(() {
currentPage = pdfViewerController.pageNumber;
currentPageCount = pdfViewerController.pageCount;
});
},
body: SafeArea(
child: Stack(
children: [
Container(
width: width,
padding: const EdgeInsets.only(top: 20.0),
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 50),
SizedBox(
width: width - zoomOut,
height: height - 70,
child: SfPdfViewerTheme(
data: SfPdfViewerThemeData(
backgroundColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
),
child: SfPdfViewer.network(
widget.arguments.link,
controller: pdfViewerController,
initialZoomLevel: startZoomLevel,
pageSpacing: 2,
maxZoomLevel: 5,
interactionMode: PdfInteractionMode.pan,
onDocumentLoaded: (details) {
setState(() {
currentPage = pdfViewerController.pageNumber;
currentPageCount = pdfViewerController.pageCount;
});
},
),
),
),
),
],
),
),
Positioned(
top: 5,
left: 2,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.fullscreen_exit,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
size: 35,
],
),
),
),
Positioned(
top: 5,
right: 2,
//width: 50,
height: 50,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconButton(
onPressed: () {
pdfViewerController.previousPage();
//print(pdfViewerController.);
//if (pdfViewerController.pageNumber > 1) {
setState(() {
currentPage = pdfViewerController.pageNumber;
});
// }
},
icon: Icon(
Icons.arrow_back,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
),
Positioned(
top: 5,
left: 2,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.fullscreen_exit,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
size: 35,
),
// SizedBox(
// width: 40,
// height: 40,
// child: MIHTextField(
// controller: cuntrController,
// hintText: "",
// editable: true,
// required: false),
// ),
Text(
"$currentPage / $currentPageCount",
style: const TextStyle(fontSize: 20),
),
IconButton(
onPressed: () {
pdfViewerController.nextPage();
//print(pdfViewerController.pageNumber);
//if (pdfViewerController.pageNumber < currentPageCount) {
setState(() {
currentPage = pdfViewerController.pageNumber;
});
//}
},
icon: Icon(
Icons.arrow_forward,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
),
),
IconButton(
onPressed: () {
if (zoomOut > 0) {
),
),
Positioned(
top: 5,
right: 2,
//width: 50,
height: 50,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconButton(
onPressed: () {
pdfViewerController.previousPage();
//print(pdfViewerController.);
//if (pdfViewerController.pageNumber > 1) {
setState(() {
zoomOut = zoomOut - 100;
currentPage = pdfViewerController.pageNumber;
});
} else {
setState(() {
pdfViewerController.zoomLevel = startZoomLevel + 0.25;
startZoomLevel = pdfViewerController.zoomLevel;
});
}
},
icon: Icon(
Icons.zoom_in,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
// }
},
icon: Icon(
Icons.arrow_back,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
),
),
),
IconButton(
onPressed: () {
if (pdfViewerController.zoomLevel > 1) {
// SizedBox(
// width: 40,
// height: 40,
// child: MIHTextField(
// controller: cuntrController,
// hintText: "",
// editable: true,
// required: false),
// ),
Text(
"$currentPage / $currentPageCount",
style: const TextStyle(fontSize: 20),
),
IconButton(
onPressed: () {
pdfViewerController.nextPage();
//print(pdfViewerController.pageNumber);
//if (pdfViewerController.pageNumber < currentPageCount) {
setState(() {
pdfViewerController.zoomLevel = startZoomLevel - 0.25;
startZoomLevel = pdfViewerController.zoomLevel;
currentPage = pdfViewerController.pageNumber;
});
} else {
if (zoomOut < (width - 100)) {
//}
},
icon: Icon(
Icons.arrow_forward,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
),
),
IconButton(
onPressed: () {
if (zoomOut > 0) {
setState(() {
zoomOut = zoomOut + 100;
zoomOut = zoomOut - 100;
});
} else {
setState(() {
pdfViewerController.zoomLevel =
startZoomLevel + 0.25;
startZoomLevel = pdfViewerController.zoomLevel;
});
}
}
},
icon: Icon(
Icons.zoom_out,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
},
icon: Icon(
Icons.zoom_in,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
),
),
),
IconButton(
onPressed: () {
html.window.open(
widget.arguments.link,
// '${AppEnviroment.baseFileUrl}/mih/$filePath',
'download');
},
icon: Icon(
Icons.download,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
IconButton(
onPressed: () {
if (pdfViewerController.zoomLevel > 1) {
setState(() {
pdfViewerController.zoomLevel =
startZoomLevel - 0.25;
startZoomLevel = pdfViewerController.zoomLevel;
});
} else {
if (zoomOut < (width - 100)) {
setState(() {
zoomOut = zoomOut + 100;
});
}
}
},
icon: Icon(
Icons.zoom_out,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
),
),
),
],
IconButton(
onPressed: () {
html.window.open(
widget.arguments.link,
// '${AppEnviroment.baseFileUrl}/mih/$filePath',
'download');
},
icon: Icon(
Icons.download,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
),
),
],
),
),
),
],
],
),
),
);
} else {

View File

@@ -269,7 +269,7 @@ class _PatientAccessRequestState extends State<PatientAccessRequest> {
return Scaffold(
appBar: const MIHAppBar(barTitle: "Access Reviews"),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
body: viewAccessRequest(screenWidth, screenHeight),
body: SafeArea(child: viewAccessRequest(screenWidth, screenHeight)),
);
}
}

View File

@@ -345,16 +345,18 @@ class _AddPatientState extends State<AddPatient> {
return Scaffold(
appBar: const MIHAppBar(barTitle: "Add Patient"),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
body: KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
submitForm();
}
},
child: displayForm(),
body: SafeArea(
child: KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
submitForm();
}
},
child: displayForm(),
),
),
);
}

View File

@@ -609,16 +609,18 @@ class _EditPatientState extends State<EditPatient> {
return Scaffold(
appBar: const MIHAppBar(barTitle: "Edit Patient"),
body: KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
submitForm();
}
},
child: displayForm(),
body: SafeArea(
child: KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
submitForm();
}
},
child: displayForm(),
),
),
);
}

View File

@@ -98,55 +98,58 @@ class _PatientViewState extends State<PatientView> {
return Scaffold(
appBar: const MIHAppBar(barTitle: "Patient Profile"),
//drawer: showDrawer(),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
IconButton(
onPressed: () {
setState(() {
_selectedIndex = 0;
});
},
icon: const Icon(
Icons.perm_identity,
size: 35,
body: SafeArea(
child: SingleChildScrollView(
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
IconButton(
onPressed: () {
setState(() {
_selectedIndex = 0;
});
},
icon: const Icon(
Icons.perm_identity,
size: 35,
),
),
),
IconButton(
onPressed: () {
setState(() {
_selectedIndex = 1;
});
},
icon: const Icon(
Icons.article_outlined,
size: 35,
IconButton(
onPressed: () {
setState(() {
_selectedIndex = 1;
});
},
icon: const Icon(
Icons.article_outlined,
size: 35,
),
),
),
IconButton(
onPressed: () {
setState(() {
_selectedIndex = 2;
});
},
icon: const Icon(
Icons.file_present,
size: 35,
IconButton(
onPressed: () {
setState(() {
_selectedIndex = 2;
});
},
icon: const Icon(
Icons.file_present,
size: 35,
),
),
),
],
),
const SizedBox(
height: 10.0,
),
showSelection(_selectedIndex),
],
],
),
const SizedBox(
height: 10.0,
),
showSelection(_selectedIndex),
],
),
),
),
),

View File

@@ -231,164 +231,167 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
return Scaffold(
appBar: const MIHAppBar(barTitle: "Add Business"),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
body: KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
submitForm();
}
},
child: SingleChildScrollView(
padding: EdgeInsets.all(25),
child: Column(
children: [
const Text(
"Add Business Profile:",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
body: SafeArea(
child: KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
submitForm();
}
},
child: SingleChildScrollView(
padding: EdgeInsets.all(25),
child: Column(
children: [
const Text(
"Add Business Profile:",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
),
),
const SizedBox(height: 15.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: 15.0),
MIHTextField(
controller: regController,
hintText: "Registration No.",
editable: true,
required: true,
),
),
const SizedBox(height: 15.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();
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: 15.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();
},
),
),
],
),
),
),
),

View File

@@ -314,176 +314,180 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
return Scaffold(
appBar: const MIHAppBar(barTitle: "Business Profile"),
//drawer: MIHAppDrawer(signedInUser: widget.arguments.signedInUser),
body: KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
//print(business_id);
submitForm(business_id);
}
},
child: SingleChildScrollView(
padding: EdgeInsets.all(25),
child: Column(
children: [
Column(
children: [
const Text(
"Update Business Profile:",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
body: SafeArea(
child: KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
//print(business_id);
submitForm(business_id);
}
},
child: SingleChildScrollView(
padding: EdgeInsets.all(25),
child: Column(
children: [
Column(
children: [
const Text(
"Update Business Profile:",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
),
),
const SizedBox(height: 15.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(),
),
],
),
Column(
children: [
const SizedBox(height: 15.0),
const Text(
"My Business User:",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
const SizedBox(height: 15.0),
MIHTextField(
controller: regController,
hintText: "Registration No.",
editable: true,
required: true,
),
),
const SizedBox(height: 15.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: () {
//print(business_id);
submitForm(business_id);
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(),
),
],
),
Column(
children: [
const SizedBox(height: 15.0),
const Text(
"My Business User:",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
),
const SizedBox(height: 15.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: "Update",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
onTap: () {
//print(business_id);
submitForm(business_id);
},
),
),
],
),
],
),
),
),
),

View File

@@ -169,89 +169,92 @@ class _ProfileUserUpdateState extends State<ProfileUserUpdate> {
return Scaffold(
appBar: const MIHAppBar(barTitle: "Update Profile"),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
body: Padding(
padding: const EdgeInsets.all(15.0),
child: Center(
child: KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
submitForm();
}
},
child: Column(
children: [
const Text(
"Personal Profile:",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Center(
child: KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
submitForm();
}
},
child: Column(
children: [
const Text(
"Personal Profile:",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
),
),
const SizedBox(height: 15.0),
MIHTextField(
controller: usernameController,
hintText: "Username",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: fnameController,
hintText: "First Name",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: lnameController,
hintText: "Last Name",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text(
"Activate Business Account",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
const SizedBox(height: 15.0),
MIHTextField(
controller: usernameController,
hintText: "Username",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: fnameController,
hintText: "First Name",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: lnameController,
hintText: "Last Name",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text(
"Activate Business Account",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
),
const SizedBox(
width: 10,
),
Switch(
value: businessUser,
onChanged: (bool value) {
setState(() {
businessUser = value;
});
const SizedBox(
width: 10,
),
Switch(
value: businessUser,
onChanged: (bool value) {
setState(() {
businessUser = value;
});
},
),
],
),
const SizedBox(height: 30.0),
SizedBox(
width: 500.0,
height: 50.0,
child: MIHButton(
buttonText: "Update",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
onTap: () {
submitForm();
},
),
],
),
const SizedBox(height: 30.0),
SizedBox(
width: 500.0,
height: 50.0,
child: MIHButton(
buttonText: "Update",
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
onTap: () {
submitForm();
},
),
),
],
],
),
),
),
),