
import 'package:flutter/material.dart';
import 'package:twong/models/index.dart';
import 'package:twong/utils/index.dart';
import 'package:twong/utils/pay.dart';
// import 'package:wechat_kit/wechat_kit.dart';

class ShareBar extends StatefulWidget {
  final Details data;
  ShareBar(this.data);

  @override
  State<StatefulWidget> createState() {
    return _ShareBarState();
  }
}

class _ShareBarState extends State<ShareBar> {
  @override
  Widget build(BuildContext context) {
    return SafeArea(child: Container(
      height: 138.px,
      child: Column(
        children: [
          Container(
            margin: EdgeInsets.only(top: 6.px, bottom: 18.px),
            alignment: Alignment.center,
            child: Text("分享到", style: TextStyle(fontSize: 16.px)),
          ),
          Container(
            margin: EdgeInsets.only(left: 26.px, right: 26.px),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Spacer(),
                InkWell(
                  onTap: _shareToWechatFriend,
                  child: Container(
                    child: Column(
                      children: [
                        Image(image: AssetImage("assets/images/wechat.png"),
                            width: 56.px, height: 56.px),
                        Text("发给朋友")
                      ],
                    ),
                  ),
                ),
                Spacer(),
                InkWell(
                  onTap: _shareToWechatFriends,
                  child: Container(
                    child: Column(
                      children: [
                        Image(image: AssetImage("assets/images/wechat.png"),
                            width: 56.px, height: 56.px),
                        Text("发到朋友圈")
                      ],
                    ),
                  ),
                ),
                Spacer(),
              ],
            ),
          )
        ],
      ),
    ));
  }

  _shareToWechatFriend() {
    Pay.wechatShare(true, widget.data);
  }

  _shareToWechatFriends() {
    Pay.wechatShare(false, widget.data);
  }
}