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

Scrolling not working on Windows Platform using touch pad #2503

Open
1 of 2 tasks
akshayverma25 opened this issue Jan 16, 2025 · 0 comments
Open
1 of 2 tasks

Scrolling not working on Windows Platform using touch pad #2503

akshayverma25 opened this issue Jan 16, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@akshayverma25
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Scrolling with the touchpad is not working properly in the webview on the Windows platform, but it functions correctly when an external mouse is connected.

Expected Behavior

Scrolling should work fine using touchpad also on windows platform.

Steps with code example to reproduce

Steps with code example to reproduce
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';

WebViewEnvironment? webViewEnvironment;

Future main() async {
  WidgetsFlutterBinding.ensureInitialized();

  if (!kIsWeb && defaultTargetPlatform == TargetPlatform.windows) {
    final availableVersion = await WebViewEnvironment.getAvailableVersion();
    assert(availableVersion != null,
    'Failed to find an installed WebView2 Runtime or non-stable Microsoft Edge installation.');

    webViewEnvironment = await WebViewEnvironment.create(
        settings:
        WebViewEnvironmentSettings(userDataFolder: 'YOUR_CUSTOM_PATH'));
  }

  if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) {
    await InAppWebViewController.setWebContentsDebuggingEnabled(kDebugMode);
  }

  runApp(const MaterialApp(home: MyApp()));
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final GlobalKey webViewKey = GlobalKey();

  InAppWebViewController? webViewController;
  InAppWebViewSettings settings = InAppWebViewSettings(
      isInspectable: kDebugMode,
      mediaPlaybackRequiresUserGesture: false,
      allowsInlineMediaPlayback: true,
      iframeAllow: "camera; microphone",
      iframeAllowFullscreen: true);

  double progress = 0;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text("Official InAppWebView website")),
        body: SafeArea(
            child: Column(children: <Widget>[
              Expanded(
                child: Stack(
                  children: [
                    InAppWebView(
                      key: webViewKey,
                      webViewEnvironment: webViewEnvironment,
                      initialSettings: settings,
                      onWebViewCreated: (controller) async {
                        webViewController = controller;

                        // Prepare DevTools Protocol
                        if (!kIsWeb &&
                            defaultTargetPlatform == TargetPlatform.windows) {
                          // Enables page domain notifications.
                          await controller.callDevToolsProtocolMethod(
                              methodName: 'Page.enable');
                          // Listen for a Page event
                          await controller.addDevToolsProtocolEventListener(
                            eventName: 'Page.loadEventFired',
                            callback: (data) {
                              print('Page.loadEventFired: $data');
                            },
                          );
                        }

                        // Load your URL
                        await controller.loadUrl(
                            urlRequest: URLRequest(
                                url: WebUri("https://inappwebview.dev/")));
                      },
                      onProgressChanged: (controller, progress) {
                        setState(() {
                          this.progress = progress / 100;
                        });
                      },
                    ),
                    progress < 1.0
                        ? LinearProgressIndicator(value: progress)
                        : Container(),
                  ],
                ),
              ),
              ButtonBar(
                alignment: MainAxisAlignment.center,
                children: <Widget>[
                  ElevatedButton(
                    child: const Icon(Icons.arrow_back),
                    onPressed: () {
                      webViewController?.goBack();
                    },
                  ),
                  ElevatedButton(
                    child: const Icon(Icons.arrow_forward),
                    onPressed: () {
                      webViewController?.goForward();
                    },
                  ),
                  ElevatedButton(
                    child: const Icon(Icons.refresh),
                    onPressed: () {
                      webViewController?.reload();
                    },
                  ),
                ],
              ),
            ])));
  }
}

Stacktrace/Logs

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

Flutter version

v3.27.1

Operating System, Device-specific and/or Tool

Windows Platform
OS Version : Windows 11

Plugin version

v6.1.5

Additional information

No response

Self grab

  • I'm ready to work on this issue!
@akshayverma25 akshayverma25 added the bug Something isn't working label Jan 16, 2025
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

1 participant