Flutter學(xué)習(xí)(二)

1.抽屜 drawer(左側(cè)) endDrawer(右側(cè))
通常在Scaffold中使用
UserAccountsDrawerHeader用于展示用戶賬戶信息
CircleAvatar圓形圖片控件

Widget _createDrawerView() {
    return new Drawer(
      child: new ListView(
        children: <Widget>[
          UserAccountsDrawerHeader(
              accountName: Text("xxx"),
              accountEmail: Text("xxx@163.com"),
              currentAccountPicture: new CircleAvatar(
                backgroundImage: AssetImage("images/bg.jpeg"),
              )
          ),
          ListTile(
            leading: CircleAvatar(
              child: Text("A")
            ),
            title: Text("itemA"),
            onTap: (){
              Navigator.pop(context);
            },
          ),
          ListTile(
            leading: CircleAvatar(
                child: Icon(Icons.favorite)
            ),
            title: Text("itemB"),
            onTap: (){
              Navigator.pop(context);
            },
          ),
          ListTile(
            leading: new CircleAvatar(
              backgroundImage: AssetImage("images/bg.jpeg"),
            ),
            title: Text("itemC"),
            onTap: (){
              Navigator.pop(context);
            },
          ),
        ],
      ),
    );
  }

2.懸浮按鈕

    this.child,//按鈕顯示的內(nèi)容
    this.tooltip,//長按時顯示的提示
    this.foregroundColor,//前景色,影響到文字顏色
    this.backgroundColor,//背景色
    this.heroTag = const _DefaultHeroTag(),//hero效果使用的tag,系統(tǒng)默認會給所有FAB使用同一個tag,方便做動畫效果
    this.elevation = 6.0,//未點擊時陰影值
    this.highlightElevation = 12.0,//點擊下陰影值
    this.onPressed//點擊事件
    this.mini = false,//FloatingActionButton有regular, mini, extended三種類型,默認為false即regular類型,true時按鈕變小即mini類型,extended需要通過FloatingActionButton.extended()創(chuàng)建,可以定制顯示內(nèi)容
    this.shape = const CircleBorder(),//定義FAB的shape,設(shè)置shape時,默認的elevation將會失效,默認為CircleBorder
    this.clipBehavior = Clip.none,
    this.materialTapTargetSize,
    this.isExtended = false,//是否為”extended”類型

3.AlertDialog

showDialog(context: mContext,builder: (mContext) =>AlertDialog(title: Text("xxxxxx"),));
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容