create new MIH Button

This commit is contained in:
2025-05-29 10:55:51 +02:00
parent 3d75efb0bb
commit c0a35411b5
46 changed files with 1704 additions and 2633 deletions

View File

@@ -1,9 +1,9 @@
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_action.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_body.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_header.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_layout_builder.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_package_alert.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_profile_getter.dart';
@@ -114,6 +114,7 @@ class _BiometricCheckState extends State<BiometricCheck> {
),
alertTitle: "Biometric Authentication Error",
alertBody: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Hi there! To jump into the MIH Home Package, you'll need to authenticate yourself with your phones biometrics, please set up biometric authentication (like fingerprint, face ID, pattern or pin) on your device first.\n\nIf you have already set up biometric authentication, press \"Authenticate now\" to try again or press \"Set Up Authentication\" to go to your device settings.",
@@ -124,38 +125,51 @@ class _BiometricCheckState extends State<BiometricCheck> {
),
const SizedBox(height: 20),
Wrap(
runAlignment: WrapAlignment.center,
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 10,
runSpacing: 10,
children: [
SizedBox(
MihButton(
onPressed: () {
AppSettings.openAppSettings(
type: AppSettingsType.security,
);
Navigator.of(context).pop();
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
width: 300,
child: MIHButton(
onTap: () {
AppSettings.openAppSettings(
type: AppSettingsType.security,
);
Navigator.of(context).pop();
},
buttonText: "Set Up Authentication",
buttonColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
child: Text(
"Set Up Authentication",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
MihButton(
onPressed: () {
Navigator.of(context).pop();
authenticateUser();
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Authenticate Now",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
SizedBox(
width: 300,
child: MIHButton(
onTap: () {
Navigator.of(context).pop();
authenticateUser();
},
buttonText: "Authenticate Now",
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
)
],
),
alertColour: MzanziInnovationHub.of(context)!.theme.errorColor(),
@@ -209,32 +223,22 @@ class _BiometricCheckState extends State<BiometricCheck> {
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
// if (_isBioAuthenticated)
// Icon(
// Icons.lock_open,
// size: 200,
// color: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// ),
const SizedBox(height: 30),
Container(
alignment: Alignment.bottomCenter,
child: SizedBox(
width: 500.0,
height: 50.0,
child: MIHButton(
buttonText: "Authenticate Now",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!
MihButton(
onPressed: () {
authenticateUser();
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Authenticate Now",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
onTap: () async {
//Check Biometrics
authenticateUser();
},
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),

View File

@@ -2,10 +2,10 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/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_package_alert.dart';
import '../../main.dart';
import 'package:supertokens_flutter/http.dart' as http;
import '../../mih_components/mih_inputs_and_buttons/mih_button.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';
@@ -86,102 +86,53 @@ class _ForgotPasswordState extends State<ForgotPassword> {
showDialog(
context: context,
builder: (context) {
return Dialog(
child: Stack(
return MihPackageAlert(
alertIcon: Icon(
Icons.warning_amber_rounded,
size: 100,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
alertTitle: "Password Reset Confirmation",
alertBody: Column(
//mainAxisSize: MainAxisSize.max,
children: [
Container(
padding: const EdgeInsets.all(10.0),
width: 500.0,
height: 450,
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
width: 5.0),
),
child: SingleChildScrollView(
child: Column(
//mainAxisSize: MainAxisSize.max,
children: [
Icon(
Icons.warning_amber_rounded,
size: 100,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
const SizedBox(height: 15),
Text(
" Password Reset Confirmation",
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 15),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Text(
"Before you reset your password, please be aware that you'll receive an email with a link to confirm your identity and set a new password. Make sure to check your inbox, including spam or junk folders. If you don't receive the email within a few minutes, please try resending the reset request.",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 25),
SizedBox(
width: 500.0,
height: 50.0,
child: MIHButton(
buttonText: "Continue",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
onTap: () {
setState(() {
acceptWarning = true;
});
Navigator.of(context).pop();
validateInput();
},
),
),
],
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Text(
"Before you reset your password, please be aware that you'll receive an email with a link to confirm your identity and set a new password. Make sure to check your inbox, including spam or junk folders. If you don't receive the email within a few minutes, please try resending the reset request.",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
),
Positioned(
top: 5,
right: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.close,
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
size: 35,
const SizedBox(height: 25),
MihButton(
onPressed: () {
setState(() {
acceptWarning = true;
});
Navigator.of(context).pop();
validateInput();
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Continue",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
alertColour: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
);
},
);
@@ -308,22 +259,24 @@ class _ForgotPasswordState extends State<ForgotPassword> {
),
//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();
},
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)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],

View File

@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
import 'package:flutter/material.dart';
@@ -10,7 +11,6 @@ import '../../main.dart';
import 'package:supertokens_flutter/http.dart' as http;
import 'package:supertokens_flutter/supertokens.dart';
import '../../mih_components/mih_inputs_and_buttons/mih_button.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';
@@ -245,19 +245,23 @@ class _RegisterState extends State<Register> {
child: MIHAction(
icon: Padding(
padding: const EdgeInsets.all(10.0),
child: SizedBox(
width: 150,
child: MIHButton(
onTap: () {
Navigator.of(context).pushNamed(
'/about',
arguments: 0,
);
},
buttonText: "Install MIH",
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
child: MihButton(
onPressed: () {
Navigator.of(context).pushNamed(
'/about',
arguments: 0,
);
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Install MIH",
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
@@ -345,7 +349,7 @@ class _RegisterState extends State<Register> {
const SizedBox(height: 10),
//Heading
Text(
'Create a New Account',
'Create an Account',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
@@ -391,40 +395,28 @@ class _RegisterState extends State<Register> {
),
),
//spacer
const SizedBox(height: 30),
const SizedBox(height: 25),
// sign up button
SizedBox(
width: 500.0,
height: 50.0,
child: MIHButton(
buttonText: "Create New Account",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.successColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
onTap: () async {
validateInput();
},
MihButton(
onPressed: () {
validateInput();
},
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),
// 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: widget.onTap,
// ),
// ),
// const SizedBox(height: 10),
//register text
SizedBox(
width: 500.0,

View File

@@ -2,10 +2,9 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
import '../../main.dart';
import 'package:supertokens_flutter/http.dart' as http;
import '../../mih_components/mih_inputs_and_buttons/mih_button.dart';
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';
@@ -102,111 +101,6 @@ class _ResetPasswordState extends State<ResetPassword> {
return MzanziInnovationHub.of(context)!.theme.primaryColor();
}
void prePassResteWarning() {
showDialog(
context: context,
builder: (context) {
return Dialog(
child: Stack(
children: [
Container(
padding: const EdgeInsets.all(10.0),
width: 500.0,
height: 450,
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
width: 5.0),
),
child: SingleChildScrollView(
child: Column(
//mainAxisSize: MainAxisSize.max,
children: [
Icon(
Icons.warning_amber_rounded,
size: 100,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
const SizedBox(height: 15),
Text(
"Password Reset Confirmation",
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 15),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Text(
"Before you reset your password, please be aware that you'll receive an email with a link to confirm your identity and set a new password. Make sure to check your inbox, including spam or junk folders. If you don't receive the email within a few minutes, please try resending the reset request.",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 25),
SizedBox(
width: 500.0,
height: 50.0,
child: MIHButton(
buttonText: "Continue",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
onTap: () {
setState(() {
acceptWarning = true;
});
Navigator.of(context).pop();
validateInput();
},
),
),
],
),
),
),
Positioned(
top: 5,
right: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.close,
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
size: 35,
),
),
),
],
),
);
},
);
}
void loginError() {
showDialog(
context: context,
@@ -372,22 +266,25 @@ class _ResetPasswordState extends State<ResetPassword> {
),
//spacer
const SizedBox(height: 30),
const SizedBox(height: 25),
// 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();
},
MihButton(
onPressed: () {
validateInput();
},
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,12 +1,11 @@
import 'dart:convert';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.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_button.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';
@@ -19,7 +18,7 @@ import '../../mih_components/mih_pop_up_messages/mih_loading_circle.dart';
import '../../mih_env/env.dart';
class SignIn extends StatefulWidget {
final Function()? onTap;
final Function() onTap;
const SignIn({super.key, required this.onTap});
@override
@@ -292,19 +291,23 @@ class _SignInState extends State<SignIn> {
child: MIHAction(
icon: Padding(
padding: const EdgeInsets.all(10.0),
child: SizedBox(
width: 150,
child: MIHButton(
onTap: () {
Navigator.of(context).pushNamed(
'/about',
arguments: 0,
);
},
buttonText: "Install MIH",
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
child: MihButton(
onPressed: () {
Navigator.of(context).pushNamed(
'/about',
arguments: 0,
);
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Install MIH",
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
@@ -486,36 +489,41 @@ class _SignInState extends State<SignIn> {
//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();
},
MihButton(
onPressed: () {
validateInput();
},
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,
),
),
),
//spacer
const SizedBox(height: 10),
SizedBox(
width: 500.0,
height: 50.0,
child: MIHButton(
buttonText: "Create New Account",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.successColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
onTap: widget.onTap,
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