Флаттер: библиотека визуализации списков Проблема: вертикальная область просмотра имеет неограниченную ширину - PullRequest
1 голос
/ 26 февраля 2020

Недавно я хочу создать приложение для автодилеров и др. c. Я хочу отобразить некоторые автомобили на главной странице, и под этим я хочу перечислить пару кнопок действий. Но когда я попытался запустить свой код, я получил сообщение об ошибке, поскольку вертикальный видовой экран получил неограниченную ширину. Я искал в сети свою проблему и пробовал все возможные решения, но это не сработало.

import 'package:flutter/material.dart';
import 'package:cardemoapp/services/car_model.dart';
import 'package:cardemoapp/services/car_list.dart';
import 'package:cardemoapp/services/actions.dart';

void main() => runApp(MaterialApp(
      home: MyHomePage(),
    ));

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  List<Car> initialCars = []
    ..add(Car(name: 'Civic Type R', price: '3400TL/Month'))
    ..add(Car(name: 'Civic HB Otomatik', price: '3400TL/Month'));

  List<Actionq> actions = [
    Actionq(name: 'Get a car'),
    Actionq(name: 'Repair'),
    Actionq(name: 'Wheel Request'),
    Actionq(name: 'Visa Appointment'),
    Actionq(name: 'Message'),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Welcome to CarApp!'),
        backgroundColor: Colors.red,
        actions: <Widget>[
          IconButton(icon: Icon(Icons.assignment_ind), onPressed: null),
        ],
      ),
      body: Container(
        child: Row(
          children: <Widget>[
            Text('Other requests',
                style: Theme.of(context).textTheme.headline),
            SizedBox(height: 10.0),
            Center(
              child: CarList(initialCars),
            ),
            SizedBox(height: 10.0),
            Text('Shortcuts', style: Theme.of(context).textTheme.headline),
            SizedBox(height: 10.0),
            Expanded(
              child: ListView.builder(
                itemCount: actions.length,
                scrollDirection: Axis.vertical,
                shrinkWrap: true,
                physics: ScrollPhysics(),
                itemBuilder: (context, index) {
                  return Padding(
                    padding: const EdgeInsets.symmetric(
                        vertical: 1.0, horizontal: 3.0),
                    child: Card(
                      child: ListTile(
                        onTap: null,
                        title: Text(actions[index].name),
                        leading: CircleAvatar(
                          backgroundImage: AssetImage('assets/plus.jpg'),
                        ),
                      ),
                    ),
                  );
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}

А также в консоли degub, которую я нашел Соответствующий виджет, вызывающий ошибки, был:

import 'package:flutter/material.dart';
import 'package:cardemoapp/services/car_card.dart';
import 'package:cardemoapp/services/car_model.dart';

class CarList extends StatelessWidget {
  final List<Car> cars;
  CarList(this.cars);

  @override
  Widget build(BuildContext context) {
    return _buildList(context);
  }

  ListView _buildList(context){
    return ListView.builder(
      itemCount: cars.length,
      itemBuilder: (context,index){
        return CarCard(cars[index]);
      });
  }

Вот мой вывод консоли отладки:

Вот консоль отладки:

D/FlutterView(12430): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@7542181
Restarted application in 32,944ms.
I/flutter (12430): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (12430): The following assertion was thrown during performResize():
I/flutter (12430): Vertical viewport was given unbounded width.
I/flutter (12430): Viewports expand in the cross axis to fill their container and constrain their children to match
I/flutter (12430): their extent in the cross axis. In this case, a vertical viewport was given an unlimited amount of
I/flutter (12430): horizontal space in which to expand.
I/flutter (12430):
I/flutter (12430): The relevant error-causing widget was:
[38;5;248mI/flutter (12430):   ListView[39;49m

I/flutter (12430):       child: RenderSliverList#eeb18 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (12430): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: RenderViewport#eea35 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: RenderIgnorePointer#2ecdb relayoutBoundary=up11 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#321a9 relayoutBoundary=up10 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#87fdc relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#fb7ad relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#c5ebf relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: _RenderScrollSemantics#40a4e relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#d39db relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: RenderCustomPaint#5f75b relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#9cec7 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: RenderPositionedBox#cb3d8 relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: RenderBox was not laid out: RenderFlex#403fe relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (12430): Another exception was thrown: NoSuchMethodError: The method '>' was called on null.

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
[38;5;244mThe following assertion was thrown during performResize():[39;49m
Vertical viewport was given unbounded width.

[38;5;244mViewports expand in the cross axis to fill their container and constrain their children to match their extent in the cross axis. In this case, a vertical viewport was given an unlimited amount of horizontal space in which to expand.[39;49m
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m
[38;5;244mWhen the exception was thrown, this was the stack[39;49m
[38;5;244m#0      RenderViewport.performResize.<anonymous closure>[39;49m
[38;5;244m#1      RenderViewport.performResize[39;49m
[38;5;244m#2      RenderObject.layout[39;49m
[38;5;244m#3      RenderProxyBoxMixin.performLayout[39;49m
[38;5;244m#4      RenderObject.layout[39;49m
[38;5;244m...[39;49m
[38;5;244mThe following RenderObject was being processed when the exception was fired: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
[38;5;244mRenderObject: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
    [38;5;244mneeds compositing[39;49m
    [38;5;244mparentData: <none> (can use size)[39;49m
    [38;5;244mconstraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=760.0)[39;49m
    [38;5;244msize: MISSING[39;49m
    [38;5;244maxisDirection: down[39;49m
    [38;5;244mcrossAxisDirection: right[39;49m
    [38;5;244moffset: ScrollPositionWithSingleContext#3488e(offset: 0.0, range: null..null, viewport: null, ScrollableState, AlwaysScrollableScrollPhysics -> ClampingScrollPhysics, IdleScrollActivity#a03fd, ScrollDirection.idle)[39;49m
    [38;5;244manchor: 0.0[39;49m
    [38;5;244mcenter child: RenderSliverPadding#a64fc NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
        [38;5;244mparentData: paintOffset=Offset(0.0, 0.0)[39;49m
        [38;5;244mconstraints: MISSING[39;49m
        [38;5;244mgeometry: null[39;49m
        [38;5;244mpadding: EdgeInsets.zero[39;49m
        [38;5;244mtextDirection: ltr[39;49m
        [38;5;244mchild: RenderSliverList#eeb18 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
            [38;5;244mparentData: paintOffset=Offset(0.0, 0.0)[39;49m
            [38;5;244mconstraints: MISSING[39;49m
            [38;5;244mgeometry: null[39;49m
            [38;5;244mno children current live[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderViewport#eea35 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;244mThe following assertion was thrown during performResize():[39;49m
Vertical viewport was given unbounded width.

[38;5;244mViewports expand in the cross axis to fill their container and constrain their children to match their extent in the cross axis. In this case, a vertical viewport was given an unlimited amount of horizontal space in which to expand.[39;49m
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m
[38;5;244mWhen the exception was thrown, this was the stack[39;49m
[38;5;244m#0      RenderViewport.performResize.<anonymous closure>[39;49m
[38;5;244m#1      RenderViewport.performResize[39;49m
[38;5;244m#2      RenderObject.layout[39;49m
[38;5;244m#3      RenderProxyBoxMixin.performLayout[39;49m
[38;5;244m#4      RenderObject.layout[39;49m
[38;5;244m...[39;49m
[38;5;244mThe following RenderObject was being processed when the exception was fired: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
[38;5;244mRenderObject: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
    [38;5;244mneeds compositing[39;49m
    [38;5;244mparentData: <none> (can use size)[39;49m
    [38;5;244mconstraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=760.0)[39;49m
    [38;5;244msize: MISSING[39;49m
    [38;5;244maxisDirection: down[39;49m
    [38;5;244mcrossAxisDirection: right[39;49m
    [38;5;244moffset: ScrollPositionWithSingleContext#3488e(offset: 0.0, range: null..null, viewport: null, ScrollableState, AlwaysScrollableScrollPhysics -> ClampingScrollPhysics, IdleScrollActivity#a03fd, ScrollDirection.idle)[39;49m
    [38;5;244manchor: 0.0[39;49m
    [38;5;244mcenter child: RenderSliverPadding#a64fc NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
        [38;5;244mparentData: paintOffset=Offset(0.0, 0.0)[39;49m
        [38;5;244mconstraints: MISSING[39;49m
        [38;5;244mgeometry: null[39;49m
        [38;5;244mpadding: EdgeInsets.zero[39;49m
        [38;5;244mtextDirection: ltr[39;49m
        [38;5;244mchild: RenderSliverList#eeb18 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
            [38;5;244mparentData: paintOffset=Offset(0.0, 0.0)[39;49m
            [38;5;244mconstraints: MISSING[39;49m
            [38;5;244mgeometry: null[39;49m
            [38;5;244mno children current live[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderViewport#eea35 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m

[38;5;244mThe following assertion was thrown during performResize():[39;49m
Vertical viewport was given unbounded width.

[38;5;244mViewports expand in the cross axis to fill their container and constrain their children to match their extent in the cross axis. In this case, a vertical viewport was given an unlimited amount of horizontal space in which to expand.[39;49m
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m
[38;5;244mWhen the exception was thrown, this was the stack[39;49m
[38;5;244m#0      RenderViewport.performResize.<anonymous closure>[39;49m
[38;5;244m#1      RenderViewport.performResize[39;49m
[38;5;244m#2      RenderObject.layout[39;49m
[38;5;244m#3      RenderProxyBoxMixin.performLayout[39;49m
[38;5;244m#4      RenderObject.layout[39;49m
[38;5;244m...[39;49m
[38;5;244mThe following RenderObject was being processed when the exception was fired: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
[38;5;244mRenderObject: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
    [38;5;244mneeds compositing[39;49m
    [38;5;244mparentData: <none> (can use size)[39;49m
    [38;5;244mconstraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=760.0)[39;49m
    [38;5;244msize: MISSING[39;49m
    [38;5;244maxisDirection: down[39;49m
    [38;5;244mcrossAxisDirection: right[39;49m
    [38;5;244moffset: ScrollPositionWithSingleContext#3488e(offset: 0.0, range: null..null, viewport: null, ScrollableState, AlwaysScrollableScrollPhysics -> ClampingScrollPhysics, IdleScrollActivity#a03fd, ScrollDirection.idle)[39;49m
    [38;5;244manchor: 0.0[39;49m
    [38;5;244mcenter child: RenderSliverPadding#a64fc NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
        [38;5;244mparentData: paintOffset=Offset(0.0, 0.0)[39;49m
        [38;5;244mconstraints: MISSING[39;49m
        [38;5;244mgeometry: null[39;49m
        [38;5;244mpadding: EdgeInsets.zero[39;49m
        [38;5;244mtextDirection: ltr[39;49m
        [38;5;244mchild: RenderSliverList#eeb18 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
            [38;5;244mparentData: paintOffset=Offset(0.0, 0.0)[39;49m
            [38;5;244mconstraints: MISSING[39;49m
            [38;5;244mgeometry: null[39;49m
            [38;5;244mno children current live[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderViewport#eea35 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderIgnorePointer#2ecdb relayoutBoundary=up11 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderSemanticsAnnotations#321a9 relayoutBoundary=up10 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderPointerListener#87fdc relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m


Vertical viewport was given unbounded width.

[38;5;244mViewports expand in the cross axis to fill their container and constrain their children to match their extent in the cross axis. In this case, a vertical viewport was given an unlimited amount of horizontal space in which to expand.[39;49m
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mListView[39;49m
[38;5;244mWhen the exception was thrown, this was the stack[39;49m
[38;5;244m#0      RenderViewport.performResize.<anonymous closure>[39;49m
[38;5;244m#1      RenderViewport.performResize[39;49m
[38;5;244m#2      RenderObject.layout[39;49m
[38;5;244m#3      RenderProxyBoxMixin.performLayout[39;49m
[38;5;244m#4      RenderObject.layout[39;49m
[38;5;244m...[39;49m
[38;5;244mThe following RenderObject was being processed when the exception was fired: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
[38;5;244mRenderObject: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
    [38;5;244mneeds compositing[39;49m
    [38;5;244mparentData: <none> (can use size)[39;49m
    [38;5;244mconstraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=760.0)[39;49m
    [38;5;244msize: MISSING[39;49m
    [38;5;244maxisDirection: down[39;49m
    [38;5;244mcrossAxisDirection: right[39;49m
    [38;5;244moffset: ScrollPositionWithSingleContext#3488e(offset: 0.0, range: null..null, viewport: null, ScrollableState, AlwaysScrollableScrollPhysics -> ClampingScrollPhysics, IdleScrollActivity#a03fd, ScrollDirection.idle)[39;49m
    [38;5;244manchor: 0.0[39;49m
    [38;5;244mcenter child: RenderSliverPadding#a64fc NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
        [38;5;244mparentData: paintOffset=Offset(0.0, 0.0)[39;49m
        [38;5;244mconstraints: MISSING[39;49m
        [38;5;244mgeometry: null[39;49m
        [38;5;244mpadding: EdgeInsets.zero[39;49m
        [38;5;244mtextDirection: ltr[39;49m
        [38;5;244mchild: RenderSliverList#eeb18 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
            [38;5;244mparentData: paintOffset=Offset(0.0, 0.0)[39;49m
            [38;5;244mconstraints: MISSING[39;49m
            [38;5;244mgeometry: null[39;49m
            [38;5;244mno children current live[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderViewport#eea35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'

RenderBox was not laid out: RenderPositionedBox#cb3d8 relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mRow[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderFlex#403fe relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mScaffold[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
The method '>' was called on null.
Receiver: null
Tried calling: >(1e-10)
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mRow[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
Reloaded 1 of 482 libraries in 1,651ms.
D/FlutterView(12430): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@7542181


Я надеюсь получить ответы на некоторые вопросы, спасибо за помощь.

1 Ответ

0 голосов
/ 26 февраля 2020

Просто оберните CarList с Expanded. Вы можете узнать больше о здесь также см. Flex здесь

Expanded(
child: Center(
 child: CarList(initialCars)
            ),),
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...