import 'package:flutter/material.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; class NotificationDialog extends StatefulWidget { final bool isGranted; const NotificationDialog({Key key, this.isGranted = false}) : super(key: key); @override _NotificationDialogState createState() => _NotificationDialogState(); } class _NotificationDialogState extends State { String tipString = ""; @override void initState() { if (!widget?.isGranted) { tipString = "系统检查到您还未开启通知权限,点击确认开启后会跳转到系统设置"; } super.initState(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.transparent, body: Container( width: double.infinity, child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: 265, padding: EdgeInsets.all(20), // height: 382, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), ), child: Column( children: [ CachedNetworkImage( imageUrl: "https://alipic.lanhuapp.com/SketchPng0b9277cdefb9a187ab3bb380a2a340ce40f7e7c31368ed08d30745bb140def63", height: 73, width: 70, fit: BoxFit.fitHeight, ), SizedBox( height: 10, ), Text( "开启消息通知", style: TextStyle(fontSize: 15, color: HexColor.fromHex("#FF4F39")), ), SizedBox( height: 10, ), Text( "获取实时获取最新消息、收益、粉丝提醒、优惠信息等", style: TextStyle(fontSize: 13, color: HexColor.fromHex("#999999")), ), SizedBox( width: 10, ), Text( tipString ?? "", style: TextStyle(fontSize: 12, color: HexColor.fromHex("#FF4F39")), ), SizedBox( height: 20, ), Row( children: [ SizedBox( width: 10, ), Expanded( child: GestureDetector( onTap: () async { Navigator.pop(context, true); }, child: Container( margin: EdgeInsets.only(top: 10, bottom: 10), height: 38, decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [HexColor.fromHex("#FFFF5632"), HexColor.fromHex("#FFFF4242")])), child: Center( child: Text( "确认开启", style: TextStyle(color: Colors.white, fontSize: 13), ))), ), ), SizedBox( width: 8, ), Expanded( child: GestureDetector( onTap: () async { Navigator.pop(context, false); }, child: Container( margin: EdgeInsets.only(top: 10, bottom: 10), height: 38, decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [HexColor.fromHex("#D6D6D6"), HexColor.fromHex("#D6D6D6")])), child: Center( child: Text( "暂时关闭", style: TextStyle(color: Colors.white, fontSize: 13), ))), ), ), SizedBox( width: 10, ) ], ) ], ), ), GestureDetector( onTap: () { Navigator.pop(context, false); }, child: Container(alignment: Alignment.center, margin: EdgeInsets.only(top: 10), child: CloseButton(color: HexColor.fromHex("#FFFFFF"))), ) ], ), ), ); } }