import 'package:flutter/material.dart';
import 'package:navigation/navigation.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class LinkPhoneScreen extends ConsumerWidget {
  final NavigationContract navigationContract;

  const LinkPhoneScreen({super.key, required this.navigationContract});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    TextEditingController phoneController = TextEditingController();
    // String? phone;

    return Scaffold(
      body: Container(
        margin: EdgeInsets.all(30),
        child: Expanded(
          child: Center(
            child: Column(
              spacing: 10,
              children: [
                Text(
                  "¡Nos alegra mucho tenerte por aquí!",
                  style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
                ),
                Text(
                  "Para poder entrar de forma segura, te vamos a enviar un código al teléfono",
                ),
                Row(
                  spacing: 10,
                  children: [
                    DropdownMenu(
                      initialSelection: "es",
                      dropdownMenuEntries: List<DropdownMenuEntry>.generate(3, (
                        int index,
                      ) {
                        return DropdownMenuEntry(
                          labelWidget: Icon(Icons.outlined_flag),
                          label: "es",
                          value: "es",
                        );
                      }),
                    ),
                    Expanded(
                      child: TextField(
                        onSubmitted: (String value) {
                          // phone = value;
                        },
                        controller: phoneController,
                        decoration: InputDecoration(
                          labelText: "Teléfono móvil",
                          hintText: "Teléfono",
                          border: OutlineInputBorder(),
                        ),
                        keyboardType: TextInputType.number,
                      ),
                    ),
                  ],
                ),
                SizedBox(
                  width: double.infinity,
                  child: FilledButton(
                    onPressed: () =>
                        navigationContract.pushTo(AppRoutes.phoneCode),
                    child: Text("Siguiente"),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
