我有以下小部件
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Playground',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.green,
body: Align(
alignment: Alignment.bottomCenter,
child: Container(
height: 100,
color: Colors.black,
child: const ResponsiveInput(),
),
),
);
}
}
class ResponsiveInput extends StatelessWidget {
const ResponsiveInput({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: TextFormField(
decoration: const InputDecoration(
fillColor: Colors.white,
filled: true,
),
),
),
TextButton(
onPressed: () => false,
child: const Text('Send'),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.orange)),
)
],
);
}
}
执行以下操作
[![在此处输入图像描述][1]][1]
但是如何使文本字段填充黑色容器中的剩余空间?
我尝试使用内容填充,但发生的情况是,如果容器具有响应高度,则文本将被截断。即使使用密集。