From 12a010058787410f166145482ba4cfb1c3ebff42 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Mon, 17 Mar 2025 10:45:45 +0200 Subject: [PATCH] update Mzansi Profile to use MihSignlewScroll --- .../app_tools/mih_personal_profile.dart | 211 +++++++++--------- 1 file changed, 104 insertions(+), 107 deletions(-) diff --git a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/app_tools/mih_personal_profile.dart b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/app_tools/mih_personal_profile.dart index ce313738..2e9d9b83 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/app_tools/mih_personal_profile.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/app_tools/mih_personal_profile.dart @@ -4,6 +4,7 @@ import 'package:Mzansi_Innovation_Hub/main.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_inputs_and_buttons/mih_button.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_inputs_and_buttons/mih_file_input.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; +import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_single_child_scroll.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih-app_tool_body.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; @@ -245,122 +246,118 @@ class _MihPersonalProfileState extends State { } Widget getBody() { - return SafeArea( - child: SingleChildScrollView( - child: Column( - children: [ - //displayProPic(), - MIHProfilePicture( - profilePictureFile: widget.arguments.propicFile, - proPicController: proPicController, - proPic: proPic, - width: 155, - radius: 70, - drawerMode: false, - editable: true, - onChange: (newProPic) { + return MihSingleChildScroll( + child: Column( + children: [ + //displayProPic(), + MIHProfilePicture( + profilePictureFile: widget.arguments.propicFile, + proPicController: proPicController, + proPic: proPic, + width: 155, + radius: 70, + drawerMode: false, + editable: true, + onChange: (newProPic) { + setState(() { + proPic = newProPic; + }); + }, + ), + const SizedBox(height: 25.0), + Visibility( + visible: false, + child: MIHFileField( + controller: proPicController, + hintText: "Profile Picture", + editable: false, + required: false, + onPressed: () async { + FilePickerResult? result = await FilePicker.platform.pickFiles( + type: FileType.custom, + allowedExtensions: ['jpg', 'png'], + ); + if (result == null) return; + final selectedFile = result.files.first; setState(() { - proPic = newProPic; + proPic = selectedFile; + propicPreview = MemoryImage(proPic!.bytes!); + }); + + setState(() { + proPicController.text = selectedFile.name; }); }, ), - const SizedBox(height: 25.0), - Visibility( - visible: false, - child: MIHFileField( - controller: proPicController, - hintText: "Profile Picture", - editable: false, - required: false, - onPressed: () async { - FilePickerResult? result = - await FilePicker.platform.pickFiles( - type: FileType.custom, - allowedExtensions: ['jpg', 'png'], - ); - if (result == null) return; - final selectedFile = result.files.first; + ), + // const SizedBox(height: 10.0), + // MIHTextField( + // controller: proPicController, + // hintText: "Pro Pic", + // editable: true, + // required: true, + // ), + const SizedBox(height: 10.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(() { - proPic = selectedFile; - propicPreview = MemoryImage(proPic!.bytes!); - }); - - setState(() { - proPicController.text = selectedFile.name; + 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: 10.0), - // MIHTextField( - // controller: proPicController, - // hintText: "Pro Pic", - // editable: true, - // required: true, - // ), - const SizedBox(height: 10.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(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(); - }, - ), - ), - ], - ), + ), + ], ), ); }