diff --git a/Frontend/patient_manager/lib/mih_packages/authentication/forgot_password.dart b/Frontend/patient_manager/lib/mih_packages/authentication/forgot_password.dart index 06912bff..30de9564 100644 --- a/Frontend/patient_manager/lib/mih_packages/authentication/forgot_password.dart +++ b/Frontend/patient_manager/lib/mih_packages/authentication/forgot_password.dart @@ -2,6 +2,10 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_action.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_body.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_header.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_layout_builder.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_button.dart'; @@ -221,6 +225,118 @@ class _ForgotPasswordState extends State { } } + MIHAction getActionButton() { + return MIHAction( + icon: const Icon(Icons.arrow_back), + iconSize: 35, + onTap: () { + Navigator.of(context).pop(); + }, + ); + } + + MIHHeader getHeader() { + return const MIHHeader( + headerAlignment: MainAxisAlignment.center, + headerItems: [ + Text( + "", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), + ), + ], + ); + } + + MIHBody getBody() { + return MIHBody( + borderOn: false, + bodyItems: [ + KeyboardListener( + focusNode: _focusNode, + autofocus: true, + onKeyEvent: (event) async { + if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.enter) { + validateInput(); + } + }, + child: SafeArea( + child: Center( + child: SingleChildScrollView( + physics: const BouncingScrollPhysics(), + child: Padding( + padding: const EdgeInsets.all(25.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + //logo + Icon( + Icons.lock, + size: 100, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + //spacer + const SizedBox(height: 10), + //Heading + Text( + 'Forgot Password', + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + //spacer + const SizedBox(height: 25), + + //email input + SizedBox( + width: 500.0, + child: MIHTextField( + controller: emailController, + hintText: 'Email', + editable: true, + required: true, + ), + ), + + //spacer + const SizedBox(height: 30), + // sign in button + SizedBox( + width: 500.0, + height: 50.0, + child: MIHButton( + buttonText: "Reset Password", + buttonColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + textColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + onTap: () { + prePassResteWarning(); + }, + ), + ), + ], + ), + ), + ), + ), + ), + ), + ], + ); + } + @override void dispose() { emailController.dispose(); @@ -235,103 +351,10 @@ class _ForgotPasswordState extends State { @override Widget build(BuildContext context) { - return KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - validateInput(); - } - }, - child: Scaffold( - //backgroundColor: Colors.white, - body: Stack( - children: [ - SafeArea( - child: Center( - child: SingleChildScrollView( - physics: const BouncingScrollPhysics(), - child: Padding( - padding: const EdgeInsets.all(25.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - //logo - Icon( - Icons.lock, - size: 100, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - //spacer - const SizedBox(height: 10), - //Heading - Text( - 'Forgot Password', - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - ), - //spacer - const SizedBox(height: 25), - - //email input - SizedBox( - width: 500.0, - child: MIHTextField( - controller: emailController, - hintText: 'Email', - editable: true, - required: true, - ), - ), - - //spacer - const SizedBox(height: 30), - // sign in button - SizedBox( - width: 500.0, - height: 50.0, - child: MIHButton( - buttonText: "Reset Password", - buttonColor: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - textColor: MzanziInnovationHub.of(context)! - .theme - .primaryColor(), - onTap: () { - prePassResteWarning(); - }, - ), - ), - ], - ), - ), - ), - ), - ), - Positioned( - top: 10, - left: 5, - width: 50, - height: 50, - child: IconButton( - onPressed: () { - Navigator.of(context).pop(); - }, - icon: const Icon(Icons.arrow_back), - ), - ), - ], - ), - ), + return MIHLayoutBuilder( + actionButton: getActionButton(), + header: getHeader(), + body: getBody(), ); } } diff --git a/Frontend/patient_manager/lib/mih_packages/authentication/register.dart b/Frontend/patient_manager/lib/mih_packages/authentication/register.dart index 221d64e0..b53a0d73 100644 --- a/Frontend/patient_manager/lib/mih_packages/authentication/register.dart +++ b/Frontend/patient_manager/lib/mih_packages/authentication/register.dart @@ -2,6 +2,10 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_action.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_body.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_header.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_layout_builder.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_pass_input.dart'; @@ -225,6 +229,173 @@ class _RegisterState extends State { }); } + MIHAction getActionButton() { + return MIHAction( + icon: Image.asset('images/logo_light.png'), + iconSize: 35, + onTap: () { + Navigator.of(context).pushNamed( + '/about', + //arguments: widget.signedInUser, + ); + }, + ); + } + + MIHHeader getHeader() { + return const MIHHeader( + headerAlignment: MainAxisAlignment.center, + headerItems: [ + Text( + "", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), + ), + ], + ); + } + + MIHBody getBody() { + return MIHBody( + borderOn: false, + bodyItems: [ + KeyboardListener( + focusNode: _focusNode, + autofocus: true, + onKeyEvent: (event) async { + if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.enter) { + validateInput(); + } + }, + child: SafeArea( + child: Center( + child: SingleChildScrollView( + physics: const BouncingScrollPhysics(), + child: Padding( + padding: const EdgeInsets.all(25.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + //logo + Icon( + Icons.lock, + size: 100, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + //spacer + const SizedBox(height: 10), + //Heading + Text( + 'Register', + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + //spacer + const SizedBox(height: 25), + //email input + SizedBox( + width: 500.0, + child: MIHTextField( + controller: emailController, + hintText: 'Email', + editable: true, + required: true, + ), + ), + //spacer + const SizedBox(height: 10), + //password input + SizedBox( + width: 500.0, + child: MIHPassField( + controller: passwordController, + hintText: 'Password', + required: true, + signIn: false, + ), + ), + //spacer + const SizedBox(height: 10), + //password input + SizedBox( + width: 500.0, + child: MIHPassField( + controller: confirmPasswordController, + hintText: 'Confirm Password', + required: true, + signIn: false, + ), + ), + //spacer + const SizedBox(height: 30), + // sign up button + SizedBox( + width: 500.0, + height: 50.0, + child: MIHButton( + buttonText: "Sign Up", + buttonColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + textColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + onTap: () async { + validateInput(); + }, + ), + ), + const SizedBox(height: 10), + //register text + SizedBox( + width: 500.0, + //height: 100.0, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + const Text( + 'Already a User?', + style: TextStyle(fontSize: 18, color: Colors.grey), + ), + const SizedBox( + width: 6, + ), + GestureDetector( + onTap: widget.onTap, + child: Text( + 'Sign In', + style: TextStyle( + fontSize: 18, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + fontWeight: FontWeight.bold, + ), + ), + ) + ], + ), + ) + ], + ), + ), + ), + )), + ), + ], + ); + } + @override void dispose() { emailController.dispose(); @@ -236,161 +407,10 @@ class _RegisterState extends State { @override Widget build(BuildContext context) { - return KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - validateInput(); - } - }, - child: Scaffold( - //backgroundColor: Colors.white, - body: SafeArea( - child: Stack( - children: [ - Center( - child: SingleChildScrollView( - physics: const BouncingScrollPhysics(), - child: Padding( - padding: const EdgeInsets.all(25.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - //logo - Icon( - Icons.lock, - size: 100, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - //spacer - const SizedBox(height: 10), - //Heading - Text( - 'Register', - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - ), - //spacer - const SizedBox(height: 25), - //email input - SizedBox( - width: 500.0, - child: MIHTextField( - controller: emailController, - hintText: 'Email', - editable: true, - required: true, - ), - ), - //spacer - const SizedBox(height: 10), - //password input - SizedBox( - width: 500.0, - child: MIHPassField( - controller: passwordController, - hintText: 'Password', - required: true, - signIn: false, - ), - ), - //spacer - const SizedBox(height: 10), - //password input - SizedBox( - width: 500.0, - child: MIHPassField( - controller: confirmPasswordController, - hintText: 'Confirm Password', - required: true, - signIn: false, - ), - ), - //spacer - const SizedBox(height: 30), - // sign up button - SizedBox( - width: 500.0, - height: 50.0, - child: MIHButton( - buttonText: "Sign Up", - buttonColor: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - textColor: MzanziInnovationHub.of(context)! - .theme - .primaryColor(), - onTap: () async { - validateInput(); - }, - ), - ), - const SizedBox(height: 10), - //register text - SizedBox( - width: 500.0, - //height: 100.0, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - const Text( - 'Already a User?', - style: - TextStyle(fontSize: 18, color: Colors.grey), - ), - const SizedBox( - width: 6, - ), - GestureDetector( - onTap: widget.onTap, - child: Text( - 'Sign In', - style: TextStyle( - fontSize: 18, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - fontWeight: FontWeight.bold, - ), - ), - ) - ], - ), - ) - ], - ), - ), - ), - ), - Positioned( - top: 5, - left: 5, - width: 75, - height: 75, - child: GestureDetector( - onTap: () { - Navigator.of(context).pushNamed( - '/about', - //arguments: widget.signedInUser, - ); - }, - child: - const Image(image: AssetImage('images/logo_light.png')), - ), - ), - ], - ), - ), - ), + return MIHLayoutBuilder( + actionButton: getActionButton(), + header: getHeader(), + body: getBody(), ); } } diff --git a/Frontend/patient_manager/lib/mih_packages/authentication/reset_password.dart b/Frontend/patient_manager/lib/mih_packages/authentication/reset_password.dart index 828d2ac1..d47de7ff 100644 --- a/Frontend/patient_manager/lib/mih_packages/authentication/reset_password.dart +++ b/Frontend/patient_manager/lib/mih_packages/authentication/reset_password.dart @@ -3,6 +3,10 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_pass_input.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_action.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_body.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_header.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_layout_builder.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_button.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; @@ -252,6 +256,144 @@ class _ResetPasswordState extends State { } } + MIHAction getActionButton() { + return MIHAction( + icon: Image.asset('images/logo_light.png'), + iconSize: 35, + onTap: () { + // Navigator.of(context).pushNamed( + // '/about', + // //arguments: widget.signedInUser, + // ); + }, + ); + } + + MIHHeader getHeader() { + return const MIHHeader( + headerAlignment: MainAxisAlignment.center, + headerItems: [ + Text( + "", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), + ), + ], + ); + } + + MIHBody getBody() { + return MIHBody( + borderOn: false, + bodyItems: [ + KeyboardListener( + focusNode: _focusNode, + autofocus: true, + onKeyEvent: (event) async { + if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.enter) { + validateInput(); + } + }, + child: SafeArea( + child: Center( + child: SingleChildScrollView( + physics: const BouncingScrollPhysics(), + child: Padding( + padding: const EdgeInsets.all(25.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + //logo + Icon( + Icons.lock, + size: 100, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + //spacer + const SizedBox(height: 10), + //Heading + Text( + 'Reset Password', + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + //spacer + // const SizedBox(height: 15), + // Text( + // 'token: ${widget.token}', + // style: TextStyle( + // fontSize: 15, + // fontWeight: FontWeight.bold, + // color: MzanziInnovationHub.of(context)! + // .theme + // .secondaryColor(), + // ), + // ), + //spacer + const SizedBox(height: 25), + //email input + SizedBox( + width: 500.0, + child: MIHPassField( + controller: passwordController, + hintText: 'New Password', + required: true, + signIn: false, + ), + ), + //spacer + const SizedBox(height: 10), + //password input + SizedBox( + width: 500.0, + child: MIHPassField( + controller: confirmPasswordController, + hintText: 'Confirm New Password', + required: true, + signIn: false, + ), + ), + + //spacer + const SizedBox(height: 30), + // sign in button + SizedBox( + width: 500.0, + height: 50.0, + child: MIHButton( + buttonText: "Reset Password", + buttonColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + textColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + onTap: () { + validateInput(); + }, + ), + ), + ], + ), + ), + ), + ), + ), + ), + ], + ); + } + @override void dispose() { passwordController.dispose(); @@ -267,127 +409,10 @@ class _ResetPasswordState extends State { @override Widget build(BuildContext context) { - return KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - validateInput(); - } - }, - child: Scaffold( - //backgroundColor: Colors.white, - body: Stack( - children: [ - SafeArea( - child: Center( - child: SingleChildScrollView( - physics: const BouncingScrollPhysics(), - child: Padding( - padding: const EdgeInsets.all(25.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - //logo - Icon( - Icons.lock, - size: 100, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - //spacer - const SizedBox(height: 10), - //Heading - Text( - 'Reset Password', - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - ), - //spacer - // const SizedBox(height: 15), - // Text( - // 'token: ${widget.token}', - // style: TextStyle( - // fontSize: 15, - // fontWeight: FontWeight.bold, - // color: MzanziInnovationHub.of(context)! - // .theme - // .secondaryColor(), - // ), - // ), - //spacer - const SizedBox(height: 25), - //email input - SizedBox( - width: 500.0, - child: MIHPassField( - controller: passwordController, - hintText: 'New Password', - required: true, - signIn: false, - ), - ), - //spacer - const SizedBox(height: 10), - //password input - SizedBox( - width: 500.0, - child: MIHPassField( - controller: confirmPasswordController, - hintText: 'Confirm New Password', - required: true, - signIn: false, - ), - ), - - //spacer - const SizedBox(height: 30), - // sign in button - SizedBox( - width: 500.0, - height: 50.0, - child: MIHButton( - buttonText: "Reset Password", - buttonColor: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - textColor: MzanziInnovationHub.of(context)! - .theme - .primaryColor(), - onTap: () { - validateInput(); - }, - ), - ), - ], - ), - ), - ), - ), - ), - Positioned( - top: 10, - left: 5, - width: 50, - height: 50, - child: IconButton( - onPressed: () { - //Navigator.of(context).pop(); - Navigator.of(context).pushReplacementNamed('/'); - }, - icon: const Icon(Icons.login), - ), - ), - ], - ), - ), + return MIHLayoutBuilder( + actionButton: getActionButton(), + header: getHeader(), + body: getBody(), ); } } diff --git a/Frontend/patient_manager/lib/mih_packages/authentication/signin.dart b/Frontend/patient_manager/lib/mih_packages/authentication/signin.dart index a08b2274..531a77d0 100644 --- a/Frontend/patient_manager/lib/mih_packages/authentication/signin.dart +++ b/Frontend/patient_manager/lib/mih_packages/authentication/signin.dart @@ -2,6 +2,10 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_action.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_body.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_header.dart'; +import 'package:patient_manager/mih_components/mih_layout/mih_layout_builder.dart'; import 'package:patient_manager/mih_components/mih_layout/mih_tile.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart'; @@ -256,6 +260,302 @@ class _SignInState extends State { ); } + MIHAction getActionButton() { + return MIHAction( + icon: Image.asset('images/logo_light.png'), + iconSize: 35, + onTap: () { + Navigator.of(context).pushNamed( + '/about', + //arguments: widget.signedInUser, + ); + }, + ); + } + + MIHHeader getHeader() { + return const MIHHeader( + headerAlignment: MainAxisAlignment.center, + headerItems: [ + Text( + "", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), + ), + ], + ); + } + + MIHBody getBody() { + return MIHBody( + borderOn: false, + bodyItems: [ + KeyboardListener( + focusNode: _focusNode, + autofocus: true, + onKeyEvent: (event) async { + if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.enter) { + validateInput(); + } + }, + child: SafeArea( + child: Center( + child: SingleChildScrollView( + physics: const BouncingScrollPhysics(), + child: Padding( + padding: const EdgeInsets.all(25.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + //logo + Icon( + Icons.lock, + size: 100, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + //spacer + const SizedBox(height: 10), + //Heading + Text( + 'Sign In', + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + ), + ), + //spacer + const SizedBox(height: 25), + + // SizedBox( + // width: 500.0, + // //height: 100.0, + // child: Row( + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // GestureDetector( + // onTap: () { + // showSandboxProfiles(); + // }, + // child: Text( + // 'Sandbox Profile', + // style: TextStyle( + // fontSize: 18, + // color: MzanziInnovationHub.of(context)! + // .theme + // .secondaryColor(), + // fontWeight: FontWeight.bold, + // ), + // ), + // ), + // ], + // ), + // ), + // const SizedBox(height: 10), + //email input + SizedBox( + width: 500.0, + child: MIHTextField( + controller: emailController, + hintText: 'Email', + editable: true, + required: true, + ), + ), + + //spacer + const SizedBox(height: 10), + //password input + SizedBox( + width: 500.0, + child: MIHPassField( + controller: passwordController, + hintText: 'Password', + required: true, + signIn: true, + ), + ), + SizedBox( + width: 500.0, + //height: 100.0, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/forgot-password', + ); + }, + child: Text( + 'Forgot Password?', + style: TextStyle( + fontSize: 15, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + ), + + //spacer + const SizedBox(height: 30), + // sign in button + SizedBox( + width: 500.0, + height: 50.0, + child: MIHButton( + buttonText: "Sign In", + buttonColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + textColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + onTap: () async { + validateInput(); + }, + ), + ), + //spacer + const SizedBox(height: 10), + //register text + SizedBox( + width: 500.0, + //height: 100.0, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + 'New User?', + style: TextStyle( + fontSize: 18, + color: MzanziInnovationHub.of(context)! + .theme + .messageTextColor()), + ), + const SizedBox( + width: 6, + ), + GestureDetector( + onTap: widget.onTap, + child: Text( + 'Register Now', + style: TextStyle( + fontSize: 18, + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + ), + //spacer + const SizedBox(height: 15), + 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)! + .theme + .secondaryColor()), + ), + onTap: () { + setState(() { + showProfiles = !showProfiles; + }); + }, + ), + ), + const Flexible( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 10.0), + child: Divider(), + ), + ), + ], + ), + ), + const SizedBox(height: 10), + Visibility( + visible: showProfiles, + child: SizedBox( + width: 500, + child: Column( + //mainAxisSize: MainAxisSize.max, + children: [ + GridView.builder( + // physics: , + shrinkWrap: true, + itemCount: sandboxProfileList.length, + gridDelegate: + const SliverGridDelegateWithMaxCrossAxisExtent( + mainAxisSpacing: 10, + maxCrossAxisExtent: 100), + itemBuilder: (context, index) { + return sandboxProfileList[index]; + }, + ), + const SizedBox(height: 20), + Text( + "NB: These accounts are used for test purposes. Please do not store personal information on these profiles.", + textAlign: TextAlign.center, + style: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ), + ), + ), + ], + ); + } + @override void dispose() { emailController.dispose(); @@ -274,288 +574,10 @@ class _SignInState extends State { @override Widget build(BuildContext context) { - return KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - validateInput(); - } - }, - child: Scaffold( - //backgroundColor: Colors.white, - body: SafeArea( - child: Stack( - children: [ - Center( - child: SingleChildScrollView( - physics: const BouncingScrollPhysics(), - child: Padding( - padding: const EdgeInsets.all(25.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - //logo - Icon( - Icons.lock, - size: 100, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - //spacer - const SizedBox(height: 10), - //Heading - Text( - 'Sign In', - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - ), - ), - //spacer - const SizedBox(height: 25), - - // SizedBox( - // width: 500.0, - // //height: 100.0, - // child: Row( - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // GestureDetector( - // onTap: () { - // showSandboxProfiles(); - // }, - // child: Text( - // 'Sandbox Profile', - // style: TextStyle( - // fontSize: 18, - // color: MzanziInnovationHub.of(context)! - // .theme - // .secondaryColor(), - // fontWeight: FontWeight.bold, - // ), - // ), - // ), - // ], - // ), - // ), - // const SizedBox(height: 10), - //email input - SizedBox( - width: 500.0, - child: MIHTextField( - controller: emailController, - hintText: 'Email', - editable: true, - required: true, - ), - ), - - //spacer - const SizedBox(height: 10), - //password input - SizedBox( - width: 500.0, - child: MIHPassField( - controller: passwordController, - hintText: 'Password', - required: true, - signIn: true, - ), - ), - SizedBox( - width: 500.0, - //height: 100.0, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - GestureDetector( - onTap: () { - Navigator.of(context).pushNamed( - '/forgot-password', - ); - }, - child: Text( - 'Forgot Password?', - style: TextStyle( - fontSize: 15, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - - //spacer - const SizedBox(height: 30), - // sign in button - SizedBox( - width: 500.0, - height: 50.0, - child: MIHButton( - buttonText: "Sign In", - buttonColor: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - textColor: MzanziInnovationHub.of(context)! - .theme - .primaryColor(), - onTap: () async { - validateInput(); - }, - ), - ), - //spacer - const SizedBox(height: 10), - //register text - SizedBox( - width: 500.0, - //height: 100.0, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - 'New User?', - style: TextStyle( - fontSize: 18, - color: MzanziInnovationHub.of(context)! - .theme - .messageTextColor()), - ), - const SizedBox( - width: 6, - ), - GestureDetector( - onTap: widget.onTap, - child: Text( - 'Register Now', - style: TextStyle( - fontSize: 18, - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - //spacer - const SizedBox(height: 15), - 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)! - .theme - .secondaryColor()), - ), - onTap: () { - setState(() { - showProfiles = !showProfiles; - }); - }, - ), - ), - const Flexible( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 10.0), - child: Divider(), - ), - ), - ], - ), - ), - const SizedBox(height: 10), - Visibility( - visible: showProfiles, - child: SizedBox( - width: 500, - child: Column( - //mainAxisSize: MainAxisSize.max, - children: [ - GridView.builder( - // physics: , - shrinkWrap: true, - itemCount: sandboxProfileList.length, - gridDelegate: - const SliverGridDelegateWithMaxCrossAxisExtent( - mainAxisSpacing: 10, - maxCrossAxisExtent: 100), - itemBuilder: (context, index) { - return sandboxProfileList[index]; - }, - ), - const SizedBox(height: 20), - Text( - "NB: These accounts are used for test purposes. Please do not store personal information on these profiles.", - textAlign: TextAlign.center, - style: TextStyle( - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - ), - ], - ), - ), - ), - ), - Positioned( - top: 5, - left: 5, - width: 75, - height: 75, - child: GestureDetector( - onTap: () { - Navigator.of(context).pushNamed( - '/about', - //arguments: widget.signedInUser, - ); - }, - child: - const Image(image: AssetImage('images/logo_light.png')), - ), - ), - ], - ), - ), - ), + return MIHLayoutBuilder( + actionButton: getActionButton(), + header: getHeader(), + body: getBody(), ); } }