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.

654 lines
21 KiB

3 years ago
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
class InviteFriends extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _InviteFriends();
}
}
class _InviteFriends extends State<InviteFriends> {
ApiService apiService;
final RefreshController refreshController = RefreshController();
final ScrollController scrollController = ScrollController();
Article article;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Stack(
children: [
Scaffold(
backgroundColor: Color(0xFFF9FAF7),
appBar: AppBar(
backgroundColor: Colors.white,
leading: GestureDetector(
child: Icon(
Icons.clear,
color: Colors.black,
),
onTap: () {
Navigator.of(context).pop();
}),
title: Text(
"邀请好友",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 17.sp,
color: Color(0xFF000000),
),
),
centerTitle: true,
elevation: 0.0,
actions: [
GestureDetector(
child: Container(
margin: EdgeInsets.only(right: 14),
padding:EdgeInsets.only(left:70,right: 20),
child: Icon(
Icons.more_horiz,
color: Colors.black,
),
),
onTap: () {
// Navigator.of(context).pop();
// share();
})
],
),
body: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {
setState(() {});
},
physics: BouncingScrollPhysics(),
scrollController: scrollController,
child: Container(
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: FutureBuilder(
// future: querySignInfo(),
builder: (context, snap) {
return Column(
children: [
invite(),
activityRule(),
achievement(),
mineInvite(),
],
);
},
),
),
),
),
),
],
);
}
///邀请图
Widget invite(){
return Container(
width:double.infinity,
height: 370.h,
margin: EdgeInsets.only(bottom:20.h),
child:Column(
children: [
Image.asset(
"assets/image/icon_story_td.webp",
height: 300.h,
width:double.infinity,
fit: BoxFit.cover,
),
SizedBox(height: 12.h,),
Container(
width: double.infinity,
height: 52.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(26),
color: Color(0xFF00E16F),
),
margin: EdgeInsets.symmetric(horizontal:14.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/wx.webp",
height: 20,
width:20,
fit: BoxFit.fill,
),
SizedBox(width:4.w,),
Text(
"邀请微信好友",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 16.sp,
color: Color(0xFFFFFFFF),
),
)
],
),
)
],
),
);
}
///活动规则
Widget activityRule(){
return Container(
width:double.infinity,
height: 173.h,decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: Color(0xFFFFFFFF),
),
margin: EdgeInsets.only(bottom:12.h,left:14.h,right: 14.h),
padding: EdgeInsets.only(top: 6.h,left: 6,right: 6),
child:Column(
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage("assets/image/invite_bj.webp"),
),
),
height: 54.h,
width:double.infinity,
alignment: Alignment.center,
child: Text(
"活动规则",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 16.sp,
color: Color(0xFF32A060),
),
)
),
SizedBox(height: 17.h,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/zu_tuan.webp",
width: 42,
height: 42,
fit: BoxFit.cover,
),
Container(
width: 51,
child: Flex(
children: List.generate(8, (_) {
return SizedBox(
width: 3,
height: 1,
child: DecoratedBox(
decoration:
BoxDecoration(color: Color(0xFF32A060)),
),
);
}),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
direction: Axis.horizontal,
),
),
],
),
SizedBox(height: 8.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width:46.w,
child:
Text(
"1.分享给微信好友",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF181818),
),
),
),
Container(
width: 43,
child: Flex(
children: List.generate(0, (_) {
return SizedBox(
width: 3,
height: 1,
child: DecoratedBox(
decoration: BoxDecoration(color: Colors.white),
),
);
}),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
direction: Axis.horizontal,
),
),
],
),
],
),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/zt_zf.webp",
width: 42,
height: 42,
fit: BoxFit.cover,
),
Container(
width: 51,
child: Flex(
children: List.generate(8, (_) {
return SizedBox(
width: 3,
height: 1,
child: DecoratedBox(
decoration:
BoxDecoration(color: Color(0xFF32A060)),
),
);
}),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
direction: Axis.horizontal,
),
),
],
),
SizedBox(height: 8.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width:46.w,
child:
Text(
"2.好友注册",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF181818),
),
),
),
Container(
width: 43,
child: Flex(
children: List.generate(0, (_) {
return SizedBox(
width: 3,
height: 1,
child: DecoratedBox(
decoration: BoxDecoration(color: Colors.white),
),
);
}),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
direction: Axis.horizontal,
),
),
],
),
],
),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/yq_zt.webp",
width: 42,
height: 42,
fit: BoxFit.cover,
),
Container(
width: 51,
child: Flex(
children: List.generate(8, (_) {
return SizedBox(
width: 3,
height: 1,
child: DecoratedBox(
decoration:
BoxDecoration(color: Color(0xFF32A060)),
),
);
}),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
direction: Axis.horizontal,
),
),
],
),
SizedBox(height: 8.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 46.w,
child:
Text(
"3.邀请完成",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF181818),
),
),
),
Container(
width: 43,
child: Flex(
children: List.generate(0, (_) {
return SizedBox(
width: 3,
height: 1,
child: DecoratedBox(
decoration: BoxDecoration(color: Colors.white),
),
);
}),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
direction: Axis.horizontal,
),
),
],
),
],
),
Column(
children: [
Image.asset(
"assets/image/zt_m.webp",
width: 42,
height: 42,
fit: BoxFit.cover,
),
SizedBox(height: 8.h),
Container(
width: 46.w,
child:
Text(
"4.获得优惠券",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF181818),
),
),
)
],
),
],
),
],
),
);
}
///我的成就
Widget achievement(){
return Container(
width:double.infinity,
height: 150.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: Color(0xFFFFFFFF),
),
margin: EdgeInsets.only(bottom:12.h,left:14.h,right: 14.h),
padding: EdgeInsets.only(top: 6.h,left: 6,right: 6,bottom: 16.h),
child:Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage("assets/image/invite_bj.webp"),
),
),
height: 54.h,
width:double.infinity,
alignment: Alignment.center,
child: Text(
"我的成就",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 16.sp,
color: Color(0xFF32A060),
),
)
),
Row(
children: [
Expanded(child:Column(
children: [
Text(
"12",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 25.sp,
color: Color(0xFF000000),
),
),
SizedBox(height: 5.h,),
Text(
"今日邀请",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
color: Color(0xFF808080),
),
)
],
)),
Expanded(child:Column(
children: [
Text(
"100",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 25.sp,
color: Color(0xFF000000),
),
),
SizedBox(height: 5.h,),
Text(
"累积邀请",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
color: Color(0xFF808080),
),
)
],
))
],
),
],
),
);
}
///我的邀请
Widget mineInvite(){
return Container(
width:double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: Color(0xFFFFFFFF),
),
margin: EdgeInsets.only(bottom:12.h,left:14.h,right: 14.h),
padding: EdgeInsets.only(top: 6.h,left: 6,right: 6),
child:Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage("assets/image/invite_bj.webp"),
),
),
height: 54.h,
width:double.infinity,
alignment: Alignment.center,
child: Text(
"我的邀请",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 16.sp,
color: Color(0xFF32A060),
),
)
),
SizedBox(height:12.h,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).shoujihao,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize:14.sp,
color: Color(0xFF000000),
),
),
Text(
S.of(context).jiangli,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize:14.sp,
color: Color(0xFF000000),
),
),
],),
SizedBox(height:12.h,),
ListView.builder(
padding: EdgeInsets.zero,
itemCount:6,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
child: mineInviteItem(),
);
},
),
],
),
);
}
Widget mineInviteItem(){
return Container(
child:Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
AppUtils.phoneEncode("15392949097"),
style: TextStyle(
color: Color(0xFF000000),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(height:8),
Text(
"注册时间:2021.09.08 12:12:12",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
],
),
Text(
"新人全场减30优惠券*1",
style: TextStyle(
color: Color(0xFF353535),
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
),
),
],
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xFFF7F7F7),
margin: EdgeInsets.symmetric(vertical: 12.h),
),
],
),
);
}
}