Skip to content

Commit

Permalink
fix navigate
Browse files Browse the repository at this point in the history
Signed-off-by: phuoc <[email protected]>
  • Loading branch information
phuocbitmark committed Nov 2, 2023
1 parent 1995573 commit 577b566
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/screen/irl_screen/webview_irl_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ class _IRLWebScreenState extends State<IRLWebScreen> {
child: InAppWebViewPage(
payload: InAppWebViewPayload(widget.payload.url,
isPlainUI: widget.payload.isPlainUI,
backgroundColor: widget.payload.statusBarColor,
onWebViewCreated: (controller) {
_controller = controller;
_addJavaScriptHandler();
Expand Down
12 changes: 8 additions & 4 deletions lib/screen/settings/help_us/inapp_webview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class _InAppWebViewPageState extends State<InAppWebViewPage> {
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) ...[
Expand Down Expand Up @@ -220,10 +220,14 @@ class _InAppWebViewPageState extends State<InAppWebViewPage> {
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});
}
3 changes: 1 addition & 2 deletions lib/service/deeplink_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
7 changes: 4 additions & 3 deletions lib/service/navigation_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -320,8 +322,7 @@ class NavigationService {
Future<dynamic> 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};
}
Expand Down

0 comments on commit 577b566

Please sign in to comment.