展开的小部件中的平面按钮未正确舍入

我在我的应用栏中添加了一个按钮,以链接到我的搜索页面,我想添加圆角,但是由于某些奇怪的原因,它并没有完全舍入。

  appBar: AppBar(
    title: Row(
      children: [
        Expanded(
          child: ClipRRect(
            borderRadius: BorderRadius.circular(20),child: flatButton(
              color: Colors.white,child: Row(
                children: <Widget>[
                  Icon(Icons.search),Text("view 1"),],),onpressed: () {
                // something
              },IconButton(
          icon: Icon(Icons.nfc),onpressed: () {},elevation: 6.1,backgroundColor: Colors.red,

我想要的-https://drive.google.com/file/d/1koiHKZXuvs57Qo6fDlhhm5jOC7N_IM1w/view

我得到了什么-https://drive.google.com/file/d/1ZNsRQSk4rtMOIMtUy1IxyO_xTGT7KjGT/view

suijianzhi 回答:展开的小部件中的平面按钮未正确舍入

FlatButton具有shape属性,您可以使用它来实现所需的功能,请检查此解决方案

AppBar(
        title: Row(
          children: [
            Expanded(
                child: FlatButton(
                  shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(60)),color: Colors.white,child: Row(
                children: <Widget>[
                  Icon(Icons.search),Text("view 1"),],),onPressed: () {
                // something
              },)),IconButton(
              icon: Icon(Icons.nfc),onPressed: () {},elevation: 6.1,backgroundColor: Colors.red,
,

删除ClipRRect小部件并添加属性

shape: RoundedRectangleBorder(
   borderRadius: new BorderRadius.circular(20.0),)

到您的FlatButton小部件

本文链接:https://www.f2er.com/3137210.html

大家都在问