From d99a26a9b857cdaa520e172e68e71d860ba9662c Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Fri, 6 Jun 2025 11:47:38 +0200 Subject: [PATCH] fix auth padding and install button --- .../mih_packages/authentication/register.dart | 15 +-- .../authentication/reset_password.dart | 48 ++++---- .../mih_packages/authentication/signin.dart | 106 ++++++++++-------- 3 files changed, 89 insertions(+), 80 deletions(-) diff --git a/Frontend/lib/mih_packages/authentication/register.dart b/Frontend/lib/mih_packages/authentication/register.dart index e0581428..c8421ca2 100644 --- a/Frontend/lib/mih_packages/authentication/register.dart +++ b/Frontend/lib/mih_packages/authentication/register.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:mzansi_innovation_hub/mih_apis/mih_install_services.dart'; import 'package:mzansi_innovation_hub/mih_apis/mih_validation_services.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_form.dart'; @@ -235,14 +236,11 @@ class _RegisterState extends State { padding: const EdgeInsets.all(10.0), child: MihButton( onPressed: () { - Navigator.of(context).pushNamed( - '/about', - arguments: 0, - ); + MihInstallServices().installMihTrigger(context); }, buttonColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - width: 300, + width: 150, child: Text( "Install MIH", style: TextStyle( @@ -255,10 +253,7 @@ class _RegisterState extends State { ), iconSize: 35, onTap: () { - Navigator.of(context).pushNamed( - '/about', - arguments: 0, - ); + MihInstallServices().installMihTrigger(context); }, ), ); @@ -352,7 +347,7 @@ class _RegisterState extends State { ), ), //spacer - const SizedBox(height: 25), + // const SizedBox(height: 20), MihForm( formKey: _formKey, formFields: [ diff --git a/Frontend/lib/mih_packages/authentication/reset_password.dart b/Frontend/lib/mih_packages/authentication/reset_password.dart index 1c97a81d..767ee600 100644 --- a/Frontend/lib/mih_packages/authentication/reset_password.dart +++ b/Frontend/lib/mih_packages/authentication/reset_password.dart @@ -180,7 +180,7 @@ class _ResetPasswordState extends State { ); } - MIHBody getBody() { + MIHBody getBody(double width) { return MIHBody( borderOn: false, bodyItems: [ @@ -200,7 +200,10 @@ class _ResetPasswordState extends State { child: SingleChildScrollView( physics: const BouncingScrollPhysics(), 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( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -295,24 +298,26 @@ class _ResetPasswordState extends State { //spacer const SizedBox(height: 25), // sign in button - MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - submitFormInput(); - } - }, - buttonColor: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - width: 300, - child: Text( - "Reset Password", - style: TextStyle( - color: MzanziInnovationHub.of(context)! - .theme - .primaryColor(), - fontSize: 20, - fontWeight: FontWeight.bold, + Center( + child: MihButton( + onPressed: () { + if (_formKey.currentState!.validate()) { + submitFormInput(); + } + }, + buttonColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + width: 300, + child: Text( + "Reset Password", + style: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + fontSize: 20, + fontWeight: FontWeight.bold, + ), ), ), ), @@ -344,11 +349,12 @@ class _ResetPasswordState extends State { @override Widget build(BuildContext context) { + double screenWidth = MediaQuery.of(context).size.width; return MIHLayoutBuilder( actionButton: getActionButton(), header: getHeader(), secondaryActionButton: null, - body: getBody(), + body: getBody(screenWidth), actionDrawer: null, secondaryActionDrawer: null, bottomNavBar: null, diff --git a/Frontend/lib/mih_packages/authentication/signin.dart b/Frontend/lib/mih_packages/authentication/signin.dart index f48125d8..70ef1c3d 100644 --- a/Frontend/lib/mih_packages/authentication/signin.dart +++ b/Frontend/lib/mih_packages/authentication/signin.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'package:mzansi_innovation_hub/mih_apis/mih_install_Services.dart'; import 'package:mzansi_innovation_hub/mih_apis/mih_validation_services.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_form.dart'; @@ -293,14 +294,11 @@ class _SignInState extends State { padding: const EdgeInsets.all(10.0), child: MihButton( onPressed: () { - Navigator.of(context).pushNamed( - '/about', - arguments: 0, - ); + MihInstallServices().installMihTrigger(context); }, buttonColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - width: 300, + width: 150, child: Text( "Install MIH", style: TextStyle( @@ -361,7 +359,7 @@ class _SignInState extends State { ); } - MIHBody getBody() { + MIHBody getBody(double width) { return MIHBody( borderOn: false, bodyItems: [ @@ -381,7 +379,10 @@ class _SignInState extends State { child: SingleChildScrollView( physics: const BouncingScrollPhysics(), 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: AutofillGroup( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -408,7 +409,7 @@ class _SignInState extends State { ), ), //spacer - const SizedBox(height: 25), + const SizedBox(height: 10), MihForm( formKey: _formKey, formFields: [ @@ -450,8 +451,9 @@ class _SignInState extends State { .validatePassword(value); }, ), + const SizedBox(height: 10), SizedBox( - width: 500.0, + // width: 500.0, //height: 100.0, child: Row( mainAxisAlignment: MainAxisAlignment.end, @@ -532,49 +534,54 @@ class _SignInState extends State { ), //spacer - const SizedBox(height: 20), - SizedBox( - width: 500.0, - //height: 100.0, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Flexible( - flex: 1, - child: Padding( - padding: EdgeInsets.only(right: 10.0), - child: Divider(), - ), - ), - Flexible( - flex: 1, - child: GestureDetector( - child: Text( - 'Use Sandox Profile', - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 15, - color: - MzanziInnovationHub.of(context)! + const SizedBox(height: 35), + Visibility( + visible: AppEnviroment.getEnv() == "Dev", + child: Center( + child: SizedBox( + width: width, + //height: 100.0, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Flexible( + flex: 1, + child: Padding( + padding: EdgeInsets.only(right: 10.0), + child: Divider(), + ), + ), + Flexible( + flex: 1, + child: GestureDetector( + child: Text( + 'Use Sandox Profile', + textAlign: TextAlign.center, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 15, + color: MzanziInnovationHub.of( + context)! .theme .secondaryColor()), + ), + onTap: () { + setState(() { + showProfiles = !showProfiles; + }); + }, + ), ), - onTap: () { - setState(() { - showProfiles = !showProfiles; - }); - }, - ), + const Flexible( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 10.0), + child: Divider(), + ), + ), + ], ), - const Flexible( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 10.0), - child: Divider(), - ), - ), - ], + ), ), ), const SizedBox(height: 10), @@ -647,11 +654,12 @@ class _SignInState extends State { @override Widget build(BuildContext context) { + double screenWidth = MediaQuery.of(context).size.width; return MIHLayoutBuilder( actionButton: getActionButton(), header: getHeader(), secondaryActionButton: getSecondaryActionButton(), - body: getBody(), + body: getBody(screenWidth), actionDrawer: null, secondaryActionDrawer: null, bottomNavBar: null,