Reputation: 17
I used the Webview script data loading from the website. only data display from post title but Webview data are not showing instead Bottom Overflowed By Infinity Pixels are display in the screen. I cant find out my problem.Please give me suggestion.
body: Container(
height: 100,
child: Padding(
padding: EdgeInsets.all(8.0),
child: Column(
children:[
Text(widget.title,
textAlign:TextAlign.start,
style: TextStyle(fontSize:19, )
),
WebView(
navigationDelegate: (NavigationRequest request) {
print('allowing navigation to $request');
return NavigationDecision.navigate;
},
javascriptMode: JavascriptMode.unrestricted,
initialUrl:'data:text/html;base64,$contentBase64',
onWebResourceError: (error) {
//EasyLoading.dismiss();
},
onPageFinished: (finish) {
//EasyLoading.dismiss();
},
),
],
)
)
),
Upvotes: 0
Views: 716
Reputation: 999
Wrap webview with expanded().
Full Code :
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('WebView Demo'),
),
body: Padding(
padding: EdgeInsets.all(8.0),
child: Column(
children: [
Text("widget.title",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 19,
)),
Expanded(
child: WebView(
navigationDelegate: (NavigationRequest request) {
print('allowing navigation to $request');
return NavigationDecision.navigate;
},
javascriptMode: JavascriptMode.unrestricted,
initialUrl: 'https://www.google.com/',
onWebResourceError: (error) {
//EasyLoading.dismiss();
},
onPageFinished: (finish) {
//EasyLoading.dismiss();
},
)),
],
)),
);
}
}
Upvotes: 1