Browse Source

safety

master
fmk 3 years ago
parent
commit
524f56eaa3
  1. BIN
      assets/image/2x/icon_gold_blessing.png
  2. BIN
      assets/image/2x/icon_gold_coin.png
  3. BIN
      assets/image/2x/icon_integral_order.png
  4. BIN
      assets/image/2x/icon_integral_share.png
  5. BIN
      assets/image/2x/icon_integral_sign.png
  6. BIN
      assets/image/2x/qr_share_bg.png
  7. BIN
      assets/image/2x/qr_share_info_bg.png
  8. BIN
      assets/image/2x/share_image_bg.png
  9. BIN
      assets/image/3x/icon_gold_blessing.png
  10. BIN
      assets/image/3x/icon_gold_coin.png
  11. BIN
      assets/image/3x/icon_integral_order.png
  12. BIN
      assets/image/3x/icon_integral_share.png
  13. BIN
      assets/image/3x/icon_integral_sign.png
  14. BIN
      assets/image/3x/qr_share_bg.png
  15. BIN
      assets/image/3x/qr_share_info_bg.png
  16. BIN
      assets/image/3x/share_image_bg.png
  17. BIN
      assets/image/icon_gold_blessing.png
  18. BIN
      assets/image/icon_gold_coin.png
  19. BIN
      assets/image/icon_integral_order.png
  20. BIN
      assets/image/icon_integral_share.png
  21. BIN
      assets/image/icon_integral_sign.png
  22. BIN
      assets/image/qr_share_bg.png
  23. BIN
      assets/image/qr_share_info_bg.png
  24. BIN
      assets/image/share_image_bg.png
  25. 1
      lib/home/home_view/home_banner.dart
  26. 6
      lib/home/huixiang_view/huixiang_banner.dart
  27. 78
      lib/integral/integral_page.dart
  28. 16
      lib/integral/intergra_view/in_for_points.dart
  29. 71
      lib/integral/intergra_view/integral_task.dart
  30. 88
      lib/integral/intergra_view/integral_vip.dart
  31. 31
      lib/qr/qr_share.dart
  32. 191
      lib/qr/qr_share_image.dart
  33. 4
      lib/view_widget/share_dialog.dart
  34. 2
      pubspec.yaml

BIN
assets/image/2x/icon_gold_blessing.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
assets/image/2x/icon_gold_coin.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
assets/image/2x/icon_integral_order.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/image/2x/icon_integral_share.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
assets/image/2x/icon_integral_sign.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 570 B

After

Width:  |  Height:  |  Size: 590 B

BIN
assets/image/2x/qr_share_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

BIN
assets/image/2x/qr_share_info_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

BIN
assets/image/2x/share_image_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
assets/image/3x/icon_gold_blessing.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
assets/image/3x/icon_gold_coin.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
assets/image/3x/icon_integral_order.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
assets/image/3x/icon_integral_share.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
assets/image/3x/icon_integral_sign.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 992 B

BIN
assets/image/3x/qr_share_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

BIN
assets/image/3x/qr_share_info_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

BIN
assets/image/3x/share_image_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

BIN
assets/image/icon_gold_blessing.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 946 B

BIN
assets/image/icon_gold_coin.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
assets/image/icon_integral_order.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 648 B

After

Width:  |  Height:  |  Size: 674 B

BIN
assets/image/icon_integral_share.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 718 B

After

Width:  |  Height:  |  Size: 790 B

BIN
assets/image/icon_integral_sign.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 386 B

BIN
assets/image/qr_share_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
assets/image/qr_share_info_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
assets/image/share_image_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

1
lib/home/home_view/home_banner.dart

@ -93,4 +93,5 @@ class _HomeBanner extends State<HomeBanner> {
break; break;
} }
} }
} }

6
lib/home/huixiang_view/huixiang_banner.dart

@ -63,9 +63,9 @@ class _HuiXiangBanner extends State<HuiXiangBanner> {
/// contentType 0123 /// contentType 0123
bannerClick(BannerData bannerData) async { bannerClick(BannerData bannerData) async {
switch (bannerData.contentType) { switch (bannerData.contentType) {
// case 0: case 0:
// Navigator.of(context).pushNamed('/router/qr_share'); Navigator.of(context).pushNamed('/router/qr_share');
// break; break;
case 1: case 1:
Navigator.of(context).pushNamed('/router/integral_store_page', Navigator.of(context).pushNamed('/router/integral_store_page',
arguments: {"goodsId": bannerData.content}); arguments: {"goodsId": bannerData.content});

78
lib/integral/integral_page.dart

@ -71,45 +71,53 @@ class _IntegralPage extends State<IntegralPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Stack(
appBar: MyAppBar( children: [
background: Color(0xFF3A405A), Positioned(
leadingColor: Colors.white, child: Container(
title: S.of(context).jifenxiangqing, height: 122.h + kToolbarHeight + MediaQuery.of(context).padding.top,
titleColor: Colors.white, decoration: BoxDecoration(
titleSize: 16.sp, gradient: RadialGradient(
brightness: Brightness.dark, center: Alignment.center,
action: Container( colors: [Color(0xFF36426E), Color(0xFF2D3247)],
alignment: Alignment.center, focal: Alignment.center,
margin: EdgeInsets.only(right: 16.w), radius: 1,
child: GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/integral_detailed_page');
},
child: Text(
S.of(context).mingxi,
style: TextStyle(
color: Colors.white,
fontSize: 18.sp,
fontWeight: FontWeight.bold,
), ),
), ),
), ),
top: 0,
left: 0,
right: 0,
), ),
), Scaffold(
body: Container( backgroundColor: Colors.transparent,
child: Stack( appBar: MyAppBar(
children: [ background: Colors.transparent,
Positioned( leadingColor: Colors.white,
child: Container( title: "",
height: 122.h, titleColor: Colors.white,
color: Color(0xFF3A405A), titleSize: 16.sp,
brightness: Brightness.dark,
action: Container(
alignment: Alignment.center,
margin: EdgeInsets.only(right: 16.w),
child: GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/integral_detailed_page');
},
child: Text(
S.of(context).mingxi,
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
),
), ),
top: 0,
left: 0,
right: 0,
), ),
SingleChildScrollView( ),
body: Container(
child: SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
child: FutureBuilder( child: FutureBuilder(
future: querySignInfo(), future: querySignInfo(),
@ -129,9 +137,9 @@ class _IntegralPage extends State<IntegralPage> {
}, },
), ),
), ),
], ),
), ),
), ],
); );
} }

16
lib/integral/intergra_view/in_for_points.dart

@ -38,7 +38,7 @@ class _InForPoints extends State<InForPoints> {
offset: Offset(0, 3), offset: Offset(0, 3),
blurRadius: 14, blurRadius: 14,
spreadRadius: 0, spreadRadius: 0,
) ),
], ],
), ),
child: Column( child: Column(
@ -87,19 +87,21 @@ class _InForPoints extends State<InForPoints> {
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
child: RoundButton( child: RoundButton(
width: 106.w, width: 166.w,
height: 34.h, height: 34.h,
text: (widget.signInfo != null && widget.signInfo.todayHasSignin) text: (widget.signInfo != null && widget.signInfo.todayHasSignin)
? S.of(context).yiqiandao ? S.of(context).yiqiandao
: S.of(context).lijiqiandao, : S.of(context).lijiqiandao,
textColor: Colors.white, textColor: (widget.signInfo != null && widget.signInfo.todayHasSignin)
? Color(0xFF808080)
: Colors.white,
backgroup: (widget.signInfo != null && widget.signInfo.todayHasSignin) backgroup: (widget.signInfo != null && widget.signInfo.todayHasSignin)
? Colors.grey ? Color(0xFFF5F6FA)
: Color(0xFF32A060), : Color(0xFF32A060),
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 6.h), padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 6.h),
radius: 4.w, radius: 20.w,
), ),
), ),
), ),
@ -114,7 +116,7 @@ class _InForPoints extends State<InForPoints> {
return Container( return Container(
padding: EdgeInsets.all(4), padding: EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFF0F0F2), color: Color(0xFFF5F6FA),
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
), ),
child: Row( child: Row(
@ -177,7 +179,7 @@ class _InForPoints extends State<InForPoints> {
widget.signInfo.signInList != null && widget.signInfo.signInList != null &&
widget.signInfo.signInList.length > position) widget.signInfo.signInList.length > position)
? Color(0xFF32A060) ? Color(0xFF32A060)
: Color(0xFFF0F0F2), : Color(0xFFF5F6FA),
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
), ),
child: Column( child: Column(

71
lib/integral/intergra_view/integral_task.dart

@ -24,7 +24,7 @@ class _IntegralTask extends State<IntegralTask> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: MediaQuery.of(context).size.width - 32, width: MediaQuery.of(context).size.width - 32,
height: 300.h, height: 320.h,
margin: EdgeInsets.all(16), margin: EdgeInsets.all(16),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 10.w, horizontal: 10.w,
@ -39,7 +39,7 @@ class _IntegralTask extends State<IntegralTask> {
offset: Offset(0, 3), offset: Offset(0, 3),
blurRadius: 14, blurRadius: 14,
spreadRadius: 0, spreadRadius: 0,
) ),
], ],
), ),
child: Column( child: Column(
@ -59,32 +59,28 @@ class _IntegralTask extends State<IntegralTask> {
), ),
Expanded( Expanded(
child: Container( child: Container(
child: Swiper( child: ListView.builder(
loop: false, padding: EdgeInsets.only(left: 10.w, top: 20.h),
physics: BouncingScrollPhysics(), physics: NeverScrollableScrollPhysics(),
pagination: SwiperPagination( // loop: false,
alignment: Alignment.bottomCenter, // pagination: SwiperPagination(
builder: DotSwiperPaginationBuilder( // alignment: Alignment.bottomCenter,
size: 8, // builder: DotSwiperPaginationBuilder(
activeSize: 8, // size: 8,
space: 5, // activeSize: 8,
activeColor: Colors.black, // space: 5,
color: Colors.black.withAlpha(76), // activeColor: Colors.black,
), // color: Colors.black.withAlpha(76),
), // ),
// ),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return taskPage(position); return taskItem(widget.signInfo.taskList[position]);
}, },
itemCount: (widget.signInfo != null && itemCount: (widget.signInfo != null &&
widget.signInfo.taskList != null && widget.signInfo.taskList != null &&
widget.signInfo.taskList.length > 0) widget.signInfo.taskList.length > 0)
? (widget.signInfo.taskList.length < 3 ? widget.signInfo.taskList.length : 0
? 1 ),
: (widget.signInfo.taskList.length ~/ 3 +
(widget.signInfo.taskList.length % 3 > 0
? 1
: 0)))
: 1),
), ),
flex: 1, flex: 1,
) )
@ -113,6 +109,9 @@ class _IntegralTask extends State<IntegralTask> {
taskImg(String taskType) { taskImg(String taskType) {
switch (taskType) { switch (taskType) {
case "bill_type_point_login": case "bill_type_point_login":
return "assets/image/icon_integral_login.png";
break;
case "bill_type_point_share":
return "assets/image/icon_integral_share.png"; return "assets/image/icon_integral_share.png";
break; break;
case "bill_type_point_order": case "bill_type_point_order":
@ -131,17 +130,11 @@ class _IntegralTask extends State<IntegralTask> {
alignment: Alignment.center, alignment: Alignment.center,
child: Row( child: Row(
children: [ children: [
(task.type == "bill_type_point_login") Image.asset(
? SvgPicture.asset( taskImg(task.type),
"assets/svg/svg_login.svg", width: 24.w,
width: 24.w, height: 24.h,
height: 24.h, ),
)
: Image.asset(
taskImg(task.type),
width: 24.w,
height: 24.h,
),
SizedBox( SizedBox(
width: 21.w, width: 21.w,
), ),
@ -193,13 +186,15 @@ class _IntegralTask extends State<IntegralTask> {
text: task.limitDay == (task.complateNum ?? task.conplateNum) text: task.limitDay == (task.complateNum ?? task.conplateNum)
? S.of(context).yiwancheng ? S.of(context).yiwancheng
: S.of(context).quwancheng, : S.of(context).quwancheng,
textColor: Colors.white, textColor: task.limitDay == (task.complateNum ?? task.conplateNum)
? Color(0xFF808080)
: Colors.white,
backgroup: task.limitDay == (task.complateNum ?? task.conplateNum) backgroup: task.limitDay == (task.complateNum ?? task.conplateNum)
? Color(0xFFA0A0A0) ? Color(0xFFF5F6FA)
: Color(0xFF32A060), : Color(0xFF32A060),
radius: 12.w, radius: 12.w,
fontSize: 14.sp, fontSize: 12.sp,
fontWeight: FontWeight.bold, fontWeight: MyFontWeight.semi_bold,
padding: EdgeInsets.symmetric(vertical: 4.h, horizontal: 12.w), padding: EdgeInsets.symmetric(vertical: 4.h, horizontal: 12.w),
), ),
], ],

88
lib/integral/intergra_view/integral_vip.dart

@ -64,61 +64,43 @@ class _IntegralVip extends State<IntegralVip> {
), ),
Expanded( Expanded(
flex: 1, flex: 1,
child: InkWell( child: Column(
onTap: () { mainAxisAlignment: MainAxisAlignment.center,
SharedPreferences.getInstance().then((value) { crossAxisAlignment: CrossAxisAlignment.center,
if (value.getString("token") != null && children: [
value.getString("token") != "") { Text(
Navigator.of(context) (widget.signInfo != null && widget.signInfo.rank != null)
.pushNamed('/router/mine_vip_level_page', arguments: { ? "${widget.signInfo.rank.rankName.replaceAll("会员", "")}"
"rankLevel": widget.rankLevel, : "",
"createTime": style: TextStyle(
(widget.userinfo != null) ? "${widget.userinfo.createTime}" : "", fontWeight: MyFontWeight.medium,
"points": (widget.userinfo != null) fontSize: 21.sp,
? int.tryParse(widget.userinfo.points) color: Colors.white,
: 0,
});
}
});
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
(widget.signInfo != null && widget.signInfo.rank != null)
? "${widget.signInfo.rank.rankName.replaceAll("会员", "")}"
: "",
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 21.sp,
color: Colors.white,
),
),
SizedBox(
height: 6.h,
), ),
Row( ),
mainAxisAlignment: MainAxisAlignment.center, SizedBox(
crossAxisAlignment: CrossAxisAlignment.center, height: 6.h,
children: [ ),
Text( Row(
S.of(context).wodehuiyuandengji, mainAxisAlignment: MainAxisAlignment.center,
style: TextStyle( crossAxisAlignment: CrossAxisAlignment.center,
fontSize: 12.sp, children: [
fontWeight: MyFontWeight.regular, Text(
color: Color(0xFFF2F2F2), S.of(context).wodehuiyuandengji,
), style: TextStyle(
), fontSize: 12.sp,
Icon( fontWeight: MyFontWeight.regular,
Icons.keyboard_arrow_right, color: Color(0xFFF2F2F2),
color: Colors.white,
size: 15,
), ),
], ),
), // Icon(
], // Icons.keyboard_arrow_right,
), // color: Colors.white,
// size: 15,
// ),
],
),
],
), ),
), ),
], ],

31
lib/qr/qr_share.dart

@ -37,8 +37,8 @@ class _QrSharePage extends State<QrSharePage> {
@override @override
void dispose() { void dispose() {
super.dispose();
SmartDialog.dismiss(); SmartDialog.dismiss();
super.dispose();
} }
@override @override
@ -56,16 +56,17 @@ class _QrSharePage extends State<QrSharePage> {
margin: EdgeInsets.only(right: 16.w), margin: EdgeInsets.only(right: 16.w),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
if (phone == null || phone == "") return;
SmartDialog.show( SmartDialog.show(
widget: QrShareImagePage("15827991714"),); widget: QrShareImagePage(phone),
clickBgDismissTemp: true,
isPenetrateTemp: false,
);
}, },
child: Text( child: Icon(
"分享", Icons.share,
style: TextStyle( color: Colors.black,
color: Colors.black, size: 24.w,
fontSize: 18.sp,
fontWeight: FontWeight.bold,
),
), ),
), ),
), ),
@ -126,10 +127,13 @@ class _QrSharePage extends State<QrSharePage> {
height: 152.w, height: 152.w,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: Color(0xFF2E3552), width: 1), color: Color(0xFF2E3552),
width: 1,
),
), ),
child: QrImage( child: QrImage(
data: phone ?? "", data:
"http://mp.hx.lotus-wallet.com/pages/invite/index?mobile=${phone ?? ""}",
version: QrVersions.auto, version: QrVersions.auto,
size: 200.w, size: 200.w,
gapless: true, gapless: true,
@ -182,7 +186,10 @@ class _QrSharePage extends State<QrSharePage> {
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFFFC93B), color: Color(0xFFFFC93B),
border: Border.all(color: Color(0xFF2E3552), width: 1), border: Border.all(
color: Color(0xFF2E3552),
width: 1,
),
), ),
); );
} }

191
lib/qr/qr_share_image.dart

@ -1,11 +1,16 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:path_provider/path_provider.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:sharesdk_plugin/sharesdk_plugin.dart';
class QrShareImagePage extends StatefulWidget { class QrShareImagePage extends StatefulWidget {
String mobile; String mobile;
QrShareImagePage(this.mobile); QrShareImagePage(this.mobile);
@ -14,19 +19,138 @@ class QrShareImagePage extends StatefulWidget {
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _QrShareImagePage(); return _QrShareImagePage();
} }
} }
class _QrShareImagePage extends State<QrShareImagePage> { class _QrShareImagePage extends State<QrShareImagePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
widgetToImage(); return Column(
return Container( mainAxisAlignment: MainAxisAlignment.center,
width: 200, children: [
height: 300, RepaintBoundary(
color: Colors.white.withAlpha(123), key: globalKey,
child: Text(widget.mobile), child: Container(
width: MediaQuery.of(context).size.width * 0.8,
height: (MediaQuery.of(context).size.width * 0.8) * 1.36,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.w),
),
child: Column(
children: [
Image.asset(
"assets/image/share_image_bg.png",
height: (MediaQuery.of(context).size.width * 0.8) * 0.47,
width: (MediaQuery.of(context).size.width * 0.8),
),
Expanded(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(10.w),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 206.w,
height: 30.h,
child: Text(
"邀请人手机号:${widget.mobile.substring(0, 3)}****${widget.mobile.substring(7, 11)}",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 12.sp,
color: Color(0xFF2E3552),
),
),
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFFFFC93B),
border: Border.all(
color: Color(0xFF2E3552),
width: 1,
),
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 68.w),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xFF2E3552),
width: 1,
),
),
child: AspectRatio(
aspectRatio: 1,
child: QrImage(
data: "http://mp.hx.lotus-wallet.com/pages/invite/index?mobile=${widget.mobile ?? ""}",
version: QrVersions.auto,
size: 200.w,
gapless: true,
),
),
),
Container(
margin: EdgeInsets.only(left: 16.w, right: 24.w),
child: Text(
"扫码识别,关注公众号",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xFF2E3552),
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
),
),
),
],
),
),
flex: 1,
),
],
),
),
),
SizedBox(
height: 15,
),
TextButton(
onPressed: () {
widgetToImage();
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
Color(0xFFFFC93B),
),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
side: BorderSide(
color: Color(0xFF2E3552),
width: 1,
),
borderRadius: BorderRadius.circular(5),
),
),
elevation: MaterialStateProperty.all(3),
shadowColor: MaterialStateProperty.all(Colors.amber),
padding: MaterialStateProperty.all(
EdgeInsets.symmetric(
vertical: 5.h,
horizontal: 20.w,
),
),
),
child: Text(
"分享至微信",
style: TextStyle(
color: Color(0xFF2E3552),
fontSize: 18.sp,
fontWeight: MyFontWeight.semi_bold),
),
),
],
); );
} }
@ -36,10 +160,49 @@ class _QrShareImagePage extends State<QrShareImagePage> {
BuildContext buildContext = globalKey.currentContext; BuildContext buildContext = globalKey.currentContext;
if (null != buildContext) { if (null != buildContext) {
RenderRepaintBoundary boundary = buildContext.findRenderObject(); RenderRepaintBoundary boundary = buildContext.findRenderObject();
ui.Image image = await boundary.toImage(); ui.Image image = await boundary.toImage(pixelRatio: 3);
ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png); ByteData byteData =
// byteData.buffer.asUint16List() await image.toByteData(format: ui.ImageByteFormat.png);
String filePath = "";
if (Platform.isAndroid) {
filePath = (await getExternalStorageDirectory()).path;
} else {
filePath = (await getApplicationDocumentsDirectory()).path;
}
filePath = "$filePath/${DateTime.now().millisecondsSinceEpoch}.png";
File file = File(filePath);
if (!file.existsSync()) {
file.createSync();
print("object: ${file.path}");
}
file.writeAsBytesSync(byteData.buffer.asUint8List());
SSDKMap params = SSDKMap()
..setGeneral(
"",
"",
[
file.path,
],
"",
file.path,
"",
"",
"",
"",
"",
SSDKContentTypes.image,
);
SharesdkPlugin.share(ShareSDKPlatforms.wechatSession, params,
(state, userData, contentEntity, error) {
print("share state !$state");
print("share userData !$userData");
print("share contentEntity !$contentEntity");
print("share error !$error");
});
} }
} }
}
}

4
lib/view_widget/share_dialog.dart

@ -40,9 +40,9 @@ class _ShareDialog extends State<ShareDialog> {
height: 200.h, height: 200.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(8)), borderRadius: BorderRadius.vertical(top: Radius.circular(8),),
), ),
padding: EdgeInsets.only(top: 16.h, bottom: 66.h), padding: EdgeInsets.only(top: 16.h, bottom: 66.h,),
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [

2
pubspec.yaml

@ -85,7 +85,7 @@ dependencies:
flutter_svg: ^0.20.0-nullsafety.3 flutter_svg: ^0.20.0-nullsafety.3
font_awesome_flutter: ^9.1.0 font_awesome_flutter: ^9.1.0
# flutter_bugly: ^0.3.3 # flutter_bugly: ^0.3.3
# bitmap: ^0.1.2
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save