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 Size size = MediaQuery.sizeOf(context);
final double width = size.width; final double width = size.width;
//final double height = size.height; //final double height = size.height;
return Scaffold( return PopScope(
appBar: const MIHAppBar(barTitle: "Mzansi Innovation\nHub"), canPop: false,
drawer: MIHAppDrawer( child: Scaffold(
signedInUser: widget.signedInUser, appBar: const MIHAppBar(barTitle: "Mzansi Innovation\nHub"),
), drawer: MIHAppDrawer(
body: Column( signedInUser: widget.signedInUser,
children: [ ),
const SizedBox(height: 10), body: SafeArea(
Padding( child: Column(
padding: EdgeInsets.symmetric(horizontal: width / 10), children: [
child: Row( const SizedBox(height: 10),
mainAxisAlignment: MainAxisAlignment.center, Padding(
mainAxisSize: MainAxisSize.min, padding: EdgeInsets.symmetric(horizontal: width / 10),
children: [ child: Row(
IconButton( mainAxisAlignment: MainAxisAlignment.center,
onPressed: () { mainAxisSize: MainAxisSize.min,
setState(() { children: [
appSearch = ""; IconButton(
searchController.clear(); onPressed: () {
});
},
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(() { 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: , Expanded(
// shrinkWrap: true, child: GridView.builder(
itemCount: searchApp(pbswitch[_selectedIndex], appSearch).length, padding: EdgeInsets.only(
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( left: width / 10,
maxCrossAxisExtent: 200), right: width / 10,
itemBuilder: (context, index) { //bottom: height / 5,
return searchApp(pbswitch[_selectedIndex], appSearch)[index]; top: 20,
}, ),
), // physics: ,
), // shrinkWrap: true,
], itemCount:
), searchApp(pbswitch[_selectedIndex], appSearch).length,
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
//), maxCrossAxisExtent: 200),
// ], itemBuilder: (context, index) {
// ), return searchApp(
bottomNavigationBar: Visibility( pbswitch[_selectedIndex], appSearch)[index];
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, ),
),
//),
// ],
// ),
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") { if (getExtType(widget.arguments.path).toLowerCase() == "pdf") {
return Scaffold( return Scaffold(
body: Stack( body: SafeArea(
children: [ child: Stack(
Container( children: [
width: width, Container(
padding: const EdgeInsets.only(top: 20.0), width: width,
decoration: BoxDecoration( padding: const EdgeInsets.only(top: 20.0),
color: MzanziInnovationHub.of(context)!.theme.primaryColor(), decoration: BoxDecoration(
), color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
child: Column( ),
mainAxisSize: MainAxisSize.max, child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ crossAxisAlignment: CrossAxisAlignment.center,
const SizedBox(height: 50), children: [
SizedBox( const SizedBox(height: 50),
width: width - zoomOut, SizedBox(
height: height - 70, width: width - zoomOut,
child: SfPdfViewerTheme( height: height - 70,
data: SfPdfViewerThemeData( child: SfPdfViewerTheme(
backgroundColor: MzanziInnovationHub.of(context)! data: SfPdfViewerThemeData(
.theme backgroundColor: MzanziInnovationHub.of(context)!
.primaryColor(), .theme
), .primaryColor(),
child: SfPdfViewer.network( ),
widget.arguments.link, child: SfPdfViewer.network(
controller: pdfViewerController, widget.arguments.link,
initialZoomLevel: startZoomLevel, controller: pdfViewerController,
pageSpacing: 2, initialZoomLevel: startZoomLevel,
maxZoomLevel: 5, pageSpacing: 2,
interactionMode: PdfInteractionMode.pan, maxZoomLevel: 5,
onDocumentLoaded: (details) { interactionMode: PdfInteractionMode.pan,
setState(() { onDocumentLoaded: (details) {
currentPage = pdfViewerController.pageNumber; setState(() {
currentPageCount = pdfViewerController.pageCount; 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(
Positioned( top: 5,
top: 5, left: 2,
right: 2, width: 50,
//width: 50, height: 50,
height: 50, child: IconButton(
child: Row( onPressed: () {
mainAxisSize: MainAxisSize.max, Navigator.pop(context);
mainAxisAlignment: MainAxisAlignment.end, },
crossAxisAlignment: CrossAxisAlignment.center, icon: Icon(
children: [ Icons.fullscreen_exit,
IconButton( color:
onPressed: () { MzanziInnovationHub.of(context)!.theme.secondaryColor(),
pdfViewerController.previousPage(); size: 35,
//print(pdfViewerController.);
//if (pdfViewerController.pageNumber > 1) {
setState(() {
currentPage = pdfViewerController.pageNumber;
});
// }
},
icon: Icon(
Icons.arrow_back,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
),
), ),
// SizedBox( ),
// width: 40, ),
// height: 40, Positioned(
// child: MIHTextField( top: 5,
// controller: cuntrController, right: 2,
// hintText: "", //width: 50,
// editable: true, height: 50,
// required: false), child: Row(
// ), mainAxisSize: MainAxisSize.max,
Text( mainAxisAlignment: MainAxisAlignment.end,
"$currentPage / $currentPageCount", crossAxisAlignment: CrossAxisAlignment.center,
style: const TextStyle(fontSize: 20), children: [
), IconButton(
IconButton( onPressed: () {
onPressed: () { pdfViewerController.previousPage();
pdfViewerController.nextPage(); //print(pdfViewerController.);
//print(pdfViewerController.pageNumber); //if (pdfViewerController.pageNumber > 1) {
//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) {
setState(() { setState(() {
zoomOut = zoomOut - 100; currentPage = pdfViewerController.pageNumber;
}); });
} else { // }
setState(() { },
pdfViewerController.zoomLevel = startZoomLevel + 0.25; icon: Icon(
startZoomLevel = pdfViewerController.zoomLevel; Icons.arrow_back,
}); color: MzanziInnovationHub.of(context)!
} .theme
}, .secondaryColor(),
icon: Icon( size: 35,
Icons.zoom_in, ),
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
), ),
), // SizedBox(
IconButton( // width: 40,
onPressed: () { // height: 40,
if (pdfViewerController.zoomLevel > 1) { // 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(() { setState(() {
pdfViewerController.zoomLevel = startZoomLevel - 0.25; currentPage = pdfViewerController.pageNumber;
startZoomLevel = pdfViewerController.zoomLevel;
}); });
} else { //}
if (zoomOut < (width - 100)) { },
icon: Icon(
Icons.arrow_forward,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
size: 35,
),
),
IconButton(
onPressed: () {
if (zoomOut > 0) {
setState(() { setState(() {
zoomOut = zoomOut + 100; zoomOut = zoomOut - 100;
});
} else {
setState(() {
pdfViewerController.zoomLevel =
startZoomLevel + 0.25;
startZoomLevel = pdfViewerController.zoomLevel;
}); });
} }
} },
}, icon: Icon(
icon: Icon( Icons.zoom_in,
Icons.zoom_out, color: MzanziInnovationHub.of(context)!
color: MzanziInnovationHub.of(context)! .theme
.theme .secondaryColor(),
.secondaryColor(), size: 35,
size: 35, ),
), ),
), IconButton(
IconButton( onPressed: () {
onPressed: () { if (pdfViewerController.zoomLevel > 1) {
html.window.open( setState(() {
widget.arguments.link, pdfViewerController.zoomLevel =
// '${AppEnviroment.baseFileUrl}/mih/$filePath', startZoomLevel - 0.25;
'download'); startZoomLevel = pdfViewerController.zoomLevel;
}, });
icon: Icon( } else {
Icons.download, if (zoomOut < (width - 100)) {
color: MzanziInnovationHub.of(context)! setState(() {
.theme zoomOut = zoomOut + 100;
.secondaryColor(), });
size: 35, }
}
},
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 { } else {

View File

@@ -269,7 +269,7 @@ class _PatientAccessRequestState extends State<PatientAccessRequest> {
return Scaffold( return Scaffold(
appBar: const MIHAppBar(barTitle: "Access Reviews"), appBar: const MIHAppBar(barTitle: "Access Reviews"),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser), //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( return Scaffold(
appBar: const MIHAppBar(barTitle: "Add Patient"), appBar: const MIHAppBar(barTitle: "Add Patient"),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser), //drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
body: KeyboardListener( body: SafeArea(
focusNode: _focusNode, child: KeyboardListener(
autofocus: true, focusNode: _focusNode,
onKeyEvent: (event) async { autofocus: true,
if (event is KeyDownEvent && onKeyEvent: (event) async {
event.logicalKey == LogicalKeyboardKey.enter) { if (event is KeyDownEvent &&
submitForm(); event.logicalKey == LogicalKeyboardKey.enter) {
} submitForm();
}, }
child: displayForm(), },
child: displayForm(),
),
), ),
); );
} }

View File

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

View File

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

View File

@@ -231,164 +231,167 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
return Scaffold( return Scaffold(
appBar: const MIHAppBar(barTitle: "Add Business"), appBar: const MIHAppBar(barTitle: "Add Business"),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser), //drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
body: KeyboardListener( body: SafeArea(
focusNode: _focusNode, child: KeyboardListener(
autofocus: true, focusNode: _focusNode,
onKeyEvent: (event) async { autofocus: true,
if (event is KeyDownEvent && onKeyEvent: (event) async {
event.logicalKey == LogicalKeyboardKey.enter) { if (event is KeyDownEvent &&
submitForm(); event.logicalKey == LogicalKeyboardKey.enter) {
} submitForm();
}, }
child: SingleChildScrollView( },
padding: EdgeInsets.all(25), child: SingleChildScrollView(
child: Column( padding: EdgeInsets.all(25),
children: [ child: Column(
const Text( children: [
"Add Business Profile:", const Text(
style: TextStyle( "Add Business Profile:",
fontWeight: FontWeight.bold, style: TextStyle(
fontSize: 25, fontWeight: FontWeight.bold,
fontSize: 25,
),
), ),
), const SizedBox(height: 15.0),
const SizedBox(height: 15.0), MIHTextField(
MIHTextField( controller: regController,
controller: regController, hintText: "Registration No.",
hintText: "Registration No.", editable: true,
editable: true, required: 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: 10.0),
const SizedBox(height: 15.0), MIHTextField(
MIHDropdownField( controller: nameController,
controller: titleController, hintText: "Business Name",
hintText: "Title", editable: true,
dropdownOptions: const ["Doctor", "Assistant"], required: true,
required: true, ),
editable: true, const SizedBox(height: 10.0),
), MIHDropdownField(
const SizedBox(height: 10.0), controller: typeController,
MIHTextField( hintText: "Business Type",
controller: fnameController, dropdownOptions: const ["Doctors Office", "Other"],
hintText: "Name", required: true,
editable: false, editable: true,
required: true, ),
), const SizedBox(height: 10.0),
const SizedBox(height: 10.0), MIHTextField(
MIHTextField( controller: contactController,
controller: lnameController, hintText: "Contact Number",
hintText: "Surname", editable: true,
editable: false, required: true,
required: true, ),
), const SizedBox(height: 10.0),
const SizedBox(height: 10.0), MIHTextField(
MIHFileField( controller: emailController,
controller: signtureController, hintText: "Email",
hintText: "Signature", editable: true,
editable: false, required: true,
required: true, ),
onPressed: () async { const SizedBox(height: 10.0),
FilePickerResult? result = MIHFileField(
await FilePicker.platform.pickFiles( controller: logonameController,
type: FileType.custom, hintText: "Logo",
allowedExtensions: ['jpg', 'png', 'pdf'], editable: false,
); required: true,
if (result == null) return; onPressed: () async {
final selectedFile = result.files.first; FilePickerResult? result =
setState(() { await FilePicker.platform.pickFiles(
selectedSignature = selectedFile; type: FileType.custom,
}); allowedExtensions: ['jpg', 'png', 'pdf'],
setState(() { );
signtureController.text = selectedFile.name; if (result == null) return;
}); final selectedFile = result.files.first;
}, setState(() {
), selectedLogo = selectedFile;
const SizedBox(height: 15.0), });
MIHDropdownField( setState(() {
controller: accessController, logonameController.text = selectedFile.name;
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: 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( return Scaffold(
appBar: const MIHAppBar(barTitle: "Business Profile"), appBar: const MIHAppBar(barTitle: "Business Profile"),
//drawer: MIHAppDrawer(signedInUser: widget.arguments.signedInUser), //drawer: MIHAppDrawer(signedInUser: widget.arguments.signedInUser),
body: KeyboardListener( body: SafeArea(
focusNode: _focusNode, child: KeyboardListener(
autofocus: true, focusNode: _focusNode,
onKeyEvent: (event) async { autofocus: true,
if (event is KeyDownEvent && onKeyEvent: (event) async {
event.logicalKey == LogicalKeyboardKey.enter) { if (event is KeyDownEvent &&
//print(business_id); event.logicalKey == LogicalKeyboardKey.enter) {
submitForm(business_id); //print(business_id);
} submitForm(business_id);
}, }
child: SingleChildScrollView( },
padding: EdgeInsets.all(25), child: SingleChildScrollView(
child: Column( padding: EdgeInsets.all(25),
children: [ child: Column(
Column( children: [
children: [ Column(
const Text( children: [
"Update Business Profile:", const Text(
style: TextStyle( "Update Business Profile:",
fontWeight: FontWeight.bold, style: TextStyle(
fontSize: 25, fontWeight: FontWeight.bold,
fontSize: 25,
),
), ),
), const SizedBox(height: 15.0),
const SizedBox(height: 15.0), MIHTextField(
MIHTextField( controller: regController,
controller: regController, hintText: "Registration No.",
hintText: "Registration No.", editable: true,
editable: true, required: 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: 10.0),
const SizedBox(height: 15.0), MIHTextField(
MIHDropdownField( controller: nameController,
controller: titleController, hintText: "Business Name",
hintText: "Title", editable: true,
dropdownOptions: const ["Doctor", "Assistant"], required: true,
required: true, ),
editable: true, const SizedBox(height: 10.0),
), MIHDropdownField(
const SizedBox(height: 10.0), controller: typeController,
MIHTextField( hintText: "Business Type",
controller: fnameController, dropdownOptions: const ["Doctors Office", "Other"],
hintText: "Name", required: true,
editable: false, editable: true,
required: true, ),
), const SizedBox(height: 10.0),
const SizedBox(height: 10.0), MIHTextField(
MIHTextField( controller: contactController,
controller: lnameController, hintText: "Contact Number",
hintText: "Surname", editable: true,
editable: false, required: true,
required: true, ),
), const SizedBox(height: 10.0),
const SizedBox(height: 10.0), MIHTextField(
MIHFileField( controller: emailController,
controller: signtureController, hintText: "Email",
hintText: "Signature", editable: true,
editable: false, required: true,
required: true, ),
onPressed: () async { const SizedBox(height: 10.0),
FilePickerResult? result = MIHFileField(
await FilePicker.platform.pickFiles( controller: logonameController,
type: FileType.custom, hintText: "Logo",
allowedExtensions: ['jpg', 'png', 'pdf'], editable: false,
); required: true,
if (result == null) return; onPressed: () async {
final selectedFile = result.files.first; FilePickerResult? result =
setState(() { await FilePicker.platform.pickFiles(
selectedSignature = selectedFile; type: FileType.custom,
}); allowedExtensions: ['jpg', 'png', 'pdf'],
setState(() { );
signtureController.text = selectedFile.name; if (result == null) return;
}); final selectedFile = result.files.first;
}, setState(() {
), selectedLogo = selectedFile;
const SizedBox(height: 15.0), });
MIHDropdownField( setState(() {
controller: accessController, logonameController.text = selectedFile.name;
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: 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( return Scaffold(
appBar: const MIHAppBar(barTitle: "Update Profile"), appBar: const MIHAppBar(barTitle: "Update Profile"),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser), //drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
body: Padding( body: SafeArea(
padding: const EdgeInsets.all(15.0), child: Padding(
child: Center( padding: const EdgeInsets.all(15.0),
child: KeyboardListener( child: Center(
focusNode: _focusNode, child: KeyboardListener(
autofocus: true, focusNode: _focusNode,
onKeyEvent: (event) async { autofocus: true,
if (event is KeyDownEvent && onKeyEvent: (event) async {
event.logicalKey == LogicalKeyboardKey.enter) { if (event is KeyDownEvent &&
submitForm(); event.logicalKey == LogicalKeyboardKey.enter) {
} submitForm();
}, }
child: Column( },
children: [ child: Column(
const Text( children: [
"Personal Profile:", const Text(
style: TextStyle( "Personal Profile:",
fontWeight: FontWeight.bold, style: TextStyle(
fontSize: 25, fontWeight: FontWeight.bold,
fontSize: 25,
),
), ),
), const SizedBox(height: 15.0),
const SizedBox(height: 15.0), MIHTextField(
MIHTextField( controller: usernameController,
controller: usernameController, hintText: "Username",
hintText: "Username", editable: true,
editable: true, required: true,
required: true, ),
), const SizedBox(height: 10.0),
const SizedBox(height: 10.0), MIHTextField(
MIHTextField( controller: fnameController,
controller: fnameController, hintText: "First Name",
hintText: "First Name", editable: true,
editable: true, required: true,
required: true, ),
), const SizedBox(height: 10.0),
const SizedBox(height: 10.0), MIHTextField(
MIHTextField( controller: lnameController,
controller: lnameController, hintText: "Last Name",
hintText: "Last Name", editable: true,
editable: true, required: true,
required: true, ),
), const SizedBox(height: 10.0),
const SizedBox(height: 10.0), Row(
Row( mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, children: [
children: [ const Text(
const Text( "Activate Business Account",
"Activate Business Account", style: TextStyle(
style: TextStyle( fontWeight: FontWeight.bold,
fontWeight: FontWeight.bold, fontSize: 20,
fontSize: 20, ),
), ),
), const SizedBox(
const SizedBox( width: 10,
width: 10, ),
), Switch(
Switch( value: businessUser,
value: businessUser, onChanged: (bool value) {
onChanged: (bool value) { setState(() {
setState(() { businessUser = value;
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();
},
), ),
), ],
], ),
), ),
), ),
), ),