基础组件库
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 

141 行
5.2 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:zhiying_comm/zhiying_comm.dart';
  3. class NotificationDialog extends StatefulWidget {
  4. final bool isGranted;
  5. const NotificationDialog({Key key, this.isGranted = false}) : super(key: key);
  6. @override
  7. _NotificationDialogState createState() => _NotificationDialogState();
  8. }
  9. class _NotificationDialogState extends State<NotificationDialog> {
  10. String tipString = "";
  11. @override
  12. void initState() {
  13. if (!widget?.isGranted) {
  14. tipString = "系统检查到您还未开启通知权限,点击确认开启后会跳转到系统设置";
  15. }
  16. super.initState();
  17. }
  18. @override
  19. Widget build(BuildContext context) {
  20. return Scaffold(
  21. backgroundColor: Colors.transparent,
  22. body: Container(
  23. width: double.infinity,
  24. child: Column(
  25. crossAxisAlignment: CrossAxisAlignment.center,
  26. mainAxisAlignment: MainAxisAlignment.center,
  27. children: <Widget>[
  28. Container(
  29. width: 265,
  30. padding: EdgeInsets.all(20),
  31. // height: 382,
  32. decoration: BoxDecoration(
  33. color: Colors.white,
  34. borderRadius: BorderRadius.circular(10),
  35. ),
  36. child: Column(
  37. children: <Widget>[
  38. CachedNetworkImage(
  39. imageUrl: "https://alipic.lanhuapp.com/SketchPng0b9277cdefb9a187ab3bb380a2a340ce40f7e7c31368ed08d30745bb140def63",
  40. height: 73,
  41. width: 70,
  42. fit: BoxFit.fitHeight,
  43. ),
  44. SizedBox(
  45. height: 10,
  46. ),
  47. Text(
  48. "开启消息通知",
  49. style: TextStyle(fontSize: 15, color: HexColor.fromHex("#FF4F39")),
  50. ),
  51. SizedBox(
  52. height: 10,
  53. ),
  54. Text(
  55. "获取实时获取最新消息、收益、粉丝提醒、优惠信息等",
  56. style: TextStyle(fontSize: 13, color: HexColor.fromHex("#999999")),
  57. ),
  58. SizedBox(
  59. width: 10,
  60. ),
  61. Text(
  62. tipString ?? "",
  63. style: TextStyle(fontSize: 12, color: HexColor.fromHex("#FF4F39")),
  64. ),
  65. SizedBox(
  66. height: 20,
  67. ),
  68. Row(
  69. children: [
  70. SizedBox(
  71. width: 10,
  72. ),
  73. Expanded(
  74. child: GestureDetector(
  75. onTap: () async {
  76. Navigator.pop(context, true);
  77. },
  78. child: Container(
  79. margin: EdgeInsets.only(top: 10, bottom: 10),
  80. height: 38,
  81. decoration: BoxDecoration(
  82. borderRadius: BorderRadius.circular(8),
  83. gradient: LinearGradient(
  84. begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [HexColor.fromHex("#FFFF5632"), HexColor.fromHex("#FFFF4242")])),
  85. child: Center(
  86. child: Text(
  87. "确认开启",
  88. style: TextStyle(color: Colors.white, fontSize: 13),
  89. ))),
  90. ),
  91. ),
  92. SizedBox(
  93. width: 8,
  94. ),
  95. Expanded(
  96. child: GestureDetector(
  97. onTap: () async {
  98. Navigator.pop(context, false);
  99. },
  100. child: Container(
  101. margin: EdgeInsets.only(top: 10, bottom: 10),
  102. height: 38,
  103. decoration: BoxDecoration(
  104. borderRadius: BorderRadius.circular(8),
  105. gradient: LinearGradient(
  106. begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [HexColor.fromHex("#D6D6D6"), HexColor.fromHex("#D6D6D6")])),
  107. child: Center(
  108. child: Text(
  109. "暂时关闭",
  110. style: TextStyle(color: Colors.white, fontSize: 13),
  111. ))),
  112. ),
  113. ),
  114. SizedBox(
  115. width: 10,
  116. )
  117. ],
  118. )
  119. ],
  120. ),
  121. ),
  122. GestureDetector(
  123. onTap: () {
  124. Navigator.pop(context, false);
  125. },
  126. child: Container(alignment: Alignment.center, margin: EdgeInsets.only(top: 10), child: CloseButton(color: HexColor.fromHex("#FFFFFF"))),
  127. )
  128. ],
  129. ),
  130. ),
  131. );
  132. }
  133. }