【发布时间】:2021-08-22 22:39:55
【问题描述】:
我想将一个小部件放到其他人的视图中。
在没有倒数计时器的普通版本中,屏幕内没有空白。它是 %50 %50 除以颜色(红色和蓝色)。
我想要做的是在不创建空格的情况下添加倒数计时器。直接将其添加到中心的那些颜色上。
我看到 Stack 可以做到这一点。我试过了,但无法删除白色区域。
这是我的代码:
@override
Widget build(BuildContext context) {
return Scaffold(
body: new Column(
children: [
Expanded(
flex: 40,
child: new Container(
width: double.infinity,
child: new Column(
children: <Widget>[
box1 = new Expanded(
flex: boxSize1,
child: InkWell(
onTap: () {
clickBox1();
}, // Handle your callback
child: new Container(
alignment: Alignment.topCenter,
color: colorRandom,
),
),
),
TimeCircularCountdown(
unit: CountdownUnit.second,
countdownTotal: 3,
onUpdated: (unit, remainingTime) => print('Updated'),
onFinished: () {
setState(() {
visibility = false;
});
},
),
box2 = new Expanded(
flex: boxSize2,
child: InkWell(
onTap: () {
clickBox2();
}, // Handle your callback
child: new Container(
alignment: Alignment.topCenter,
color: color,
),
),
),
],
),
),
),
],
),
);
【问题讨论】:
标签: flutter widget flutter-layout