import 'package:flutter/material.dart'; import 'package:thesis_shop/route_key.dart'; import 'package:thesis_shop/screens/cart/cart_screen.dart'; import 'package:thesis_shop/screens/product_list/product_list_screen.dart'; import 'package:thesis_shop/service/product_service.dart'; import 'package:thesis_shop/stores/store_injector.dart'; import 'package:thesis_shop/stores/user_store.dart'; import 'package:thesis_shop/utils/map_keys_extension.dart'; import 'stores/cart_store.dart'; import 'stores/product_store.dart'; class ThesisShopApp extends StatelessWidget { final ProductService productService; const ThesisShopApp({Key? key, required this.productService}) : super(key: key); @override Widget build(BuildContext context) { final userStore = UserStore(); final productStore = ProductStore(productService, userStore); final cartStore = CartStore(productStore); return StoreInjector( cartStore: cartStore, userStore: userStore, productStore: productStore, child: MaterialApp( title: 'Thesis Shop', theme: ThemeData(primarySwatch: Colors.red), darkTheme: ThemeData( primarySwatch: Colors.red, brightness: Brightness.dark, ), routes: { RouteKey.products: (context) => const ProductListScreen(), RouteKey.cart: (context) => const CartScreen(), }.mapKeys((key) => key.name), initialRoute: 'products', ), ); } }