import 'package:flutter/material.dart';

class DeleteUser extends StatelessWidget {
  final _passwordController = TextEditingController();

  DeleteUser({super.key});

  @override
  Widget build(BuildContext context) {
    final GlobalKey<FormState> formKey = GlobalKey<FormState>();

    return Scaffold(
        appBar: AppBar(
            centerTitle: true,
            backgroundColor: Theme.of(context).colorScheme.primary,
            foregroundColor: Colors.white,
            title: const Text('Delete account',
                style: TextStyle(fontWeight: FontWeight.bold))),
        body: Form(
            key: formKey,
            child: Padding(
              padding: const EdgeInsets.all(10.0),
              child: Column(
                children: [
                  Row(
                    children: const [
                      Icon(Icons.warning, size: 40, color: Colors.orange),
                      Text('Remember that deletion of account is irreversible!',
                          style: TextStyle(
                              fontWeight: FontWeight.bold, fontSize: 14)),
                    ],
                  ),
                  Padding(
                    padding: const EdgeInsets.all(10.0),
                    child: TextFormField(
                      controller: _passwordController,
                      obscureText: true,
                      validator: (value) {
                        return 'Not implemented';
                      },
                      decoration: InputDecoration(
                        floatingLabelBehavior: FloatingLabelBehavior.always,
                        border: OutlineInputBorder(),
                        labelText: 'Old password',
                      ),
                    ),
                  ),
                  Text('Confirm deletion of account by filling in password.',
                      style: TextStyle(
                          color: Colors.grey, fontStyle: FontStyle.italic)),
                  Padding(
                    padding: const EdgeInsets.all(10.0),
                    child: ElevatedButton(
                        onPressed: () {
                          if (formKey.currentState!.validate()) {}
                        },
                        style: ButtonStyle(
                            backgroundColor: MaterialStatePropertyAll<Color>(
                                Colors.redAccent),
                            foregroundColor:
                                MaterialStatePropertyAll<Color>(Colors.white)),
                        child: Text('Delete account')),
                  ),
                ],
              ),
            )));
  }
}
