clean console problems

This commit is contained in:
AlcalaJulian
2025-12-03 13:57:08 +01:00
parent 8d11c08f81
commit 323e944152
9 changed files with 420 additions and 370 deletions

View File

@@ -38,7 +38,7 @@ class AddKidScreen extends StatelessWidget {
"Si aún no lo tienes, puedes conseguirlo a través de nuestra web", "Si aún no lo tienes, puedes conseguirlo a través de nuestra web",
), ),
Spacer(flex: 8), Spacer(flex: 8),
Container( SizedBox(
width: double.infinity, width: double.infinity,
child: FilledButton( child: FilledButton(
onPressed: () => Navigator.push( onPressed: () => Navigator.push(

View File

@@ -5,88 +5,98 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:navigation/navigation.dart'; import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart'; import 'package:sf_localizations/sf_localizations.dart';
class LoginScreen extends ConsumerWidget { class LoginScreen extends ConsumerStatefulWidget {
final NavigationContract navigationContract; final NavigationContract navigationContract;
const LoginScreen({super.key, required this.navigationContract}); const LoginScreen({super.key, required this.navigationContract});
@override @override
Widget build(BuildContext context, WidgetRef ref) { ConsumerState<LoginScreen> createState() => _LoginScreenState();
bool passwordVisible = true; }
class _LoginScreenState extends ConsumerState<LoginScreen> {
bool passwordVisible = false;
@override
Widget build(BuildContext context) {
// final l10n = SfLocalizations.of(context);
return Scaffold( return Scaffold(
body: Center( body: Center(
child: Container( child: Container(
margin: EdgeInsets.all(30), margin: const EdgeInsets.all(30),
child: Column( child: Column(
spacing: 10, spacing: 10,
children: [ children: [
Icon(Icons.check, color: Color(0xFF329e95), size: 50), const Icon(Icons.check, color: Color(0xFF329e95), size: 50),
Text( const Text(
// context.translate(I18n.example) // example to use Intl package // context.translate(I18n.example)
"¡Te damos la bienvenida!", '¡Te damos la bienvenida!',
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold), style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
), ),
TextField( const TextField(
decoration: InputDecoration( decoration: InputDecoration(
hintText: "Nombre de usuario", hintText: 'Nombre de usuario',
labelText: "Nombre de usuario", labelText: 'Nombre de usuario',
border: OutlineInputBorder(), border: OutlineInputBorder(),
), ),
), ),
TextField( TextField(
obscureText: passwordVisible, obscureText: !passwordVisible,
enableSuggestions: false, enableSuggestions: false,
autocorrect: false, autocorrect: false,
decoration: InputDecoration( decoration: InputDecoration(
labelText: "Contraseña", labelText: 'Contraseña',
hintText: "********", hintText: '********',
border: OutlineInputBorder(), border: const OutlineInputBorder(),
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
passwordVisible ? Icons.visibility : Icons.visibility_off, passwordVisible ? Icons.visibility : Icons.visibility_off,
), ),
onPressed: () { onPressed: () {
// setState(() { setState(() {
// passwordVisible = !passwordVisible; passwordVisible = !passwordVisible;
// }); });
}, },
), ),
), ),
), ),
TextButton( TextButton(
onPressed: () => onPressed: () =>
navigationContract.pushTo(AppRoutes.recoverPassword), widget.navigationContract.pushTo(AppRoutes.recoverPassword),
child: Text("¿Has olvidado la contraseña?"), child: const Text('¿Has olvidado la contraseña?'),
), ),
FilledButton( FilledButton(
onPressed: () => onPressed: () =>
navigationContract.pushTo(AppRoutes.dashboardHome), widget.navigationContract.pushTo(AppRoutes.dashboardHome),
child: Text("Iniciar sesión"), child: const Text('Iniciar sesión'),
), ),
Stack(children: [Divider(), Text("o continúa con")]), const Stack(children: [Divider(), Text('o continúa con')]),
Row( Row(
spacing: 20, spacing: 20,
children: [ children: [
OutlinedButton( OutlinedButton(
onPressed: () => Navigator.push( onPressed: () => Navigator.push(
context, context,
MaterialPageRoute(builder: (_) => LoadingGoogleScreen()), MaterialPageRoute(
builder: (_) => const LoadingGoogleScreen(),
),
), ),
child: Text("Google", semanticsLabel: "Google"), child: const Text('Google', semanticsLabel: 'Google'),
), ),
OutlinedButton( OutlinedButton(
onPressed: () => {}, onPressed: () {},
child: Icon(Icons.apple, semanticLabel: "Apple"), child: const Icon(Icons.apple, semanticLabel: 'Apple'),
), ),
], ],
), ),
Text("¿No tienes cuenta?"), const Text('¿No tienes cuenta?'),
TextButton( TextButton(
onPressed: () => Navigator.push( onPressed: () => Navigator.push(
context, context,
MaterialPageRoute(builder: (_) => SignupScreen()), MaterialPageRoute(builder: (_) => const SignupScreen()),
), ),
child: Text("Crear una ahora"), child: const Text('Crear una ahora'),
), ),
], ],
), ),

View File

@@ -12,26 +12,27 @@ class NewPasswordScreen extends ConsumerStatefulWidget {
class NewPasswordScreenState extends ConsumerState<NewPasswordScreen> { class NewPasswordScreenState extends ConsumerState<NewPasswordScreen> {
bool passwordVisible = false; bool passwordVisible = false;
bool equalPasswords = false; bool equalPasswords = false;
String password = ""; String password = '';
var securityChecks = {
"min": false, Map<String, bool> securityChecks = {
"capital": false, 'min': false,
"number": false, 'capital': false,
"special": false, 'number': false,
'special': false,
}; };
@override @override
void initState() { void initState() {
super.initState();
passwordVisible = false; passwordVisible = false;
equalPasswords = false; equalPasswords = false;
String password = ""; password = '';
securityChecks = { securityChecks = {
"min": false, 'min': false,
"capital": false, 'capital': false,
"number": false, 'number': false,
"special": false, 'special': false,
}; };
super.initState();
} }
@override @override
@@ -40,24 +41,24 @@ class NewPasswordScreenState extends ConsumerState<NewPasswordScreen> {
return Scaffold( return Scaffold(
body: Container( body: Container(
margin: EdgeInsets.all(30), margin: const EdgeInsets.all(30),
child: Center( child: Center(
child: Column( child: Column(
spacing: 10, spacing: 10,
children: [ children: [
Spacer(flex: 4), const Spacer(flex: 4),
Text( const Text(
"Recuperar contraseña", 'Recuperar contraseña',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
), ),
TextField( TextField(
obscureText: passwordVisible, obscureText: !passwordVisible,
enableSuggestions: false, enableSuggestions: false,
autocorrect: false, autocorrect: false,
decoration: InputDecoration( decoration: InputDecoration(
labelText: "Nueva contraseña", labelText: 'Nueva contraseña',
hintText: "********", hintText: '********',
border: OutlineInputBorder(), border: const OutlineInputBorder(),
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
passwordVisible ? Icons.visibility : Icons.visibility_off, passwordVisible ? Icons.visibility : Icons.visibility_off,
@@ -69,21 +70,21 @@ class NewPasswordScreenState extends ConsumerState<NewPasswordScreen> {
}, },
), ),
), ),
onChanged: (value) => { onChanged: (value) {
setState(() { setState(() {
password = value; password = value;
securityChecks = checkSecurity(value); securityChecks = checkSecurity(value);
}), });
}, },
), ),
TextField( TextField(
obscureText: passwordVisible, obscureText: !passwordVisible,
enableSuggestions: false, enableSuggestions: false,
autocorrect: false, autocorrect: false,
decoration: InputDecoration( decoration: InputDecoration(
labelText: "Repetir contraseña", labelText: 'Repetir contraseña',
hintText: "********", hintText: '********',
border: OutlineInputBorder(), border: const OutlineInputBorder(),
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
passwordVisible ? Icons.visibility : Icons.visibility_off, passwordVisible ? Icons.visibility : Icons.visibility_off,
@@ -95,78 +96,82 @@ class NewPasswordScreenState extends ConsumerState<NewPasswordScreen> {
}, },
), ),
), ),
onChanged: (value) => { onChanged: (value) {
setState(() { setState(() {
equalPasswords = password == value; equalPasswords = password == value;
}), });
}, },
), ),
Row( Row(
children: [ children: [
securityChecks["min"]! Icon(
? Icon( securityChecks['min']!
Icons.check, ? Icons.check
color: theme.getColorFor(ThemeCode.buttonPrimary), : Icons.cancel_outlined,
) color: securityChecks['min']!
: Icon( ? theme.getColorFor(ThemeCode.buttonPrimary)
Icons.cancel_outlined, : theme.getColorFor(ThemeCode.buttonSecondary),
color: theme.getColorFor(ThemeCode.buttonSecondary), ),
), const SizedBox(width: 8),
Text("Al menos 8 caracteres"), const Text('Al menos 8 caracteres'),
], ],
), ),
Row( Row(
children: [ children: [
securityChecks["capital"]! Icon(
? Icon( securityChecks['capital']!
Icons.check, ? Icons.check
color: theme.getColorFor(ThemeCode.buttonPrimary), : Icons.cancel_outlined,
) color: securityChecks['capital']!
: Icon( ? theme.getColorFor(ThemeCode.buttonPrimary)
Icons.cancel_outlined, : theme.getColorFor(ThemeCode.buttonSecondary),
color: theme.getColorFor(ThemeCode.buttonSecondary), ),
), const SizedBox(width: 8),
Text("Una mayúscula"), const Text('Una mayúscula'),
], ],
), ),
Row( Row(
children: [ children: [
securityChecks["number"]! Icon(
? Icon( securityChecks['number']!
Icons.check, ? Icons.check
color: theme.getColorFor(ThemeCode.buttonPrimary), : Icons.cancel_outlined,
) color: securityChecks['number']!
: Icon( ? theme.getColorFor(ThemeCode.buttonPrimary)
Icons.cancel_outlined, : theme.getColorFor(ThemeCode.buttonSecondary),
color: theme.getColorFor(ThemeCode.buttonSecondary), ),
), const SizedBox(width: 8),
Text("Un número"), const Text('Un número'),
], ],
), ),
Row( Row(
children: [ children: [
securityChecks["special"]! Icon(
? Icon( securityChecks['special']!
Icons.check, ? Icons.check
color: theme.getColorFor(ThemeCode.buttonPrimary), : Icons.cancel_outlined,
) color: securityChecks['special']!
: Icon( ? theme.getColorFor(ThemeCode.buttonPrimary)
Icons.cancel_outlined, : theme.getColorFor(ThemeCode.buttonSecondary),
color: theme.getColorFor(ThemeCode.buttonSecondary), ),
), const SizedBox(width: 8),
Text("Un carácter especial"), const Text('Un carácter especial'),
], ],
), ),
Spacer(flex: 1), const Spacer(flex: 1),
FilledButton( FilledButton(
onPressed: () => {}, onPressed:
equalPasswords &&
securityChecks.values.every((check) => check)
? () {}
: null,
child: Container( child: Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: Text("Aceptar"), child: const Center(child: Text('Aceptar')),
), ),
), ),
Spacer(flex: 4), const Spacer(flex: 4),
], ],
), ),
), ),
@@ -176,13 +181,11 @@ class NewPasswordScreenState extends ConsumerState<NewPasswordScreen> {
//TODO: Extraer de la vista //TODO: Extraer de la vista
Map<String, bool> checkSecurity(String value) { Map<String, bool> checkSecurity(String value) {
Map<String, bool> checks = {}; return {
'min': value.length >= 8,
checks["min"] = value.length >= 8; 'capital': RegExp(r'[A-Z]').hasMatch(value),
checks["capital"] = RegExp(r'[A-Z]').hasMatch(value); 'number': RegExp(r'[0-9]').hasMatch(value),
checks["number"] = RegExp(r'[0-9]').hasMatch(value); 'special': RegExp(r'[^A-Za-z0-9]').hasMatch(value),
checks["special"] = RegExp(r'[^A-Za-z0-9]').hasMatch(value); };
return checks;
} }
} }

View File

@@ -6,69 +6,79 @@ import 'package:auth/src/sign_up/signup_personal_screen.dart';
import 'package:auth/src/sign_up/signup_user_screen.dart'; import 'package:auth/src/sign_up/signup_user_screen.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
class SignupScreen extends ConsumerWidget { class SignupScreen extends ConsumerStatefulWidget {
SignupScreen({super.key}); const SignupScreen({super.key});
@override
ConsumerState<SignupScreen> createState() => _SignupScreenState();
}
class _SignupScreenState extends ConsumerState<SignupScreen> {
int currentStep = 0; int currentStep = 0;
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context) {
final theme = ref.watch(themePortProvider); final theme = ref.watch(themePortProvider);
return MaterialApp( return Scaffold(
home: Scaffold( body: Center(
body: Center( child: Container(
child: Container( color: theme.getColorFor(ThemeCode.backgroundPrimary),
color: theme.getColorFor(ThemeCode.backgroundPrimary), padding: const EdgeInsets.all(20),
padding: const EdgeInsets.all(20), child: SizedBox(
child: SizedBox( child: Stepper(
child: Stepper( type: StepperType.horizontal,
controlsBuilder: currentStep: currentStep,
(BuildContext context, ControlsDetails controls) { steps: getSteps(),
return Row( controlsBuilder:
children: <Widget>[ (BuildContext context, ControlsDetails controls) {
Expanded( final canGoBack = currentStep > 0;
child: OutlinedButton(
onPressed: controls.onStepCancel, return Row(
child: const Text('Atrás'), children: <Widget>[
), Expanded(
child: OutlinedButton(
onPressed: canGoBack ? controls.onStepCancel : null,
child: const Text('Atrás'),
), ),
Expanded( ),
child: FilledButton( Expanded(
style: ButtonStyle( child: FilledButton(
backgroundColor: WidgetStatePropertyAll<Color>( style: ButtonStyle(
theme.getColorFor(ThemeCode.buttonSecondary), backgroundColor: WidgetStatePropertyAll<Color>(
), theme.getColorFor(ThemeCode.buttonSecondary),
), ),
onPressed: controls.onStepContinue,
child: const Text('Siguiente'),
), ),
onPressed: controls.onStepContinue,
child: const Text('Siguiente'),
), ),
], ),
); ],
},
type: StepperType.horizontal,
currentStep: currentStep,
onStepCancel: () => currentStep == 0,
// ? null
// : setState(() {
// currentStep -= 1;
// }),
onStepContinue: () {
bool isLastStep = (currentStep == getSteps().length - 1);
if (isLastStep) {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (_) => AccountCreatedScreen()),
); );
} else { },
// setState(() { onStepCancel: () {
// currentStep += 1; if (currentStep > 0) {
// }); setState(() {
} currentStep -= 1;
}, });
steps: getSteps(), }
), },
onStepContinue: () {
final isLastStep = currentStep == getSteps().length - 1;
if (isLastStep) {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const AccountCreatedScreen(),
),
);
} else {
setState(() {
currentStep += 1;
});
}
},
), ),
), ),
), ),
@@ -82,55 +92,55 @@ class SignupScreen extends ConsumerWidget {
state: currentStep > 0 ? StepState.complete : StepState.indexed, state: currentStep > 0 ? StepState.complete : StepState.indexed,
isActive: currentStep >= 0, isActive: currentStep >= 0,
stepStyle: currentStep >= 0 stepStyle: currentStep >= 0
? StepStyle( ? const StepStyle(
connectorThickness: 0, connectorThickness: 0,
color: Color(0xFF329e95), color: Color(0xFF329e95),
indexStyle: TextStyle(color: Colors.transparent), indexStyle: TextStyle(color: Colors.transparent),
) )
: StepStyle( : const StepStyle(
connectorThickness: 0, connectorThickness: 0,
color: Colors.transparent, color: Colors.transparent,
boxShadow: BoxShadow(spreadRadius: 5), boxShadow: BoxShadow(spreadRadius: 5),
indexStyle: TextStyle(color: Colors.transparent), indexStyle: TextStyle(color: Colors.transparent),
), ),
title: const Text(""), title: const Text(""),
content: SignupPersonalScreen(), content: const SignupPersonalScreen(),
), ),
Step( Step(
state: currentStep > 1 ? StepState.complete : StepState.indexed, state: currentStep > 1 ? StepState.complete : StepState.indexed,
isActive: currentStep >= 1, isActive: currentStep >= 1,
stepStyle: currentStep >= 1 stepStyle: currentStep >= 1
? StepStyle( ? const StepStyle(
connectorThickness: 0, connectorThickness: 0,
color: Color(0xFF329e95), color: Color(0xFF329e95),
indexStyle: TextStyle(color: Colors.transparent), indexStyle: TextStyle(color: Colors.transparent),
) )
: StepStyle( : const StepStyle(
connectorThickness: 0, connectorThickness: 0,
color: Colors.white, color: Colors.white,
boxShadow: BoxShadow(spreadRadius: 1), boxShadow: BoxShadow(spreadRadius: 1),
indexStyle: TextStyle(color: Colors.transparent), indexStyle: TextStyle(color: Colors.transparent),
), ),
title: const Text(""), title: const Text(""),
content: SignupAddressScreen(), content: const SignupAddressScreen(),
), ),
Step( Step(
state: currentStep > 2 ? StepState.complete : StepState.indexed, state: currentStep > 2 ? StepState.complete : StepState.indexed,
isActive: currentStep >= 2, isActive: currentStep >= 2,
stepStyle: currentStep >= 2 stepStyle: currentStep >= 2
? StepStyle( ? const StepStyle(
connectorThickness: 0, connectorThickness: 0,
color: Color(0xFF329e95), color: Color(0xFF329e95),
indexStyle: TextStyle(color: Colors.transparent), indexStyle: TextStyle(color: Colors.transparent),
) )
: StepStyle( : const StepStyle(
connectorThickness: 0, connectorThickness: 0,
color: Colors.white, color: Colors.white,
boxShadow: BoxShadow(spreadRadius: 1), boxShadow: BoxShadow(spreadRadius: 1),
indexStyle: TextStyle(color: Colors.transparent), indexStyle: TextStyle(color: Colors.transparent),
), ),
title: const Text(""), title: const Text(""),
content: SignupUserScreen(), content: const SignupUserScreen(),
), ),
]; ];
} }

View File

@@ -5,39 +5,44 @@ import 'package:home/src/presentation/wallet_management_layout.dart';
import 'package:sf_shared/sf_shared.dart'; import 'package:sf_shared/sf_shared.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
class DepositScreen extends ConsumerWidget { class DepositScreen extends ConsumerStatefulWidget {
final Kid kid; final Kid kid;
DepositScreen({super.key, required this.kid}); const DepositScreen({super.key, required this.kid});
String reason = "other"; @override
ConsumerState<DepositScreen> createState() => _DepositScreenState();
}
class _DepositScreenState extends ConsumerState<DepositScreen> {
String reason = 'other';
bool program = false; bool program = false;
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context) {
final theme = ref.watch(themePortProvider); final theme = ref.watch(themePortProvider);
return WalletManagementLayout( return WalletManagementLayout(
kid: kid, kid: widget.kid,
footer: Container( footer: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.getColorFor(ThemeCode.backgroundPrimary), color: theme.getColorFor(ThemeCode.backgroundPrimary),
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: const BorderRadius.all(Radius.circular(20)),
), ),
padding: EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Column( child: Column(
children: [ children: [
FilledButton( FilledButton(
onPressed: () => {}, onPressed: () {},
child: Container( child: Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: Center(child: Text("Añadir dinero")), child: const Center(child: Text('Añadir dinero')),
), ),
), ),
TextButton( TextButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
child: Text("Cancelar"), child: const Text('Cancelar'),
), ),
], ],
), ),
@@ -46,87 +51,88 @@ class DepositScreen extends ConsumerWidget {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.getColorFor(ThemeCode.backgroundPrimary), color: theme.getColorFor(ThemeCode.backgroundPrimary),
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: const BorderRadius.all(Radius.circular(20)),
), ),
padding: EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Column( child: Column(
spacing: 10, spacing: 10,
children: [ children: [
Text( const Text(
"Ingresar dinero en el wallet", 'Ingresar dinero en el wallet',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
), ),
TextField( TextField(
decoration: InputDecoration( decoration: const InputDecoration(
labelText: "Cantidad", labelText: 'Cantidad',
hintText: "0€", hintText: '0€',
border: OutlineInputBorder(), border: OutlineInputBorder(),
), ),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly], inputFormatters: [FilteringTextInputFormatter.digitsOnly],
), ),
Align( const Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text("Saldo total disponible después: 30 €"), child: Text('Saldo total disponible después: 30 €'),
), ),
], ],
), ),
), ),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.getColorFor(ThemeCode.backgroundPrimary), color: theme.getColorFor(ThemeCode.backgroundPrimary),
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: const BorderRadius.all(Radius.circular(20)),
), ),
padding: EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Column( child: Column(
spacing: 10, spacing: 10,
children: [ children: [
Text( const Text(
"Motivo", 'Motivo',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
), ),
Text("Este dato aparecerá en el reloj del peque"), const Text('Este dato aparecerá en el reloj del peque'),
CheckboxListTile( CheckboxListTile(
title: Text('Paga semanal'), title: const Text('Paga semanal'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: reason == "weekly", value: reason == 'weekly',
onChanged: (value) { onChanged: (_) {
// setState(() { setState(() {
// reason = "weekly"; reason = 'weekly';
// }); });
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
CheckboxListTile( CheckboxListTile(
title: Text('Objetivo semanal cumplido'), title: const Text('Objetivo semanal cumplido'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: reason == "goal", value: reason == 'goal',
onChanged: (value) { onChanged: (_) {
// setState(() { setState(() {
// reason = "goal"; reason = 'goal';
// }); });
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
CheckboxListTile( CheckboxListTile(
title: Text('Gastos extraordinarios'), title: const Text('Gastos extraordinarios'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: reason == "extraordinary", value: reason == 'extraordinary',
onChanged: (value) { onChanged: (_) {
// setState(() { setState(() {
// reason = "extraordinary"; reason = 'extraordinary';
// }); });
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
CheckboxListTile( CheckboxListTile(
title: Text('Otro'), title: const Text('Otro'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: reason == "other", value: reason == 'other',
onChanged: (value) { onChanged: (_) {
// setState(() { setState(() {
// reason = "other"; reason = 'other';
// }); });
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
@@ -136,55 +142,62 @@ class DepositScreen extends ConsumerWidget {
maxLength: 150, maxLength: 150,
decoration: InputDecoration( decoration: InputDecoration(
labelText: labelText:
"Escribir mensaje a ${kid.name} del motivo del ingreso", 'Escribir mensaje a ${widget.kid.name} del motivo del ingreso',
hintText: "Escribe tu mensaje", hintText: 'Escribe tu mensaje',
border: OutlineInputBorder(), border: const OutlineInputBorder(),
), ),
), ),
Align( const Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text("Máximo 150 caracteres"), child: Text('Máximo 150 caracteres'),
), ),
], ],
), ),
), ),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.getColorFor(ThemeCode.backgroundPrimary), color: theme.getColorFor(ThemeCode.backgroundPrimary),
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: const BorderRadius.all(Radius.circular(20)),
), ),
padding: EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Column( child: Column(
spacing: 10, spacing: 10,
children: [ children: [
Text( const Text(
"Cuándo se envía el dinero", 'Cuándo se envía el dinero',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
), ),
Text("Este dato aparecerá en el reloj del peque"), const Text('Este dato aparecerá en el reloj del peque'),
CheckboxListTile( CheckboxListTile(
title: Text('Ahora'), title: const Text('Ahora'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: program == false, value: !program,
onChanged: (value) { onChanged: (_) {
// setState(() { setState(() {
// program = false; program = false;
// }); });
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
CheckboxListTile( CheckboxListTile(
title: Text('Programar'), title: const Text('Programar'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: program == true, value: program,
onChanged: (value) { onChanged: (_) {
// setState(() { setState(() {
// program = true; program = true;
// }); });
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
if (program) TextField(), if (program)
const TextField(
decoration: InputDecoration(
labelText: 'Fecha / hora (placeholder)',
border: OutlineInputBorder(),
),
),
], ],
), ),
), ),

View File

@@ -204,7 +204,7 @@ class HomeScreen extends ConsumerWidget {
onPressed: () => showDialog( onPressed: () => showDialog(
context: context, context: context,
builder: (BuildContext context) => Dialog( builder: (BuildContext context) => Dialog(
child: Container( child: SizedBox(
height: 100, height: 100,
width: double.infinity, width: double.infinity,
child: Column( child: Column(

View File

@@ -5,29 +5,35 @@ import 'package:home/src/presentation/wallet_management_layout.dart';
import 'package:sf_shared/sf_shared.dart'; import 'package:sf_shared/sf_shared.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
class WageScreen extends ConsumerWidget { class WageScreen extends ConsumerStatefulWidget {
final Kid kid; final Kid kid;
WageScreen({super.key, required this.kid}); const WageScreen({super.key, required this.kid});
String frequence = "weekly"; @override
var conditions = { ConsumerState<WageScreen> createState() => _WageScreenState();
"weeklyLimits": false, }
"incidences": false,
"holidays": false, class _WageScreenState extends ConsumerState<WageScreen> {
String frequence = 'weekly';
final Map<String, bool> conditions = {
'weeklyLimits': false,
'incidences': false,
'holidays': false,
}; };
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context) {
final theme = ref.watch(themePortProvider); final theme = ref.watch(themePortProvider);
return WalletManagementLayout( return WalletManagementLayout(
kid: kid, kid: widget.kid,
footer: Container( footer: Container(
padding: EdgeInsets.all(20), padding: const EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.getColorFor(ThemeCode.backgroundPrimary), color: theme.getColorFor(ThemeCode.backgroundPrimary),
borderRadius: BorderRadius.only( borderRadius: const BorderRadius.only(
topLeft: Radius.circular(20), topLeft: Radius.circular(20),
topRight: Radius.circular(20), topRight: Radius.circular(20),
), ),
@@ -36,14 +42,14 @@ class WageScreen extends ConsumerWidget {
spacing: 10, spacing: 10,
children: [ children: [
FilledButton( FilledButton(
onPressed: () => {}, onPressed: () {},
child: Container( child: Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: Center(child: Text("Activar paga automática")), child: const Center(child: Text('Activar paga automática')),
), ),
), ),
TextButton(onPressed: () => {}, child: Text("Cancelar")), TextButton(onPressed: () {}, child: const Text('Cancelar')),
], ],
), ),
), ),
@@ -51,108 +57,110 @@ class WageScreen extends ConsumerWidget {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.getColorFor(ThemeCode.backgroundPrimary), color: theme.getColorFor(ThemeCode.backgroundPrimary),
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: const BorderRadius.all(Radius.circular(20)),
), ),
padding: EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Column( child: Column(
spacing: 10, spacing: 10,
children: [ children: [
Text( const Text(
"Paga automática", 'Paga automática',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
), ),
TextField( TextField(
decoration: InputDecoration( decoration: const InputDecoration(
labelText: "Cantidad", labelText: 'Cantidad',
hintText: "0€", hintText: '0€',
border: OutlineInputBorder(), border: OutlineInputBorder(),
), ),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly], inputFormatters: [FilteringTextInputFormatter.digitsOnly],
), ),
Text("Saldo total disponible después: 30 €"), const Text('Saldo total disponible después: 30 €'),
], ],
), ),
), ),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.getColorFor(ThemeCode.backgroundPrimary), color: theme.getColorFor(ThemeCode.backgroundPrimary),
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: const BorderRadius.all(Radius.circular(20)),
), ),
padding: EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Column( child: Column(
spacing: 10, spacing: 10,
children: [ children: [
Text( const Text(
"Frecuencia", 'Frecuencia',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
), ),
Text("Cuándo se envía el dinero"), const Text('Cuándo se envía el dinero'),
CheckboxListTile( CheckboxListTile(
title: Text('Semanal'), title: const Text('Semanal'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: frequence == "weekly", value: frequence == 'weekly',
onChanged: (value) { onChanged: (_) {
// setState(() { setState(() {
// frequence = "weekly"; frequence = 'weekly';
// }); });
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
CheckboxListTile( CheckboxListTile(
title: Text('Cada dos semanas'), title: const Text('Cada dos semanas'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: frequence == "biweekly", value: frequence == 'biweekly',
onChanged: (value) { onChanged: (_) {
// setState(() { setState(() {
// frequence = "biweekly"; frequence = 'biweekly';
// }); });
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
CheckboxListTile( CheckboxListTile(
title: Text('Mensual'), title: const Text('Mensual'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: frequence == "monthly", value: frequence == 'monthly',
onChanged: (value) { onChanged: (_) {
// setState(() { setState(() {
// frequence = "monthly"; frequence = 'monthly';
// }); });
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
Container( SizedBox(
width: double.infinity, width: double.infinity,
child: DropdownMenu( child: DropdownMenu<String>(
label: Text("Día de la semana"), label: const Text('Día de la semana'),
initialSelection: "Domingo", initialSelection: 'Domingo',
dropdownMenuEntries: List<DropdownMenuEntry>.generate(7, ( dropdownMenuEntries: () {
int index, const days = [
) { 'Lunes',
final days = [ 'Martes',
"Lunes", 'Miércoles',
"Martes", 'Jueves',
"Miércoles", 'Viernes',
"Jueves", 'Sábado',
"Viernes", 'Domingo',
"Sábado",
"Domingo",
]; ];
return DropdownMenuEntry( return List<DropdownMenuEntry<String>>.generate(
value: days[index], days.length,
label: days[index], (index) => DropdownMenuEntry<String>(
value: days[index],
label: days[index],
),
); );
}), }(),
), ),
), ),
DropdownMenu( DropdownMenu<int>(
label: Text("Hora del día"), label: const Text('Hora del día'),
initialSelection: 9, initialSelection: 9,
dropdownMenuEntries: List<DropdownMenuEntry>.generate(24, ( dropdownMenuEntries: List<DropdownMenuEntry<int>>.generate(
int index, 24,
) { (index) =>
return DropdownMenuEntry(value: index, label: "$index:00"); DropdownMenuEntry<int>(value: index, label: '$index:00'),
}), ),
), ),
TextField( TextField(
minLines: 3, minLines: 3,
@@ -160,62 +168,65 @@ class WageScreen extends ConsumerWidget {
maxLength: 150, maxLength: 150,
decoration: InputDecoration( decoration: InputDecoration(
labelText: labelText:
"Escribir mensaje a ${kid.name} del motivo del ingreso", 'Escribir mensaje a ${widget.kid.name} del motivo del ingreso',
hintText: "Escribe tu mensaje", hintText: 'Escribe tu mensaje',
border: OutlineInputBorder(), border: const OutlineInputBorder(),
), ),
), ),
Align( const Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text("Máximo 150 caracteres"), child: Text('Máximo 150 caracteres'),
), ),
], ],
), ),
), ),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.getColorFor(ThemeCode.backgroundPrimary), color: theme.getColorFor(ThemeCode.backgroundPrimary),
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: const BorderRadius.all(Radius.circular(20)),
), ),
padding: EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Column( child: Column(
spacing: 10, spacing: 10,
children: [ children: [
Text( const Text(
"Condiciones", 'Condiciones',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
), ),
Text("Este dato aparecerá en el reloj del peque"), const Text('Este dato aparecerá en el reloj del peque'),
CheckboxListTile( CheckboxListTile(
title: Text('Sólo si cumple límites semanales'), title: const Text('Sólo si cumple límites semanales'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: conditions["weeklyLimits"], value: conditions['weeklyLimits'],
onChanged: (value) { onChanged: (_) {
// setState(() { setState(() {
// conditions["weeklyLimits"] = !conditions["weeklyLimits"]!; conditions['weeklyLimits'] =
// }); !(conditions['weeklyLimits'] ?? false);
});
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
CheckboxListTile( CheckboxListTile(
title: Text('Sólo si no ha tenido incidencias'), title: const Text('Sólo si no ha tenido incidencias'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: conditions["incidences"], value: conditions['incidences'],
onChanged: (value) { onChanged: (_) {
// setState(() { setState(() {
// conditions["incidences"] = !conditions["incidences"]!; conditions['incidences'] =
// }); !(conditions['incidences'] ?? false);
});
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
CheckboxListTile( CheckboxListTile(
title: Text('Pausar durante vacaciones'), title: const Text('Pausar durante vacaciones'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: conditions["holidays"], value: conditions['holidays'],
onChanged: (value) { onChanged: (_) {
// setState(() { setState(() {
// conditions["holidays"] = !conditions["holidays"]!; conditions['holidays'] = !(conditions['holidays'] ?? false);
// }); });
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
), ),

View File

@@ -4,9 +4,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
class ActivityList extends ConsumerStatefulWidget { class ActivityList extends ConsumerStatefulWidget {
final List activity; final List activity;
bool edit = false; final bool edit;
ActivityList({super.key, required this.activity, required this.edit}); const ActivityList({super.key, required this.activity, this.edit = false});
@override @override
ConsumerState<ActivityList> createState() => ActivityListState(); ConsumerState<ActivityList> createState() => ActivityListState();
@@ -17,27 +17,29 @@ class ActivityListState extends ConsumerState<ActivityList> {
@override @override
void initState() { void initState() {
values = List<bool>.generate(widget.activity.length, (_) => false);
super.initState(); super.initState();
values = List<bool>.generate(widget.activity.length, (_) => false);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = ref.watch(themePortProvider); final theme = ref.watch(themePortProvider);
final colors = [ const colors = [
Colors.cyan, Colors.cyan,
Colors.pinkAccent, Colors.pinkAccent,
Colors.deepOrangeAccent, Colors.deepOrangeAccent,
Colors.red, Colors.red,
]; ];
final icons = {
const icons = {
"wage": Icons.wallet, "wage": Icons.wallet,
"goal": Icons.emoji_events_outlined, "goal": Icons.emoji_events_outlined,
"lock": Icons.lock_outline, "lock": Icons.lock_outline,
"reload": Icons.attach_money_outlined, "reload": Icons.attach_money_outlined,
}; };
final titles = {
const titles = {
"wage": "Entrega de paga", "wage": "Entrega de paga",
"goal": "¡Objetivo cumplido!", "goal": "¡Objetivo cumplido!",
"lock": "Bloqueo de pago", "lock": "Bloqueo de pago",
@@ -47,33 +49,35 @@ class ActivityListState extends ConsumerState<ActivityList> {
return Column( return Column(
spacing: 20, spacing: 20,
children: List<Widget>.generate(widget.activity.length, (int index) { children: List<Widget>.generate(widget.activity.length, (int index) {
var logItem = Container( final color = colors[index % colors.length];
padding: EdgeInsets.all(20), final type = widget.activity[index]["type"] as String;
final logItem = Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.getColorFor(ThemeCode.backgroundPrimary), color: theme.getColorFor(ThemeCode.backgroundPrimary),
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: const BorderRadius.all(Radius.circular(20)),
border: BoxBorder.fromLTRB( border: Border(left: BorderSide(color: color, width: 5)),
left: BorderSide(color: colors[index % colors.length], width: 5),
),
), ),
child: Column( child: Column(
spacing: 15, spacing: 15,
children: [ children: [
Row( Row(
children: [ children: [
Icon( Icon(icons[type], color: color),
icons[widget.activity[index]["type"]], const SizedBox(width: 8),
color: colors[index % colors.length],
),
Text( Text(
titles[widget.activity[index]["type"]]!, titles[type]!,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16), style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
),
), ),
Spacer(), const Spacer(),
Text("14/01/2005"), const Text("14/01/2005"),
], ],
), ),
Align( const Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text("Ana ya tiene su paga de 5€ en el reloj"), child: Text("Ana ya tiene su paga de 5€ en el reloj"),
), ),
@@ -86,10 +90,10 @@ class ActivityListState extends ConsumerState<ActivityList> {
children: [ children: [
Checkbox( Checkbox(
value: values[index], value: values[index],
onChanged: (value) => { onChanged: (_) {
setState(() { setState(() {
values[index] = !values[index]; values[index] = !values[index];
}), });
}, },
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
semanticLabel: "Eliminar", semanticLabel: "Eliminar",

View File

@@ -1,6 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:notifications/notifications.dart';
import 'package:profile/profile.dart'; import 'package:profile/profile.dart';
class ProfileBuilder { class ProfileBuilder {