import 'package:flutter/material.dart';
import 'package:gymlink_module_web/main_mobile.dart';
import 'package:gymlink_module_web/pages/main.dart';
import 'package:gymlink_module_web/providers/cart.dart';
import 'package:gymlink_module_web/providers/main.dart';
import 'package:provider/provider.dart';

class MyAppStateMobile extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return Consumer<GymLinkProvider>(
      builder: (context, provider, __) {
        final theme = provider.theme;
        final isLoading = provider.isLoading;
        return ChangeNotifierProvider(
          create: (_) => CartProvider(),
          builder: (context, __) => isLoading
              ? const Center(child: CircularProgressIndicator())
              : MaterialApp(
                  title: 'GymLink Module',
                  theme: theme,
                  debugShowCheckedModeBanner: false,
                  home: const MainPage(),
                ),
        );
      },
    );
  }
}
