Flutter:Listview渲染库问题:垂直视口被赋予了无限宽度



最近我想为汽车经销商等创建一个应用程序。我想在主页上显示一些汽车,并在主页下列出几个操作按钮。但当我试图运行我的代码时,我得到了一个错误,垂直视口被赋予了无限宽度。我在网上搜索我的问题,并尝试了各种可能的解决方案,但都没有奏效。

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

我希望我能得到一些答案,谢谢你的帮助

只需用Expanded包装CarList。你可以在这里了解更多信息也可以在这里查看Flex

Expanded(
child: Center(
child: CarList(initialCars)
),),

最新更新