Add new mih text form field to Auth

This commit is contained in:
2025-06-04 11:19:30 +02:00
parent 16eec990d6
commit 4fb9992dfa
4 changed files with 488 additions and 441 deletions

View File

@@ -2,11 +2,13 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/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';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_text_form_field.dart';
import '../../main.dart';
import 'package:supertokens_flutter/http.dart' as http;
import '../../mih_components/mih_inputs_and_buttons/mih_text_input.dart';
import '../../mih_components/mih_layout/mih_action.dart';
import '../../mih_components/mih_layout/mih_body.dart';
import '../../mih_components/mih_layout/mih_header.dart';
@@ -25,6 +27,7 @@ class ForgotPassword extends StatefulWidget {
class _ForgotPasswordState extends State<ForgotPassword> {
final emailController = TextEditingController();
final _formKey = GlobalKey<FormState>();
//bool _obscureText = true;
bool successfulForgotPassword = false;
@@ -244,40 +247,53 @@ class _ForgotPasswordState extends State<ForgotPassword> {
.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: 25),
MihButton(
onPressed: () {
prePassResteWarning();
},
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
width: 300,
child: Text(
"Reset Password",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
controller: emailController,
multiLineInput: false,
requiredText: true,
hintText: "Email",
validator: (value) {
return MihValidationServices()
.validateEmail(value);
},
),
),
//spacer
const SizedBox(height: 20),
Align(
alignment: Alignment.center,
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
prePassResteWarning();
}
},
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,
),
),
),
),
],
),
],
),

View File

@@ -1,18 +1,16 @@
import 'dart:convert';
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';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_text_form_field.dart';
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../main.dart';
//import '../objects/sessionST.dart';
//import 'package:supertokens_flutter/supertokens.dart';
import 'package:supertokens_flutter/http.dart' as http;
import 'package:supertokens_flutter/supertokens.dart';
import '../../mih_components/mih_inputs_and_buttons/mih_pass_input.dart';
import '../../mih_components/mih_inputs_and_buttons/mih_text_input.dart';
import '../../mih_components/mih_layout/mih_action.dart';
import '../../mih_components/mih_layout/mih_body.dart';
import '../../mih_components/mih_layout/mih_header.dart';
@@ -37,6 +35,7 @@ class _RegisterState extends State<Register> {
final officeID = TextEditingController();
final baseAPI = AppEnviroment.baseApiUrl;
final FocusNode _focusNode = FocusNode();
final _formKey = GlobalKey<FormState>();
bool _obscureText = true;
bool successfulSignUp = false;
@@ -218,19 +217,8 @@ class _RegisterState extends State<Register> {
);
}
void validateInput() async {
if (emailController.text.isEmpty ||
passwordController.text.isEmpty ||
confirmPasswordController.text.isEmpty) {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(errorType: "Input Error");
},
);
} else {
await signUserUp();
}
void submitFormInput() async {
await signUserUp();
}
void toggle() {
@@ -325,7 +313,9 @@ class _RegisterState extends State<Register> {
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
validateInput();
if (_formKey.currentState!.validate()) {
submitFormInput();
}
}
},
child: SafeArea(
@@ -360,92 +350,128 @@ class _RegisterState extends State<Register> {
),
//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: 25),
// sign up button
MihButton(
onPressed: () {
validateInput();
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
width: 300,
child: Text(
"Create New Account",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
MihForm(
formKey: _formKey,
formFields: [
//email input
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
controller: emailController,
multiLineInput: false,
requiredText: true,
hintText: "Email",
autofillHints: const [AutofillHints.email],
validator: (value) {
return MihValidationServices().validateEmail(value);
},
),
),
),
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,
//spacer
const SizedBox(height: 10),
//password input
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: passwordController,
multiLineInput: false,
requiredText: true,
hintText: "Password",
passwordMode: true,
autofillHints: const [AutofillHints.password],
validator: (value) {
return MihValidationServices()
.validatePassword(value);
},
),
//spacer
const SizedBox(height: 10),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: confirmPasswordController,
multiLineInput: false,
requiredText: true,
hintText: "Confirm Password",
passwordMode: true,
autofillHints: const [AutofillHints.password],
validator: (value) {
return MihValidationServices()
.validatePassword(value);
},
),
//spacer
const SizedBox(height: 20),
// sign up button
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
submitFormInput();
}
},
buttonColor: MzanziInnovationHub.of(context)!
.theme
.successColor(),
width: 300,
child: Text(
'Sign In',
"Create New Account",
style: TextStyle(
fontSize: 18,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
.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: [
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,
),
),
)
],
),
//here
),
],
)
],
),

View File

@@ -2,10 +2,12 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/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';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_text_form_field.dart';
import '../../main.dart';
import 'package:supertokens_flutter/http.dart' as http;
import '../../mih_components/mih_inputs_and_buttons/mih_pass_input.dart';
import '../../mih_components/mih_layout/mih_action.dart';
import '../../mih_components/mih_layout/mih_body.dart';
import '../../mih_components/mih_layout/mih_header.dart';
@@ -35,6 +37,7 @@ class _ResetPasswordState extends State<ResetPassword> {
bool acceptWarning = false;
// focus node to capture keyboard events
final FocusNode _focusNode = FocusNode();
final _formKey = GlobalKey<FormState>();
final baseAPI = AppEnviroment.baseApiUrl;
@@ -131,16 +134,8 @@ class _ResetPasswordState extends State<ResetPassword> {
);
}
void validateInput() async {
if (passwordController.text.isEmpty ||
confirmPasswordController.text.isEmpty) {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(errorType: "Input Error");
},
);
} else if (passwordController.text != confirmPasswordController.text) {
void submitFormInput() async {
if (passwordController.text != confirmPasswordController.text) {
passwordError();
} else {
await submitPasswodReset();
@@ -195,7 +190,9 @@ class _ResetPasswordState extends State<ResetPassword> {
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
validateInput();
if (_formKey.currentState!.validate()) {
submitFormInput();
}
}
},
child: SafeArea(
@@ -229,63 +226,97 @@ class _ResetPasswordState extends State<ResetPassword> {
),
),
//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: 25),
// sign in button
MihButton(
onPressed: () {
validateInput();
},
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
width: 300,
child: Text(
"Reset Password",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
controller: passwordController,
multiLineInput: false,
requiredText: true,
hintText: "Password",
passwordMode: true,
autofillHints: const [AutofillHints.password],
validator: (value) {
return MihValidationServices()
.validatePassword(value);
},
),
),
//spacer
const SizedBox(height: 10),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: confirmPasswordController,
multiLineInput: false,
requiredText: true,
hintText: "Confirm Password",
passwordMode: true,
autofillHints: const [AutofillHints.password],
validator: (value) {
return MihValidationServices()
.validatePassword(value);
},
),
// //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: 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,
),
),
),
],
),
],
),

View File

@@ -1,13 +1,14 @@
import 'dart:convert';
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';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_text_form_field.dart';
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../main.dart';
import 'package:supertokens_flutter/http.dart' as http;
import '../../mih_components/mih_inputs_and_buttons/mih_pass_input.dart';
import '../../mih_components/mih_inputs_and_buttons/mih_text_input.dart';
import '../../mih_components/mih_layout/mih_action.dart';
import '../../mih_components/mih_layout/mih_body.dart';
import '../../mih_components/mih_layout/mih_header.dart';
@@ -34,6 +35,7 @@ class _SignInState extends State<SignIn> {
// focus node to capture keyboard events
final FocusNode _focusNode = FocusNode();
final _formKey = GlobalKey<FormState>();
final baseAPI = AppEnviroment.baseApiUrl;
@@ -99,7 +101,9 @@ class _SignInState extends State<SignIn> {
emailController.text = "testpatient@mzansi-innovation-hub.co.za";
passwordController.text = "Testprofile@1234";
});
validateInput();
if (_formKey.currentState!.validate()) {
submitSignInForm();
}
},
tileName: "Patient",
tileIcon: Icon(
@@ -116,7 +120,9 @@ class _SignInState extends State<SignIn> {
emailController.text = "testdoctor@mzansi-innovation-hub.co.za";
passwordController.text = "Testprofile@1234";
});
validateInput();
if (_formKey.currentState!.validate()) {
submitSignInForm();
}
},
tileName: "Doctor",
tileIcon: Icon(
@@ -134,7 +140,9 @@ class _SignInState extends State<SignIn> {
emailController.text = "test-business@mzansi-innovation-hub.co.za";
passwordController.text = "Testprofile@1234";
});
validateInput();
if (_formKey.currentState!.validate()) {
submitSignInForm();
}
},
tileName: "Business",
tileIcon: Icon(
@@ -151,7 +159,9 @@ class _SignInState extends State<SignIn> {
emailController.text = "test@mzansi-innovation-hub.co.za";
passwordController.text = "Testprofile@1234";
});
validateInput();
if (_formKey.currentState!.validate()) {
submitSignInForm();
}
},
tileName: "Test",
tileIcon: Icon(
@@ -174,27 +184,17 @@ class _SignInState extends State<SignIn> {
);
}
void validateInput() async {
if (emailController.text.isEmpty || passwordController.text.isEmpty) {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(errorType: "Input Error");
},
void submitSignInForm() async {
await signUserIn();
if (successfulSignIn) {
Navigator.of(context).pushNamedAndRemoveUntil(
'/',
(route) => false,
arguments: AuthArguments(
true,
true,
),
);
} else {
await signUserIn();
if (successfulSignIn) {
// TextInput.finishAutofillContext();
Navigator.of(context).pushNamedAndRemoveUntil(
'/',
(route) => false,
arguments: AuthArguments(
true,
true,
),
);
}
}
}
@@ -371,7 +371,9 @@ class _SignInState extends State<SignIn> {
onKeyEvent: (event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
validateInput();
if (_formKey.currentState!.validate()) {
submitSignInForm();
}
}
},
child: SafeArea(
@@ -407,241 +409,213 @@ class _SignInState extends State<SignIn> {
),
//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,
autoFillHintGroup: const [AutofillHints.email],
textInputAction: TextInputAction.next,
),
),
//spacer
const SizedBox(height: 10),
//password input
SizedBox(
width: 500.0,
child: MIHPassField(
controller: passwordController,
hintText: 'Password',
required: true,
signIn: true,
autoFillHintGroup: const [AutofillHints.password],
),
),
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
MihButton(
onPressed: () {
validateInput();
},
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
width: 300,
child: Text(
"Sign In",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
controller: emailController,
multiLineInput: false,
requiredText: true,
hintText: "Email",
autofillHints: const [AutofillHints.email],
validator: (value) {
return MihValidationServices()
.validateEmail(value);
},
),
),
),
const SizedBox(height: 10),
MihButton(
onPressed: widget.onTap,
buttonColor: MzanziInnovationHub.of(context)!
.theme
.successColor(),
width: 300,
child: Text(
"Create New Account",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
//spacer
const SizedBox(height: 10),
//password input
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
controller: passwordController,
multiLineInput: false,
requiredText: true,
hintText: "Password",
passwordMode: true,
autofillHints: const [AutofillHints.password],
validator: (value) {
return MihValidationServices()
.validatePassword(value);
},
),
),
),
//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,
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()),
.secondaryColor(),
fontWeight: FontWeight.bold,
),
),
),
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: const NeverScrollableScrollPhysics(),
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,
),
),
],
),
),
//spacer
const SizedBox(height: 20),
// sign in button
Center(
child: Wrap(
alignment: WrapAlignment.center,
runAlignment: WrapAlignment.center,
spacing: 10,
runSpacing: 10,
children: [
MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
submitSignInForm();
}
},
buttonColor:
MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
width: 300,
child: Text(
"Sign In",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 10),
MihButton(
onPressed: widget.onTap,
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,
),
),
),
],
),
),
//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)!
.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:
const NeverScrollableScrollPhysics(),
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,
),
),
],
),
),
),
],
),
],
),