import 'package:flutter/material.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:fluttericon/web_symbols_icons.dart';
import 'package:fluttericon/font_awesome5_icons.dart';
import '../../../../model/login_data/user_info/user_data.dart';
import 'menu.dart';
import '../../../../utils/global.dart';

class MenuScreen extends StatefulWidget {
  final UserData? userData;
  const MenuScreen({Key? key, required this.userData}) : super(key: key);

  @override
  State<MenuScreen> createState() => _MenuScreenState();
}

class _MenuScreenState extends State<MenuScreen> {
  @override
  Widget build(BuildContext context) {
    final String firstName =
        widget.userData!.user!.login!.user!.firstName!.toUpperCase();
    final String lastname =
        widget.userData!.user!.login!.user!.lastName!.toUpperCase();
    return Drawer(
      child: SizedBox(
        height: screenHeight,
        child: Column(
          mainAxisSize: MainAxisSize.max,
          children: [
            Column(
              // ignore: prefer_const_literals_to_create_immutables
              children: <Widget>[
                UserAccountsDrawerHeader(
                  decoration: const BoxDecoration(
                      color: primary,
                      image: DecorationImage(
                          image: AssetImage('assets/pngs/bg.png'),
                          fit: BoxFit.cover)),
                  accountName: Text("$firstName $lastname"),
                  accountEmail: null,
                  currentAccountPicture: CircleAvatar(
                    radius: 40,
                    backgroundColor: fifth,
                    child: CircleAvatar(
                      radius: 33,
                      backgroundColor: third,
                      child: //Icon(Icons.person, size: 40, color: fifth),
                          Text(
                        firstName[0].toUpperCase(),
                        style: const TextStyle(fontSize: 45.0, color: fifth),
                      ),
                    ),
                  ),
                ),
                getTile(FontAwesome5.user, "Basic Info", '/basic-info', context,
                    widget.userData!),
                const Divider(),
                getTile(FontAwesome5.user_circle, "Profile",
                    '/profile', context, widget.userData!),
                const Divider(),
                getTile(FontAwesome5.life_ring, "Request SOS", '/sos',
                    context, widget.userData!),
             
              ],
            ),
            const Expanded(child:  SizedBox()),
               const Divider(),
                  Align(
                    alignment: FractionalOffset.bottomLeft,
                    child: getTile(WebSymbols.logout, "Logout", '/', context,
                    widget.userData!),
                  ),
                  const SizedBox(height: 10,),
          ],
        ),
      ),
    );
  }
}
