Feature update release.
This release adds WebView dialog support to KAlertFlutter, making the Flutter package more closely aligned with the native Android Java KAlertDialog library. WebView dialogs are useful for showing Terms and Conditions, Privacy Policy, Refund Policy, Help pages, FAQ pages, documentation pages, or any hosted web content directly inside a dialog.
- Added WebView dialog support.
- Added
KAlertType.webView. - Added
KAlertDialog.webView(). - Added
KAlertDialog.showWebView(). - Added backward-compatible
KAlert.webView(). - Added support for loading hosted web pages inside dialogs.
- Added Terms and Privacy Policy dialog support.
- Added Refund Policy, Help, FAQ, and documentation page dialog support.
- Added horizontal WebView loading progress support.
- Added center WebView loading spinner support.
- Added WebView created callback.
- Added WebView progress callback.
- Added WebView page started callback.
- Added WebView page finished callback.
- Added WebView page error callback.
- Added navigation request callback support.
- Added JavaScript enable/disable option.
- Added WebView zoom enable/disable option.
- Added configurable WebView height.
- Added configurable progress color.
- Added main-frame-only WebView error handling to avoid false errors from failed favicon, script, CSS, image, iframe, or analytics resources.
- Added
webview_flutterfor WebView rendering.
final result = await KAlertDialog.webView(
context: context,
title: 'Terms & Privacy Policy',
content: 'Please read our terms and privacy policy before continuing.',
url: 'https://policies.google.com/privacy',
webViewHeight: 420,
showHorizontalProgress: true,
showCenterLoader: true,
javaScriptEnabled: true,
enableZoom: false,
showCancelButton: true,
confirmText: 'I Agree',
cancelText: 'Cancel',
);
if (result?.confirmed == true) {
debugPrint('Accepted');
}final accepted = await KAlert.webView(
context,
url: 'https://policies.google.com/privacy',
title: 'Terms & Privacy Policy',
message: 'Please read the page before continuing.',
);
if (accepted == true) {
debugPrint('Accepted');
}For Android apps, make sure Internet permission is added in android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />For best compatibility, use https:// URLs for Terms, Privacy Policy, Help, FAQ, and documentation pages.