From a412e04424a9e0c57453bc6bd3a96937803e5987 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Thu, 5 Jun 2025 09:12:35 +0200 Subject: [PATCH] . --- .../package_tools/package_tool_one.dart | 544 +++++++++--------- .../package_tools/mih_personal_profile.dart | 2 +- 2 files changed, 278 insertions(+), 268 deletions(-) diff --git a/Frontend/lib/mih_components/mih_package_components/Example/package_tools/package_tool_one.dart b/Frontend/lib/mih_components/mih_package_components/Example/package_tools/package_tool_one.dart index d899911b..485292fb 100644 --- a/Frontend/lib/mih_components/mih_package_components/Example/package_tools/package_tool_one.dart +++ b/Frontend/lib/mih_components/mih_package_components/Example/package_tools/package_tool_one.dart @@ -95,7 +95,7 @@ class _PackageToolOneState extends State { @override Widget build(BuildContext context) { return MihPackageToolBody( - borderOn: true, + borderOn: false, bodyItem: getBody(), ); } @@ -122,121 +122,201 @@ class _PackageToolOneState extends State { Widget getBody() { return Stack( children: [ - MihSingleChildScroll( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Hello", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)! + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: MihSingleChildScroll( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Hello", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + ], + ), + const SizedBox(height: 20), + MihForm( + formKey: _formKey, + formFields: [ + MihTextFormField( + fillColor: MzanziInnovationHub.of(context)! .theme .secondaryColor(), + inputColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: _textFieldZeroController, + multiLineInput: false, + requiredText: true, + hintText: "Username", + validator: (value) { + return MihValidationServices().validateUsername(value); + }, + ), + const SizedBox(height: 10), + MihTextFormField( + fillColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: _textFieldOneController, + multiLineInput: false, + requiredText: true, + hintText: "Email", + autofillHints: [AutofillHints.email], + validator: (value) { + return MihValidationServices().validateEmail(value); + }, + ), + const SizedBox(height: 10), + MihTextFormField( + fillColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: _textFieldTwoController, + multiLineInput: false, + requiredText: true, + hintText: "Password", + passwordMode: true, + autofillHints: [AutofillHints.password], + validator: (value) { + return MihValidationServices().validatePassword(value); + }, + ), + const SizedBox(height: 10), + MihTextFormField( + fillColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: _textFieldThreeController, + multiLineInput: false, + requiredText: true, + hintText: "Numbers Only", + numberMode: true, + validator: (value) => value == null || value.isEmpty + ? 'This Field is required' + : null, + ), + const SizedBox(height: 10), + MihTextFormField( + height: 250, + fillColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + inputColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: _textFieldFourController, + multiLineInput: true, + requiredText: false, + hintText: "Enter Multi Line Text", + ), + const SizedBox(height: 20), + Align( + alignment: Alignment.center, + child: MihButton( + onPressed: () { + if (_formKey.currentState!.validate()) { + // Process data + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text("Input Valid")), + ); + } + }, + buttonColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + elevation: 10, + width: 300, + child: Text( + "Click Me", + style: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ], + ), + const SizedBox(height: 10), + Divider( + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + thickness: 2, + ), + const SizedBox(height: 10), + MihSearchBar( + controller: _searchController, + hintText: "Ask Mzansi", + // prefixIcon: Icons.search, + prefixIcon: Icons.search, + prefixAltIcon: MihIcons.mzansiAi, + width: 300, + fillColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + hintColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onPrefixIconTap: () { + print("Search Icon Pressed: ${_searchController.text}"); + }, + searchFocusNode: searchFocusNode, + ), + const SizedBox(height: 20), + MihButton( + onPressed: () { + print("Button Pressed"); + }, + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + elevation: 10, + width: 300, + child: Text( + "Click Me", + style: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontSize: 20, + fontWeight: FontWeight.bold, ), ), - ], - ), - const SizedBox(height: 20), - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: _textFieldZeroController, - multiLineInput: false, - requiredText: true, - hintText: "Username", - validator: (value) { - return MihValidationServices().validateUsername(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: _textFieldOneController, - multiLineInput: false, - requiredText: true, - hintText: "Email", - autofillHints: [AutofillHints.email], - validator: (value) { - return MihValidationServices().validateEmail(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: _textFieldTwoController, - multiLineInput: false, - requiredText: true, - hintText: "Password", - passwordMode: true, - autofillHints: [AutofillHints.password], - validator: (value) { - return MihValidationServices().validatePassword(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: _textFieldThreeController, - multiLineInput: false, - requiredText: true, - hintText: "Numbers Only", - numberMode: true, - validator: (value) => value == null || value.isEmpty - ? 'This Field is required' - : null, - ), - const SizedBox(height: 10), - MihTextFormField( - height: 250, - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: _textFieldFourController, - multiLineInput: true, - requiredText: false, - hintText: "Enter Multi Line Text", - ), - const SizedBox(height: 20), - Align( - alignment: Alignment.center, - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - // Process data - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text("Input Valid")), - ); - } - }, - buttonColor: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - elevation: 10, - width: 300, - child: Text( + ), + const SizedBox(height: 40), + MihButton( + onPressed: () { + print("Button Pressed"); + }, + buttonColor: + MzanziInnovationHub.of(context)!.theme.successColor(), + width: 300, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.delete, + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + ), + Text( "Click Me", style: TextStyle( color: MzanziInnovationHub.of(context)! @@ -246,169 +326,99 @@ class _PackageToolOneState extends State { fontWeight: FontWeight.bold, ), ), - ), - ), - ], - ), - const SizedBox(height: 10), - Divider( - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - thickness: 2, - ), - const SizedBox(height: 10), - MihSearchBar( - controller: _searchController, - hintText: "Ask Mzansi", - // prefixIcon: Icons.search, - prefixIcon: Icons.search, - prefixAltIcon: MihIcons.mzansiAi, - width: 300, - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - hintColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onPrefixIconTap: () { - print("Search Icon Pressed: ${_searchController.text}"); - }, - searchFocusNode: searchFocusNode, - ), - const SizedBox(height: 20), - MihButton( - onPressed: () { - print("Button Pressed"); - }, - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - elevation: 10, - width: 300, - child: Text( - "Click Me", - style: TextStyle( - color: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - fontSize: 20, - fontWeight: FontWeight.bold, + ], ), ), - ), - const SizedBox(height: 40), - MihButton( - onPressed: () { - print("Button Pressed"); - }, - buttonColor: - MzanziInnovationHub.of(context)!.theme.successColor(), - width: 300, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.delete, + const SizedBox(height: 10), + MihButton( + onPressed: () { + print("Button Pressed"); + }, + buttonColor: + MzanziInnovationHub.of(context)!.theme.errorColor(), + width: 300, + child: Text( + "Click Me", + style: TextStyle( + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + const SizedBox(height: 10), + Container( + color: Colors.black, + width: 200, + height: 200, + padding: EdgeInsets.zero, + alignment: Alignment.center, + child: IconButton.filled( + onPressed: () {}, + icon: Icon( + MihIcons.mihLogo, color: MzanziInnovationHub.of(context)!.theme.primaryColor(), ), - Text( - "Click Me", - style: TextStyle( - color: MzanziInnovationHub.of(context)! - .theme - .primaryColor(), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - const SizedBox(height: 10), - MihButton( - onPressed: () { - print("Button Pressed"); - }, - buttonColor: - MzanziInnovationHub.of(context)!.theme.errorColor(), - width: 300, - child: Text( - "Click Me", - style: TextStyle( - color: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - fontSize: 20, - fontWeight: FontWeight.bold, ), ), - ), - const SizedBox(height: 10), - Container( - color: Colors.black, - width: 200, - height: 200, - padding: EdgeInsets.zero, - alignment: Alignment.center, - child: IconButton.filled( - onPressed: () {}, - icon: Icon( - MihIcons.mihLogo, - color: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - ), + const SizedBox(height: 10), + MihCircleAvatar( + imageFile: imagePreview, + width: 50, + editable: false, + fileNameController: _fileNameController, + userSelectedfile: file, + frameColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + backgroundColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + onChange: (selectedImage) { + setState(() { + file = selectedImage; + }); + }, ), - ), - const SizedBox(height: 10), - MihCircleAvatar( - imageFile: imagePreview, - width: 50, - editable: false, - fileNameController: _fileNameController, - userSelectedfile: file, - frameColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - backgroundColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onChange: (selectedImage) { - setState(() { - file = selectedImage; - }); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: _fileNameController, - hintText: "Selected Avatar File", - requiredText: false, - readOnly: false, - ), - const SizedBox(height: 10), - MihImageDisplay( - imageFile: imagePreview, - width: 300, - height: 200, - editable: true, - fileNameController: _imagefileController, - userSelectedfile: imageFile, - onChange: (selectedFile) { - setState(() { - imageFile = selectedFile; - }); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - inputColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - controller: _imagefileController, - hintText: "Selected Image File", - requiredText: false, - readOnly: false, - ), - const SizedBox(height: 10), - ], + const SizedBox(height: 10), + MihTextFormField( + fillColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + inputColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: _fileNameController, + hintText: "Selected Avatar File", + requiredText: false, + readOnly: false, + ), + const SizedBox(height: 10), + MihImageDisplay( + imageFile: imagePreview, + width: 300, + height: 200, + editable: true, + fileNameController: _imagefileController, + userSelectedfile: imageFile, + onChange: (selectedFile) { + setState(() { + imageFile = selectedFile; + }); + }, + ), + const SizedBox(height: 10), + MihTextFormField( + fillColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + inputColor: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + controller: _imagefileController, + hintText: "Selected Image File", + requiredText: false, + readOnly: false, + ), + const SizedBox(height: 10), + ], + ), ), ), Positioned( diff --git a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile.dart b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile.dart index 63c65973..85a8817f 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile.dart @@ -269,7 +269,7 @@ class _MihPersonalProfileState extends State { ), const SizedBox(height: 25.0), Visibility( - visible: true, + visible: false, child: MihTextFormField( fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),