added login and 2fa login endpoints, providers and states

This commit is contained in:
AlcalaJulian
2025-12-10 14:56:36 +01:00
parent f8a3b038b6
commit 076951af24
34 changed files with 1624 additions and 851 deletions

View File

@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
class PrimaryButton extends StatelessWidget {
final VoidCallback onPressed;
final VoidCallback? onPressed;
final String text;
final Color color;
final double height;
@@ -9,24 +9,35 @@ class PrimaryButton extends StatelessWidget {
final double size;
final double radius;
final double padding;
final Widget? leading;
final double leadingGap;
const PrimaryButton({
super.key,
required this.onPressed,
required this.text,
required this.color,
this.onPressed,
this.height = 60,
this.width,
this.size = 18,
this.radius = 18,
this.padding = 0,
this.leading,
this.leadingGap = 10,
});
@override
Widget build(BuildContext context) {
final bgResolver = WidgetStateProperty.resolveWith<Color>((states) {
if (states.contains(WidgetState.disabled)) {
return color.withValues(alpha: 0.5);
}
return color;
});
return FilledButton(
style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll<Color>(color),
backgroundColor: bgResolver,
padding: WidgetStatePropertyAll<EdgeInsetsGeometry>(
EdgeInsets.symmetric(horizontal: padding),
),
@@ -40,17 +51,29 @@ class PrimaryButton extends StatelessWidget {
child: SizedBox(
width: width,
height: height,
child: Center(
child: Text(
text,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: size,
fontWeight: FontWeight.w500,
letterSpacing: 0,
color: Colors.white, // theme.getColorFor(ThemeCode.textSecondary)
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
// mainAxisSize: MainAxisSize.min,
children: [
if (leading != null) ...[
IconTheme.merge(
data: const IconThemeData(color: Colors.white, size: 20),
child: leading!,
),
SizedBox(width: leadingGap),
],
Text(
text,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: size,
fontWeight: FontWeight.w500,
letterSpacing: 0,
color: Colors.white,
),
),
),
],
),
),
);

View File

@@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class CustomTextField extends StatefulWidget {
final bool? showPassword;
final bool numeric;
final TextInputType keyboardType;
final TextInputAction? textInputAction;
final ValueChanged<String>? onSubmitted;
final String hint;
final String label;
final int? lines;
@@ -14,7 +15,9 @@ class CustomTextField extends StatefulWidget {
const CustomTextField({
super.key,
this.showPassword,
this.numeric = false,
this.keyboardType = TextInputType.text,
this.textInputAction,
this.onSubmitted,
this.hint = '',
this.label = '',
this.lines,
@@ -49,17 +52,14 @@ class CustomTextFieldState extends State<CustomTextField> {
),
),
TextFormField(
onFieldSubmitted: widget.onSubmitted,
textInputAction: widget.textInputAction,
controller: widget.controller,
keyboardType: widget.numeric
? TextInputType.number
: TextInputType.text,
keyboardType: widget.keyboardType,
obscureText: !_showPassword,
enableSuggestions: _showPassword,
autocorrect: !_showPassword,
style: const TextStyle(color: Color(0xFF4B4B4B)),
inputFormatters: widget.numeric
? <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly]
: const <TextInputFormatter>[],
decoration: InputDecoration(
counterText: "",
hintText: widget.hint,

View File

@@ -93,7 +93,11 @@ void main() {
)
..addScenario(
'numeric',
SizedBox(height: 70, width: 250, child: CustomTextField(numeric: true)),
SizedBox(
height: 70,
width: 250,
child: CustomTextField(keyboardType: TextInputType.number),
),
)
..addScenario(
'password',