import 'package:cashier_reserve/common/manager/app_manager.dart';
import 'package:cashier_reserve/home/home_view.dart';
import 'package:cashier_reserve/home/home_view_model.dart';

import 'common/base/provider.dart';
import 'common/base/ui.dart';

class RootView extends StatefulWidget {
  const RootView({super.key});

  @override
  _RootView createState() => _RootView();
}

class _RootView extends State<RootView>
    with AutomaticKeepAliveClientMixin, RouteAware {
  @override
  bool get wantKeepAlive => true;

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
  }

  @override
  Widget build(BuildContext context) {
    AppManager.setGlobalContext(context);
    super.build(context);
    return MultiProvider(
      providers: [
        ChangeNotifierProvider<HomeViewModel>(
          create: (_) => HomeViewModel(),
        )
      ],
      child: BaseUIController(stateWidget: HomeView()),
    );
  }
}