From cbcc8e310ca52de07a3f3fa9d824b7c8845f0e3b Mon Sep 17 00:00:00 2001 From: Justin Enerio Date: Tue, 7 May 2024 10:50:27 +0800 Subject: [PATCH] feat: show loading title on webview --- packages/espressocash_app/lib/ui/web_view_screen.dart | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/espressocash_app/lib/ui/web_view_screen.dart b/packages/espressocash_app/lib/ui/web_view_screen.dart index a198c29e94..01c8d6512e 100644 --- a/packages/espressocash_app/lib/ui/web_view_screen.dart +++ b/packages/espressocash_app/lib/ui/web_view_screen.dart @@ -69,12 +69,10 @@ class _WebViewScreenState extends State { Future _handleLoaded(InAppWebViewController controller) async { widget.onLoaded?.call(controller); - if (widget.title != null) return; - - final title = await controller.getTitle(); + final title = widget.title ?? await controller.getTitle() ?? ''; if (!mounted) return; - setState(() => _title = title ?? ''); + setState(() => _title = title); } Future _handlePermissionRequest( @@ -100,7 +98,7 @@ class _WebViewScreenState extends State { theme: theme, child: Scaffold( appBar: CpAppBar( - title: Text(widget.title ?? _title ?? context.l10n.loading), + title: Text(_title ?? context.l10n.loading), ), body: InAppWebView( initialUrlRequest: URLRequest(url: WebUri.uri(widget.url)),