我插入了6张卡,但是无法滚动屏幕 .
根据下图,页脚中出现红色条纹,屏幕不滚动 .
有什么可以滚动屏幕?
main.dart
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: "Myapp",
home: new HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) => new Scaffold(
appBar: new AppBar(
backgroundColor: new Color(0xFF26C6DA),
),
body: new Column(
children: <Widget>[
new Card(
child: new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const ListTile(
leading: const Icon(Icons.album),
title: const Text('The Enchanted Nightingale'),
subtitle: const Text('Music by Julie Gable. Lyrics by Sidney Stein.'),
),
],
),
),
...
...
...
],
)
);
}
4 回答
列不滚动 . 尝试使用ListView替换外部列 . 你可能需要把shrinkWrap:true放在上面 .
列中的列使得无需设置高度就无法计算布局 . 第二列是无用的,因为它只包含一个元素,尝试将ListTile直接作为卡的主体 .
你必须把它放在ListView.builder上
要使列可滚动,只需将其包装在SingleChildScrollView中 .