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",
),
Spacer(flex: 8),
Container(
SizedBox(
width: double.infinity,
child: FilledButton(
onPressed: () => Navigator.push(

View File

@@ -5,88 +5,98 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
class LoginScreen extends ConsumerWidget {
class LoginScreen extends ConsumerStatefulWidget {
final NavigationContract navigationContract;
const LoginScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
bool passwordVisible = true;
ConsumerState<LoginScreen> createState() => _LoginScreenState();
}
class _LoginScreenState extends ConsumerState<LoginScreen> {
bool passwordVisible = false;
@override
Widget build(BuildContext context) {
// final l10n = SfLocalizations.of(context);
return Scaffold(
body: Center(
child: Container(
margin: EdgeInsets.all(30),
margin: const EdgeInsets.all(30),
child: Column(
spacing: 10,
children: [
Icon(Icons.check, color: Color(0xFF329e95), size: 50),
Text(
// context.translate(I18n.example) // example to use Intl package
"¡Te damos la bienvenida!",
const Icon(Icons.check, color: Color(0xFF329e95), size: 50),
const Text(
// context.translate(I18n.example)
'¡Te damos la bienvenida!',
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
TextField(
const TextField(
decoration: InputDecoration(
hintText: "Nombre de usuario",
labelText: "Nombre de usuario",
hintText: 'Nombre de usuario',
labelText: 'Nombre de usuario',
border: OutlineInputBorder(),
),
),
TextField(
obscureText: passwordVisible,
obscureText: !passwordVisible,
enableSuggestions: false,
autocorrect: false,
decoration: InputDecoration(
labelText: "Contraseña",
hintText: "********",
border: OutlineInputBorder(),
labelText: 'Contraseña',
hintText: '********',
border: const OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(
passwordVisible ? Icons.visibility : Icons.visibility_off,
),
onPressed: () {
// setState(() {
// passwordVisible = !passwordVisible;
// });
setState(() {
passwordVisible = !passwordVisible;
});
},
),
),
),
TextButton(
onPressed: () =>
navigationContract.pushTo(AppRoutes.recoverPassword),
child: Text("¿Has olvidado la contraseña?"),
widget.navigationContract.pushTo(AppRoutes.recoverPassword),
child: const Text('¿Has olvidado la contraseña?'),
),
FilledButton(
onPressed: () =>
navigationContract.pushTo(AppRoutes.dashboardHome),
child: Text("Iniciar sesión"),
widget.navigationContract.pushTo(AppRoutes.dashboardHome),
child: const Text('Iniciar sesión'),
),
Stack(children: [Divider(), Text("o continúa con")]),
const Stack(children: [Divider(), Text('o continúa con')]),
Row(
spacing: 20,
children: [
OutlinedButton(
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => LoadingGoogleScreen()),
MaterialPageRoute(
builder: (_) => const LoadingGoogleScreen(),
),
),
child: Text("Google", semanticsLabel: "Google"),
child: const Text('Google', semanticsLabel: 'Google'),
),
OutlinedButton(
onPressed: () => {},
child: Icon(Icons.apple, semanticLabel: "Apple"),
onPressed: () {},
child: const Icon(Icons.apple, semanticLabel: 'Apple'),
),
],
),
Text("¿No tienes cuenta?"),
const Text('¿No tienes cuenta?'),
TextButton(
onPressed: () => Navigator.push(
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> {
bool passwordVisible = false;
bool equalPasswords = false;
String password = "";
var securityChecks = {
"min": false,
"capital": false,
"number": false,
"special": false,
String password = '';
Map<String, bool> securityChecks = {
'min': false,
'capital': false,
'number': false,
'special': false,
};
@override
void initState() {
super.initState();
passwordVisible = false;
equalPasswords = false;
String password = "";
password = '';
securityChecks = {
"min": false,
"capital": false,
"number": false,
"special": false,
'min': false,
'capital': false,
'number': false,
'special': false,
};
super.initState();
}
@override
@@ -40,24 +41,24 @@ class NewPasswordScreenState extends ConsumerState<NewPasswordScreen> {
return Scaffold(
body: Container(
margin: EdgeInsets.all(30),
margin: const EdgeInsets.all(30),
child: Center(
child: Column(
spacing: 10,
children: [
Spacer(flex: 4),
Text(
"Recuperar contraseña",
const Spacer(flex: 4),
const Text(
'Recuperar contraseña',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
),
TextField(
obscureText: passwordVisible,
obscureText: !passwordVisible,
enableSuggestions: false,
autocorrect: false,
decoration: InputDecoration(
labelText: "Nueva contraseña",
hintText: "********",
border: OutlineInputBorder(),
labelText: 'Nueva contraseña',
hintText: '********',
border: const OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(
passwordVisible ? Icons.visibility : Icons.visibility_off,
@@ -69,21 +70,21 @@ class NewPasswordScreenState extends ConsumerState<NewPasswordScreen> {
},
),
),
onChanged: (value) => {
onChanged: (value) {
setState(() {
password = value;
securityChecks = checkSecurity(value);
}),
});
},
),
TextField(
obscureText: passwordVisible,
obscureText: !passwordVisible,
enableSuggestions: false,
autocorrect: false,
decoration: InputDecoration(
labelText: "Repetir contraseña",
hintText: "********",
border: OutlineInputBorder(),
labelText: 'Repetir contraseña',
hintText: '********',
border: const OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(
passwordVisible ? Icons.visibility : Icons.visibility_off,
@@ -95,78 +96,82 @@ class NewPasswordScreenState extends ConsumerState<NewPasswordScreen> {
},
),
),
onChanged: (value) => {
onChanged: (value) {
setState(() {
equalPasswords = password == value;
}),
});
},
),
Row(
children: [
securityChecks["min"]!
? Icon(
Icons.check,
color: theme.getColorFor(ThemeCode.buttonPrimary),
)
: Icon(
Icons.cancel_outlined,
color: theme.getColorFor(ThemeCode.buttonSecondary),
),
Text("Al menos 8 caracteres"),
Icon(
securityChecks['min']!
? Icons.check
: Icons.cancel_outlined,
color: securityChecks['min']!
? theme.getColorFor(ThemeCode.buttonPrimary)
: theme.getColorFor(ThemeCode.buttonSecondary),
),
const SizedBox(width: 8),
const Text('Al menos 8 caracteres'),
],
),
Row(
children: [
securityChecks["capital"]!
? Icon(
Icons.check,
color: theme.getColorFor(ThemeCode.buttonPrimary),
)
: Icon(
Icons.cancel_outlined,
color: theme.getColorFor(ThemeCode.buttonSecondary),
),
Text("Una mayúscula"),
Icon(
securityChecks['capital']!
? Icons.check
: Icons.cancel_outlined,
color: securityChecks['capital']!
? theme.getColorFor(ThemeCode.buttonPrimary)
: theme.getColorFor(ThemeCode.buttonSecondary),
),
const SizedBox(width: 8),
const Text('Una mayúscula'),
],
),
Row(
children: [
securityChecks["number"]!
? Icon(
Icons.check,
color: theme.getColorFor(ThemeCode.buttonPrimary),
)
: Icon(
Icons.cancel_outlined,
color: theme.getColorFor(ThemeCode.buttonSecondary),
),
Text("Un número"),
Icon(
securityChecks['number']!
? Icons.check
: Icons.cancel_outlined,
color: securityChecks['number']!
? theme.getColorFor(ThemeCode.buttonPrimary)
: theme.getColorFor(ThemeCode.buttonSecondary),
),
const SizedBox(width: 8),
const Text('Un número'),
],
),
Row(
children: [
securityChecks["special"]!
? Icon(
Icons.check,
color: theme.getColorFor(ThemeCode.buttonPrimary),
)
: Icon(
Icons.cancel_outlined,
color: theme.getColorFor(ThemeCode.buttonSecondary),
),
Text("Un carácter especial"),
Icon(
securityChecks['special']!
? Icons.check
: Icons.cancel_outlined,
color: securityChecks['special']!
? theme.getColorFor(ThemeCode.buttonPrimary)
: theme.getColorFor(ThemeCode.buttonSecondary),
),
const SizedBox(width: 8),
const Text('Un carácter especial'),
],
),
Spacer(flex: 1),
const Spacer(flex: 1),
FilledButton(
onPressed: () => {},
onPressed:
equalPasswords &&
securityChecks.values.every((check) => check)
? () {}
: null,
child: Container(
width: double.infinity,
padding: EdgeInsets.all(20),
child: Text("Aceptar"),
padding: const EdgeInsets.all(20),
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
Map<String, bool> checkSecurity(String value) {
Map<String, bool> checks = {};
checks["min"] = value.length >= 8;
checks["capital"] = RegExp(r'[A-Z]').hasMatch(value);
checks["number"] = RegExp(r'[0-9]').hasMatch(value);
checks["special"] = RegExp(r'[^A-Za-z0-9]').hasMatch(value);
return checks;
return {
'min': value.length >= 8,
'capital': RegExp(r'[A-Z]').hasMatch(value),
'number': RegExp(r'[0-9]').hasMatch(value),
'special': RegExp(r'[^A-Za-z0-9]').hasMatch(value),
};
}
}

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:flutter_riverpod/flutter_riverpod.dart';
class SignupScreen extends ConsumerWidget {
SignupScreen({super.key});
class SignupScreen extends ConsumerStatefulWidget {
const SignupScreen({super.key});
@override
ConsumerState<SignupScreen> createState() => _SignupScreenState();
}
class _SignupScreenState extends ConsumerState<SignupScreen> {
int currentStep = 0;
@override
Widget build(BuildContext context, WidgetRef ref) {
Widget build(BuildContext context) {
final theme = ref.watch(themePortProvider);
return MaterialApp(
home: Scaffold(
body: Center(
child: Container(
color: theme.getColorFor(ThemeCode.backgroundPrimary),
padding: const EdgeInsets.all(20),
child: SizedBox(
child: Stepper(
controlsBuilder:
(BuildContext context, ControlsDetails controls) {
return Row(
children: <Widget>[
Expanded(
child: OutlinedButton(
onPressed: controls.onStepCancel,
child: const Text('Atrás'),
),
return Scaffold(
body: Center(
child: Container(
color: theme.getColorFor(ThemeCode.backgroundPrimary),
padding: const EdgeInsets.all(20),
child: SizedBox(
child: Stepper(
type: StepperType.horizontal,
currentStep: currentStep,
steps: getSteps(),
controlsBuilder:
(BuildContext context, ControlsDetails controls) {
final canGoBack = currentStep > 0;
return Row(
children: <Widget>[
Expanded(
child: OutlinedButton(
onPressed: canGoBack ? controls.onStepCancel : null,
child: const Text('Atrás'),
),
Expanded(
child: FilledButton(
style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll<Color>(
theme.getColorFor(ThemeCode.buttonSecondary),
),
),
Expanded(
child: FilledButton(
style: ButtonStyle(
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(() {
// currentStep += 1;
// });
}
},
steps: getSteps(),
),
},
onStepCancel: () {
if (currentStep > 0) {
setState(() {
currentStep -= 1;
});
}
},
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,
isActive: currentStep >= 0,
stepStyle: currentStep >= 0
? StepStyle(
? const StepStyle(
connectorThickness: 0,
color: Color(0xFF329e95),
indexStyle: TextStyle(color: Colors.transparent),
)
: StepStyle(
: const StepStyle(
connectorThickness: 0,
color: Colors.transparent,
boxShadow: BoxShadow(spreadRadius: 5),
indexStyle: TextStyle(color: Colors.transparent),
),
title: const Text(""),
content: SignupPersonalScreen(),
content: const SignupPersonalScreen(),
),
Step(
state: currentStep > 1 ? StepState.complete : StepState.indexed,
isActive: currentStep >= 1,
stepStyle: currentStep >= 1
? StepStyle(
? const StepStyle(
connectorThickness: 0,
color: Color(0xFF329e95),
indexStyle: TextStyle(color: Colors.transparent),
)
: StepStyle(
: const StepStyle(
connectorThickness: 0,
color: Colors.white,
boxShadow: BoxShadow(spreadRadius: 1),
indexStyle: TextStyle(color: Colors.transparent),
),
title: const Text(""),
content: SignupAddressScreen(),
content: const SignupAddressScreen(),
),
Step(
state: currentStep > 2 ? StepState.complete : StepState.indexed,
isActive: currentStep >= 2,
stepStyle: currentStep >= 2
? StepStyle(
? const StepStyle(
connectorThickness: 0,
color: Color(0xFF329e95),
indexStyle: TextStyle(color: Colors.transparent),
)
: StepStyle(
: const StepStyle(
connectorThickness: 0,
color: Colors.white,
boxShadow: BoxShadow(spreadRadius: 1),
indexStyle: TextStyle(color: Colors.transparent),
),
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:flutter_riverpod/flutter_riverpod.dart';
class DepositScreen extends ConsumerWidget {
class DepositScreen extends ConsumerStatefulWidget {
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;
@override
Widget build(BuildContext context, WidgetRef ref) {
Widget build(BuildContext context) {
final theme = ref.watch(themePortProvider);
return WalletManagementLayout(
kid: kid,
kid: widget.kid,
footer: Container(
decoration: BoxDecoration(
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(
children: [
FilledButton(
onPressed: () => {},
onPressed: () {},
child: Container(
width: double.infinity,
padding: EdgeInsets.all(20),
child: Center(child: Text("Añadir dinero")),
padding: const EdgeInsets.all(20),
child: const Center(child: Text('Añadir dinero')),
),
),
TextButton(
onPressed: () => Navigator.pop(context),
child: Text("Cancelar"),
child: const Text('Cancelar'),
),
],
),
@@ -46,87 +51,88 @@ class DepositScreen extends ConsumerWidget {
Container(
decoration: BoxDecoration(
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(
spacing: 10,
children: [
Text(
"Ingresar dinero en el wallet",
const Text(
'Ingresar dinero en el wallet',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
TextField(
decoration: InputDecoration(
labelText: "Cantidad",
hintText: "0€",
decoration: const InputDecoration(
labelText: 'Cantidad',
hintText: '0€',
border: OutlineInputBorder(),
),
keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
),
Align(
const Align(
alignment: Alignment.topLeft,
child: Text("Saldo total disponible después: 30 €"),
child: Text('Saldo total disponible después: 30 €'),
),
],
),
),
Container(
decoration: BoxDecoration(
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(
spacing: 10,
children: [
Text(
"Motivo",
const Text(
'Motivo',
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(
title: Text('Paga semanal'),
title: const Text('Paga semanal'),
controlAffinity: ListTileControlAffinity.leading,
value: reason == "weekly",
onChanged: (value) {
// setState(() {
// reason = "weekly";
// });
value: reason == 'weekly',
onChanged: (_) {
setState(() {
reason = 'weekly';
});
},
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
),
CheckboxListTile(
title: Text('Objetivo semanal cumplido'),
title: const Text('Objetivo semanal cumplido'),
controlAffinity: ListTileControlAffinity.leading,
value: reason == "goal",
onChanged: (value) {
// setState(() {
// reason = "goal";
// });
value: reason == 'goal',
onChanged: (_) {
setState(() {
reason = 'goal';
});
},
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
),
CheckboxListTile(
title: Text('Gastos extraordinarios'),
title: const Text('Gastos extraordinarios'),
controlAffinity: ListTileControlAffinity.leading,
value: reason == "extraordinary",
onChanged: (value) {
// setState(() {
// reason = "extraordinary";
// });
value: reason == 'extraordinary',
onChanged: (_) {
setState(() {
reason = 'extraordinary';
});
},
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
),
CheckboxListTile(
title: Text('Otro'),
title: const Text('Otro'),
controlAffinity: ListTileControlAffinity.leading,
value: reason == "other",
onChanged: (value) {
// setState(() {
// reason = "other";
// });
value: reason == 'other',
onChanged: (_) {
setState(() {
reason = 'other';
});
},
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
),
@@ -136,55 +142,62 @@ class DepositScreen extends ConsumerWidget {
maxLength: 150,
decoration: InputDecoration(
labelText:
"Escribir mensaje a ${kid.name} del motivo del ingreso",
hintText: "Escribe tu mensaje",
border: OutlineInputBorder(),
'Escribir mensaje a ${widget.kid.name} del motivo del ingreso',
hintText: 'Escribe tu mensaje',
border: const OutlineInputBorder(),
),
),
Align(
const Align(
alignment: Alignment.topLeft,
child: Text("Máximo 150 caracteres"),
child: Text('Máximo 150 caracteres'),
),
],
),
),
Container(
decoration: BoxDecoration(
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(
spacing: 10,
children: [
Text(
"Cuándo se envía el dinero",
const Text(
'Cuándo se envía el dinero',
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(
title: Text('Ahora'),
title: const Text('Ahora'),
controlAffinity: ListTileControlAffinity.leading,
value: program == false,
onChanged: (value) {
// setState(() {
// program = false;
// });
value: !program,
onChanged: (_) {
setState(() {
program = false;
});
},
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
),
CheckboxListTile(
title: Text('Programar'),
title: const Text('Programar'),
controlAffinity: ListTileControlAffinity.leading,
value: program == true,
onChanged: (value) {
// setState(() {
// program = true;
// });
value: program,
onChanged: (_) {
setState(() {
program = true;
});
},
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(
context: context,
builder: (BuildContext context) => Dialog(
child: Container(
child: SizedBox(
height: 100,
width: double.infinity,
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:flutter_riverpod/flutter_riverpod.dart';
class WageScreen extends ConsumerWidget {
class WageScreen extends ConsumerStatefulWidget {
final Kid kid;
WageScreen({super.key, required this.kid});
const WageScreen({super.key, required this.kid});
String frequence = "weekly";
var conditions = {
"weeklyLimits": false,
"incidences": false,
"holidays": false,
@override
ConsumerState<WageScreen> createState() => _WageScreenState();
}
class _WageScreenState extends ConsumerState<WageScreen> {
String frequence = 'weekly';
final Map<String, bool> conditions = {
'weeklyLimits': false,
'incidences': false,
'holidays': false,
};
@override
Widget build(BuildContext context, WidgetRef ref) {
Widget build(BuildContext context) {
final theme = ref.watch(themePortProvider);
return WalletManagementLayout(
kid: kid,
kid: widget.kid,
footer: Container(
padding: EdgeInsets.all(20),
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: theme.getColorFor(ThemeCode.backgroundPrimary),
borderRadius: BorderRadius.only(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
@@ -36,14 +42,14 @@ class WageScreen extends ConsumerWidget {
spacing: 10,
children: [
FilledButton(
onPressed: () => {},
onPressed: () {},
child: Container(
width: double.infinity,
padding: EdgeInsets.all(20),
child: Center(child: Text("Activar paga automática")),
padding: const EdgeInsets.all(20),
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(
decoration: BoxDecoration(
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(
spacing: 10,
children: [
Text(
"Paga automática",
const Text(
'Paga automática',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
TextField(
decoration: InputDecoration(
labelText: "Cantidad",
hintText: "0€",
decoration: const InputDecoration(
labelText: 'Cantidad',
hintText: '0€',
border: OutlineInputBorder(),
),
keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
),
Text("Saldo total disponible después: 30 €"),
const Text('Saldo total disponible después: 30 €'),
],
),
),
Container(
decoration: BoxDecoration(
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(
spacing: 10,
children: [
Text(
"Frecuencia",
const Text(
'Frecuencia',
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(
title: Text('Semanal'),
title: const Text('Semanal'),
controlAffinity: ListTileControlAffinity.leading,
value: frequence == "weekly",
onChanged: (value) {
// setState(() {
// frequence = "weekly";
// });
value: frequence == 'weekly',
onChanged: (_) {
setState(() {
frequence = 'weekly';
});
},
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
),
CheckboxListTile(
title: Text('Cada dos semanas'),
title: const Text('Cada dos semanas'),
controlAffinity: ListTileControlAffinity.leading,
value: frequence == "biweekly",
onChanged: (value) {
// setState(() {
// frequence = "biweekly";
// });
value: frequence == 'biweekly',
onChanged: (_) {
setState(() {
frequence = 'biweekly';
});
},
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
),
CheckboxListTile(
title: Text('Mensual'),
title: const Text('Mensual'),
controlAffinity: ListTileControlAffinity.leading,
value: frequence == "monthly",
onChanged: (value) {
// setState(() {
// frequence = "monthly";
// });
value: frequence == 'monthly',
onChanged: (_) {
setState(() {
frequence = 'monthly';
});
},
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
),
Container(
SizedBox(
width: double.infinity,
child: DropdownMenu(
label: Text("Día de la semana"),
initialSelection: "Domingo",
dropdownMenuEntries: List<DropdownMenuEntry>.generate(7, (
int index,
) {
final days = [
"Lunes",
"Martes",
"Miércoles",
"Jueves",
"Viernes",
"Sábado",
"Domingo",
child: DropdownMenu<String>(
label: const Text('Día de la semana'),
initialSelection: 'Domingo',
dropdownMenuEntries: () {
const days = [
'Lunes',
'Martes',
'Miércoles',
'Jueves',
'Viernes',
'Sábado',
'Domingo',
];
return DropdownMenuEntry(
value: days[index],
label: days[index],
return List<DropdownMenuEntry<String>>.generate(
days.length,
(index) => DropdownMenuEntry<String>(
value: days[index],
label: days[index],
),
);
}),
}(),
),
),
DropdownMenu(
label: Text("Hora del día"),
DropdownMenu<int>(
label: const Text('Hora del día'),
initialSelection: 9,
dropdownMenuEntries: List<DropdownMenuEntry>.generate(24, (
int index,
) {
return DropdownMenuEntry(value: index, label: "$index:00");
}),
dropdownMenuEntries: List<DropdownMenuEntry<int>>.generate(
24,
(index) =>
DropdownMenuEntry<int>(value: index, label: '$index:00'),
),
),
TextField(
minLines: 3,
@@ -160,62 +168,65 @@ class WageScreen extends ConsumerWidget {
maxLength: 150,
decoration: InputDecoration(
labelText:
"Escribir mensaje a ${kid.name} del motivo del ingreso",
hintText: "Escribe tu mensaje",
border: OutlineInputBorder(),
'Escribir mensaje a ${widget.kid.name} del motivo del ingreso',
hintText: 'Escribe tu mensaje',
border: const OutlineInputBorder(),
),
),
Align(
const Align(
alignment: Alignment.topLeft,
child: Text("Máximo 150 caracteres"),
child: Text('Máximo 150 caracteres'),
),
],
),
),
Container(
decoration: BoxDecoration(
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(
spacing: 10,
children: [
Text(
"Condiciones",
const Text(
'Condiciones',
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(
title: Text('Sólo si cumple límites semanales'),
title: const Text('Sólo si cumple límites semanales'),
controlAffinity: ListTileControlAffinity.leading,
value: conditions["weeklyLimits"],
onChanged: (value) {
// setState(() {
// conditions["weeklyLimits"] = !conditions["weeklyLimits"]!;
// });
value: conditions['weeklyLimits'],
onChanged: (_) {
setState(() {
conditions['weeklyLimits'] =
!(conditions['weeklyLimits'] ?? false);
});
},
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
),
CheckboxListTile(
title: Text('Sólo si no ha tenido incidencias'),
title: const Text('Sólo si no ha tenido incidencias'),
controlAffinity: ListTileControlAffinity.leading,
value: conditions["incidences"],
onChanged: (value) {
// setState(() {
// conditions["incidences"] = !conditions["incidences"]!;
// });
value: conditions['incidences'],
onChanged: (_) {
setState(() {
conditions['incidences'] =
!(conditions['incidences'] ?? false);
});
},
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
),
CheckboxListTile(
title: Text('Pausar durante vacaciones'),
title: const Text('Pausar durante vacaciones'),
controlAffinity: ListTileControlAffinity.leading,
value: conditions["holidays"],
onChanged: (value) {
// setState(() {
// conditions["holidays"] = !conditions["holidays"]!;
// });
value: conditions['holidays'],
onChanged: (_) {
setState(() {
conditions['holidays'] = !(conditions['holidays'] ?? false);
});
},
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
),

View File

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

View File

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