В Scaffold у меня есть контейнер для установки фона. у ребенка контейнера SingleChildScrollView
, а у ребенка Column
. У детей этого виджета у меня есть 2 Expanded
виджет:
Scaffold
|
Container
|
SingleChildScrollView
|
* Expanded
* Expanded
Это код:
Widget build(BuildContext context) {
return Scaffold(
extendBodyBehindAppBar: true,
resizeToAvoidBottomPadding: true,
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("images/main_background.png"),
fit: BoxFit.cover,
),
),
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(..)
Expanded(..)
Моя проблема в том, что когда на этой странице запускаются все страницы, значит розовый цвет означает Я получил эту ошибку:
I/flutter ( 8893): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter ( 8893): The following assertion was thrown during performLayout():
I/flutter ( 8893): RenderFlex children have non-zero flex but incoming height constraints are unbounded.
I/flutter ( 8893): When a column is in a parent that does not provide a finite height constraint, for example if it is
I/flutter ( 8893): in a vertical scrollable, it will try to shrink-wrap its children along the vertical axis. Setting a
I/flutter ( 8893): flex on a child (e.g. using Expanded) indicates that the child is to expand to fill the remaining
I/flutter ( 8893): space in the vertical direction.
I/flutter ( 8893): These two directives are mutually exclusive. If a parent is to shrink-wrap its child, the child
I/flutter ( 8893): cannot simultaneously expand to fit its parent.
I/flutter ( 8893): Consider setting mainAxisSize to MainAxisSize.min and using FlexFit.loose fits for the flexible
I/flutter ( 8893): children (using Flexible rather than Expanded). This will allow the flexible children to size
I/flutter ( 8893): themselves to less than the infinite remaining space they would otherwise be forced to take, and
I/flutter ( 8893): then will cause the RenderFlex to shrink-wrap the children rather than expanding to fit the maximum
I/flutter ( 8893): constraints provided by the parent.
I/flutter ( 8893): If this message did not help you determine the problem, consider using debugDumpRenderTree():
I/flutter ( 8893): https://flutter.dev/debugging/#rendering-layer
I/flutter ( 8893): http://api.flutter.dev/flutter/rendering/debugDumpRenderTree.html
I/flutter ( 8893): The affected RenderFlex is:
I/flutter ( 8893): RenderFlex#4b35c relayoutBoundary=up13 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE(creator: Column ← _SingleChildViewport ← IgnorePointer-[GlobalKey#fcff2] ← Semantics ← _PointerListener ← Listener ← _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#e245d] ← _PointerListener ← Listener ← _ScrollableScope ← _ScrollSemantics-[GlobalKey#471e6] ← ⋯, parentData: <none> (can use size), constraints: BoxConstraints(0.0<=w<=320.0, 0.0<=h<=Infinity), size: MISSING, direction: vertical, mainAxisAlignment: start, mainAxisSize: max, crossAxisAlignment: center, verticalDirection: down)
I/flutter ( 8893): The creator information is set to:
I/flutter ( 8893): Column ← _SingleChildViewport ← IgnorePointer-[GlobalKey#fcff2] ← Semantics ← .....
В чем проблема?