import 'package:flutter/material.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; class TipDialog extends StatelessWidget { String title; String btnText; TipDialog({this.title = "温馨提示", this.content, this.btnText = "知道了"}); String content; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.transparent, body: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( width: double.infinity, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20)), margin: EdgeInsets.only(left: 45, right: 45), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ SizedBox( width: 48, ), Text( title, style: TextStyle( fontSize: 15, fontWeight: FontWeight.w500), ), SizedBox( width: 48, child: IconButton( icon: Icon(Icons.close), onPressed: () { Navigator.pop(context, false); }), ), ], ), Container( margin: EdgeInsets.all(16), constraints: BoxConstraints(minHeight: 100), child: Text( content, style: TextStyle(fontSize: 13), ), ), Row( children: [ Expanded( child: Padding( padding: const EdgeInsets.only( left: 16, right: 16, bottom: 16), child: FlatButton( padding: EdgeInsets.only(top: 10, bottom: 10), color: HexColor.fromHex("#FFFF4242"), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(50)), onPressed: () { Navigator.pop(context,true); }, child: Text( btnText, style: TextStyle( color: HexColor.fromHex("#FFFFFF"), fontSize: 13), )), )) ], ) ], ), ) ], ), ); } }