Skip to content

Commit abf4eee

Browse files
authored
feat: show loading title on webview (#1429)
1 parent d765f6d commit abf4eee

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/espressocash_app/lib/ui/web_view_screen.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,10 @@ class _WebViewScreenState extends State<WebViewScreen> {
6969
Future<void> _handleLoaded(InAppWebViewController controller) async {
7070
widget.onLoaded?.call(controller);
7171

72-
if (widget.title != null) return;
73-
74-
final title = await controller.getTitle();
72+
final title = widget.title ?? await controller.getTitle() ?? '';
7573
if (!mounted) return;
7674

77-
setState(() => _title = title ?? '');
75+
setState(() => _title = title);
7876
}
7977

8078
Future<PermissionResponse?> _handlePermissionRequest(
@@ -100,7 +98,7 @@ class _WebViewScreenState extends State<WebViewScreen> {
10098
theme: theme,
10199
child: Scaffold(
102100
appBar: CpAppBar(
103-
title: Text(widget.title ?? _title ?? context.l10n.loading),
101+
title: Text(_title ?? context.l10n.loading),
104102
),
105103
body: InAppWebView(
106104
initialUrlRequest: URLRequest(url: WebUri.uri(widget.url)),

0 commit comments

Comments
 (0)