[Flutter]Button

小黑
發佈於APP
2023/12/12閱讀時間約 1 分鐘

樣式

  • RaisedButton:凸起
  • FlatButton:扁平化
  • OutlineButton:邊框
  • IconButton:圖示


屬性

  • onPressed:按下後觸發方法,若是 null 則不能用。
RaisedButton(
child: Text('Click'),
onPressed: btnClick,
)

void btnClick() {
print('btnClick');
}


  • color:按鈕顏色
RaisedButton(
child: Text('Click'),
onPressed: btnClick,
color: Color.fromARGB(255, 255, 255, 255),
)


  • textColor:按鈕中顯示文字的顏色
RaisedButton(
child: Text('Click'),
onPressed: btnClick,
textColor:: Color.fromARGB(255, 255, 255, 255),
)


  • elevation:按鈕陰影大小值
RaisedButton(
child: Text('Click'),
onPressed: btnClick,
elevation: 20,
)




7會員
78內容數
嗨,我是一名程式設計師,會在這分享開發與學習紀錄。
留言0
查看全部
發表第一個留言支持創作者!
從 Google News 追蹤更多 vocus 的最新精選內容