From 577b566f656c13bd7c41815dd2822034f14e0291 Mon Sep 17 00:00:00 2001 From: phuoc Date: Wed, 1 Nov 2023 13:42:51 +0700 Subject: [PATCH] fix navigate Signed-off-by: phuoc --- lib/screen/irl_screen/webview_irl_screen.dart | 1 + lib/screen/settings/help_us/inapp_webview.dart | 12 ++++++++---- lib/service/deeplink_service.dart | 3 +-- lib/service/navigation_service.dart | 7 ++++--- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/screen/irl_screen/webview_irl_screen.dart b/lib/screen/irl_screen/webview_irl_screen.dart index 852adb476..ad4c3293c 100644 --- a/lib/screen/irl_screen/webview_irl_screen.dart +++ b/lib/screen/irl_screen/webview_irl_screen.dart @@ -427,6 +427,7 @@ class _IRLWebScreenState extends State { child: InAppWebViewPage( payload: InAppWebViewPayload(widget.payload.url, isPlainUI: widget.payload.isPlainUI, + backgroundColor: widget.payload.statusBarColor, onWebViewCreated: (controller) { _controller = controller; _addJavaScriptHandler(); diff --git a/lib/screen/settings/help_us/inapp_webview.dart b/lib/screen/settings/help_us/inapp_webview.dart index 85b043e10..6ba6b5165 100644 --- a/lib/screen/settings/help_us/inapp_webview.dart +++ b/lib/screen/settings/help_us/inapp_webview.dart @@ -39,12 +39,12 @@ class _InAppWebViewPageState extends State { return Scaffold( appBar: AppBar( toolbarHeight: 0, - systemOverlayStyle: const SystemUiOverlayStyle( - statusBarColor: Colors.transparent, + systemOverlayStyle: SystemUiOverlayStyle( + statusBarColor: widget.payload.backgroundColor ?? Colors.transparent, systemNavigationBarDividerColor: Colors.transparent, ), ), - backgroundColor: theme.primaryColor, + backgroundColor: widget.payload.backgroundColor ?? theme.primaryColor, body: Column( children: [ if (!widget.payload.isPlainUI) ...[ @@ -220,10 +220,14 @@ class _InAppWebViewPageState extends State { class InAppWebViewPayload { final String url; final bool isPlainUI; + final Color? backgroundColor; Function(InAppWebViewController controler)? onWebViewCreated; Function(InAppWebViewController controler, ConsoleMessage consoleMessage)? onConsoleMessage; InAppWebViewPayload(this.url, - {this.isPlainUI = false, this.onWebViewCreated, this.onConsoleMessage}); + {this.isPlainUI = false, + this.onWebViewCreated, + this.onConsoleMessage, + this.backgroundColor}); } diff --git a/lib/service/deeplink_service.dart b/lib/service/deeplink_service.dart index ba1ca6801..d3526f22e 100644 --- a/lib/service/deeplink_service.dart +++ b/lib/service/deeplink_service.dart @@ -305,8 +305,7 @@ class DeeplinkServiceImpl extends DeeplinkService { }, ); if (address == null) return; - final url = - "${Environment.payToMintBaseUrl}/moma/postcard?address=$address"; + final url = "${Environment.payToMintBaseUrl}/payToMint?address=$address"; final response = (await _navigationService.goToIRLWebview( IRLWebScreenPayload(url, isPlainUI: true, statusBarColor: POSTCARD_BACKGROUND_COLOR))) diff --git a/lib/service/navigation_service.dart b/lib/service/navigation_service.dart index 2ea949a2b..a612f6007 100644 --- a/lib/service/navigation_service.dart +++ b/lib/service/navigation_service.dart @@ -27,7 +27,9 @@ import 'package:autonomy_flutter/util/ui_helper.dart'; import 'package:autonomy_theme/autonomy_theme.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:nft_collection/models/asset_token.dart'; // ignore: implementation_imports +import 'package:nft_collection/models/asset_token.dart'; + +// ignore: implementation_imports import 'package:overlay_support/src/overlay_state_finder.dart'; class NavigationService { @@ -320,8 +322,7 @@ class NavigationService { Future goToIRLWebview(IRLWebScreenPayload payload) async { if (navigatorKey.currentState?.mounted == true && navigatorKey.currentContext != null) { - return await navigatorKey.currentState - ?.pushNamed(AppRouter.irlWebView, arguments: payload); + return await navigateTo(AppRouter.irlWebView, arguments: payload); } else { return {'result': false}; }