有没有办法使用Container
小部件用Column
填充Row
中的剩余空间?我试过使用Expanded
,但集装箱不会占用可用的空间.
所需的Row
设计类似于:
在我的应用程序中,这Row
被包装在Column
中,而Container
在使用Expanded
时没有填满空间.
示例应用程序:
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: Scaffold(
body: Column(
children: [
const Text("Some text"),
Row(
children: [
const Text("Flutter"),
Expanded(
child: Container(color: Colors.pink),
),
],
),
const Text("Some more text"),
],
),
),
);
}
}
如示例应用程序中所示,展开的容器不会以粉色背景显示.