【发布时间】:2021-11-15 10:22:05
【问题描述】:
正如你在图片中看到的,当我们按下搜索图标时,我希望图标传递到文本字段中。
基本上,当我按下搜索图标时,我希望该图标消失在文本字段中。 感谢您的帮助。
return Scaffold(
appBar: AppBar(
backgroundColor: it_tool_main_grey_accent,
elevation: 0,
title: !isSearching
? Text('All')
: TextField(
decoration: InputDecoration(
enabledBorder: const OutlineInputBorder(
borderSide:
BorderSide(color: Colors.black, width: 1.0),
),
hintText: "Search"),
),
automaticallyImplyLeading: false,
leadingWidth: 55,
leading: Padding(
padding:
EdgeInsets.only(left: MediaQuery.of(context).size.width / 30),
child: DecoratedBox(
decoration:
BoxDecoration(shape: BoxShape.circle, color: Colors.white),
child: IconButton(
icon: customIcon,
onPressed: () {
setState(() {
isSearching = !isSearching;
});
},
),
),
),
),
body: Text("hi"),
);
【问题讨论】:
-
您需要为其制作动画还是只想让它立即移动?
-
是的,我需要一个动画,但我不知道该怎么做。
标签: flutter dart input icons textfield