This commit is contained in:
2025-06-06 10:11:51 +02:00
parent 7d6b42640c
commit efb9098835
6 changed files with 373 additions and 354 deletions

View File

@@ -94,9 +94,10 @@ class _PackageToolOneState extends State<PackageToolOne> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody( return MihPackageToolBody(
borderOn: false, borderOn: false,
bodyItem: getBody(), bodyItem: getBody(screenWidth),
); );
} }
@@ -119,12 +120,15 @@ class _PackageToolOneState extends State<PackageToolOne> {
}); });
} }
Widget getBody() { Widget getBody(double width) {
return Stack( return Stack(
children: [ children: [
Padding( MihSingleChildScroll(
padding: const EdgeInsets.symmetric(horizontal: 10.0), child: Padding(
child: MihSingleChildScroll( padding:
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.2)
: EdgeInsets.symmetric(horizontal: width * 0.075),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,

View File

@@ -84,190 +84,194 @@ class _MihTextFormFieldState extends State<MihTextFormField> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return Center(
width: widget.width, child: SizedBox(
height: widget.height, width: widget.width,
child: Theme( height: widget.height,
data: Theme.of(context).copyWith( child: Theme(
textSelectionTheme: TextSelectionThemeData( data: Theme.of(context).copyWith(
selectionColor: widget.inputColor.withValues(alpha: 0.3), textSelectionTheme: TextSelectionThemeData(
selectionHandleColor: widget.inputColor, selectionColor: widget.inputColor.withValues(alpha: 0.3),
selectionHandleColor: widget.inputColor,
),
), ),
), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Row(
Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
children: [ Text(
Text( widget.hintText,
widget.hintText, textAlign: TextAlign.left,
textAlign: TextAlign.left,
style: TextStyle(
color: widget.fillColor,
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
Visibility(
visible: !widget.requiredText,
child: Text(
"(Optional)",
textAlign: TextAlign.right,
style: TextStyle( style: TextStyle(
color: widget.fillColor, color: widget.fillColor,
fontSize: 15, fontSize: 15,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), Visibility(
], visible: !widget.requiredText,
), child: Text(
const SizedBox(height: 4), "(Optional)",
FormField<String>( textAlign: TextAlign.right,
initialValue: widget.controller.text, style: TextStyle(
validator: widget.validator, color: widget.fillColor,
autovalidateMode: AutovalidateMode.onUserInteraction, fontSize: 15,
builder: (field) { fontWeight: FontWeight.bold,
_formFieldState = field;
return Column(
crossAxisAlignment:
CrossAxisAlignment.start, // <-- Add this line
children: [
Material(
elevation: widget.elevation ?? 4.0,
borderRadius:
BorderRadius.circular(widget.borderRadius ?? 8.0),
child: SizedBox(
height:
widget.height != null ? widget.height! - 25 : null,
child: TextFormField(
controller: widget.controller,
cursorColor: widget.inputColor,
autofillHints: widget.autofillHints,
textAlign: TextAlign.start,
textAlignVertical: widget.multiLineInput == true
? TextAlignVertical.top
: TextAlignVertical.center,
obscureText: widget.passwordMode == true
? _obscureText
: false,
expands: widget.passwordMode == true
? false
: (widget.multiLineInput ?? false),
maxLines: widget.passwordMode == true ? 1 : null,
readOnly: widget.readOnly ?? false,
keyboardType: widget.numberMode == true
? TextInputType.number
: null,
inputFormatters: widget.numberMode == true
? [FilteringTextInputFormatter.digitsOnly]
: null,
style: TextStyle(
color: widget.inputColor,
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
suffixIcon: widget.passwordMode == true
? IconButton(
icon: Icon(
_obscureText
? Icons.visibility_off
: Icons.visibility,
color: widget.inputColor,
),
onPressed: () {
setState(() {
_obscureText = !_obscureText;
});
},
)
: null,
errorStyle: const TextStyle(
height: 0, fontSize: 0), // <-- Add this line
contentPadding: const EdgeInsets.symmetric(
horizontal: 10.0, vertical: 8.0),
filled: true,
fillColor: widget.fillColor,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: field.hasError
? BorderSide(
color: MzanziInnovationHub.of(context)!
.theme
.errorColor(),
width: 2.0,
)
: BorderSide.none,
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide.none,
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: field.hasError
? MzanziInnovationHub.of(context)!
.theme
.errorColor()
: widget.inputColor,
width: 3.0,
),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: MzanziInnovationHub.of(context)!
.theme
.errorColor(),
width: 3.0,
),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: MzanziInnovationHub.of(context)!
.theme
.errorColor(),
width: 3.0,
),
),
),
onChanged: (value) {
field.didChange(value);
},
),
), ),
), ),
if (field.hasError) ),
Row( ],
children: [ ),
Padding( const SizedBox(height: 4),
padding: const EdgeInsets.only(left: 8.0, top: 4.0), FormField<String>(
child: Text( initialValue: widget.controller.text,
field.errorText ?? '', validator: widget.validator,
style: TextStyle( autovalidateMode: AutovalidateMode.onUserInteraction,
fontSize: 12, builder: (field) {
color: MzanziInnovationHub.of(context)! _formFieldState = field;
.theme return Column(
.errorColor(), crossAxisAlignment:
fontWeight: FontWeight.bold, CrossAxisAlignment.start, // <-- Add this line
children: [
Material(
elevation: widget.elevation ?? 4.0,
borderRadius:
BorderRadius.circular(widget.borderRadius ?? 8.0),
child: SizedBox(
height: widget.height != null
? widget.height! - 25
: null,
child: TextFormField(
controller: widget.controller,
cursorColor: widget.inputColor,
autofillHints: widget.autofillHints,
textAlign: TextAlign.start,
textAlignVertical: widget.multiLineInput == true
? TextAlignVertical.top
: TextAlignVertical.center,
obscureText: widget.passwordMode == true
? _obscureText
: false,
expands: widget.passwordMode == true
? false
: (widget.multiLineInput ?? false),
maxLines: widget.passwordMode == true ? 1 : null,
readOnly: widget.readOnly ?? false,
keyboardType: widget.numberMode == true
? TextInputType.number
: null,
inputFormatters: widget.numberMode == true
? [FilteringTextInputFormatter.digitsOnly]
: null,
style: TextStyle(
color: widget.inputColor,
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
suffixIcon: widget.passwordMode == true
? IconButton(
icon: Icon(
_obscureText
? Icons.visibility_off
: Icons.visibility,
color: widget.inputColor,
),
onPressed: () {
setState(() {
_obscureText = !_obscureText;
});
},
)
: null,
errorStyle: const TextStyle(
height: 0, fontSize: 0), // <-- Add this line
contentPadding: const EdgeInsets.symmetric(
horizontal: 10.0, vertical: 8.0),
filled: true,
fillColor: widget.fillColor,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: field.hasError
? BorderSide(
color: MzanziInnovationHub.of(context)!
.theme
.errorColor(),
width: 2.0,
)
: BorderSide.none,
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide.none,
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: field.hasError
? MzanziInnovationHub.of(context)!
.theme
.errorColor()
: widget.inputColor,
width: 3.0,
),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: MzanziInnovationHub.of(context)!
.theme
.errorColor(),
width: 3.0,
),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: MzanziInnovationHub.of(context)!
.theme
.errorColor(),
width: 3.0,
),
), ),
), ),
onChanged: (value) {
field.didChange(value);
},
), ),
], ),
), ),
], if (field.hasError)
); Row(
}, children: [
), Padding(
], padding:
const EdgeInsets.only(left: 8.0, top: 4.0),
child: Text(
field.errorText ?? '',
style: TextStyle(
fontSize: 12,
color: MzanziInnovationHub.of(context)!
.theme
.errorColor(),
fontWeight: FontWeight.bold,
),
),
),
],
),
],
);
},
),
],
),
), ),
), ),
); );

View File

@@ -15,13 +15,13 @@ abstract class AppEnviroment {
case Enviroment.dev: case Enviroment.dev:
{ {
//================= Android Dev Urls ================= //================= Android Dev Urls =================
baseApiUrl = "http://10.0.2.2:8080"; // baseApiUrl = "http://10.0.2.2:8080";
baseFileUrl = "http://10.0.2.2:9000"; // baseFileUrl = "http://10.0.2.2:9000";
baseAiUrl = "http://10.0.2.2:11434"; // baseAiUrl = "http://10.0.2.2:11434";
//================= Web Dev Urls ================= //================= Web Dev Urls =================
// baseApiUrl = "http://localhost:8080"; baseApiUrl = "http://localhost:8080";
// baseFileUrl = "http://localhost:9000"; baseFileUrl = "http://localhost:9000";
// baseAiUrl = "http://localhost:11434"; baseAiUrl = "http://localhost:11434";
break; break;
} }
case Enviroment.prod: case Enviroment.prod:

View File

@@ -204,7 +204,7 @@ class _ForgotPasswordState extends State<ForgotPassword> {
); );
} }
MIHBody getBody() { MIHBody getBody(double width) {
return MIHBody( return MIHBody(
borderOn: false, borderOn: false,
bodyItems: [ bodyItems: [
@@ -222,7 +222,12 @@ class _ForgotPasswordState extends State<ForgotPassword> {
child: SingleChildScrollView( child: SingleChildScrollView(
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
child: Padding( child: Padding(
padding: const EdgeInsets.all(25.0), padding: MzanziInnovationHub.of(context)!.theme.screenType ==
"desktop"
? EdgeInsets.symmetric(
vertical: 25, horizontal: width * 0.2)
: EdgeInsets.symmetric(
vertical: 25, horizontal: width * 0.075),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@@ -320,11 +325,12 @@ class _ForgotPasswordState extends State<ForgotPassword> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MIHLayoutBuilder( return MIHLayoutBuilder(
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
secondaryActionButton: null, secondaryActionButton: null,
body: getBody(), body: getBody(screenWidth),
actionDrawer: null, actionDrawer: null,
secondaryActionDrawer: null, secondaryActionDrawer: null,
bottomNavBar: null, bottomNavBar: null,

View File

@@ -303,7 +303,7 @@ class _RegisterState extends State<Register> {
); );
} }
MIHBody getBody() { MIHBody getBody(double width) {
return MIHBody( return MIHBody(
borderOn: false, borderOn: false,
bodyItems: [ bodyItems: [
@@ -323,7 +323,10 @@ class _RegisterState extends State<Register> {
child: SingleChildScrollView( child: SingleChildScrollView(
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
child: Padding( child: Padding(
padding: const EdgeInsets.all(25.0), padding: MzanziInnovationHub.of(context)!.theme.screenType ==
"desktop"
? EdgeInsets.symmetric(horizontal: width * 0.2)
: EdgeInsets.symmetric(horizontal: width * 0.075),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@@ -415,62 +418,55 @@ class _RegisterState extends State<Register> {
const SizedBox(height: 20), const SizedBox(height: 20),
// sign up button // sign up button
Center( Center(
child: MihButton( child: Wrap(
onPressed: () { alignment: WrapAlignment.center,
if (_formKey.currentState!.validate()) { runAlignment: WrapAlignment.center,
submitFormInput(); spacing: 10,
} runSpacing: 10,
},
buttonColor: MzanziInnovationHub.of(context)!
.theme
.successColor(),
width: 300,
child: Text(
"Create New Account",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
const SizedBox(height: 10),
//register text
SizedBox(
width: 300.0,
//height: 100.0,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
const Text( MihButton(
'Already a User?', onPressed: () {
style: if (_formKey.currentState!.validate()) {
TextStyle(fontSize: 18, color: Colors.grey), submitFormInput();
), }
const SizedBox( },
width: 6, buttonColor: MzanziInnovationHub.of(context)!
), .theme
GestureDetector( .successColor(),
onTap: widget.onTap, width: 300,
child: Text( child: Text(
'Sign In', "Create New Account",
style: TextStyle( style: TextStyle(
fontSize: 18,
color: MzanziInnovationHub.of(context)! color: MzanziInnovationHub.of(context)!
.theme .theme
.secondaryColor(), .primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
) ),
MihButton(
onPressed: widget.onTap,
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
width: 300,
child: Text(
"I have an account",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
], ],
), ),
//here
), ),
//here
], ],
) )
], ],
@@ -494,11 +490,12 @@ class _RegisterState extends State<Register> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MIHLayoutBuilder( return MIHLayoutBuilder(
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
secondaryActionButton: getSecondaryActionButton(), secondaryActionButton: getSecondaryActionButton(),
body: getBody(), body: getBody(screenWidth),
actionDrawer: null, actionDrawer: null,
secondaryActionDrawer: null, secondaryActionDrawer: null,
bottomNavBar: null, bottomNavBar: null,

View File

@@ -235,146 +235,154 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody( return MihPackageToolBody(
borderOn: false, borderOn: false,
innerHorizontalPadding: 10, innerHorizontalPadding: 10,
bodyItem: getBody(), bodyItem: getBody(screenWidth),
); );
} }
Widget getBody() { Widget getBody(double width) {
return MihSingleChildScroll( return MihSingleChildScroll(
child: Column( child: Padding(
children: [ padding: MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
MihForm( ? EdgeInsets.symmetric(horizontal: width * 0.2)
formKey: _formKey, : EdgeInsets.symmetric(horizontal: width * 0.075),
formFields: [ child: Column(
Center( mainAxisAlignment: MainAxisAlignment.start,
child: MihCircleAvatar( children: [
imageFile: propicPreview, MihForm(
width: 150, formKey: _formKey,
editable: true, formFields: [
fileNameController: proPicController, Center(
userSelectedfile: proPic, child: MihCircleAvatar(
frameColor: imageFile: propicPreview,
MzanziInnovationHub.of(context)!.theme.secondaryColor(), width: 150,
backgroundColor: editable: true,
MzanziInnovationHub.of(context)!.theme.primaryColor(), fileNameController: proPicController,
onChange: (selectedImage) { userSelectedfile: proPic,
setState(() { frameColor:
proPic = selectedImage; MzanziInnovationHub.of(context)!.theme.secondaryColor(),
}); backgroundColor:
}, MzanziInnovationHub.of(context)!.theme.primaryColor(),
onChange: (selectedImage) {
setState(() {
proPic = selectedImage;
});
},
),
), ),
), const SizedBox(height: 25.0),
const SizedBox(height: 25.0), Visibility(
Visibility( visible: false,
visible: false, child: MihTextFormField(
child: MihTextFormField( fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: proPicController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Selected File Name",
),
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(), MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(), MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: proPicController, controller: usernameController,
multiLineInput: false, multiLineInput: false,
requiredText: true, requiredText: true,
readOnly: true, hintText: "Username",
hintText: "Selected File Name", validator: (value) {
), return MihValidationServices().validateUsername(value);
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: usernameController,
multiLineInput: false,
requiredText: true,
hintText: "Username",
validator: (value) {
return MihValidationServices().validateUsername(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: fnameController,
multiLineInput: false,
requiredText: true,
hintText: "First Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: lnameController,
multiLineInput: false,
requiredText: true,
hintText: "Last Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
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),
Center(
child: MihButton(
onPressed: () {
//Add validation here
if (_formKey.currentState!.validate()) {
submitForm();
}
}, },
buttonColor: ),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(), MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300, inputColor:
child: Text( MzanziInnovationHub.of(context)!.theme.primaryColor(),
"Update", controller: fnameController,
style: TextStyle( multiLineInput: false,
color: requiredText: true,
MzanziInnovationHub.of(context)!.theme.primaryColor(), hintText: "First Name",
fontSize: 20, validator: (value) {
fontWeight: FontWeight.bold, return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: lnameController,
multiLineInput: false,
requiredText: true,
hintText: "Last Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
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),
Center(
child: MihButton(
onPressed: () {
//Add validation here
if (_formKey.currentState!.validate()) {
submitForm();
}
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Update",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
), ),
), ),
), ),
), ],
], ),
), ],
], ),
), ),
); );
} }