我是flutter的新手,如何将图像搜索设置为图像菜单的layoutToRight? 现在在这个部分有困难。
我的代码如下。
return MaterialApp(
theme: ThemeData(
primarySwatch: Colors.red,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home:Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(45.0),
child: AppBar(
leading: Container(
child: GestureDetector(
onTap: (){/* open left menu */},
child: Image.asset("assets/images/ic_title_menu.png")),
padding: EdgeInsets.fromLTRB(14.0, 14.0, 14.0, 14.0),
),
actions: <Widget>[
Container(
child: GestureDetector(
onTap: (){/* open search */},
child: Image.asset("assets/images/ic_title_search.png"),
),
padding: EdgeInsets.fromLTRB(14.0, 14.0, 14.0, 14.0),
)
],
),
),
你可以使用title属性,来实现想要的输出。
Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(45.0),
child: AppBar(
leading: Row(
children: [
Container(
child: GestureDetector(
onTap: () {/* open left menu */},
child: Image.asset("assets/images/ic_title_menu.png")),
padding: EdgeInsets.fromLTRB(14.0, 14.0, 14.0, 14.0),
),
],
),
titleSpacing: 0.0, // added update
title: Container(
child: GestureDetector(
onTap: () {/* open search */},
child: Image.asset("assets/images/ic_title_search.png"),
),
padding: EdgeInsets.fromLTRB(14.0, 14.0, 14.0, 14.0),
),
),
),
)