76 lines
2.7 KiB
Dart
76 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:playmaker/controllers/register_controller.dart';
|
|
import '../Controllers/register_controller.dart';
|
|
import '../widgets/register_widgets.dart'; // Import dos novos widgets
|
|
import 'home.dart';
|
|
|
|
class RegisterPage extends StatefulWidget {
|
|
const RegisterPage({super.key});
|
|
|
|
@override
|
|
State<RegisterPage> createState() => _RegisterPageState();
|
|
}
|
|
|
|
class _RegisterPageState extends State<RegisterPage> {
|
|
final RegisterController controller = RegisterController();
|
|
|
|
@override
|
|
void dispose() {
|
|
controller.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(backgroundColor: Colors.white, elevation: 0, foregroundColor: Colors.black),
|
|
backgroundColor: Colors.white,
|
|
body: SafeArea(
|
|
child: ListenableBuilder(
|
|
listenable: controller,
|
|
builder: (context, child) {
|
|
return Center(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.all(32),
|
|
child: Column(
|
|
children: [
|
|
const RegisterHeader(), // Widget do Header
|
|
const SizedBox(height: 40),
|
|
|
|
RegisterFormFields(controller: controller), // Widget dos Campos
|
|
|
|
const SizedBox(height: 32),
|
|
|
|
// Botão de Finalizar
|
|
SizedBox(
|
|
width: double.infinity,
|
|
height: 60,
|
|
child: ElevatedButton(
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: const Color(0xFFE74C3C),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
|
|
),
|
|
onPressed: controller.isLoading ? null : () async {
|
|
final success = await controller.signUp();
|
|
if (success && mounted) {
|
|
Navigator.pushReplacement(
|
|
context,
|
|
MaterialPageRoute(builder: (context) => const HomeScreen()),
|
|
);
|
|
}
|
|
},
|
|
child: controller.isLoading
|
|
? const CircularProgressIndicator(color: Colors.white)
|
|
: const Text("Criar Conta", style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold)),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |