Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android content not scroll up when keyboard is open #2493

Open
1 of 2 tasks
AdilHypeteq opened this issue Jan 10, 2025 · 1 comment
Open
1 of 2 tasks

Android content not scroll up when keyboard is open #2493

AdilHypeteq opened this issue Jan 10, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@AdilHypeteq
Copy link

AdilHypeteq commented Jan 10, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

InAppWebViewSettings settings = InAppWebViewSettings(
isInspectable: true,
mediaPlaybackRequiresUserGesture: false,
allowsInlineMediaPlayback: true,
iframeAllowFullscreen: true,
clearCache: true,
clearSessionCache: true,
alwaysBounceVertical: true,
scrollbarFadingEnabled: false,
alwaysBounceHorizontal: true,
javaScriptEnabled: true,
javaScriptCanOpenWindowsAutomatically: true,
useHybridComposition: false);

  Scaffold(
        appBar: AppBar(toolbarHeight: 0),
        resizeToAvoidBottomInset: true,
        drawer: const SideDrawer(),
        body: Column(
          children: [
            AppBarWidget(startPointOfUrl: widget.startPointUrl),
            const SizedBox(height: 10),
            Expanded(
              child: Stack(
                children: [
                  InAppWebView(
                    key: webViewKey,
                    initialUrlRequest:
                        URLRequest(url: WebUri(provider.webViewUrl)),
                    initialSettings: settings,
                    pullToRefreshController: pullToRefreshController,
                    onWebViewCreated: (controller) {
                      provider.webViewController = controller;
                      //controller.platform.clearHistory();
                      // provider.webViewControllerAssign(controller);
                    },
                    onLoadStart: (controller, url) {
                      print("controller,onLoadStart");
                      if (url != WebUri(provider.webViewUrl)) {
                        controller.loadUrl(
                            urlRequest: URLRequest(
                          url: WebUri(provider.webViewUrl),
                        ));
                        // provider.webViewControllerAssign(controller);
                        provider.webViewController = controller;
                      }
                      setState(() {
                        this.url = url.toString();
                      });
                    },
                    onWindowFocus: (controller) {
                      controller.resume();
                    },
                    onRequestFocus: (controller) {
                      print("controller,onRequestFocus");
                    },
                    onWindowBlur: (controller) {
                      print("controller,onWindowBlur");
                    },
                    onPermissionRequest: (controller, request) async {
                      return PermissionResponse(
                          resources: request.resources,
                          action: PermissionResponseAction.GRANT);
                    },
                    shouldOverrideUrlLoading:
                        (controller, navigationAction) async {
                      var uri = navigationAction.request.url!;

                      if (![
                        "http",
                        "https",
                        "file",
                        "chrome",
                        "data",
                        "javascript",
                        "about"
                      ].contains(uri.scheme)) {
                        if (await canLaunchUrl(uri)) {
                          // Launch the App
                          await launchUrl(
                            uri,
                          );
                          // and cancel the request
                          return NavigationActionPolicy.CANCEL;
                        }
                      }

                      return NavigationActionPolicy.ALLOW;
                    },
                    onLoadStop: (controller, url) async {
                      pullToRefreshController?.endRefreshing();
                    },
                    onReceivedServerTrustAuthRequest:
                        (controller, challenge) async {
                      return ServerTrustAuthResponse(
                          action:
                              ServerTrustAuthResponseAction.PROCEED);
                    },
                    onReceivedError: (controller, request, error) {
                      pullToRefreshController?.endRefreshing();
                    },
                    onProgressChanged: (controller, progress) {
                      setState(() {
                        this.progress = progress / 100;
                      });
                      if (progress == 100) {
                        pullToRefreshController?.endRefreshing();
                      }
                    },
                    onUpdateVisitedHistory:
                        (controller, url, androidIsReload) {
                      print("onUpdateVisitedHistory->$url");
                    },
                    onConsoleMessage: (controller, consoleMessage) {
                      print("consoleMessage $consoleMessage");
                      if (consoleMessage.message
                          .contains('"code":498')) {
                        ShowSnackBar.showSnackBar(
                            text:
                                "Your session has expired. Please login again.",
                            backgroundColor: context.colorScheme.error);
                        PreferenceService preferenceService =
                            PreferenceService.instance;
                        preferenceService.setIsLogin(false);
                        preferenceService.clear();
                        context.navigator.pushNamedAndRemoveUntil(
                            LoginScreen.route, (route) => false);
                      }
                    },
                    onDownloadStartRequest:
                        (controller, downloadRequest) async {
                      final url = downloadRequest.url.toString();
                      print("Download pdf -> $url");

                      await canLaunchUrl(Uri.parse(url))
                          ? await launchUrl(Uri.parse(url))
                          : throw 'Could not launch $url';
                    },
                  ),
                  if (progress < 1.0)
                    LinearProgressIndicator(
                      value: progress,
                      backgroundColor: Colors.transparent,
                      valueColor: const AlwaysStoppedAnimation<Color>(
                          AppColor.primary),
                    ),
                ],
              ),
            ),
          ],
        ),
      )

Expected Behavior

Android content not scroll up when keyboard is open

Steps with code example to reproduce

Steps with code example to reproduce
// Paste your code here

Stacktrace/Logs

Stacktrace/Logs
<Replace this line by pasting your stacktrace or logs here>

Flutter version

'>=3.3.0 <4.0.0'

Operating System, Device-specific and/or Tool

30 and 34

Plugin version

6.1.5

Additional information

No response

Self grab

  • I'm ready to work on this issue!
@AdilHypeteq AdilHypeteq added the bug Something isn't working label Jan 10, 2025
@Manguelo
Copy link

Running into the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants