mirrored_repositories/Widgets-App/lib/presentation/screen


import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:wigets_app/config/menu/menu_items.dart';
import 'package:wigets_app/presentation/widgets/side_menu.dart'; 

class HomeScreen extends StatelessWidget {

  static const String name = "home_screen";

  const HomeScreen({super.key});

  @override
  Widget build(BuildContext context) {

    final scaffoldKey = GlobalKey<ScaffoldState>();

    return  Scaffold(
      appBar: AppBar( 
        title: const Text("Home screen + Material3"), 
      ),
      body: const _HomeView(),
      drawer: SideMenu(scaffoldKey: scaffoldKey),
    );
  }
}

class _HomeView extends StatelessWidget {
  const _HomeView();

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
      physics: const BouncingScrollPhysics(),
      itemCount: appMenuItems.length,
      itemBuilder: (context, index){
        final menuItem = appMenuItems[index];
        return _CustomListTile(menuItem: menuItem);
      },
    );
  }
}

class _CustomListTile extends StatelessWidget {
  const _CustomListTile({ 
    required this.menuItem,
  });

  final MenuItems menuItem;

  @override
  Widget build(BuildContext context) {

    final colors = Theme.of( context ).colorScheme;

    return ListTile(
      leading: Icon(menuItem.icon, color: colors.primary,),
      trailing: Icon( Icons.arrow_forward_ios_outlined, color: colors.primary,),
      title: Text(menuItem.title),
      subtitle: Text(menuItem.subTitle),
      onTap: () {
        
        // Navigator.of(context).push(
        //   MaterialPageRoute(builder: (context) => const ButtonsScreen())
        // );

        // Navigator.pushNamed(context, menuItem.link);

        context.push( menuItem.link );

        // context.pushNamed(ButtonsScreen.name);
      },
    );
  }
}