#flutter #widget #stepper
Вопрос:
У меня есть шаговый виджет, я хочу вставить редактируемый виджет в шаговый виджет. Журнал ошибок довольно длинный, но я вставлю только ту часть, которая, по моему мнению, наиболее актуальна.
Что я пробовал: Я попытался обернуть виджет столбца в расширенный виджет, я завернул его в виджет Sizedbox.
The Flutter DevTools debugger and profiler on Chrome is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:62272/2xgDSUA-qPE= ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════ The following assertion was thrown during performLayout(): RenderFlex children have non-zero flex but incoming height constraints are unbounded. When a column is in a parent that does not provide a finite height constraint, for example if it is in a vertical scrollable, it will try to shrink-wrap its children along the vertical axis. Setting a flex on a child (e.g. using Expanded) indicates that the child is to expand to fill the remaining space in the vertical direction. These two directives are mutually exclusive. If a parent is to shrink-wrap its child, the child cannot simultaneously expand to fit its parent. Consider setting mainAxisSize to MainAxisSize.min and using FlexFit.loose fits for the flexible children (using Flexible rather than Expanded). This will allow the flexible children to size themselves to less than the infinite remaining space they would otherwise be forced to take, and then will cause the RenderFlex to shrink-wrap the children rather than expanding to fit the maximum constraints provided by the parent. If this message did not help you determine the problem, consider using debugDumpRenderTree(): https://flutter.dev/debugging/#rendering-layer http://api.flutter.dev/flutter/rendering/debugDumpRenderTree.html The affected RenderFlex is: RenderFlex#86b88 relayoutBoundary=up27 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE(creator: Column ← Column ← Padding ← Container ← FadeTransition ← _FocusMarker ← Focus ← ExcludeFocus ← ExcludeSemantics ← _EffectiveTickerMode ← TickerMode-[lt;CrossFadeState.showSecondgt;] ← Positioned-[lt;CrossFadeState.showSecondgt;] ← ⋯, parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size), constraints: BoxConstraints(0.0lt;=wlt;=1334.0, 0.0lt;=hlt;=Infinity), size: MISSING, direction: vertical, mainAxisAlignment: start, mainAxisSize: max, crossAxisAlignment: center, verticalDirection: down) The creator information is set to: Column ← Column ← Padding ← Container ← FadeTransition ← _FocusMarker ← Focus ← ExcludeFocus ← ExcludeSemantics ← _EffectiveTickerMode ← TickerMode-[lt;CrossFadeState.showSecondgt;] ← Positioned-[lt;CrossFadeState.showSecondgt;] ← ⋯ See also: https://flutter.dev/layout/ If none of the above helps enough to fix this problem, please don't hesitate to file a bug: https://github.com/flutter/flutter/issues/new?template=2_bug.md The relevant error-causing widget was: Column Column:file:///auth/screens/home.dart:386:18
Я добавил таблицу в степперы, и она отлично работает. Я добавил mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch
виджет в столбец и все еще получаю те же результаты.
Вот мой код с помощью шагового
Listlt;Stepgt; getSteps() { return[ Step( title: new Text('Stepper One'), content: Column( mainAxisSize: MainAxisSize.min, children: lt;Widgetgt;[ Expanded( child: SizedBox( height: 20.0, child: Editable( key: _editableKey, columns: cols, rows: rows, zebraStripe: true, stripeColor1: Colors.white, stripeColor2: Colors.grey, ), ), ), ], ), isActive: currentStep gt;= 0, state: currentStep == 0 ? StepState.editing : StepState.complete, ), ]; }