我希望在“欢迎使用返回文字”旁边对齐用户名。有什么办法可以在一行代码中完成?这是我现在所拥有的。
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
brightness: Brightness.light,
backgroundColor: Colors.white,
elevation: 0,
title: Text("Welcome Back", style: TextStyle(color: Color.fromRGBO(49, 39, 79, 1), fontWeight: FontWeight.bold,fontSize: 20),),
actions: <Widget>[
new Container(
child: Text(
name, style: TextStyle(color: Color.fromRGBO(49, 39, 79, 1), fontWeight: FontWeight.bold,fontSize: 20)
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(
backgroundImage: NetworkImage(
imageUrl,
),
),
),
]),
用于此情况Row(...)
actions: <Widget>[
Row(
children: <Widget>[
Container(
child: Text(name, style: TextStyle(color: Color.fromRGBO(49, 39, 79, 1), fontWeight: FontWeight.bold,fontSize: 20))
),
Padding(padding: const EdgeInsets.all(8.0),
child: CircleAvatar(
backgroundImage: NetworkImage(imageUrl),
),
),
],
),
]
Btw:您不需要new
。由于Dart 2.0是可选的。