|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- 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<NotificationDialog> {
- 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: <Widget>[
- Container(
- width: 265,
- padding: EdgeInsets.all(20),
- // height: 382,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(10),
- ),
- child: Column(
- children: <Widget>[
- 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"))),
- )
- ],
- ),
- ),
- );
- }
- }
|