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 createState() { return _ShareDialog(); } } class _ShareDialog extends State { // List platformNames = ["line", "微信好友", "朋友圈", "facebook"]; List platformNames = ["转至回乡", "转至微信", "转发到朋友圈", "转至私信","复制链接"]; List 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 platforms = [ ShareSDKPlatforms.line, ShareSDKPlatforms.wechatSession, ShareSDKPlatforms.wechatTimeline, ShareSDKPlatforms.facebook, ShareSDKPlatforms.copy ]; @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Container( height: 200.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: 28.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: 4.h, ), Container( width: 40.w, child: Text( platformNames[platforms.indexOf(e)], style: TextStyle( fontSize: 12.sp, color: Color(0xFF1A1A1A), ), ), ), ], ), ), ), flex: 1, )) .toList(), ), Spacer(), 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), ), ), ) ], ), ); } }