NEW: Import & Set Up Provider
This commit is contained in:
@@ -19,7 +19,8 @@
|
|||||||
<application
|
<application
|
||||||
android:label="MIH"
|
android:label="MIH"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/launcher_icon">
|
android:icon="@mipmap/launcher_icon"
|
||||||
|
android:enableOnBackInvokedCallback="true">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_wallet_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'package:upgrader/upgrader.dart';
|
import 'package:upgrader/upgrader.dart';
|
||||||
import 'mih_config/mih_env.dart';
|
import 'mih_config/mih_env.dart';
|
||||||
import 'mih_config/mih_theme.dart';
|
import 'mih_config/mih_theme.dart';
|
||||||
@@ -66,26 +68,33 @@ class _MzansiInnovationHubState extends State<MzansiInnovationHub> {
|
|||||||
double width = MediaQuery.sizeOf(context).width;
|
double width = MediaQuery.sizeOf(context).width;
|
||||||
theme.setScreenType(width);
|
theme.setScreenType(width);
|
||||||
precacheImage(theme.loadingImage(), context);
|
precacheImage(theme.loadingImage(), context);
|
||||||
return MaterialApp.router(
|
return MultiProvider(
|
||||||
title: getTitle(),
|
providers: [
|
||||||
themeMode: ThemeMode.dark,
|
ChangeNotifierProvider(
|
||||||
theme: theme.getThemeData(),
|
create: (context) => MzansiWalletProvider(),
|
||||||
darkTheme: theme.getThemeData(),
|
),
|
||||||
debugShowCheckedModeBanner: false,
|
],
|
||||||
routerConfig: widget.router,
|
child: MaterialApp.router(
|
||||||
builder: (context, child) {
|
title: getTitle(),
|
||||||
if (child == null) {
|
themeMode: ThemeMode.dark,
|
||||||
return const Scaffold(
|
theme: theme.getThemeData(),
|
||||||
body: Center(
|
darkTheme: theme.getThemeData(),
|
||||||
child: CircularProgressIndicator(),
|
debugShowCheckedModeBanner: false,
|
||||||
),
|
routerConfig: widget.router,
|
||||||
|
builder: (context, child) {
|
||||||
|
if (child == null) {
|
||||||
|
return const Scaffold(
|
||||||
|
body: Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return UpgradeAlert(
|
||||||
|
navigatorKey: widget.router.routerDelegate.navigatorKey,
|
||||||
|
child: child,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
return UpgradeAlert(
|
),
|
||||||
navigatorKey: widget.router.routerDelegate.navigatorKey,
|
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1129,7 +1129,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.0"
|
version: "4.1.0"
|
||||||
provider:
|
provider:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: provider
|
name: provider
|
||||||
sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272"
|
sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272"
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ dependencies:
|
|||||||
upgrader: ^12.0.0
|
upgrader: ^12.0.0
|
||||||
screenshot: ^3.0.0
|
screenshot: ^3.0.0
|
||||||
file_saver: ^0.3.1
|
file_saver: ^0.3.1
|
||||||
|
provider: ^6.1.5+1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user