|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
|
import 'package:flutter_swiper_view/flutter_swiper_view.dart';
|
|
|
|
import 'package:huixiang/data/base_data.dart';
|
|
|
|
import 'package:huixiang/data/base_list_data.dart';
|
|
|
|
import 'package:huixiang/data/examine_instance.dart';
|
|
|
|
import 'package:huixiang/data/msg_stats.dart';
|
|
|
|
import 'package:huixiang/data/rank.dart';
|
|
|
|
import 'package:huixiang/data/social_info.dart';
|
|
|
|
import 'package:huixiang/data/user_info.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/main.dart';
|
|
|
|
import 'package:huixiang/mine/mine_view/mine_calendar.dart';
|
|
|
|
import 'package:huixiang/mine/mine_view/mine_item.dart';
|
|
|
|
import 'package:huixiang/mine/mine_view/mine_navbar.dart';
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
|
|
|
import 'package:huixiang/utils/event_type.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:huixiang/view_widget/classic_header.dart';
|
|
|
|
import 'package:huixiang/view_widget/login_tips_dialog.dart';
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
import 'package:retrofit/error_logger.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
|
|
|
import '../data/banner.dart';
|
|
|
|
import '../data/coupon.dart';
|
|
|
|
import '../data/page.dart';
|
|
|
|
import '../utils/flutter_utils.dart';
|
|
|
|
import '../view_widget/custom_image.dart';
|
|
|
|
import 'mine_view/mine_view.dart';
|
|
|
|
|
|
|
|
class MinePage extends StatefulWidget {
|
|
|
|
MinePage(Key key) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return MinePageState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class MinePageState extends State<MinePage>
|
|
|
|
with AutomaticKeepAliveClientMixin, ParseErrorLogger {
|
|
|
|
ApiService? apiService;
|
|
|
|
UserInfo? userInfo;
|
|
|
|
List<Rank> ranks = [];
|
|
|
|
SocialInfo? infoNumber;
|
|
|
|
final RefreshController _refreshController = RefreshController();
|
|
|
|
int totalMsg = 0;
|
|
|
|
String? couponNum;
|
|
|
|
List<BannerData> activityBannerData = [];
|
|
|
|
|
|
|
|
_toUserInfo() async {
|
|
|
|
SharedPreferences shared = await SharedPreferences.getInstance();
|
|
|
|
if (shared.getString("token") == null || shared.getString("token") == "") {
|
|
|
|
Navigator.of(context).pushReplacementNamed('/router/new_login_page',
|
|
|
|
arguments: {"login": "login"});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
(Platform.isAndroid && ExamineInstance.instance.isExamine)
|
|
|
|
? await Navigator.of(context).pushNamed('/router/user_info_page')
|
|
|
|
: await Navigator.of(context)
|
|
|
|
.pushNamed('/router/personal_page', arguments: {
|
|
|
|
"memberId": "0",
|
|
|
|
});
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
_refreshController.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
querySocialInfo();
|
|
|
|
queryMsgStats();
|
|
|
|
queryCoupon();
|
|
|
|
queryActivityBanner();
|
|
|
|
// queryCard();
|
|
|
|
|
|
|
|
eventBus.on<EventType>().listen((event) {
|
|
|
|
print("EventType: ${event.type}");
|
|
|
|
if (event.type < 3) {
|
|
|
|
if (mounted) setState(() {});
|
|
|
|
}
|
|
|
|
if (event.type == 3) {
|
|
|
|
if (mounted) setState(() {});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
queryUserInfo() async {
|
|
|
|
// SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai);
|
|
|
|
|
|
|
|
final SharedPreferences value = await SharedPreferences.getInstance();
|
|
|
|
if (value.containsKey('user') &&
|
|
|
|
value.getString('user') != null &&
|
|
|
|
value.getString('user') != "") {
|
|
|
|
userInfo = UserInfo.fromJson(jsonDecode(value.getString('user')!));
|
|
|
|
}
|
|
|
|
apiService = ApiService(
|
|
|
|
Dio(),
|
|
|
|
context: context,
|
|
|
|
token: value.getString('token'),
|
|
|
|
showLoading: false,
|
|
|
|
errorLogger: this,
|
|
|
|
);
|
|
|
|
|
|
|
|
BaseListData<Rank>? rankData =
|
|
|
|
await apiService?.rankList().catchError((onError) {
|
|
|
|
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
|
|
|
|
alignment: Alignment.center);
|
|
|
|
_refreshController.refreshFailed();
|
|
|
|
return BaseListData<Rank>()..isSuccess = false;
|
|
|
|
});
|
|
|
|
if (rankData?.isSuccess ?? false) {
|
|
|
|
ranks.clear();
|
|
|
|
ranks.addAll(rankData?.data ?? []);
|
|
|
|
}
|
|
|
|
|
|
|
|
BaseData<UserInfo>? baseDate =
|
|
|
|
await apiService?.queryInfo().catchError((onError) {
|
|
|
|
_refreshController.refreshFailed();
|
|
|
|
return Future.value(null);
|
|
|
|
});
|
|
|
|
if (baseDate?.isSuccess ?? false) {
|
|
|
|
userInfo = baseDate?.data;
|
|
|
|
SharedPreferences.getInstance().then(
|
|
|
|
(value) => {
|
|
|
|
value.setString('user', jsonEncode(baseDate?.data)),
|
|
|
|
},
|
|
|
|
);
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
} else {
|
|
|
|
_refreshController.refreshFailed();
|
|
|
|
}
|
|
|
|
// SmartDialog.dismiss();
|
|
|
|
}
|
|
|
|
|
|
|
|
///宣传banner
|
|
|
|
queryActivityBanner() async {
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance();
|
|
|
|
apiService = ApiService(
|
|
|
|
Dio(),
|
|
|
|
context: context,
|
|
|
|
token: value.getString("token"),
|
|
|
|
showLoading: false,
|
|
|
|
errorLogger: this,
|
|
|
|
);
|
|
|
|
BaseData<PageInfo<BannerData>>? baseData = await apiService?.queryBanner({
|
|
|
|
"model": {"type": "HOME_STORE_PAGE"},
|
|
|
|
}).catchError((onError) {
|
|
|
|
return BaseData<PageInfo<BannerData>>()..isSuccess = false;
|
|
|
|
});
|
|
|
|
if (baseData?.isSuccess ?? false) {
|
|
|
|
activityBannerData = baseData?.data?.records ?? [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
queryCoupon() async {
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance();
|
|
|
|
apiService = ApiService(
|
|
|
|
Dio(),
|
|
|
|
context: context,
|
|
|
|
token: value.getString("token"),
|
|
|
|
showLoading: false,
|
|
|
|
errorLogger: this,
|
|
|
|
);
|
|
|
|
BaseData<PageInfo<Coupon>>? baseData = await apiService?.queryCard({
|
|
|
|
"centre": true,
|
|
|
|
"pageNum": 1,
|
|
|
|
"pageSize": 10,
|
|
|
|
"searchKey": "",
|
|
|
|
"state": 1
|
|
|
|
}).catchError((error) {
|
|
|
|
_refreshController.refreshFailed();
|
|
|
|
return Future.value(null);
|
|
|
|
});
|
|
|
|
if (baseData?.isSuccess ?? false) {
|
|
|
|
couponNum = baseData?.data?.total;
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
} else {
|
|
|
|
_refreshController.refreshFailed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_onRefresh() {
|
|
|
|
// queryUserInfo();
|
|
|
|
queryCoupon();
|
|
|
|
querySocialInfo();
|
|
|
|
queryMsgStats();
|
|
|
|
queryActivityBanner();
|
|
|
|
}
|
|
|
|
|
|
|
|
///个人社交信息(粉丝/关注数量/成就数量)
|
|
|
|
querySocialInfo() async {
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance();
|
|
|
|
apiService = ApiService(
|
|
|
|
Dio(),
|
|
|
|
context: context,
|
|
|
|
token: value.getString("token"),
|
|
|
|
showLoading: false,
|
|
|
|
errorLogger: this,
|
|
|
|
);
|
|
|
|
|
|
|
|
BaseData<SocialInfo>? baseData =
|
|
|
|
await apiService?.socialInfo().catchError((onError) {
|
|
|
|
_refreshController.refreshFailed();
|
|
|
|
return Future.value(null);
|
|
|
|
});
|
|
|
|
if (baseData?.isSuccess ?? false) {
|
|
|
|
infoNumber = baseData?.data;
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
}
|
|
|
|
SmartDialog.dismiss();
|
|
|
|
}
|
|
|
|
|
|
|
|
///消息数量
|
|
|
|
queryMsgStats() async {
|
|
|
|
BaseListData<MsgStats>? baseData =
|
|
|
|
await apiService?.stats().catchError((onError) {
|
|
|
|
return BaseListData<MsgStats>()..isSuccess = false;
|
|
|
|
});
|
|
|
|
if (baseData?.isSuccess ?? false) {
|
|
|
|
setState(() {
|
|
|
|
totalMsg = 0;
|
|
|
|
baseData?.data?.forEach((element) {
|
|
|
|
totalMsg += (element.number ?? 0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
SmartDialog.dismiss();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
super.build(context);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: Color(0xFFF9FAF7),
|
|
|
|
body: Container(
|
|
|
|
padding: EdgeInsets.only(bottom: 76.h),
|
|
|
|
child: SmartRefresher(
|
|
|
|
controller: _refreshController,
|
|
|
|
enablePullDown: true,
|
|
|
|
enablePullUp: false,
|
|
|
|
header: MyHeader(),
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
onRefresh: () {
|
|
|
|
setState(() {
|
|
|
|
_onRefresh();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Container(
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: 306.h,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
image: DecorationImage(
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
image: AssetImage("assets/image/settlement_bg.webp"),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
FutureBuilder(
|
|
|
|
future: queryUserInfo(),
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
///我的 用户信息
|
|
|
|
MineView(userInfo, () {
|
|
|
|
_toUserInfo();
|
|
|
|
}, () {
|
|
|
|
toIntegralPage();
|
|
|
|
}, () {
|
|
|
|
setState(() {
|
|
|
|
totalMsg = 0;
|
|
|
|
});
|
|
|
|
}, totalMsg, infoNumber, ranks),
|
|
|
|
|
|
|
|
///订单/钱包/会员码/设置
|
|
|
|
MineNavbar(couponNum, userInfo, infoNumber, () {
|
|
|
|
toIntegralPage();
|
|
|
|
}, () {
|
|
|
|
setState(() {
|
|
|
|
queryCoupon();
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
|
|
|
|
///我的 VIP等级信息
|
|
|
|
// MineVipEntry(
|
|
|
|
// tag: "vip",
|
|
|
|
// ranks: ranks,
|
|
|
|
// userInfo: userInfo,
|
|
|
|
// rank: double.tryParse(userInfo?.expendAmount ?? "0")
|
|
|
|
// .toInt(),
|
|
|
|
// rankMax: userInfo?.memberRankVo?.nextOrigin ?? 0,
|
|
|
|
// createTime: userInfo?.createTime ?? "",
|
|
|
|
// ),
|
|
|
|
|
|
|
|
///我的订单
|
|
|
|
// MineOrderView(),
|
|
|
|
|
|
|
|
///推广图
|
|
|
|
if (activityBannerData.length > 0) spreadImage(),
|
|
|
|
|
|
|
|
///我的 下面item
|
|
|
|
MineItem(),
|
|
|
|
|
|
|
|
///我的成就
|
|
|
|
attainment(),
|
|
|
|
|
|
|
|
///绿色足迹
|
|
|
|
MineCalendar()
|
|
|
|
|
|
|
|
// ///关注度/粉丝/发布
|
|
|
|
// attention(),
|
|
|
|
|
|
|
|
// /// 钱包或领券中心
|
|
|
|
// WalletCoupon(),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
// buildNotice(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///我的成就
|
|
|
|
Widget attainment() {
|
|
|
|
return GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
'/router/mine_attainment_page',
|
|
|
|
arguments: {"userInfo": userInfo},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 30.h),
|
|
|
|
padding:
|
|
|
|
EdgeInsets.only(left: 12.w, top: 12.h, right: 10.w, bottom: 17.h),
|
|
|
|
width: double.infinity,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(12),
|
|
|
|
offset: Offset(0, 2),
|
|
|
|
blurRadius: 3,
|
|
|
|
spreadRadius: 0,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
S.of(context).wodechengjiu,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
fontSize: 15.sp,
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 9.h,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/icon_attainment.webp",
|
|
|
|
width: 54,
|
|
|
|
height: 54,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 7.w,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"已解锁${infoNumber?.achievementNumber ?? 0}个成就",
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
color: Color(0xFF262626),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 4.w,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"完成任务解锁更多成就",
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: 60.w,
|
|
|
|
height: 19.h,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
border: Border.all(
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
width: 1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
"全部成就",
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///推广图
|
|
|
|
Widget spreadImage() {
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
margin: EdgeInsets.only(bottom: 24.h),
|
|
|
|
height: 85.h,
|
|
|
|
child: activityBannerData.isNotEmpty
|
|
|
|
? Swiper(
|
|
|
|
pagination: SwiperPagination(
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
margin: EdgeInsets.only(top: 5.h),
|
|
|
|
builder: DotSwiperPaginationBuilder(
|
|
|
|
size: 8.w,
|
|
|
|
activeSize: 8.w,
|
|
|
|
space: 5.w,
|
|
|
|
activeColor: Colors.white,
|
|
|
|
color: Colors.white.withAlpha(76),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
autoplay: true,
|
|
|
|
duration: 1000,
|
|
|
|
autoplayDelay: 10000,
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
spreadBannerClick(activityBannerData[position]);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 14.w),
|
|
|
|
child: MImage(
|
|
|
|
activityBannerData[position].imgUrl ?? "",
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
radius: BorderRadius.circular(6),
|
|
|
|
errorSrc: "assets/image/default_2_1.webp",
|
|
|
|
fadeSrc: "assets/image/default_2_1.webp",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
itemCount: activityBannerData.length,
|
|
|
|
)
|
|
|
|
: Image.asset(
|
|
|
|
"assets/image/default_2_1.webp",
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程,7:门店跳转)
|
|
|
|
spreadBannerClick(BannerData activityBannerData) async {
|
|
|
|
switch (activityBannerData.contentType) {
|
|
|
|
case 1:
|
|
|
|
Navigator.of(context).pushNamed('/router/integral_store_page',
|
|
|
|
arguments: {"goodsId": activityBannerData.content});
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
Navigator.of(context).pushNamed('/router/web_page', arguments: {
|
|
|
|
"activityId": activityBannerData.content,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
Navigator.of(context).pushNamed('/router/web_page', arguments: {
|
|
|
|
"articleId": activityBannerData.content,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
String? router = activityBannerData.content;
|
|
|
|
if (router?.isEmpty ?? true) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// String router = "/router/store_order?{\"id\":\"1512378184161558528\",\"tenant\":\"1188\",\"storeName\":\"农场煮意\"}";
|
|
|
|
if (router!.contains("?")) {
|
|
|
|
String params = router.substring(router.indexOf("?") + 1);
|
|
|
|
Map map = jsonDecode(params);
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
router.substring(0, router.indexOf("?")),
|
|
|
|
arguments: map);
|
|
|
|
} else {
|
|
|
|
Navigator.of(context).pushNamed(router);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
Navigator.of(context).pushNamed('/router/class_details', arguments: {
|
|
|
|
"id": activityBannerData.content,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
String? router = activityBannerData.content;
|
|
|
|
if (router?.isEmpty ?? true) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
String params = router!.substring(router!.indexOf("?") + 1);
|
|
|
|
Map map = jsonDecode(params);
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
router.substring(0, router.indexOf("?")),
|
|
|
|
arguments: map);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
final List<String> spreadItem = [
|
|
|
|
"assets/image/welfare_spread.webp",
|
|
|
|
"assets/image/welfare_yz.webp",
|
|
|
|
];
|
|
|
|
|
|
|
|
///横向的提示
|
|
|
|
Widget buildNotice() {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(top: 130.h),
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: 33.h,
|
|
|
|
margin: EdgeInsets.only(left: 12.w),
|
|
|
|
padding: EdgeInsets.only(left: 16.w),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(25),
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: 12,
|
|
|
|
spreadRadius: 0,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(2),
|
|
|
|
bottomLeft: Radius.circular(2),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
S.of(context).ninyouyigedingdanyaolingqu,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Icons.keyboard_arrow_right,
|
|
|
|
color: Colors.black,
|
|
|
|
size: 16,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 5.h, bottom: 4.h),
|
|
|
|
padding: EdgeInsets.all(2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(25),
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: 12,
|
|
|
|
spreadRadius: 0,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
),
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/icon_mine_motorcycle.webp",
|
|
|
|
width: 20.w,
|
|
|
|
height: 20.h,
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///关注度/粉丝/成就数量
|
|
|
|
Widget attention() {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(left: 16, top: 10, right: 16),
|
|
|
|
// padding: EdgeInsets.only(top: 16,bottom: 16),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(12),
|
|
|
|
offset: Offset(0, 3),
|
|
|
|
blurRadius: 14,
|
|
|
|
spreadRadius: 0,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
'/router/communityFollow',
|
|
|
|
arguments: {},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
color: Colors.transparent,
|
|
|
|
padding: EdgeInsets.all(16),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"${infoNumber?.follow ?? 0}",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 4,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
S.of(context).guanzhu,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
'/router/communityFollow',
|
|
|
|
arguments: {},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
color: Colors.transparent,
|
|
|
|
padding: EdgeInsets.all(16),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"${infoNumber?.fans ?? 0}",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 4,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
S.of(context).fensi,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
'/router/mine_attainment_page',
|
|
|
|
arguments: {"userInfo": userInfo},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
color: Colors.transparent,
|
|
|
|
padding: EdgeInsets.all(16),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"${infoNumber?.achievementNumber ?? 0}",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 4,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
S.of(context).chengjiu,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
toIntegralPage() async {
|
|
|
|
SharedPreferences shared = await SharedPreferences.getInstance();
|
|
|
|
if (shared.getString("token") == null || shared.getString("token") == "") {
|
|
|
|
LoginTipsDialog().show(context);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
await Navigator.of(context).pushNamed('/router/integral_page');
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool get wantKeepAlive => true;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void logError(Object error, StackTrace stackTrace, RequestOptions options) {
|
|
|
|
debugPrint(
|
|
|
|
"logError: $error ${stackTrace.toString()} ${options.path}");
|
|
|
|
}
|
|
|
|
}
|