简体   繁体   中英

Bottom Overflowed By Infinity Pixels in Flutter

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();
              },
            ),
          ],
    
        )
        )
      ),

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();
                },
              )),
            ],
          )),
    );
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM