Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebView in ListView without assigning its dimensions

Is there any possibility to put WebView (webview_flutter) inside a ListView without assigning its dimensions but automatically adopt its height. Only working solution I found is to put WebView in Container by assigning its height but I dont want to assign any height I just want it to occupy height according to its content..

I have tried so many solutions including Expanded for this but getting error about infinite height . Any solution?

like image 826
Shahzad Akram Avatar asked Mar 21 '19 06:03

Shahzad Akram


1 Answers

Until now you can not as I expect...but you can include a scroll inside your webview widget

import those libraries:

import 'package:flutter/gestures.dart';

import 'package:flutter/foundation.dart';

add this line to your webview widget:

gestureRecognizers: Set()..add(Factory<VerticalDragGestureRecognizer>(()=>VerticalDragGestureRecognizer())),

and you are done :)

EDIT the flutter_widget_from_html plugin is now supporting the webview and iframe and you can use it insted of the web_view plugin and without the need of using a height

like image 174
Emam Avatar answered Nov 28 '22 09:11

Emam