import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import '../space.dart';

Future<bool> showSharePopup(BuildContext context) {
  return showGeneralDialog<bool>(
      context: context,
      barrierDismissible: true,
      barrierLabel: '',
      barrierColor: Colors.black.withOpacity(0.5),
      transitionDuration: Duration(milliseconds: 200),
//                              useRootNavigator: false,
      pageBuilder: (BuildContext context, Animation<double> animation,
          Animation<double> secondaryAnimation) {
        return Center(
          child: Material(
            color: Colors.transparent,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Container(
                  height: MediaQuery.of(context).size.height * 0.55,
                  width: MediaQuery.of(context).size.width * 0.7,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(20.0)),
                    color: Colors.white,
                  ),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: <Widget>[
                      Space(
                        height: 36.0,
                      ),
                      Text(
                        "恭喜您达到新成就",
                        style: Theme.of(context).textTheme.headline3,
                      ),
                      Space(
                        height: 5.0,
                      ),
                      Text(
                        "您是第100位获得者",
                        style: Theme.of(context).textTheme.bodyText1,
                      ),
                      Space(
                        height: 16.0,
                      ),
                      CachedNetworkImage(
                        imageUrl:
                            "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1405015388,2107694993&fm=26&gp=0.jpg",
                        width: 120.0,
                        height: 120.0,
                      ),
                      Space(
                        height: 8.0,
                      ),
                      Text(
                        "燃脂达人Ⅱ",
                        style: Theme.of(context).textTheme.headline1,
                      ),
                      Space(
                        height: 16.0,
                      ),
                      Text(
                        "使用智能鞋运动消耗1000kal",
                        style: Theme.of(context).textTheme.bodyText1,
                      ),
                      Space(
                        height: 5.0,
                      ),
                      Container(
                        height: 25.0,
                        width: MediaQuery.of(context).size.width * 0.6,
                        color: Color(0xffFFC400).withOpacity(0.3),
                        alignment: Alignment.center,
                        child: Text(
                          "经验值+5  积分+1",
                          style: Theme.of(context)
                              .textTheme
                              .subtitle2
                              .copyWith(color: Theme.of(context).accentColor),
                        ),
                      ),
                      Space(
                        height: 16.0,
                      ),
                      Container(
                        width: 132.0,
                        height: 35.0,
                        alignment: Alignment.center,
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.all(Radius.circular(20.0)),
                          border: new Border.all(
                              width: 1, color: Theme.of(context).accentColor),
                          gradient: new LinearGradient(
                              begin: Alignment.topCenter,
                              end: Alignment.bottomCenter,
                              colors: [
                                Color.fromRGBO(255, 196, 0, 1),
                                Color.fromRGBO(255, 170, 0, 1),
                              ]),
                        ),
                        child: Text(
                          "成就分享",
                          style: Theme.of(context).textTheme.headline6,
                        ),
                      ),
                      Space(
                        height: 8.0,
                      ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: <Widget>[
                          Expanded(
                            child: Divider(
                              indent: 50.0,
                              endIndent: 10.0,
                            ),
                          ),
                          Text(
                            "2020.07.14",
                            style: Theme.of(context).textTheme.bodyText1,
                          ),
                          Expanded(
                            child: Divider(
                              indent: 10.0,
                              endIndent: 50.0,
                            ),
                          ),
                        ],
                      ),
                    ],
                  ),
                ),
                Space(
                  height: 20.0,
                ),
                InkWell(
                  child: Text(
                    "关闭",
                    style: TextStyle(color: Theme.of(context).accentColor),
                  ),
                  onTap: () {
                    print("AAAAA");
                    Navigator.of(context).pop();
                  },
                )
              ],
            ),
          ),
        );
      });
}
