Files
sf-app-platform/lib/payments/view/screens/phone_code_screen.dart
2025-11-10 12:03:32 +01:00

62 lines
2.2 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sf_app_platform/payments/view/screens/core/dashboard_screen.dart';
import 'package:sf_app_platform/payments/view/screens/login_screen.dart';
class PhoneCodeScreen extends StatefulWidget {
final String phone;
const PhoneCodeScreen({super.key, required this.phone});
@override
State<PhoneCodeScreen> createState() => PhoneCodeScreenState();
}
class PhoneCodeScreenState extends State<PhoneCodeScreen> {
final focusNodes = List<FocusNode>.generate(6, (int i){
return FocusNode();
});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
margin: EdgeInsets.all(30),
child: Expanded(child: Center(
child: Column(
spacing: 15,
children: [
Spacer(flex:8),
Text("Conéctate", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30)),
Text.rich(TextSpan(text: "Hemos enviado el código al ",
children: [TextSpan(
text: widget.phone, style: TextStyle(fontWeight: FontWeight.bold))]
)),
Text("Introduce el código aquí"),
Row(
spacing: 20,
children: List<Widget>.generate(6, (int i){
return Expanded(child: TextField(
focusNode: focusNodes[i],
keyboardType: TextInputType.number,
decoration: InputDecoration(hintText: "0", counterText: "", border: OutlineInputBorder()),
maxLength: 1,
onChanged: (String value)=>{value!="" ? focusNodes[i+1].requestFocus() : focusNodes[i-1].requestFocus()},
));
}),
),
FilledButton(onPressed: ()=>{Navigator.pushReplacement(context, MaterialPageRoute(builder: (_)=>LoginScreen()))}, child: Text("Entrar")),
Text("¿No lo has recibido?"),
TextButton(onPressed: ()=>{},
child: Text("Volver a intentarlo", style: TextStyle(fontWeight: FontWeight.bold))
),
Spacer(flex:10)
]
),
)),
)
);
}
}