|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:sharesdk_plugin/sharesdk_defines.dart';
|
|
|
|
|
|
|
|
class ShareDialog extends StatefulWidget {
|
|
|
|
final Function(ShareSDKPlatform platform) onTap;
|
|
|
|
|
|
|
|
|
|
|
|
ShareDialog(this.onTap);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _ShareDialog();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ShareDialog extends State<ShareDialog> {
|
|
|
|
// List<String> platformNames = ["line", "微信好友", "朋友圈", "facebook"];
|
|
|
|
List<String> platformNames = ["转至回乡", "转至微信", "转发到朋友圈", "转至私信","复制链接"];
|
|
|
|
List<String> platformIcons = [
|
|
|
|
// "assets/image/icon_line.webp",
|
|
|
|
"assets/image/icon_share_hx.webp",
|
|
|
|
"assets/image/icon_weixin.webp",
|
|
|
|
"assets/image/icon_pengyouquan.webp",
|
|
|
|
"assets/image/icon_share_chat.webp",
|
|
|
|
"assets/image/icon_copy _link.webp"
|
|
|
|
// "assets/image/icon_facebook.webp"
|
|
|
|
];
|
|
|
|
List<ShareSDKPlatform> platforms = [
|
|
|
|
ShareSDKPlatforms.douyin,//转至回乡
|
|
|
|
ShareSDKPlatforms.wechatSession,
|
|
|
|
ShareSDKPlatforms.wechatTimeline,
|
|
|
|
ShareSDKPlatforms.facebook,//转至私信
|
|
|
|
ShareSDKPlatforms.copy
|
|
|
|
];
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
height: 180.h,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(8),),
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.only(top: 16.h,),
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
S.of(context).fenxiangdao,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
color: Color(0xFF1A1A1A),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 30.h,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: platforms
|
|
|
|
.map((e) => Expanded(
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
widget.onTap(e);
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
platformIcons[platforms.indexOf(e)],
|
|
|
|
width: 40,
|
|
|
|
height: 40,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height:8.h,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: 42.w,
|
|
|
|
padding: EdgeInsets.symmetric(horizontal:4.w),
|
|
|
|
child: Text(
|
|
|
|
platformNames[platforms.indexOf(e)],
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF1A1A1A),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
flex: 1,
|
|
|
|
))
|
|
|
|
.toList(),
|
|
|
|
),
|
|
|
|
// GestureDetector(
|
|
|
|
// behavior: HitTestBehavior.opaque,
|
|
|
|
// onTap: (){
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// width: double.infinity,
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// padding: EdgeInsets.only(top: 14.h,bottom:17.h),
|
|
|
|
// color: Color(0xFF32A060),
|
|
|
|
// child: Text(
|
|
|
|
// S.of(context).quxiao,
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// fontSize: 16.sp,
|
|
|
|
// color: Colors.white),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// )
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|