import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart';
import 'package:mohem_flutter_app/models/dashboard/menus.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';

class SubMenuScreen extends StatelessWidget {
  late Menus menu;
  @override
  Widget build(BuildContext context) {
    menu = ModalRoute.of(context)!.settings.arguments as Menus;
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBarWidget(context, title: menu.menuEntry.prompt.toString()),
      // AppBar(
      // context,
      // title: menu.menuEntry.prompt.toString(),
      // ),

      body: Container(
          width: double.infinity,
          height: double.infinity,
          child: Column(
            children: menu.menuEntiesList.map((i) => rowItem(i, context)).toList(),
          )),
    );
  }

  Widget rowItem(obj, context) {
    return InkWell(
      onTap: () {
        Navigator.pushNamed(
          context,
          AppRoutes.addEitScreen,
          arguments: obj,
        );
      },
      child: Container(
        width: double.infinity,
        padding: EdgeInsets.all(12),
        margin: EdgeInsets.only(top: 10),
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(10),
          boxShadow: [
            BoxShadow(
              color: const Color(0xff000000).withOpacity(.1),
              blurRadius: 26,
              offset: const Offset(0, -3),
            ),
          ],
        ),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [Text(obj.prompt.toString()), Icon(Icons.arrow_right)],
        ).paddingAll(6),
      ),
    );
  }
}
