Желаю хорошего дня. Я изо всех сил пытаюсь обернуть ListView.builder внутри столбца. каждый раз, когда я пытаюсь это исправить, я получаю это исключение:
The following RenderObject was being processed when the exception was fired:
flutter: RenderViewport#c3792 NEEDS-LAYOUT NEEDS-PAINT
flutter: creator: Viewport ← IgnorePointer-[GlobalKey#b696d] ← Semantics ← Listener ← _GestureSemantics ←
flutter: RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#65964] ← Listener ← _ScrollableScope
flutter: ← _ScrollSemantics-[GlobalKey#f3a27] ← Scrollable ← PrimaryScrollController ← ListView ← ⋯
flutter: parentData: <none> (can use size)
flutter: constraints: BoxConstraints(w=327.0, 0.0<=h<=Infinity)
flutter: size: MISSING
flutter: axisDirection: down
flutter: crossAxisDirection: right
flutter: offset: ScrollPositionWithSingleContext#60171(offset: 0.0, range: null..null, viewport: null,
flutter: ScrollableState, AlwaysScrollableScrollPhysics -> BouncingScrollPhysics, IdleScrollActivity#63b9f,
flutter: ScrollDirection.idle)
flutter: anchor: 0.0
flutter: This RenderObject had the following descendants (showing up to depth 5):
flutter: RenderSliverPadding#e4dfb NEEDS-LAYOUT NEEDS-PAINT
flutter: RenderSliverList#17862 NEEDS-LAYOUT NEEDS-PAINT
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: RenderBox was not laid out: RenderViewport#c3792 NEEDS-LAYOUT NEEDS-PAINT
flutter: Another exception was thrown: RenderBox was not laid out: RenderViewport#c3792 NEEDS-PAINT
flutter: Another exception was thrown: RenderBox was not laid out: RenderIgnorePointer#8fccb relayoutBoundary=up9 NEEDS-PAINT
flutter: Another exception was thrown: RenderBox was not laid out: RenderFlex#cbeea relayoutBoundary=up2 NEEDS-PAINT
flutter: Another exception was thrown: RenderBox was not laid out: RenderPadding#0b306 relayoutBoundary=up1 NEEDS-PAINT
flutter: Another exception was thrown: NoSuchMethodError: The method '<=' was called on null.
flutter: Another exception was thrown: NoSuchMethodError: The getter 'visible' was called on null.
flutter: Another exception was thrown: NoSuchMethodError: The method '<=' was called on null.
flutter: Another exception was thrown: NoSuchMethodError: The method '<=' was called on null.
flutter: Another exception was thrown: NoSuchMethodError: The method '<=' was called on null.
flutter: Another exception was thrown: NoSuchMethodError: The method '<=' was called on null.
это мой код:
Padding(
padding: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: ListView.builder(
itemCount: _messages.length,
itemBuilder: (context, position) {
print(_messages.length);
return Center(child: Text(_messages[position]));
}),
)
]))
если есть кто-то, кто может мне помочь, я буду очень благодарен.
спасибо бро, это работает для меня.
Рад, что это помогло! Не возражаете, если я опубликую это как ответ?
Да, конечно
заверните второй
Padding
в виджетExpanded
.