Here is the simple code that are using for the webview. The used package is webview_flutter: ^4.4.4.
class ScreenWebview extends StatelessWidget {
const ScreenWebview({super.key});
@override
Widget build(BuildContext context) {
GetWebViewController controller = Get.find();
return Scaffold(
resizeToAvoidBottomInset: false,
body: SafeArea(
child: Obx(
() => controller.isLoading.value
? const Center(child: LoadingWidget())
: WebViewWidget(controller: controller.webController),
),
),
);
}
}
here is the controller part
class WebViewBinding implements Bindings {
@override
void dependencies() {
Get.lazyPut(() => WebViewController());
}
}
class WebViewController extends GetxController {
RxBool isLoading = false.obs;
late WebViewController webController;
@override
void onInit() {
super.onInit();
controllerInitialize();
}
void controllerInitialize() {
isLoading.value = true;
webController = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(Get.theme.colorScheme.surface)
..enableZoom(false)
..loadRequest(Uri.parse("https://www.google.com/"));
isLoading.value = false;
}
}
Here is the output:
Expectation: If the keyboard appears, the auto resize will work and change ui for me.