我使用三个扩展块。当我用展开包装容器时,将显示空格/行。我无法在扩展块之间将其删除。尽管我已经使用了很多方法。有人遇到过同样的案件吗?谢谢。enter image description here
import 'package:flutter/material.dart';
void main() async {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Color(0x000000),
body: Container(
color: Color(0x000000),
child: SizedBox.expand(
child: VariousDiscs(),
),
),
),
),
);
}
class VariousDiscs extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Expanded Column Sample'),
),
body: Center(
child: Column(
children: <Widget>[
Expanded(
child: Container(
color: Color(0xbf000000),
height: 100,
width: 100
),
),
Expanded(
child: Container(
color: Color(0xbf000000),
height: 100,
width: 100,
),
),
Expanded(
child: Container(
color: Color(0xbf000000),
height: 100,
width: 100,
),
),
],
),
),
);
}
}
我已经在稳定版本的Flutter上在Android设备上测试了您的代码,并且可以正常工作,没有任何问题。您显示的屏幕截图来自[DartPad] [1],似乎此问题与DartPad或Flutter Web版本有关。您可以在飞镖垫repo上打开错误报告。