This commit is contained in:
otsmr 2025-03-22 17:50:15 +01:00
parent 67379566a5
commit d9741ee877
3 changed files with 29 additions and 8 deletions

View file

@ -36,7 +36,7 @@ void main() async {
await setupPushNotification();
await initMediaStorage();
await initFCMService();
initFCMService();
gCameras = await availableCameras();

View file

@ -152,10 +152,12 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
const InputDecorationTheme(border: OutlineInputBorder())),
darkTheme: ThemeData.dark().copyWith(
colorScheme: ColorScheme.fromSeed(
brightness: Brightness.dark, // <-- the only line added
seedColor: const Color(0xFF57CC99)),
inputDecorationTheme:
const InputDecorationTheme(border: OutlineInputBorder()),
brightness: Brightness.dark, // <-- the only line added
seedColor: const Color(0xFF57CC99),
),
inputDecorationTheme: const InputDecorationTheme(
border: OutlineInputBorder(),
),
),
themeMode: context.watch<SettingsChangeProvider>().themeMode,
initialRoute: '/',
@ -184,9 +186,8 @@ class MyAppMainWidget extends StatefulWidget {
}
class _MyAppMainWidgetState extends State<MyAppMainWidget> {
Future<bool> _isUserCreated =
isUserCreated(); // Assume this is a function that checks if the user is created
bool _showOnboarding = true; // Initial state for onboarding
Future<bool> _isUserCreated = isUserCreated();
bool _showOnboarding = true;
@override
Widget build(BuildContext context) {

View file

@ -1,7 +1,9 @@
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:pie_menu/pie_menu.dart';
import 'package:provider/provider.dart';
import 'package:twonly/src/providers/send_next_media_to.dart';
import 'package:twonly/src/services/notification_service.dart';
import 'camera_to_share/camera_preview_view.dart';
import 'chats/chat_list_view.dart';
import 'package:flutter/material.dart';
@ -34,10 +36,28 @@ class HomeViewState extends State<HomeView> {
activePageIdx = index;
});
};
selectNotificationStream.stream
.listen((NotificationResponse? response) async {
globalUpdateOfHomeViewPageIndex(1);
});
initAsync();
}
Future initAsync() async {
var notificationAppLaunchDetails =
await flutterLocalNotificationsPlugin.getNotificationAppLaunchDetails();
if (notificationAppLaunchDetails != null) {
if (notificationAppLaunchDetails.didNotificationLaunchApp) {
globalUpdateOfHomeViewPageIndex(1);
}
}
}
@override
void dispose() {
selectNotificationStream.close();
// disable globalCallbacks to the flutter tree
globalUpdateOfHomeViewPageIndex = (a) {};
super.dispose();