【发布时间】:2022-01-19 18:48:31
【问题描述】:
我正在尝试在 Scaffold 中实现底部导航栏小部件,但由于某种未知原因,小部件的内容 (bottomNavigationBar) 没有出现
这是我的代码
class _ChatScreenState extends State<ChatScreen> {
final TextEditingController messageController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('App Title'.toUpperCase()),
centerTitle: true,
backgroundColor: Colors.redAccent,
),
bottomNavigationBar: Row( // Nothing showing up
children: [
TextField(
controller: messageController,
autofocus: false,
keyboardType: TextInputType.text,
decoration: const InputDecoration(
hintText: 'Message',
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(5.0))
)
),
),
TextButton(
onPressed: (){},
style: ButtonStyle(
padding: MaterialStateProperty.all(const EdgeInsets.all(10.0)),
backgroundColor: MaterialStateProperty.all(Colors.redAccent)
),
child: Text('Send'.toUpperCase()),
),
],
),
);
}
}
【问题讨论】: