聊聊 Flutter 2021 中的按钮

开发 前端
在本文中,我们将介绍令人惊叹的 Flutter 按钮,它们可以帮助所有初学者或专业人士为现代应用程序设计漂亮的 UI。

[[432217]]

在本文中,我们将介绍令人惊叹的 Flutter 按钮,它们可以帮助所有初学者或专业人士为现代应用程序设计漂亮的 UI。

首先让我告诉你关于 Flutter 中按钮的一件重要事情,在flutter最新版本中以下Buttons在fluter中被废弃了:

废弃的 推荐的替代
RaisedButton ElevatedButton
OutlineButton OutlinedButton
FlatButton TextButton

那么让我们来探索一下 Flutter 中的按钮。

Elevated Button

StadiumBorder

  1. ElevatedButton( 
  2.   onPressed: (){}, 
  3.   child: Text('Button'), 
  4.   style: ElevatedButton.styleFrom( 
  5.   shadowColor: Colors.green, 
  6.   shape: StadiumBorder(), 
  7.   padding: EdgeInsets.symmetric(horizontal: 35,vertical: 20)), 

RoundedRectangleBorder

  1. ElevatedButton( 
  2.   onPressed: (){}, 
  3.   child: Text('Button'), 
  4.   style: ElevatedButton.styleFrom( 
  5.   shadowColor: Colors.green, 
  6.   shape: RoundedRectangleBorder( 
  7.   borderRadius: BorderRadius.circular(12), 
  8.       ), 
  9.    ), 
  10. ), 

CircleBorder

  1. ElevatedButton( 
  2.   onPressed: () {}, 
  3.   child: Text('Button'), 
  4.   style: ElevatedButton.styleFrom( 
  5.     shape: CircleBorder(), 
  6.     padding: EdgeInsets.all(24), 
  7.   ), 

BeveledRectangleBorder

  1. ElevatedButton( 
  2.   onPressed: () {}, 
  3.   child: Text('Button'), 
  4.   style: ElevatedButton.styleFrom( 
  5.     shape: BeveledRectangleBorder( 
  6.       borderRadius: BorderRadius.circular(12) 
  7.     ), 
  8.   ), 

Outlined Button

StadiumBorder

  1. OutlinedButton( 
  2.   onPressed: () {}, 
  3.   child: Text('Button'), 
  4.   style: OutlinedButton.styleFrom( 
  5.     shape: StadiumBorder(), 
  6.   ), 

RoundedRectangleBorder

  1. OutlinedButton( 
  2.   onPressed: () {}, 
  3.   child: Text('Button'), 
  4.   style: OutlinedButton.styleFrom( 
  5.     shape: BeveledRectangleBorder( 
  6.       borderRadius: BorderRadius.circular(12), 
  7.     ), 
  8.   ), 

CircleBorder

  1. OutlinedButton( 
  2.   onPressed: () {}, 
  3.   child: Text('Button'), 
  4.   style: OutlinedButton.styleFrom( 
  5.     shape: CircleBorder(), 
  6.     padding: EdgeInsets.all(24), 
  7.   ), 

BeveledRectangleBorder

  1. OutlinedButton( 
  2.   onPressed: () {}, 
  3.   child: Text('Button'), 
  4.   style: OutlinedButton.styleFrom( 
  5.     shape: BeveledRectangleBorder( 
  6.       borderRadius: BorderRadius.circular(12), 
  7.     ), 
  8.   ), 

原文:https://medium.com/@waseemakram.jpb/button-cheat-sheet-in-flutter-2021-1db38501d5f2

 

责任编辑:武晓燕 来源: 前端全栈开发者
相关推荐

2022-02-21 07:02:16

CSSbeautiful按钮

2023-07-05 08:15:41

按钮PRSHT.H函数

2023-01-04 07:46:10

单选按钮双击效果

2021-06-08 13:29:56

FlutterReact Nativ开发

2021-11-17 08:11:35

MySQL

2023-11-09 11:56:28

MySQL死锁

2021-08-31 07:54:24

SQLDblink查询

2022-05-11 09:01:54

Swift类型系统幻象类型

2023-07-28 09:54:14

SQL数据Excel

2021-03-08 00:11:02

Spring注解开发

2021-08-16 08:12:04

SQLMerge用法

2021-09-03 06:46:34

SQL分组集功能

2022-07-04 08:54:39

Swift处理器项目

2022-08-03 08:11:58

数据测试同类型

2024-04-15 00:00:00

RabbitMQ死信队列消息

2021-08-16 06:56:21

Slice数组类型内存

2021-11-09 06:55:03

SQLServer排序

2023-08-29 09:46:12

SQLCTE递归

2022-04-02 08:14:02

JavaThreadLoca数据

2021-12-11 19:00:54

Java中断机制
点赞
收藏

51CTO技术栈公众号