我为我的项目使用了 multi_image_picker插件,它运行良好。现在我尝试修改代码,以便所选图像以水平ListView
而不是GridView
.
但我得到以下异常
I/flutter (18429): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3723 pos 14: 'owner._debugCurrentBuildTarget == this': is not true.
I/chatty (18429): uid=10160(com.example.flutter_sample) 1.ui identical 7 lines
I/flutter (18429): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3723 pos 14: 'owner._debugCurrentBuildTarget == this': is not true.
D/EGL_emulation(18429): eglMakeCurrent: 0xe18058a0: ver 2 0 (tinfo 0xe18035c0)
这是我尝试的代码。
Container(
margin: EdgeInsets.symmetric(vertical: 20.0),
height: 200.0,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
Expanded(
child: buildGridView(),
)
],
),
)
Widget buildGridView() {
return GridView.count(
scrollDirection: Axis.horizontal,
crossAxisCount: 3,
children: List.generate(images.length, (index) {
Asset asset = images[index];
return AssetThumb(
asset: asset,
width: 300,
height: 300,
);
}),
);
}