build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Create the widget that is the root of the application.

Args: context (BuildContext): BuildContext

Returns: A CupertinoApp widget.

Implementation

@override
Widget build(BuildContext context) => MultiProvider(
      providers: <SingleChildWidget>[
        ChangeNotifierProvider<LocaleProvider>(
          create: (_) => LocaleProvider(),
        ),
        ChangeNotifierProvider<TypeUpdateNotifier>(
          create: (_) => TypeUpdateNotifier(),
        ),
        ChangeNotifierProvider<BlockUpdateNotifier>(
          create: (_) => BlockUpdateNotifier(),
        ),
        ChangeNotifierProvider<VisibilityNotifier>(
          create: (_) => VisibilityNotifier(),
        ),
      ],
      child: Consumer<LocaleProvider>(
        builder: (
          BuildContext context,
          LocaleProvider provider,
          Widget? snapshot,
        ) =>
            CupertinoApp(
          home: const HomePage(),
          initialRoute: "/",
          routes: {
            "/mode": (BuildContext context) => const ModeSelection(),
          },
          debugShowCheckedModeBanner: false,
          theme: const CupertinoThemeData(
            brightness: Brightness.light,
            primaryColor: CupertinoColors.systemOrange,
          ),
          navigatorObservers: <NavigatorObserver>[routeObserver],
          locale: provider.locale,
          localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
            AppLocalizationsDelegate(),
            GlobalMaterialLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
            DefaultCupertinoLocalizations.delegate,
            DefaultWidgetsLocalizations.delegate,
            DefaultCupertinoLocalizations.delegate,
          ],
          supportedLocales: LocaleProvider()._languages,
        ),
      ),
    );