diff --git a/flutter_inappwebview/example/lib/in_app_webiew_example.screen.dart b/flutter_inappwebview/example/lib/in_app_webview_example.screen.dart similarity index 81% rename from flutter_inappwebview/example/lib/in_app_webiew_example.screen.dart rename to flutter_inappwebview/example/lib/in_app_webview_example.screen.dart index 4acc6d966..5338b474f 100755 --- a/flutter_inappwebview/example/lib/in_app_webiew_example.screen.dart +++ b/flutter_inappwebview/example/lib/in_app_webview_example.screen.dart @@ -83,11 +83,6 @@ class _InAppWebViewExampleScreenState extends State { ); } - @override - void dispose() { - super.dispose(); - } - @override Widget build(BuildContext context) { return Scaffold( @@ -125,22 +120,18 @@ class _InAppWebViewExampleScreenState extends State { initialSettings: settings, contextMenu: contextMenu, pullToRefreshController: pullToRefreshController, - onWebViewCreated: (controller) async { - webViewController = controller; - }, - onLoadStart: (controller, url) { + onWebViewCreated: (controller) => + webViewController = controller, + onLoadStart: (_, url) { setState(() { this.url = url.toString(); urlController.text = this.url; }); }, - onPermissionRequest: (controller, request) { - return PermissionResponse( - resources: request.resources, - action: PermissionResponseAction.GRANT); - }, - shouldOverrideUrlLoading: - (controller, navigationAction) async { + onPermissionRequest: (_, request) => PermissionResponse( + resources: request.resources, + action: PermissionResponseAction.GRANT), + shouldOverrideUrlLoading: (_, navigationAction) async { var uri = navigationAction.request.url!; if (![ @@ -164,16 +155,15 @@ class _InAppWebViewExampleScreenState extends State { return NavigationActionPolicy.ALLOW; }, - onLoadStop: (controller, url) { + onLoadStop: (_, url) { pullToRefreshController?.endRefreshing(); setState(() { this.url = url.toString(); urlController.text = this.url; }); }, - onReceivedError: (controller, request, error) { - pullToRefreshController?.endRefreshing(); - }, + onReceivedError: (_, __, ___) => + pullToRefreshController?.endRefreshing(), onProgressChanged: (controller, progress) { if (progress == 100) { pullToRefreshController?.endRefreshing(); @@ -183,15 +173,14 @@ class _InAppWebViewExampleScreenState extends State { urlController.text = this.url; }); }, - onUpdateVisitedHistory: (controller, url, isReload) { + onUpdateVisitedHistory: (_, url, __) { setState(() { this.url = url.toString(); urlController.text = this.url; }); }, - onConsoleMessage: (controller, consoleMessage) { - print(consoleMessage); - }, + onConsoleMessage: (_, consoleMessage) => + print(consoleMessage), ), progress < 1.0 ? LinearProgressIndicator(value: progress) @@ -201,24 +190,18 @@ class _InAppWebViewExampleScreenState extends State { ), ButtonBar( alignment: MainAxisAlignment.center, - children: [ + children: [ ElevatedButton( child: Icon(Icons.arrow_back), - onPressed: () { - webViewController?.goBack(); - }, + onPressed: () => webViewController?.goBack(), ), ElevatedButton( child: Icon(Icons.arrow_forward), - onPressed: () { - webViewController?.goForward(); - }, + onPressed: () => webViewController?.goForward(), ), ElevatedButton( child: Icon(Icons.refresh), - onPressed: () { - webViewController?.reload(); - }, + onPressed: () => webViewController?.reload(), ), ], ), diff --git a/flutter_inappwebview/example/lib/main.dart b/flutter_inappwebview/example/lib/main.dart index 0a7802bd8..28cf35c5f 100755 --- a/flutter_inappwebview/example/lib/main.dart +++ b/flutter_inappwebview/example/lib/main.dart @@ -6,7 +6,7 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_inappwebview_example/chrome_safari_browser_example.screen.dart'; import 'package:flutter_inappwebview_example/headless_in_app_webview.screen.dart'; import 'package:flutter_inappwebview_example/in_app_browser_example.screen.dart'; -import 'package:flutter_inappwebview_example/in_app_webiew_example.screen.dart'; +import 'package:flutter_inappwebview_example/in_app_webview_example.screen.dart'; import 'package:flutter_inappwebview_example/web_authentication_session_example.screen.dart'; import 'package:pointer_interceptor/pointer_interceptor.dart';