How to style AlertDialog Actions in Flutter

后端 未结 6 863
抹茶落季
抹茶落季 2020-12-08 14:55

I use this method to show a AlertDialog:

_onSubmit(message) {
    if (message.isNotEmpty) {
      showDialog(
        context: context,
        barrierDismis         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-08 15:37

    I use this method to align buttons in actions of AlertDialog.

    AlertDialog style:

    AlertDialog(
            title: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text('Tilte'),
                  CloseButton(
                      color: Color(0xFFD5D3D3),
                      onPressed: () {
                        Navigator.of(context).pop();
                      })
                ]),
            content: SingleChildScrollView(child: Text("Boby")),
            actions: [
              SizedBox(
                  width: MediaQuery.of(context).size.width,
                  child: Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        ButtonTheme(
                            minWidth: 25.0,
                            height: 25.0,
                            child: OutlineButton(
                                borderSide: BorderSide(color: Colors.blueAccent),
                                child: new Text("Save"),
                                shape: RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(20)),
                                onPressed: () {})),
                        SizedBox(width: 8.0),
                        ButtonTheme(
                            minWidth: 25.0,
                            height: 25.0,
                            child: OutlineButton(
                                borderSide: BorderSide(color: Colors.black26),
                                textColor: Colors.blue,
                                child: new Text("Close"),
                                shape: RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(20)),
                                onPressed: () {}))
                      ]))
            ]);
    

提交回复
热议问题