show static method

dynamic show(
  1. BuildContext buildContext,
  2. MessageType type,
  3. String titleText,
  4. String contentText, {
  5. TextStyle? titleStyle,
  6. TextStyle? contentStyle,
  7. TextStyle? comfirmStyle,
  8. TextStyle? cancelStyle,
  9. VoidCallback? executeCall,
})

Implementation

static show(BuildContext buildContext,
    MessageType type,
    String titleText,
    String contentText,
    {
      TextStyle? titleStyle,
      TextStyle? contentStyle,
      TextStyle? comfirmStyle,
      TextStyle? cancelStyle,
      VoidCallback? executeCall
    }) {

  showDialog(
      context: buildContext,
      builder: (context) {
        return AlertDialog(
          title: Row(
             children: [

               Icon(
                 getTitleIcon(type),
                 color: getTitleColor(type),
               ),

               SizedBox(
                  width: 6,
               ),

               Text(titleText,style: titleStyle??TextStyle(
                   fontSize: 16,
                   color: Colors.black,
                   fontWeight: FontWeight.bold,
                   decoration: TextDecoration.none))
             ],
          ),
          content: Container(
            margin: EdgeInsets.fromLTRB(12, 0, 0, 0),
             child: Text(contentText,style: contentStyle??TextStyle(
                 fontSize: 14,
                 color: Colors.black87,
                 decoration: TextDecoration.none)),
          ),
          actions: <Widget>[

            TextButton(
              child: Text(
                '取消',
                style: cancelStyle ??
                    new TextStyle(
                        fontSize: 14,
                        color: Colors.black54,
                        decoration: TextDecoration.none),
              ),
              onPressed: () {
                Navigator.pop(context);
              },
            ),

            TextButton(
              child: Text(
                '确认',
                style: comfirmStyle ??
                    new TextStyle(
                        fontSize: 14,
                        color: Colors.blueAccent,
                        fontWeight: FontWeight.bold,
                        decoration: TextDecoration.none),
              ),
              onPressed: () async {

                if(executeCall!=null){
                  executeCall();
                }
                Navigator.of(context).pop();
              },
            ),

          ],
        );
      });
}