Flutter inappwebview scroll not working inside the NestedScrollView TabBarView

Issue

Im new to flutter, i have added the webview(inappwebview) inside the TabBarView, but when i try to scroll down the web page, it is not scrolling down, below i have added my code and screenshot

import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
        body: DefaultTabController(
          length: 5,
          child: Scaffold(
              body: NestedScrollView(
            headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
              return <Widget>[
                new SliverAppBar(
                  title: Text('Tabs Demo'),
                  pinned: true,
                  floating: true,
                  bottom: TabBar(
                    isScrollable: true,
                    tabs: [
                      Tab(child: Text('Flight')),
                      Tab(child: Text('Train')),
                      Tab(child: Text('Car')),
                      Tab(child: Text('Cycle')),
                      Tab(child: Text('Boat')),
                    ],
                  ),
                ),
              ];
            },
            body: TabBarView(
              children: <Widget>[
                InAppWebView(initialUrlRequest: URLRequest(url: Uri.parse("https://flutter.dev/"))),
                Icon(Icons.directions_transit, size: 350),
                Icon(Icons.directions_car, size: 350),
                Icon(Icons.directions_bike, size: 350),
                Icon(Icons.directions_boat, size: 350),
              ],
            ),
          )),
        ),
      ),
    );
  }
}

screenshot:
page

Solution

Try adding a gesture detector, like this:

InAppWebView(
gestureRecognizers: Set()..add(Factory<VerticalDragGestureRecognizer>(() => VerticalDragGestureRecognizer())),
initialUrlRequest: URLRequest(url: Uri.parse("https://flutter.dev/"))),
               

If this doesn’t solve your problem, this is the place you have to look, gesture detectors.

Answered By – Huthaifa Muayyad

Answer Checked By – Willingham (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.