基础组件库
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

89 righe
2.9 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:zhiying_comm/zhiying_comm.dart';
  3. class TipDialog extends StatelessWidget {
  4. String title;
  5. String btnText;
  6. TipDialog({this.title = "温馨提示", this.content, this.btnText = "知道了"});
  7. String content;
  8. @override
  9. Widget build(BuildContext context) {
  10. return Scaffold(
  11. backgroundColor: Colors.transparent,
  12. body: Column(
  13. mainAxisAlignment: MainAxisAlignment.center,
  14. crossAxisAlignment: CrossAxisAlignment.center,
  15. children: <Widget>[
  16. Container(
  17. width: double.infinity,
  18. decoration: BoxDecoration(
  19. color: Colors.white, borderRadius: BorderRadius.circular(20)),
  20. margin: EdgeInsets.only(left: 45, right: 45),
  21. child: Column(
  22. children: <Widget>[
  23. Row(
  24. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  25. children: <Widget>[
  26. SizedBox(
  27. width: 48,
  28. ),
  29. Text(
  30. title,
  31. style: TextStyle(
  32. fontSize: 15, fontWeight: FontWeight.w500),
  33. ),
  34. SizedBox(
  35. width: 48,
  36. child: IconButton(
  37. icon: Icon(Icons.close),
  38. onPressed: () {
  39. Navigator.pop(context, false);
  40. }),
  41. ),
  42. ],
  43. ),
  44. Container(
  45. margin: EdgeInsets.all(16),
  46. constraints: BoxConstraints(minHeight: 100),
  47. child: Text(
  48. content,
  49. style: TextStyle(fontSize: 13),
  50. ),
  51. ),
  52. Row(
  53. children: <Widget>[
  54. Expanded(
  55. child: Padding(
  56. padding: const EdgeInsets.only(
  57. left: 16, right: 16, bottom: 16),
  58. child: FlatButton(
  59. padding: EdgeInsets.only(top: 10, bottom: 10),
  60. color: HexColor.fromHex("#FFFF4242"),
  61. shape: RoundedRectangleBorder(
  62. borderRadius: BorderRadius.circular(50)),
  63. onPressed: () {
  64. Navigator.pop(context,true);
  65. },
  66. child: Text(
  67. btnText,
  68. style: TextStyle(
  69. color: HexColor.fromHex("#FFFFFF"),
  70. fontSize: 13),
  71. )),
  72. ))
  73. ],
  74. )
  75. ],
  76. ),
  77. )
  78. ],
  79. ),
  80. );
  81. }
  82. }