You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.2 KiB
103 lines
3.2 KiB
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> platformIcons = [ |
|
"assets/image/icon_line.png", |
|
"assets/image/icon_weixin.png", |
|
"assets/image/icon_pengyouquan.png", |
|
"assets/image/icon_facebook.png" |
|
]; |
|
List<ShareSDKPlatform> 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(), |
|
), |
|
], |
|
), |
|
); |
|
} |
|
}
|
|
|