简体   繁体   中英

A RenderFlex overflowed by pixels on the bottom

I got error debugging my flutter application on android.

The error is : A RenderFlex overflowed by 99317 pixels on the bottom.

I have notice that the error comes only when using Color.blue code, but if I erase this line of code the program runs. but I need the code to works with this.

Code:

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: HomeScreen(),
    );
  }
}


class HomeScreen extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: <Widget>[
          HomeScreenTopPart()
        ],
      ),
    );
  }
}

class HomeScreenTopPart extends StatefulWidget {
  @override
  _HomeScreenTopPartState createState() => _HomeScreenTopPartState();
}

class _HomeScreenTopPartState extends State<HomeScreenTopPart> {
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
        Container(height:400.0, color: Colors.blue, )
      ],
    );
  }
}

This is the console error :

I/flutter (20722): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (20722): The following _CompileTimeError was thrown building Container(bg: BoxDecoration(color:
I/flutter (20722): MaterialColor(primary value: Color(0xff2196f3))), constraints: BoxConstraints(0.0<=w<=Infinity,
I/flutter (20722): h=400.0)):
I/flutter (20722): 'package:flutter/src/widgets/basic.dart': error: line 4799 pos 30:
I/flutter (20722): file:///C:/src/flutter/packages/flutter/lib/src/widgets/basic.dart:4799:30: Error: Getter not found:
I/flutter (20722): 'rootBundle'.
I/flutter (20722):     return result?.bundle ?? rootBundle;
I/flutter (20722):                              ^^^^^^^^^^
I/flutter (20722):     return result?.bundle ?? rootBundle;
I/flutter (20722):                              ^
I/flutter (20722):
I/flutter (20722): When the exception was thrown, this was the stack:

*************
I/flutter (20722): #125    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
I/flutter (20722): #126    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3710:16)
I/flutter (20722): #127    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (20722): #128    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2286:33)
I/flutter (20722): #129    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:676:20)
I/flutter (20722): #130    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:219:5)
I/flutter (20722): #131    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
I/flutter (20722): #132    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
I/flutter (20722): #133    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:751:7)
Reloaded 1 of 419 libraries in 810ms.
I/flutter (20722): #135    _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
I/flutter (20722): #136    _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
I/flutter (20722): #137    _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
I/flutter (20722): (elided one frame from package dart:async)
I/flutter (20722): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (20722): Another exception was thrown: A RenderFlex overflowed by 99317 pixels on the bottom.

I've run your code and no problem encountered on my side. I've run it on Flutter Channel stable, 2.5.1 :

在此处输入图片说明

Just update Flutter to current version and flutter clean to clear build-cache.

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