fix
This commit is contained in:
@ -2,9 +2,13 @@ import 'dart:io';
|
||||
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
// import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:momo/material/app.dart';
|
||||
import 'package:momo/provider/token.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
import 'package:tray_manager/tray_manager.dart';
|
||||
// import 'package:tray_manager/tray_manager.dart';
|
||||
|
||||
void main() async {
|
||||
if (Platform.isLinux || Platform.isWindows || Platform.isMacOS) {
|
||||
@ -24,14 +28,38 @@ void main() async {
|
||||
await windowManager.focus();
|
||||
});
|
||||
}
|
||||
runApp(const ProviderScope(child: MyApp()));
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
String? tk = prefs.getString("token");
|
||||
final container = ProviderContainer();
|
||||
container.read(tokenProvider.notifier).setToken(tk);
|
||||
runApp(
|
||||
UncontrolledProviderScope(
|
||||
container: container,
|
||||
child: const MyApp(),
|
||||
),
|
||||
);
|
||||
// runApp((child: MyApp(token: tk)));
|
||||
// runApp(MultiProvider(
|
||||
// providers: [
|
||||
// ChangeNotifierProvider(
|
||||
// create: (context) => Secret(),
|
||||
// ),
|
||||
// ],
|
||||
// child: MyApp(
|
||||
// token: tk,
|
||||
// ),
|
||||
// ));
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
const MyApp({super.key, this.token});
|
||||
|
||||
final String? token;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Provider.of<Secret>(context, listen: false).setToken(token);
|
||||
|
||||
return const MyMaterialApp();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user