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 platformIcons = [ "assets/image/icon_line.webp", "assets/image/icon_weixin.webp", "assets/image/icon_pengyouquan.webp", "assets/image/icon_facebook.webp" ]; List platforms = [ ShareSDKPlatforms.line, ShareSDKPlatforms.wechatSession, ShareSDKPlatforms.wechatTimeline, ShareSDKPlatforms.facebook ]; @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, bottom: 66.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.w, height: 40.h, ), SizedBox( height: 4.h, ), Container( height: 18.h, child: Text( platformNames[platforms.indexOf(e)], style: TextStyle( fontSize: 12.sp, color: Color(0xFF1A1A1A), ), ), ), ], ), ), ), flex: 1, )) .toList(), ), ], ), ); } }