chore(notifications): fix conflig when show notification in android
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
|
||||
import 'package:alarm/alarm.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:persistent_bottom_nav_bar_v2/persistent_bottom_nav_bar_v2.dart' show PersistentTabController;
|
||||
import 'package:persistent_bottom_nav_bar_v2/persistent_bottom_nav_bar_v2.dart'
|
||||
show PersistentTabController;
|
||||
|
||||
import 'firebase_options.dart';
|
||||
import 'product/lang/l10n/app_localizations.dart';
|
||||
@@ -15,16 +15,17 @@ import 'bloc/main_bloc.dart';
|
||||
import 'product/base/bloc/base_bloc.dart';
|
||||
import 'product/constant/navigation/navigation_router.dart';
|
||||
|
||||
|
||||
|
||||
PersistentTabController controller = PersistentTabController(initialIndex: 0);
|
||||
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform, name: "sfm-notification");
|
||||
FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler);
|
||||
await Firebase.initializeApp(
|
||||
options: DefaultFirebaseOptions.currentPlatform,
|
||||
name: "sfm-notification");
|
||||
FirebaseMessaging.onBackgroundMessage(
|
||||
NotificationServices.firebaseMessagingBackgroundHandler);
|
||||
await Alarm.init();
|
||||
await Alarm.stopAll();
|
||||
runApp(
|
||||
BlocProvider(
|
||||
child: const MyApp(),
|
||||
@@ -33,7 +34,6 @@ void main() async {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@@ -67,7 +67,7 @@ class _MyAppState extends State<MyApp> {
|
||||
_themeData = theme;
|
||||
mainBloc.sinkTheme.add(_themeData);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -92,19 +92,18 @@ class _MyAppState extends State<MyApp> {
|
||||
initialData: _locale,
|
||||
builder: (context, languageSnapshot) {
|
||||
return StreamBuilder<ThemeData?>(
|
||||
stream: mainBloc.streamTheme,
|
||||
initialData: _themeData,
|
||||
builder: (context, themeSnapshot) {
|
||||
return MaterialApp.router(
|
||||
theme: themeSnapshot.data,
|
||||
routerConfig: router,
|
||||
debugShowCheckedModeBanner: false,
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
locale: languageSnapshot.data,
|
||||
);
|
||||
}
|
||||
);
|
||||
stream: mainBloc.streamTheme,
|
||||
initialData: _themeData,
|
||||
builder: (context, themeSnapshot) {
|
||||
return MaterialApp.router(
|
||||
theme: themeSnapshot.data,
|
||||
routerConfig: router,
|
||||
debugShowCheckedModeBanner: false,
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
locale: languageSnapshot.data,
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user