0

I have implemented the webview open in bottomsheet and i did but this sheet opens this does not scroll i tried with many other ways but in bottomsheet the webview does not scroll

 onTap: () {
                      showModalBottomSheet(
                        context: context,
                        isScrollControlled: true,
                        enableDrag: true,
                        builder: (context) {
                          return DraggableScrollableSheet(
                            expand: false,
                            initialChildSize: 0.9,
                            minChildSize: 0.5,
                            maxChildSize: 0.9,
                            builder: (context, scrollController) {
                              return Column(
                                children: [
                                  Container(
                                    height: 24,
                                    alignment: Alignment.center,
                                    child: Container(
                                      width: 40,
                                      height: 4,
                                      decoration: BoxDecoration(
                                        color: Colors.grey[300],
                                        borderRadius: BorderRadius.circular(2),
                                      ),
                                    ),
                                  ),

                                  Expanded(
                                    child: SimpleWebViewScreen(
                                      url:
                                          'https://arleven.com/projects/San%20Andreas%20Cheats/privacy',
                                    ),
                                  ),
                                ],
                              );
                            },
                          );
                        },
                      );
                    },

See when i tap in sheet i have opened the Webview screen

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

class SimpleWebViewScreen extends StatefulWidget {
  final String url;
  const SimpleWebViewScreen({super.key, required this.url});

  @override
  State<SimpleWebViewScreen> createState() => _SimpleWebViewScreenState();
}

class _SimpleWebViewScreenState extends State<SimpleWebViewScreen> {
  late final WebViewController _controller;

  @override
  void initState() {
    super.initState();
    _controller = WebViewController()
      ..setJavaScriptMode(JavaScriptMode.unrestricted)
      ..loadRequest(Uri.parse(widget.url));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("WebView")),
      body: WebViewWidget(controller: _controller),
    );
  }
}

Now This is my webview screen which i was opening in bottomsheet

1 Answer 1

0

Try this one.

import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
WebViewWidget(
    gestureRecognizers: {
      Factory(() => EagerGestureRecognizer()),
    },
    controller: _controller)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.