ffix: move theme and screen to widgetsBinding
This commit is contained in:
parent
e67b643b47
commit
cf0e17662e
|
@ -25,7 +25,7 @@ class _SignInPageWidgetState extends State<SignInPageWidget> {
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_model = createModel(context, () => SignInPageModel());
|
_model = createModel(context, () => SignInPageModel());
|
||||||
DeepLinkService().initDeepLinks();
|
DeepLinkService().ensureInitialization();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -26,7 +26,7 @@ class _SignUpPageWidgetState extends State<SignUpPageWidget> {
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_model = createModel(context, () => SignUpPageModel());
|
_model = createModel(context, () => SignUpPageModel());
|
||||||
DeepLinkService().initDeepLinks();
|
DeepLinkService().ensureInitialization();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -43,7 +43,7 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
DeepLinkService().initDeepLinks();
|
DeepLinkService().ensureInitialization();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -12,11 +12,12 @@ class DeepLinkService {
|
||||||
|
|
||||||
DeepLinkService._internal();
|
DeepLinkService._internal();
|
||||||
|
|
||||||
|
|
||||||
late final AppLinks _appLinks;
|
late final AppLinks _appLinks;
|
||||||
StreamSubscription<Uri>? _linkSubscription;
|
StreamSubscription<Uri>? _linkSubscription;
|
||||||
|
bool _isInitialized = false;
|
||||||
|
|
||||||
Future<void> initDeepLinks() async {
|
Future<void> ensureInitialization() async {
|
||||||
|
if (_isInitialized) return;
|
||||||
try {
|
try {
|
||||||
_appLinks = AppLinks();
|
_appLinks = AppLinks();
|
||||||
print('initDeepLinks');
|
print('initDeepLinks');
|
||||||
|
@ -25,6 +26,7 @@ class DeepLinkService {
|
||||||
await _handleDeepLink(uri);
|
await _handleDeepLink(uri);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
_isInitialized = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error initializing deep links: $e');
|
print('Error initializing deep links: $e');
|
||||||
}
|
}
|
||||||
|
@ -45,10 +47,9 @@ class DeepLinkService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _showForgotPasswordScreen(String email, String token) async {
|
Future<void> _showForgotPasswordScreen(String email, String token) async {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
final theme = FlutterFlowTheme.of(StorageHelper().context!);
|
final theme = FlutterFlowTheme.of(StorageHelper().context!);
|
||||||
final screen = ForgotPasswordScreen(email: email, token: token);
|
final screen = ForgotPasswordScreen(email: email, token: token);
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
||||||
await showModalBottomSheet(
|
await showModalBottomSheet(
|
||||||
context: StorageHelper().context!,
|
context: StorageHelper().context!,
|
||||||
builder: (context) => Padding(
|
builder: (context) => Padding(
|
||||||
|
|
Loading…
Reference in New Issue