621 lines
18 KiB
Dart
621 lines
18 KiB
Dart
|
|
import 'dart:io';
|
|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
|
|
import 'package:circle_app/app/circle/view.dart';
|
|
|
|
import 'package:circle_app/app/msg/view.dart';
|
|
import 'package:circle_app/router/app_routers.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import '../../common/Widgets/open_vip_tip/view.dart';
|
|
import '../../util/SharedPreferencesHelper.dart';
|
|
import '../../util/util.dart';
|
|
import 'logic.dart';
|
|
|
|
const vipIcon = 'assets/images/home/icon_vip_more.png';
|
|
|
|
const MyImageWidget = Image(
|
|
image: AssetImage(vipIcon),
|
|
fit: BoxFit.fill,
|
|
);
|
|
|
|
const vipIcon1 = 'assets/images/home/icon_one_vip.png';
|
|
|
|
const MyImageWidget1 = Image(
|
|
image: AssetImage(vipIcon1),
|
|
fit: BoxFit.fill,
|
|
);
|
|
|
|
class MinefragmentPage extends StatelessWidget {
|
|
MinefragmentPage({Key? key}) : super(key: key);
|
|
|
|
final logic = Get.lazyPut(() => MinefragmentLogic());
|
|
|
|
|
|
final state = Get
|
|
.find<MinefragmentLogic>()
|
|
.state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
double statusBarHeight = MediaQuery
|
|
.of(context)
|
|
.padding
|
|
.top;
|
|
|
|
return GetBuilder<MinefragmentLogic>(
|
|
builder: (logic) {
|
|
return Scaffold(
|
|
|
|
backgroundColor: Colors.transparent,
|
|
body: Padding(
|
|
padding: EdgeInsets.only(
|
|
top: 20.0 + statusBarHeight.sp,
|
|
left: 11.sp,
|
|
right: 11.sp,),
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
_buildAvatarRow(logic),
|
|
_friendsRow(logic),
|
|
GestureDetector(
|
|
onTap: () {
|
|
showRechargeDialog(logic);
|
|
},
|
|
child: Stack(children: [
|
|
logic.isProxy ? MyImageWidget1 : MyImageWidget,
|
|
Positioned(
|
|
top: 24.sp,
|
|
left: 78.sp,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text("会员-微乐园贵宾",style: TextStyle(color: const Color(0xFFFFFFFF),fontSize: 16.sp),),
|
|
SizedBox(height: 4.sp,),
|
|
Text(logic.vipMsg,style: TextStyle(color: const Color(0x99FFFFFF),fontSize: 13.sp),),
|
|
],
|
|
)),
|
|
|
|
],),
|
|
),
|
|
_circleLiveView(logic),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
});
|
|
}
|
|
|
|
Widget _circleLiveView(MinefragmentLogic logic) {
|
|
return Column(
|
|
children: [_circleItemView(logic),_invienItemView(), _helpItemView(),_setUpItemView()],
|
|
);
|
|
}
|
|
|
|
Widget _setUpItemView() {
|
|
return GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () {
|
|
Get.toNamed(AppRoutes.SetUpActivity);
|
|
// controller.state.hearUrl
|
|
},
|
|
child: Container(
|
|
// color: Colors.red,
|
|
margin: EdgeInsets.only(top: 18.sp),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Image(
|
|
image: AssetImage(getHomeImage("mine_setup")),
|
|
width: 24.sp,
|
|
height: 24.sp,
|
|
),
|
|
SizedBox(width: 10.sp),
|
|
const Text(
|
|
"设置",
|
|
style: TextStyle(color: Colors.white),
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Image(
|
|
image: AssetImage(getHomeImage("icon_in")),
|
|
width: 24.sp,
|
|
height: 24.sp,
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _helpItemView() {
|
|
return GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () {
|
|
Get.toNamed(AppRoutes.HelpActivity);
|
|
// controller.state.hearUrl
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.only(top: 18.sp),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Image(
|
|
image: AssetImage(getHomeImage("mine_help")),
|
|
width: 24.sp,
|
|
height: 24.sp,
|
|
),
|
|
SizedBox(width: 10.sp),
|
|
const Text(
|
|
"帮助与反馈",
|
|
style: TextStyle(color: Colors.white),
|
|
),
|
|
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
const Text(
|
|
"乐园客服在线等您哦",
|
|
style: TextStyle(color: Colors.white60),
|
|
),
|
|
Image(
|
|
image: AssetImage(getHomeImage("icon_in")),
|
|
width: 24.sp,
|
|
height: 24.sp,
|
|
),
|
|
],
|
|
)
|
|
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _invienItemView() {
|
|
return GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () {
|
|
Get.toNamed(AppRoutes.Invite);
|
|
// controller.state.hearUrl
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.only(top: 18.sp),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Image(
|
|
image: AssetImage(getMineImage("invite_icon")),
|
|
width: 24.sp,
|
|
height: 24.sp,
|
|
),
|
|
SizedBox(width: 10.sp),
|
|
const Text(
|
|
"邀请得会员",
|
|
style: TextStyle(color: Colors.white),
|
|
),
|
|
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
const Text(
|
|
"免费领取会员",
|
|
style: TextStyle(color: Colors.white60),
|
|
),
|
|
Image(
|
|
image: AssetImage(getHomeImage("icon_in")),
|
|
width: 24.sp,
|
|
height: 24.sp,
|
|
),
|
|
],
|
|
)
|
|
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _circleItemView(MinefragmentLogic logic) {
|
|
return GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () {
|
|
Get.toNamed(AppRoutes.MyCircle,arguments: '');
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.only(top: 18.sp),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Image(
|
|
image: AssetImage(getHomeImage("mine_circle")),
|
|
width: 24.sp,
|
|
height: 24.sp,
|
|
),
|
|
SizedBox(width: 10.sp),
|
|
const Text(
|
|
"我的圈子",
|
|
style: TextStyle(color: Colors.white),
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Text(
|
|
logic.joinedCircle,
|
|
style: const TextStyle(color: Colors.white60),
|
|
),
|
|
Image(
|
|
image: AssetImage(getHomeImage("icon_in")),
|
|
width: 24.sp,
|
|
height: 24.sp,
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _friendsRow(MinefragmentLogic logic) {
|
|
return Center(
|
|
child: Container(
|
|
width: Get.width,
|
|
height: 85.sp,
|
|
margin: EdgeInsets.only(left: 30.sp, right: 30.sp),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () {
|
|
Get.toNamed(AppRoutes.FriendsActivity);
|
|
},
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text(
|
|
logic.likeCount.toString(),
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16.sp,
|
|
),
|
|
),
|
|
SizedBox(height: 4.sp),
|
|
Text(
|
|
"我喜欢的",
|
|
style: TextStyle(
|
|
shadows: const [
|
|
Shadow(
|
|
color: Color(0x99FF00F8),
|
|
offset: Offset(2, 2),
|
|
blurRadius: 3,
|
|
),
|
|
],
|
|
color: const Color.fromARGB(255, 247, 250, 250),
|
|
fontSize: 16.sp,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: ()async {
|
|
logic.like_me_count_new = 0;
|
|
logic.update();
|
|
SharedPreferencesHelper.getInstance().then((sharedPreferences) {
|
|
sharedPreferences.setInt(SharedPreferencesHelper.LIKEMECOUNT, logic.like_me_count);
|
|
});
|
|
Get.toNamed(AppRoutes.LikeListActivity);
|
|
},
|
|
child: Stack(
|
|
children: [
|
|
Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Text(
|
|
logic.like_me_count.toString(),
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16.sp,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 4.sp,
|
|
width: 80.sp,
|
|
),
|
|
Text(
|
|
"喜欢我的",
|
|
style: TextStyle(
|
|
shadows: const [
|
|
Shadow(
|
|
color: Color(0x99FF00F8),
|
|
offset: Offset(2, 2),
|
|
blurRadius: 3,
|
|
),
|
|
],
|
|
color: const Color.fromARGB(255, 247, 250, 250),
|
|
fontSize: 16.sp,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Positioned(
|
|
right: 0.sp,
|
|
top: 15.sp,
|
|
child: Text(
|
|
logic.like_me_count_new>0 ? "+${logic.like_me_count_new}":"",
|
|
style: const TextStyle(color: Color.fromRGBO(0, 255, 210, 1.0)),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () async{
|
|
logic.recent_visit_count_new = 0;
|
|
SharedPreferencesHelper.getInstance().then((sharedPreferences) {
|
|
sharedPreferences.setInt(SharedPreferencesHelper.RECENTVISITCOUNT, logic.recent_visit_count);
|
|
});
|
|
Get.toNamed(AppRoutes.VisitorListActivity);
|
|
},
|
|
child: Stack(
|
|
children: [
|
|
Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Text(
|
|
logic.recent_visit_count.toString(),
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16.sp,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 4.sp,
|
|
width: 80.sp,
|
|
),
|
|
Text(
|
|
"最近来访",
|
|
style: TextStyle(
|
|
shadows: const [
|
|
Shadow(
|
|
color: Color(0x99FF00F8),
|
|
offset: Offset(2, 2),
|
|
blurRadius: 3,
|
|
),
|
|
],
|
|
color: const Color.fromARGB(255, 247, 250, 250),
|
|
fontSize: 16.sp,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Positioned(
|
|
right: 0.sp,
|
|
top: 15.sp,
|
|
child: Text(
|
|
logic.recent_visit_count_new>0 ? "+${logic.recent_visit_count_new}":"",
|
|
style: const TextStyle(color: Color.fromRGBO(0, 255, 210, 1.0)),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildAvatarRow(MinefragmentLogic logic) {
|
|
return GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () async{
|
|
await Get.toNamed(AppRoutes.UserInfoActivity);
|
|
logic.onInit();
|
|
},
|
|
child: SizedBox(
|
|
width: Get.width,
|
|
height: 65.sp,
|
|
child: Row(
|
|
children: [
|
|
Center(
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Container(
|
|
width: 68.sp,
|
|
height: 68.sp,
|
|
decoration: const BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
gradient: LinearGradient(
|
|
colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)],
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 63.sp,
|
|
height: 63.sp,
|
|
child: _buildAvatar1(logic),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
padding: EdgeInsets.only(left: 10.sp),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
_buildNameRow(logic),
|
|
SizedBox(height: 10.sp),
|
|
_buildInfoRow(logic),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildAvatar1(MinefragmentLogic logic) {
|
|
|
|
|
|
return ClipOval(
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
if(logic.userInfoBean!=null){
|
|
var imgList = <String>[];
|
|
imgList.add(logic.userInfoBean!.avatar);
|
|
// Get.toNamed(AppRoutes.Swiper,arguments:imgList);
|
|
Get.toNamed(AppRoutes.Swiper, arguments: {
|
|
'imaglist': imgList,
|
|
'index': 0
|
|
});
|
|
}
|
|
|
|
},
|
|
child:logic.userInfoBean==null ? SizedBox(
|
|
width: 63.sp,
|
|
height: 63.sp,
|
|
): CachedNetworkImage(
|
|
fit: BoxFit.cover,
|
|
placeholder: null,
|
|
imageUrl: logic.avatar,
|
|
width: 63.sp,
|
|
height: 63.sp,
|
|
),
|
|
),
|
|
|
|
);
|
|
}
|
|
|
|
Widget _buildNameRow(MinefragmentLogic logic) {
|
|
return Container(
|
|
margin: EdgeInsets.only(top: 6.sp),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
logic.name,
|
|
style: TextStyle(
|
|
color: const Color.fromRGBO(247, 250, 250, 1.0),
|
|
fontSize: 16.sp,
|
|
),
|
|
),
|
|
Row(
|
|
children: [
|
|
Text(
|
|
logic.enterHomeInfoMsg,
|
|
style: TextStyle(
|
|
color: const Color.fromRGBO(247, 250, 250, 1.0),
|
|
fontSize: 16.sp,
|
|
),
|
|
),
|
|
Image(
|
|
image: AssetImage(getHomeImage("icon_in")),
|
|
width: 44.sp,
|
|
height: 18.sp,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildInfoRow(MinefragmentLogic logic) {
|
|
return Row(
|
|
children: [
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(17),
|
|
gradient: const LinearGradient(
|
|
colors: [
|
|
Color.fromRGBO(141, 255, 248, 1.0),
|
|
Color.fromRGBO(181, 211, 255, 1.0),
|
|
],
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
),
|
|
),
|
|
padding: EdgeInsets.only(top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp),
|
|
child: Text(
|
|
logic.ageMsg,
|
|
style: TextStyle(
|
|
color: Colors.black,
|
|
fontSize: 10.sp,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(width: 6.sp),
|
|
Obx(() {
|
|
return logic.isVip.value > 0 ? Image(
|
|
image: AssetImage(getBaseImage(logic.isVip.value == 2 ? 'year_vip' : "vip")),
|
|
width: 44.sp,
|
|
height: 18.sp,
|
|
) : Container();
|
|
}),
|
|
|
|
|
|
// logic.isVip>0 ?
|
|
// Image(
|
|
// image: AssetImage(getBaseImage("vip")),
|
|
// width: 44.sp,
|
|
// height: 18.sp,
|
|
// ):Container(),
|
|
],
|
|
);
|
|
}
|
|
|
|
showRechargeDialog(MinefragmentLogic ctr) async {
|
|
Get.bottomSheet(
|
|
Scaffold(
|
|
backgroundColor: Colors.transparent,
|
|
body: Open_vip_tipPage(false),
|
|
),
|
|
isScrollControlled: true,
|
|
enableDrag: false).then((value) {
|
|
ctr.getMode();
|
|
});
|
|
|
|
|
|
}
|
|
}
|