是否在颤动中创建凹槽按钮?

问题描述 投票:0回答:2

是否可以使按钮像图像一样?它不必是圆形的,反正可以使Flutter中的凸起按钮和文本字段区域产生凹槽效果吗?图像的链接也是“ https://css-tricks.com/circular-3d-buttons/”这是css制作的,如果材料设计上有技巧,也许css import可以完成这样的工作?

Groove button with css

flutter button uibutton flutter-layout
2个回答
0
投票

尝试一下

    new RawMaterialButton(
  onPressed: () {},
  child: new Icon(
     Icons.pause,
     color: Colors.blue,
     size: 35.0,
  ),
  shape: new CircleBorder(),
  elevation: 2.0,
  fillColor: Colors.white,
  padding: const EdgeInsets.all(15.0),
),

0
投票

您可以通过使用RawMaterialButton和装饰的Container获得非常相似的结果。

enter image description here

Container(
  padding: EdgeInsets.all(10),      
  decoration: new BoxDecoration(
     shape: BoxShape.circle,
     gradient: LinearGradient(
       begin: Alignment.bottomCenter,
       end: Alignment.topCenter,
       stops: [0.0 , 0.5, 1.0],
       colors: [Colors.white, Colors.white, Colors.grey[200]]
     )  
  ),
  child: RawMaterialButton(
    onPressed: () {},
    child: new Icon(
      Icons.settings,
        color: Colors.grey[600],
        size: 28.0,
     ),
     shape: new CircleBorder(),
     elevation: 2.0,
     fillColor: Colors.white,
     padding: const EdgeInsets.all(18.0),
   )
);
© www.soinside.com 2019 - 2024. All rights reserved.