发现页面,填写微信号接入

This commit is contained in:
CYH 2023-10-08 15:36:05 +08:00
parent 76b79e8c75
commit 883d35d1eb
45 changed files with 2955 additions and 302 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -40,7 +40,7 @@
</Testables> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Release" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"

View File

@ -455,6 +455,23 @@ class _TIMTextFieldLayoutNarrowState
_buildRepliedMessage(widget.repliedMessage), _buildRepliedMessage(widget.repliedMessage),
Stack( Stack(
children: [ children: [
Positioned(
bottom: MediaQuery.of(context).padding.bottom + 20,
child: AnimatedContainer(
duration: Duration(
milliseconds: (showKeyboard && PlatformUtils().isAndroid)
? 200
: 340),
curve: Curves.fastOutSlowIn,
width: Get.width,
height: max(_getBottomHeight(), 0.0),
child: ListView(
physics: const NeverScrollableScrollPhysics(),
children: [_getBottomContainer()],
),
),
),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
@ -469,26 +486,26 @@ class _TIMTextFieldLayoutNarrowState
children: [ children: [
Container( Container(
padding: padding:
EdgeInsets.symmetric(vertical: 8, horizontal: 12.sp), EdgeInsets.symmetric(vertical: 8, horizontal: 12.sp),
constraints: const BoxConstraints(minHeight: 30), constraints: const BoxConstraints(minHeight: 30),
child: Row( child: Row(
children: [ children: [
if (widget.forbiddenText != null) if (widget.forbiddenText != null)
Expanded( Expanded(
child: Container( child: Container(
height: 35, height: 35,
color: theme.weakBackgroundColor, color: theme.weakBackgroundColor,
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
TIM_t(widget.forbiddenText!), TIM_t(widget.forbiddenText!),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 16, fontSize: 16,
color: theme.weakTextColor, color: theme.weakTextColor,
), ),
), ),
)), )),
if (PlatformUtils().isMobile && if (PlatformUtils().isMobile &&
widget.showSendAudio && widget.showSendAudio &&
widget.forbiddenText == null) widget.forbiddenText == null)
@ -532,7 +549,7 @@ class _TIMTextFieldLayoutNarrowState
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 8, horizontal: 12.sp), vertical: 8, horizontal: 12.sp),
constraints: constraints:
const BoxConstraints(minHeight: 30), const BoxConstraints(minHeight: 30),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0x1AFFFFFF), color: Color(0x1AFFFFFF),
borderRadius: BorderRadius.circular(26.sp), borderRadius: BorderRadius.circular(26.sp),
@ -543,91 +560,91 @@ class _TIMTextFieldLayoutNarrowState
Expanded( Expanded(
child: showSendSoundText child: showSendSoundText
? TIMSendSoundMessage( ? TIMSendSoundMessage(
onDownBottom: onDownBottom:
widget.goDownBottom, widget.goDownBottom,
conversationID: conversationID:
widget.conversationID, widget.conversationID,
conversationType: conversationType:
widget.conversationType) widget.conversationType)
: KeyboardVisibility( : KeyboardVisibility(
child: ExtendedTextField( child: ExtendedTextField(
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14.sp), fontSize: 14.sp),
maxLines: 4, maxLines: 4,
minLines: 1, minLines: 1,
focusNode: widget.focusNode, focusNode: widget.focusNode,
onChanged: debounceFunc, onChanged: debounceFunc,
onTap: () { onTap: () {
showKeyboard = true; showKeyboard = true;
widget.goDownBottom(); widget.goDownBottom();
setState(() { setState(() {
showEmojiPanel = false; showEmojiPanel = false;
showMore = false; showMore = false;
}); });
}, },
keyboardType: keyboardType:
TextInputType.multiline, TextInputType.multiline,
textInputAction: textInputAction:
PlatformUtils() PlatformUtils()
.isAndroid .isAndroid
? TextInputAction ? TextInputAction
.newline .newline
: TextInputAction : TextInputAction
.send, .send,
onEditingComplete: () { onEditingComplete: () {
widget.onSubmitted(); widget.onSubmitted();
if (showKeyboard) { if (showKeyboard) {
widget.focusNode widget.focusNode
.requestFocus(); .requestFocus();
}
setState(() {
if (widget
.textEditingController
.text
.isEmpty) {
showMoreButton = true;
}
});
},
textAlignVertical:
TextAlignVertical.top,
decoration: InputDecoration(
border: InputBorder.none,
hintStyle: TextStyle(
fontSize: 14.sp,
color:
Color(0xB3FFFFFF),
),
hintText: widget.hintText,
fillColor:
Colors.transparent,
filled: true,
isDense: true,
),
controller: widget
.textEditingController,
specialTextSpanBuilder:
PlatformUtils().isWeb
? null
: DefaultSpecialTextSpanBuilder(
isUseDefaultEmoji:
widget
.isUseDefaultEmoji,
customEmojiStickerList:
widget
.customEmojiStickerList,
showAtBackground:
true,
)),
onChanged: (bool visibility) {
if (showKeyboard !=
visibility) {
setState(() {
showKeyboard = visibility;
});
} }
}), setState(() {
if (widget
.textEditingController
.text
.isEmpty) {
showMoreButton = true;
}
});
},
textAlignVertical:
TextAlignVertical.top,
decoration: InputDecoration(
border: InputBorder.none,
hintStyle: TextStyle(
fontSize: 14.sp,
color:
Color(0xB3FFFFFF),
),
hintText: widget.hintText,
fillColor:
Colors.transparent,
filled: true,
isDense: true,
),
controller: widget
.textEditingController,
specialTextSpanBuilder:
PlatformUtils().isWeb
? null
: DefaultSpecialTextSpanBuilder(
isUseDefaultEmoji:
widget
.isUseDefaultEmoji,
customEmojiStickerList:
widget
.customEmojiStickerList,
showAtBackground:
true,
)),
onChanged: (bool visibility) {
if (showKeyboard !=
visibility) {
setState(() {
showKeyboard = visibility;
});
}
}),
), ),
if (widget.forbiddenText == null) if (widget.forbiddenText == null)
const SizedBox( const SizedBox(
@ -682,6 +699,7 @@ class _TIMTextFieldLayoutNarrowState
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () async { onTap: () async {
if (isBlack) { if (isBlack) {
showOKToast("您已将对方拉黑,请移除黑名单后在发送消息~"); showOKToast("您已将对方拉黑,请移除黑名单后在发送消息~");
@ -701,7 +719,7 @@ class _TIMTextFieldLayoutNarrowState
}); });
} else { } else {
var data = var data =
await Permission.microphone.request(); await Permission.microphone.request();
if (data.isGranted) { if (data.isGranted) {
setState(() { setState(() {
showEmojiPanel = false; showEmojiPanel = false;
@ -723,7 +741,6 @@ class _TIMTextFieldLayoutNarrowState
), ),
), ),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
if (isBlack) { if (isBlack) {
showOKToast("您已将对方拉黑,请移除黑名单后在发送消息~"); showOKToast("您已将对方拉黑,请移除黑名单后在发送消息~");
@ -732,7 +749,7 @@ class _TIMTextFieldLayoutNarrowState
await getImageFile(); await getImageFile();
}, },
child: child:
Image.asset(getMsgImage('photo'), width: 40.sp), Image.asset(getMsgImage('photo'), width: 40.sp),
), ),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
@ -773,9 +790,9 @@ class _TIMTextFieldLayoutNarrowState
AnimatedContainer( AnimatedContainer(
duration: Duration( duration: Duration(
milliseconds: milliseconds:
(showKeyboard && PlatformUtils().isAndroid) (showKeyboard && PlatformUtils().isAndroid)
? 200 ? 200
: 340), : 340),
curve: Curves.fastOutSlowIn, curve: Curves.fastOutSlowIn,
height: max(_getBottomHeight(), 0.0), height: max(_getBottomHeight(), 0.0),
// child: ListView( // child: ListView(
@ -786,22 +803,6 @@ class _TIMTextFieldLayoutNarrowState
], ],
), ),
), ),
Positioned(
bottom: MediaQuery.of(context).padding.bottom + 20,
child: AnimatedContainer(
duration: Duration(
milliseconds: (showKeyboard && PlatformUtils().isAndroid)
? 200
: 340),
curve: Curves.fastOutSlowIn,
width: Get.width,
height: max(_getBottomHeight(), 0.0),
child: ListView(
physics: const NeverScrollableScrollPhysics(),
children: [_getBottomContainer()],
),
),
)
], ],
) )
], ],

View File

@ -0,0 +1,34 @@
import 'package:circle_app/app/circle/widgets/discover.dart';
import 'package:circle_app/components/my_app_bar.dart';
import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart';
class DiscoverPage extends StatefulWidget {
@override
_DiscoverPageState createState() => new _DiscoverPageState();
}
class _DiscoverPageState extends State<DiscoverPage> {
// TODO: add state variables and methods
@override
Widget build(BuildContext context) {
// TODO: add widget build method
return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(getBaseImage("bg")),
fit: BoxFit.cover,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: const MyAppBar(
centerTitle: '已解锁的圈友',
// actionWdiget: ,
),
body: Discover(1),
));
}
}

View File

@ -33,6 +33,7 @@ class CircleLogic extends GetxController {
int page = 1; int page = 1;
int vicinityPage = 1; int vicinityPage = 1;
int currentPage = 0;
bool isMore = true; bool isMore = true;
int myVip = 0; int myVip = 0;
@ -79,6 +80,13 @@ class CircleLogic extends GetxController {
List<MyConfigData> roleList = []; List<MyConfigData> roleList = [];
List<MyConfigData> dis_genderList = [];
List<MyConfigData> dis_orientationList = [];
List<MyConfigData> dis_roleList = [];
void initGerder() async { void initGerder() async {
var data1 = var data1 =
await DioManager.instance.get(url: Api.getCircleList, params: {}); await DioManager.instance.get(url: Api.getCircleList, params: {});
@ -89,13 +97,17 @@ class CircleLogic extends GetxController {
configBean.genderMap.forEach((key, value) { configBean.genderMap.forEach((key, value) {
genderList.add(MyConfigData(key, value, false)); genderList.add(MyConfigData(key, value, false));
dis_genderList.add(MyConfigData(key, value, false));
}); });
configBean.orientationMap.forEach((key, value) { configBean.orientationMap.forEach((key, value) {
orientationList.add(MyConfigData(key, value, false)); orientationList.add(MyConfigData(key, value, false));
dis_orientationList.add(MyConfigData(key, value, false));
}); });
configBean.roleMap.forEach((key, value) { configBean.roleMap.forEach((key, value) {
roleList.add(MyConfigData(key, value, false)); roleList.add(MyConfigData(key, value, false));
dis_roleList.add(MyConfigData(key, value, false));
}); });
} }

View File

@ -1,22 +1,21 @@
import 'dart:math'; import 'dart:math';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:circle_app/app/circle/widgets/discover.dart';
import 'package:circle_app/app/circle/widgets/info_list_view.dart'; import 'package:circle_app/app/circle/widgets/info_list_view.dart';
import 'package:circle_app/app/circle/widgets/vicinity.dart';
import 'package:circle_app/app/dialog/ScreenBottomSheetDialog.dart'; import 'package:circle_app/app/dialog/ScreenBottomSheetDialog.dart';
import 'package:circle_app/app/msg/view.dart';
import 'package:circle_app/common/Widgets/open_vip_tip/view.dart';
import 'package:circle_app/router/app_routers.dart'; import 'package:circle_app/router/app_routers.dart';
import 'package:circle_app/util/eventBus.dart';
import 'package:circle_app/util/util.dart'; import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_pickers/pickers.dart'; import 'package:flutter_pickers/pickers.dart';
import 'package:flutter_pickers/style/default_style.dart';
import 'package:flutter_pickers/style/picker_style.dart'; import 'package:flutter_pickers/style/picker_style.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../../util/eventBus.dart';
import '../select_circle/logic.dart'; import '../select_circle/logic.dart';
import '../userinfo/logic.dart'; import '../userinfo/logic.dart';
import 'logic.dart'; import 'logic.dart';
@ -32,7 +31,7 @@ class CirclePage extends StatefulWidget {
} }
class _CirclePageState extends State<CirclePage> class _CirclePageState extends State<CirclePage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
late TabController _tabController; late TabController _tabController;
late PageController _pageController; late PageController _pageController;
@ -42,8 +41,9 @@ class _CirclePageState extends State<CirclePage>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_pageController = PageController(); int initIndex = Random().nextInt(3);
_tabController = TabController(length: 1, vsync: this); _pageController = PageController(initialPage: initIndex);
_tabController = TabController(length: 3, vsync: this, initialIndex: initIndex);
_tabController.addListener(_handleTabChange); _tabController.addListener(_handleTabChange);
} }
@ -73,13 +73,10 @@ class _CirclePageState extends State<CirclePage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
getContext = context; getContext = context;
return GetBuilder<CircleLogic>(builder: (logic) return GetBuilder<CircleLogic>(builder: (logic) {
{
return Scaffold( return Scaffold(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: body: SafeArea(
SafeArea(
child: GetBuilder(builder: (CircleLogic controller) { child: GetBuilder(builder: (CircleLogic controller) {
return Stack( return Stack(
children: [ children: [
@ -100,35 +97,29 @@ class _CirclePageState extends State<CirclePage>
}, },
children: [ children: [
circleList(controller), circleList(controller),
// vicinityList(controller), Vicinity(controller),
Discover(0)
], ],
), ),
), ),
logic.isShowCircle _tabController.index == 0
? ? Positioned(
Positioned( bottom: 36.sp,
bottom: 36.sp, right: 10.sp,
right: 10.sp, child: GestureDetector(
child: GestureDetector( onTap: () async {
onTap: () async { List<MyConfigData> numbers = [];
List<MyConfigData> numbers = []; numbers.add(MyConfigData(
numbers.add(MyConfigData( logic.getCircleIndex().id.toString(),
logic logic.getCircleIndex().title!,
.getCircleIndex() false));
.id var data = await Get.toNamed(AppRoutes.Call_out,
.toString(), arguments: {'numbers': numbers});
logic },
.getCircleIndex() child: Image.asset(
.title!, getCircleImage('send_msg'),
false)); width: 60.sp,
var data = await Get.toNamed( )))
AppRoutes.Call_out,
arguments: {'numbers': numbers});
},
child: Image.asset(
getCircleImage('send_msg'),
width: 60.sp,
)))
: Center() : Center()
], ],
); );
@ -562,11 +553,11 @@ class _CirclePageState extends State<CirclePage>
infoList = statistics.lastVisitUsers; infoList = statistics.lastVisitUsers;
if (infoList.isNotEmpty) { if (infoList.isNotEmpty) {
for (var element in infoList) { for (var element in infoList) {
if(element["avatar"]!=null&&element["avatar"].contains("http")){ if (element["avatar"] != null && element["avatar"].contains("http")) {
urlList.add(element["avatar"]); urlList.add(element["avatar"]);
} }
// urlList.add(element["avatar"]); // urlList.add(element["avatar"]);
} }
} }
} }
@ -594,71 +585,84 @@ class _CirclePageState extends State<CirclePage>
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
// logic.isShowCircle _tabController.index == 0
// ? Positioned( ? Positioned(
// left: 0, left: 0,
// child: GestureDetector( child: GestureDetector(
// onTap: () { onTap: () {
// Get.toNamed(AppRoutes.Invite); Get.toNamed(AppRoutes.Invite);
// }, },
// child: Container( child: Container(
// decoration: BoxDecoration( decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(17.0), borderRadius: BorderRadius.circular(17.0),
// gradient: const LinearGradient( gradient: const LinearGradient(
// colors: [ colors: [
// Color(0xFF06F9FA), Color(0xFF06F9FA),
// Color(0xFFDC5BFD), Color(0xFFDC5BFD),
// ], ],
// ), ),
// color: const Color(0xFF392D53), color: const Color(0xFF392D53),
// ), ),
// child: Container( child: Container(
// margin: EdgeInsets.all(0.6.sp), margin: EdgeInsets.all(0.6.sp),
// decoration: BoxDecoration( decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(17.0), borderRadius: BorderRadius.circular(17.0),
// color: const Color(0xFF392D53), color: const Color(0xFF392D53),
// ), ),
// child: Padding( child: Padding(
// padding: EdgeInsets.only( padding: EdgeInsets.only(
// top: 5.sp, top: 5.sp,
// bottom: 4.sp, bottom: 4.sp,
// left: 8.sp, left: 8.sp,
// right: 8.sp, right: 8.sp,
// ), ),
// child: const Center( child: const Center(
// child: Text( child: Text(
// "邀请得会员", "邀请得会员",
// style: TextStyle( style: TextStyle(
// fontSize: 11, fontSize: 11,
// color: Colors.white, color: Colors.white,
// ), ),
// ), ),
// ), ),
// ), ),
// ), ),
// ), ),
// )) ))
// : _tabController.index == 1
// : GestureDetector( ? Positioned(
// onTap: () { left: 0,
// showCityPiker(context); child: GestureDetector(
// }, onTap: () {
// child: Row( showCityPiker(context);
// children: [ },
// Image.asset( child: Row(
// getCircleImage('icon_city'), children: [
// width: 24.sp, Image.asset(
// ), getCircleImage('icon_city'),
// Container( width: 24.sp,
// margin: EdgeInsets.only(left: 4.sp, top: 4.sp), ),
// child: Text( Container(
// modifyCityName(logic.cityName), margin: EdgeInsets.only(left: 4.sp, top: 4.sp),
// style: child: Text(
// TextStyle(color: Colors.white, fontSize: 16.sp), modifyCityName(logic.cityName),
// )) style: TextStyle(
// ], color: Colors.white, fontSize: 16.sp),
// ), ))
// ), ],
),
))
: Positioned(
left: 0,
child: GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.DisCover);
},
child: Image.asset(
getCircleImage('clocked_icon'),
width: 60.sp,
),
)),
Container( Container(
alignment: Alignment.center, alignment: Alignment.center,
//padding: EdgeInsets.symmetric(horizontal: 10.sp), //padding: EdgeInsets.symmetric(horizontal: 10.sp),
@ -674,17 +678,34 @@ class _CirclePageState extends State<CirclePage>
indicator: UnderlineTabIndicator( indicator: UnderlineTabIndicator(
borderSide: BorderSide( borderSide: BorderSide(
color: const Color(0xFF00FFF4), color: const Color(0xFF00FFF4),
width: 2.sp, width: 1.5.sp,
), ),
insets: EdgeInsets.symmetric(horizontal: 6.0.sp), insets: EdgeInsets.symmetric(horizontal: 6.0.sp),
borderRadius: BorderRadius.circular(18.0), borderRadius: BorderRadius.circular(18.0),
), ),
indicatorColor: const Color(0xFF00FFF4), indicatorColor: const Color(0xFF00FFF4),
indicatorWeight: 2.sp, indicatorWeight: 1.sp,
labelColor: const Color(0xFF00FFF4), labelColor: const Color(0xFF00FFF4),
unselectedLabelColor: const Color(0xB3FFFFFF), unselectedLabelColor: const Color(0xB3FFFFFF),
indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.label,
indicatorPadding: EdgeInsets.only(left: 6.sp, right: 6.sp),
tabs: [ tabs: [
Tab(
child: Text(
'圈子',
style: TextStyle(
fontSize: 18.sp,
),
),
),
Tab(
child: Text(
'附近',
style: TextStyle(
fontSize: 18.sp,
),
),
),
Tab( Tab(
child: Text( child: Text(
'发现', '发现',
@ -693,14 +714,6 @@ class _CirclePageState extends State<CirclePage>
), ),
), ),
), ),
// Tab(
// child: Text(
// '附近',
// style: TextStyle(
// fontSize: 18.sp,
// ),
// ),
// ),
], ],
labelStyle: TextStyle( labelStyle: TextStyle(
color: const Color(0xFF00FFF4), color: const Color(0xFF00FFF4),
@ -731,35 +744,18 @@ class _CirclePageState extends State<CirclePage>
duration: const Duration(milliseconds: 300), // duration: const Duration(milliseconds: 300), //
curve: Curves.ease, // 线 curve: Curves.ease, // 线
); );
if (index == 2) {
EventBusManager.fire(DiscovrScrollTap());
} else if (index == 1) {
EventBusManager.fire(NearScrollTap());
} else if (index == 0) {
EventBusManager.fire(ScrollToTop());
}
}, },
), ),
], ],
), ),
), ),
// ShaderMask(
// shaderCallback: (Rect bounds) {
// return const LinearGradient(
// begin: Alignment(0.0, -1.0),
// end: Alignment.bottomCenter,
// colors: [Color(0xff71F3F2), Color(0xffF657FF)],
// ).createShader(Offset.zero & bounds.size);
// },
// child: GestureDetector(
// onTap: (){
//
// },
// child: Text(
// '发现',
// style: TextStyle(
// fontSize: 18.sp,
// fontWeight: FontWeight.w600,
// color: Colors.white,
// shadows: const [Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1))],
// ),
// ),
// ),
// ),
Positioned( Positioned(
right: 0, right: 0,
child: logic.isShowCircle child: logic.isShowCircle
@ -793,11 +789,32 @@ class _CirclePageState extends State<CirclePage>
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (BuildContext context) { builder: (BuildContext context) {
return ScreenBottomSheetDialog( return ScreenBottomSheetDialog(
genderList: logic.genderList, genderList: _tabController.index == 1 ? logic.genderList : logic.dis_genderList,
orientationList: logic.orientationList, orientationList: _tabController.index == 1 ? logic.orientationList : logic.dis_orientationList,
roleList: logic.roleList, roleList: _tabController.index == 1 ? logic.roleList : logic.dis_roleList,
callback: (genderList, orientationList, roleList) { callback: (genderList, orientationList, roleList) {
_onRefresh(); if (_tabController.index == 1) {
_onRefresh();
} else {
List<String> genders = [];
logic.dis_genderList.forEach((element) {
if (element.isSelect) {
genders.add(element.id);
}
});
List<String> roles = [];
logic.dis_orientationList.forEach((element) {
if (element.isSelect) roles.add(element.id);
});
List<String> orientations = [];
logic.dis_roleList.forEach((element) {
if (element.isSelect) orientations.add(element.id);
});
EventBusManager.fire(OptionFindclass(genders,roles,orientations));
}
}, },
); // Use your custom widget here ); // Use your custom widget here
}, },
@ -1112,3 +1129,14 @@ class DefaultPickerStyle extends PickerStyle {
this.textColor = Colors.white; this.textColor = Colors.white;
} }
} }
class DiscovrScrollTap {}
class NearScrollTap {}
class CircleScrollTap {}
class OptionFindclass {
List<String>? genderList;List<String>? orientationList;List<String>? roleList;
OptionFindclass(this.genderList,this.orientationList,this.roleList);
}

View File

@ -0,0 +1,956 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:circle_app/app/circle/view.dart';
import 'package:circle_app/common/Widgets/genderview.dart';
import 'package:circle_app/common/colors/app_color.dart';
import 'package:circle_app/common/const.dart';
import 'package:circle_app/main.dart';
import 'package:circle_app/network/api.dart';
import 'package:circle_app/network/dio_manager.dart';
import 'package:circle_app/router/app_routers.dart';
import 'package:circle_app/util/SharedPreferencesHelper.dart';
import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../../../../util/eventBus.dart';
const String todayAddWxStatus = 'todayAddWxStatus';
class Discover extends StatefulWidget {
int unlockWxNum;
Discover(this.unlockWxNum, {super.key});
@override
_DiscoverState createState() => _DiscoverState();
}
class _DiscoverState extends State<Discover>
with AutomaticKeepAliveClientMixin {
// TODO: add state variables and methods
@override
bool get wantKeepAlive => true;
// TODO: add state variables and methods
ScrollController _scrollController = ScrollController();
RefreshController refreshController = RefreshController();
var refreshSignSub;
var sub;
var sub1;
var subscripition;
List list = [];
List giftList = [];
bool isMore = true;
int index = 1;
List tagList = [];
List<String> genderList = [];List<String> orientationList= [];List<String> roleList= [];
bool isPop = false;
//
Offset pointerStart = Offset.zero;
Offset pointerEnd = Offset.zero;
double touchRangeY = 0;
double nextOffset = 0;
int lastPage = 0;
double screenHeight = Get.height -
Get.bottomBarHeight -
Get.statusBarHeight -
((Get.height > 750 ? 115.sp : 155.sp) - Get.statusBarHeight);
void animateToOffset(ScrollController controller, double offset,
void Function() onScrollCompleted) {
controller
.animateTo(offset,
duration: const Duration(milliseconds: 200), curve: Curves.easeIn)
.then((value) {
if (onScrollCompleted != null) {
onScrollCompleted();
}
}).catchError((e) {
print(e);
});
}
//
//
PointerDownEventListener getPointDownListenerInHorizontal() {
return (event) {
pointerStart = event.position;
};
}
//
PointerUpEventListener getPointUpListenerInHorizontal() {
return (event) {
pointerEnd = event.position;
touchRangeY = pointerStart.dy - pointerEnd.dy;
if (touchRangeY.abs() < screenHeight / 3) {
// 1/8
nextOffset = (screenHeight + 10.sp) * lastPage;
animateToOffset(_scrollController, nextOffset, () {});
return;
}
if (touchRangeY < 0 && lastPage > 0) {
//
lastPage--;
animateToOffset(
_scrollController, lastPage * (screenHeight + 10.sp), () {});
} else if (touchRangeY > 0 && lastPage < list.length - 1) {
//
lastPage++;
animateToOffset(
_scrollController, lastPage * (screenHeight + 10.sp), () {});
if (lastPage == 3 && isPop == false && widget.unlockWxNum == 0) {
isPop = true;
//
checkIsPopWxTip();
}
}
};
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
if (widget.unlockWxNum == 0) {
subscripition.cancel();
}
sub.cancel();
sub1.cancel();
}
@override
void initState() {
// TODO: implement initState
super.initState();
loadData();
if (widget.unlockWxNum == 0) {
subscripition = EventBusManager.on<DiscoverDataRefresh>().listen((event) {
refreshData();
});
}
sub = EventBusManager.on<DiscovrScrollTap>().listen((event) {
_scrollController.animateTo(0,
duration: const Duration(milliseconds: 300), curve: Curves.easeInOut);
});
sub1 = EventBusManager.on<OptionFindclass>().listen((event) {
genderList = event.genderList!;
orientationList = event.orientationList!;
roleList = event.roleList!;
index = 1;
loadData();
});
refreshSignSub = EventBusManager.on<DiscoverDataRefresh>().listen((event) {
loadSignDiscoverData(event.userId);
});
}
setLike(String userId, bool isLike, Function callBack) async {
// if (isBlack || isDestroy) {
// showOKToast("喜欢失败,存在拉黑关系或者该账户已注销");
// return;
// }
var data = await DioManager.instance.post(
url: "${Api.setLike + userId}/follow",
params: {'status': isLike ? "0" : "1"});
var bean = BaseResponse<dynamic>.fromJson(
data,
(jsonData) => jsonData,
);
if (bean.isSuccess()) {
callBack();
}
showOKToast(bean.msg);
}
loadSignDiscoverData(String userId) async {
try {
var result = await DioManager.instance
.get(url: Api.getFindPageUserByUserId, params: {
'userId': userId,
'lat': '0',
'lng': '0',
});
int initIndex = 0;
list.forEach((element) {
if (element['id'].toString() == userId) {
initIndex = list.indexOf(element);
}
});
list[initIndex] = result['data'];
setState(() {});
} catch (e) {
}
}
loadGiftListData() async {
// var result = await DioManager.instance.get(url: Api.giftList);
// if (result['code'] == 10000) {
// giftList = result['data'];
// await loadData();
// setState(() {});
// }
}
loadData() async {
var data = await DioManager.instance.post(url: Api.findPage, params: {
'page': index,
'pageSize': 8,
'unlockWxNum': widget.unlockWxNum,
"genders": genderList,
"roles": roleList,
"orientations": orientationList,
'lat': '0',
'lng': '0',
});
//
if (data['code'] == 200) {
List dataList = data['data'];
if (dataList.isNotEmpty) {
if (index == 1) {
list = dataList;
refreshController.refreshCompleted();
} else {
list.addAll(dataList);
}
index = index + 1;
isMore = true;
refreshController.loadComplete();
} else {
isMore = false;
refreshController.loadNoData();
}
if (mounted) {
setState(() {});
}
}
}
void refreshData() {
index = 1;
loadData();
}
_onLoading() {
loadData();
}
@override
Widget build(BuildContext context) {
// TODO: add widget build method
return list.isEmpty
? isMore
? loaddingWidget(true)
: noResultWidget(tip: '已解锁微信的圈友会展示在这里哦~')
: Listener(
onPointerDown: getPointDownListenerInHorizontal(),
onPointerUp: getPointUpListenerInHorizontal(),
child: SmartRefresher(
onRefresh: refreshData,
controller: refreshController,
onLoading: _onLoading,
enablePullUp: true,
child: ListView.builder(
itemBuilder: (context, index) {
var user = Users.fromJson(list[index]);
String onLineStr = '';
if (user.online! ?? false) {
onLineStr = '当前在线';
if (user.distance != null) {
if (user.distance! < 100) {
onLineStr = '当前在线 · ${user.distance!}km';
}
}
} else {
if (user.distance != null) {
if ((user.distance! ?? 10) < 100) {
onLineStr = '${user.distance!}km';
}
}
}
return Container(
height: screenHeight,
width: Get.width,
margin: EdgeInsets.only(
top: 10.sp, left: 16.sp, right: 16.sp),
child: Stack(
children: [
Container(
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10.sp),
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage(
getCircleImage('open_vip_bg'),
))),
height: screenHeight,
width: Get.width,
child: ClipRRect(
borderRadius: BorderRadius.circular(18),
clipBehavior: Clip.hardEdge,
child: Container(
padding: EdgeInsets.all(2.sp),
child: Swiper(
autoplay:
user.images!.length == 1 ? false : true,
itemBuilder:
(BuildContext context, int index) {
// print(index);
return GestureDetector(
onTap: () {
List<String> imgList = [];
user.images!.forEach((element) {
imgList.add(element);
});
Get.toNamed(AppRoutes.Swiper,
arguments: {
'imaglist': imgList,
'index': index
});
},
child: CachedNetworkImage(
imageUrl: user.images![index],
fit: BoxFit.cover,
width: Get.width,
height: screenHeight,
));
},
itemCount: user.images!.length,
),
)),
),
Positioned(
left: 16.sp,
top: 20.sp,
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (user.both_cities!.isNotEmpty)
Row(
children: [
Container(
width: 6.sp,
height: 6.sp,
margin:
EdgeInsets.only(right: 4.sp),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(3.sp),
color: const Color(0xFFCE51FF),
),
),
// if (logic.online)
Text(
"你们都来过${user.both_cities!.first}",
style: TextStyle(
color: Colors.white,
fontSize: 14.sp),
),
],
),
if (user.both_cities!.isNotEmpty)
SizedBox(
height: 8.sp,
),
if (onLineStr.isNotEmpty)
Row(
children: [
Container(
width: 6.sp,
height: 6.sp,
margin:
EdgeInsets.only(right: 4.sp),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(3.sp),
color: const Color(0xFFCE51FF),
),
),
// if (logic.online)
Text(
onLineStr,
style: TextStyle(
color: Colors.white,
fontSize: 14.sp),
),
],
),
],
),
)),
Positioned(
right: 16.sp,
top: 16.sp,
child: GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.UserInfoActivity,
arguments: user.userId!.toString());
},
child: Container(
width: 73.sp,
height: 25.sp,
decoration: BoxDecoration(
gradient: AppColor.mainLinearGradient,
borderRadius:
BorderRadius.circular(12.5.sp)),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.only(left: 5.sp),
child: Text(
'查看主页',
style: TextStyle(
color: Colors.white,
fontSize: 10.sp,
),
),
),
Image(
width: 15.sp,
image: AssetImage(
getDisCoverImage("right_icon")),
// width: 44.sp,
),
],
),
),
)),
Positioned(
left: 6.sp,
bottom: 6.sp,
child: Container(
width: Get.width - 32.sp,
padding: EdgeInsets.only(right: 0.sp),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (user.wxNum != null)
wxStatusWidget(
user.unLockWxNum == 1,
user.wxNum!,
user.userId.toString(),
user.avatarUrl!, () {
loadSignDiscoverData(
user.userId.toString());
}),
SizedBox(
height: 10.sp,
),
Row(
children: [
Text(
user.nickname ?? '',
style: TextStyle(
fontSize: 18.sp,
color: Color(0XFFF7FAFA),
fontWeight: FontWeight.bold),
),
Container(
margin: EdgeInsets.only(left: 5.sp),
alignment: Alignment.center,
height: 18.sp,
padding: EdgeInsets.only(
left: 6.sp, right: 6.sp),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(9.sp),
gradient: const LinearGradient(
begin: Alignment(0.25, 0.5),
end: Alignment(0.75, 0.5),
colors: [
Color(0xff8DFFF8),
Color(0xffB5D3FF)
])),
child: Text(
getAgeCOntent(
user!.gender ?? 0,
user!.age ?? 0,
user!.role ?? 0,
user!.orientation ?? 0),
style: TextStyle(
color: Colors.black,
fontSize: 12.sp,
),
),
),
if (user.vip! > 0)
Container(
margin: EdgeInsets.only(
left: 4.sp,
),
child: Image.asset(
getCircleImage(user!.vip == 1
? 'vip'
: 'year_vip'),
width: 36.sp,
),
),
],
),
Container(
width: Get.width - 120.sp,
margin: EdgeInsets.only(top: 5.sp),
child: Text(
user.signature! ?? '',
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 15.sp,
color: const Color(0XFFF7FAFA)),
),
),
Container(
width: Get.width - 110.sp,
height: 35.sp,
child: tagItem(user.interests!),
),
],
),
)),
Positioned(
bottom: 5.sp,
right: 15.sp,
child: Container(
child: Column(
children: [
GestureDetector(
onTap: () {
pushChatPage(
user.userId.toString(),
user.imAccid!.toString(),
user.nickname!);
},
child: Image.asset(
getCircleImage(
'chat_icon',
),
width: 40.sp,
),
),
SizedBox(
height: 8.sp,
),
GestureDetector(
onTap: () {
setLike(user.userId!.toString(),
user.is_follow!, () {
list[index]['is_follow'] =
!user.is_follow!;
setState(() {});
});
},
child: Image.asset(
getCircleImage(
user.is_follow!
? 'like_icon'
: 'nor_like_icon',
),
width: 40.sp,
),
),
GestureDetector(
onTap: () {
sendNoLookData(user.userId!,index);
},
child: Image.asset(
getCircleImage(
'no_look_icon',
),
width: 40.sp,
),
)
],
),
))
],
));
},
itemCount: list.length,
physics: BouncingScrollPhysics(),
controller: _scrollController,
),
),
);
}
tagItem(List item) {
return Container(
width: Get.width,
margin: EdgeInsets.only(top: 5.sp, bottom: 5.sp),
// color: Colors.red,
// height: 45.sp,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: item.length,
itemBuilder: (context, index) {
return tagWidget(item[index]['title'], item[index]['id']);
}),
);
}
tagWidget(String tagName, int id) {
return GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.Signal_circle_list, arguments: id);
},
child: Container(
margin: EdgeInsets.only(right: 6.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17.0),
gradient: const LinearGradient(
colors: [
Color(0xFF06F9FA),
Color(0xFFDC5BFD),
],
),
color: const Color(0xFF392D53),
),
child: Container(
margin: EdgeInsets.all(0.2.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17.0),
color: const Color(0xFF392D53),
),
child: Padding(
padding: EdgeInsets.only(
top: 2.sp,
bottom: 2.sp,
left: 10.sp,
right: 10.sp,
),
child: Center(
child: Text(
tagName,
style: const TextStyle(
fontSize: 11.0,
color: Colors.white,
),
),
),
),
),
),
);
}
addWxPicker() {
return Get.bottomSheet(
Container(),
isScrollControlled: false,
enableDrag: false,
);
}
void checkIsPopWxTip() async {
SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance();
var date = DateTime.now();
final dateFormat = DateFormat("yyyy-MM-dd");
final date2 = dateFormat.format(date);
if (sp.preferences!.containsKey(todayAddWxStatus)) {
var lastDate = sp.preferences!.getString(todayAddWxStatus);
if (lastDate != date2) {
loadWxNumData();
sp.preferences!.setString(todayAddWxStatus, date2);
}
} else {
sp.preferences!.setString(todayAddWxStatus, date2);
loadWxNumData();
}
}
loadWxNumData() async {
// var data = await DioManager.instance.post(url: Api.myMainPage);
//
// if (data['code'] == 10000) {
// if (data['userBase']['wxNum'] == null) {
// showAddWxPicker(false);
// } else if (data['userBase']['wxNum'].toString().isEmpty) {
// showAddWxPicker(false);
// }
//
// }
}
void sendNoLookData(int userId,int index) async {
var data = await DioManager.instance.post(url: Api.uninterested + userId.toString());
if (data['code'] == 200) {
list.removeAt(index);
setState(() {
});
}
}
}
class DiscoverDataRefresh {
String userId;
DiscoverDataRefresh(this.userId);
}
class Users {
int? age;
bool? auth;
String? avatarUrl;
String? bgPicUrl;
String? birthday;
bool? blacklist;
String? city;
double? distance;
bool? dust;
String? email;
bool? followBag;
int? followStatus;
int? gender;
String? genderName;
String? heartbeatValue;
int? height;
int? hugCount;
String? imAccid;
List? images;
List? interests;
String? inviteCode;
int? kyNum;
String? lastLoginLog;
String? lastLoginTime;
int? level;
List? litGifts;
int? lvType;
MapUserJumpAo? mapUserJumpAo;
String? nickname;
String? nicknameNote;
bool? online;
String? openId;
bool? partner;
bool? is_follow;
String? phoneNum;
int? popularityValue;
bool? realPersonAuth;
int? relationshipStatus;
String? signature;
bool? specialConcern;
int? storyCount;
List? tags;
int? touchTime;
int? unLockWxNum;
int? userId;
int? weight;
int? orientation;
int? role;
int? vip;
String? wxNum;
List? both_cities;
Users(
{this.age,
this.auth,
this.avatarUrl,
this.bgPicUrl,
this.birthday,
this.blacklist,
this.city,
this.distance,
this.dust,
this.email,
this.is_follow,
this.vip,
this.followBag,
this.followStatus,
this.gender,
this.genderName,
this.heartbeatValue,
this.height,
this.hugCount,
this.imAccid,
this.role,
this.images,
this.interests,
this.inviteCode,
this.kyNum,
this.lastLoginLog,
this.lastLoginTime,
this.level,
this.litGifts,
this.lvType,
this.mapUserJumpAo,
this.nickname,
this.nicknameNote,
this.online,
this.openId,
this.partner,
this.phoneNum,
this.popularityValue,
this.realPersonAuth,
this.relationshipStatus,
this.signature,
this.specialConcern,
this.storyCount,
this.tags,
this.touchTime,
this.unLockWxNum,
this.both_cities,
this.userId,
this.orientation,
this.weight,
this.wxNum});
Users.fromJson(Map<String, dynamic> json) {
age = json['age'];
vip = json['vip'];
role = json['role'];
auth = json['auth'];
both_cities = json['both_cities'] ?? [];
is_follow = json['is_follow'];
interests = json['interests'];
avatarUrl = json['avatar'];
bgPicUrl = json['bgPicUrl'];
birthday = json['birthday'];
blacklist = json['blacklist'];
city = json['city'];
orientation = json['orientation'];
distance = json['distance'];
dust = json['dust'];
email = json['email'];
followBag = json['followBag'];
followStatus = json['followStatus'];
gender = json['gender'];
genderName = json['genderName'];
heartbeatValue = json['heartbeatValue'].toString();
height = json['height'];
hugCount = json['hugCount'];
imAccid = json['account_id'];
images = json['images'];
inviteCode = json['inviteCode'];
kyNum = json['kyNum'];
lastLoginLog = json['lastLoginLog'];
lastLoginTime = json['lastLoginTime'];
level = json['level'];
litGifts = json['litGifts'];
lvType = json['lvType'];
mapUserJumpAo = json['mapUserJumpAo'] != null
? new MapUserJumpAo.fromJson(json['mapUserJumpAo'])
: null;
nickname = json['nickname'];
nicknameNote = json['nicknameNote'];
online = json['isOnline'];
openId = json['openId'];
partner = json['partner'];
phoneNum = json['phoneNum'];
popularityValue = json['popularityValue'];
realPersonAuth = json['realPersonAuth'];
relationshipStatus = json['relationshipStatus'];
signature = json['signature'];
specialConcern = json['specialConcern'];
storyCount = json['storyCount'];
tags = json['tags'];
touchTime = json['touchTime'];
unLockWxNum = json['unLockWxNum'];
userId = json['id'];
weight = json['weight'];
wxNum = json['wx_num'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['age'] = this.age;
data['auth'] = this.auth;
data['avatarUrl'] = this.avatarUrl;
data['bgPicUrl'] = this.bgPicUrl;
data['birthday'] = this.birthday;
data['blacklist'] = this.blacklist;
data['city'] = this.city;
data['distance'] = this.distance;
data['dust'] = this.dust;
data['email'] = this.email;
data['followBag'] = this.followBag;
data['followStatus'] = this.followStatus;
data['gender'] = this.gender;
data['genderName'] = this.genderName;
data['heartbeatValue'] = this.heartbeatValue;
data['height'] = this.height;
data['hugCount'] = this.hugCount;
data['imAccid'] = this.imAccid;
if (this.images != null) {
data['images'] = this.images!.map((v) => v.toJson()).toList();
}
data['inviteCode'] = this.inviteCode;
data['kyNum'] = this.kyNum;
data['lastLoginLog'] = this.lastLoginLog;
data['lastLoginTime'] = this.lastLoginTime;
data['level'] = this.level;
if (this.litGifts != null) {
data['litGifts'] = this.litGifts!.map((v) => v.toJson()).toList();
}
data['lvType'] = this.lvType;
if (this.mapUserJumpAo != null) {
data['mapUserJumpAo'] = this.mapUserJumpAo!.toJson();
}
data['nickname'] = this.nickname;
data['nicknameNote'] = this.nicknameNote;
data['online'] = this.online;
data['openId'] = this.openId;
data['partner'] = this.partner;
data['phoneNum'] = this.phoneNum;
data['popularityValue'] = this.popularityValue;
data['realPersonAuth'] = this.realPersonAuth;
data['relationshipStatus'] = this.relationshipStatus;
data['signature'] = this.signature;
data['specialConcern'] = this.specialConcern;
data['storyCount'] = this.storyCount;
if (this.tags != null) {
data['tags'] = this.tags!.map((v) => v.toJson()).toList();
}
data['touchTime'] = this.touchTime;
data['unLockWxNum'] = this.unLockWxNum;
data['userId'] = this.userId;
data['weight'] = this.weight;
data['wxNum'] = this.wxNum;
return data;
}
}
class MapUserJumpAo {
int? id;
String? roomId;
String? title;
int? type;
MapUserJumpAo({this.id, this.roomId, this.title, this.type});
MapUserJumpAo.fromJson(Map<String, dynamic> json) {
id = json['id'];
roomId = json['roomId'];
title = json['title'];
type = json['type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['roomId'] = this.roomId;
data['title'] = this.title;
data['type'] = this.type;
return data;
}
}
class msgPageRefresh {}

View File

@ -100,11 +100,14 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
scroToTop = EventBusManager.on<ScrollToTop>().listen((event) { scroToTop = EventBusManager.on<ScrollToTop>().listen((event) {
scrollController.animateTo( if (widget.logic.state.index == widget.index) {
0.0, scrollController.animateTo(
duration: Duration(milliseconds: 300), 0.0,
curve: Curves.easeInOut, duration: Duration(milliseconds: 300),
); curve: Curves.easeInOut,
);
}
}); });
// widget.back(widget.createState()); // widget.back(widget.createState());

View File

@ -0,0 +1,469 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:circle_app/app/circle/logic.dart';
import 'package:circle_app/app/circle/view.dart';
import 'package:circle_app/app/circle/widgets/info_list_view.dart';
import 'package:circle_app/app/userinfo/logic.dart';
import 'package:circle_app/router/app_routers.dart';
import 'package:circle_app/util/eventBus.dart';
import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
class Vicinity extends StatefulWidget {
CircleLogic logic;
// TODO: add state variables, methods and constructor params
Vicinity(this.logic);
@override
State<Vicinity> createState() => _VicinityState();
}
class _VicinityState extends State<Vicinity> with AutomaticKeepAliveClientMixin {
var sub;
ScrollController _scrollController = ScrollController();
@override
void initState() {
// TODO: implement initState
super.initState();
sub = EventBusManager.on<NearScrollTap>().listen((event) {
_scrollController.animateTo(0,
duration: const Duration(milliseconds: 300), curve: Curves.easeInOut);
});
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
_scrollController.dispose();
sub.cancel();
}
@override
Widget build(BuildContext context) {
// TODO: add widget build method
return widget.logic.vicinityList.isNotEmpty ? SmartRefresher(
controller: widget.logic.refreshController,
onRefresh: _onRefresh,
onLoading: _onLoading,
enablePullUp: widget.logic.myVip > 0,
child: ListView.builder(
controller: _scrollController,
padding: EdgeInsets.all(10.sp),
itemCount: widget.logic.myVip == 0
? widget.logic.vicinityList.length + 2
: widget.logic.vicinityList.length + 1,
itemBuilder: (context, index) {
if (index == 0) {
return bannerView(widget.logic);
} else {
if (widget.logic.myVip == 0 && index == widget.logic.vicinityList.length + 1) {
return showVipView();
} else {
return ListItem(widget.logic.vicinityList[index - 1], index - 1);
}
}
},
),
) : loaddingWidget(true);
}
Widget bannerView(CircleLogic controller) {
return SizedBox(
height: 160.sp,
// margin: EdgeInsets.symmetric(horizontal: 16.sp),
child: Swiper(
autoplay: widget.logic.bannerList.length > 1,
controller: widget.logic.swiperController,
autoplayDelay: 6000,
loop: widget.logic.bannerList.length > 1 ? true : false,
// index:logic.index,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () async {
// print(logic.bannerList[index].param);
navigateToCustomRoute(widget.logic.bannerList[index]);
},
child: SizedBox(
width: Get.width,
child: ClipRRect(
borderRadius: BorderRadius.circular(15.sp),
child: CachedNetworkImage(
imageUrl: widget.logic.bannerList[index].picUrl,
fit: BoxFit.fill,
width: Get.width,
),
)),
);
},
itemCount: widget.logic.bannerList.length,
pagination: SwiperPagination(
margin: EdgeInsets.all(5.0.sp), //
alignment: Alignment.bottomCenter,
builder: DotSwiperPaginationBuilder(
color: Color(0x00FFFFFF), //
activeColor: widget.logic.bannerList.length == 1
? Color(0x00FFFFFF)
: Color(0x00FFFFFF), //
),
),
// control: new SwiperControl(), //,线
),
);
}
Widget circleList(CircleLogic controller) {
return Swiper(
itemBuilder: (BuildContext context, int index) {
var bean = widget.logic.circle.lists[index];
// final GlobalKey<InfoListViewState> infoListViewKey = GlobalKey<InfoListViewState>();
return InfoListView(index, bean, widget.logic);
},
onIndexChanged: (index) {
controller.state.index = index;
if (index == widget.logic.circle.lists.length - 1) {
widget.logic.loadMore();
}
print(index.toString());
},
index: controller.state.index,
itemCount: widget.logic.circle.lists.length,
viewportFraction: 0.93,
// scale: 0.9,
loop: false,
// key: UniqueKey(),
// pagination: new SwiperPagination(),//
// control: new SwiperControl(),//
);
}
Widget showVipView() {
return Container(
margin: EdgeInsets.only(top: 10.sp),
color: const Color(0xB30B011B),
padding: EdgeInsets.symmetric(vertical: 14.sp, horizontal: 20.sp),
child: Column(
children: [
Center(
child: Text(
"VIP特权",
style: TextStyle(color: Colors.white, fontSize: 16.sp),
),
),
Container(
padding: EdgeInsets.only(top: 18.sp),
child: Text(
"开通VIP后才能查看更多附近的圈友也可以根据您的喜好、属性、角色、取向等筛选出想要认识的人还可以获得其他十几种会员特权拥有更多不一样的体验",
style: TextStyle(color: Colors.white, fontSize: 12.sp),
),
),
GestureDetector(
onTap: () async {
widget.logic.showRechargeDialog();
},
child: Center(
child: Container(
margin: EdgeInsets.only(top: 14.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17),
gradient: const LinearGradient(
colors: [
Color(0xFF06F9FA),
Color(0xFFDC5BFD),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.sp,
horizontal: 55.sp,
),
child: const Text(
"前往开通VIP",
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
),
))
],
));
}
Widget ListItem(VicinityItemBean item, int index) {
return GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.id.toString());
},
child: Container(
margin: EdgeInsets.only(top: 10.sp),
// padding: EdgeInsets.only( left: 8.sp, right: 8.sp),
width: Get.width,
height: 200.sp,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage(
getCircleImage('pic_bg'),
))),
child: Stack(
children: [
Container(
margin: EdgeInsets.only(top: 1.sp, left: 1.sp, right: 1.sp),
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10.sp),
topRight: Radius.circular(10.sp),
),
child: item.images.length == 0
? Image(
image: AssetImage(getCircleImage("icon_list_null")),
width: Get.width,
fit: BoxFit.fill,
height: 92.sp,
)
: Container(),
),
),
Column(children: [
Container(
margin: EdgeInsets.only(right: 2.sp),
child: Row(
children: [
Container(
margin: EdgeInsets.only(top: 6.sp, left: 8.sp),
width: 88.sp,
height: 88.sp,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.0),
gradient: const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xFF71F3F2),
Color(0xFFF558FF),
],
stops: [0.0365, 0.9427],
),
),
padding: EdgeInsets.all(2.sp),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: Image.network(item.avatarThumb,
width: 88.sp, height: 88.sp, fit: BoxFit.cover),
),
),
Expanded(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Container(
margin: EdgeInsets.only(top: 6.sp),
child: Row(
children: [
for (int i = 0; i < item.images.length; i++)
GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.Swiper,
arguments: {
'imaglist': item.images,
'index': i
});
},
child: ListAlbumItem(item.images[i], i)),
],
),
),
),
),
],
),
),
Container(
margin: EdgeInsets.only(top: 6.sp, left: 9.sp),
child: Row(
children: [
Text(
item.nickname,
style: TextStyle(
fontWeight: FontWeight.bold,
color: const Color.fromRGBO(247, 250, 250, 1.0),
fontSize: 16.sp,
),
),
SizedBox(width: 8.sp),
_buildInfoRow(item),
const Spacer(),
Container(
margin: EdgeInsets.only(right: 8.sp),
child: Text(
item.onlineFlag.toString(),
style: TextStyle(
color: const Color.fromRGBO(247, 250, 250, 1.0),
fontSize: 12.sp,
),
)),
],
),
),
Container(
height: 50.sp, //
width: Get.width,
margin: EdgeInsets.symmetric(horizontal: 8.0),
child: Align(
alignment: Alignment.centerLeft, //
child: Text(
item.signature,
maxLines: 2,
style: TextStyle(color: Colors.white, fontSize: 14.sp),
overflow: TextOverflow.ellipsis,
),
),
),
Container(
margin: EdgeInsets.only(left: 8.sp, right: 3.sp),
child: _buildInterestsListView(item.interests))
]),
],
)),
);
}
Widget ListAlbumItem(String item, int index) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 2.sp),
child: CachedNetworkImage(
width: 88.sp,
height: 88.sp,
fit: BoxFit.cover,
imageUrl: item + "?imageView2/1/w/176/h/176/q/75",
),
);
}
Widget _buildInfoRow(VicinityItemBean item) {
String ageMsg =
getAgeCOntent(item!.gender, item!.age, item!.role, item!.orientation);
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(
ageMsg,
style: const TextStyle(
color: Colors.black,
fontSize: 10,
),
),
),
const SizedBox(width: 6),
if (item.vip > 0)
Image(
image: AssetImage(getBaseImage(item.vip == 1 ? "vip" : 'year_vip')),
width: 44.sp,
height: 18.sp,
),
],
);
}
Widget _buildInterestsListView(List<Interest> interests) {
return Align(
alignment: Alignment.centerLeft,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
for (int index = 0; index < interests.length; index++)
GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.Signal_circle_list,
arguments: interests[index].id);
},
child: Container(
margin: EdgeInsets.only(right: 11.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17.0),
gradient: const LinearGradient(
colors: [
Color(0xFF06F9FA),
Color(0xFFDC5BFD),
],
),
color: const Color(0xFF392D53),
),
child: Container(
margin: EdgeInsets.all(0.2.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17.0),
color: const Color(0xFF392D53),
),
child: Padding(
padding: EdgeInsets.only(
top: 2.sp,
bottom: 2.sp,
left: 15.sp,
right: 15.sp,
),
child: Center(
child: Text(
interests[index].title,
style: const TextStyle(
fontSize: 13.0,
color: Colors.white,
),
),
),
),
),
),
),
],
),
),
);
}
void _onRefresh() async {
widget.logic.vicinityPage = 1;
widget.logic.offset = 0;
widget.logic.getNearByList();
// logic.refreshController.refreshCompleted();
}
void _onLoading() async {
if (widget.logic.myVip > 0) {
widget.logic.vicinityPage = widget.logic.vicinityPage + 1;
// logic.offset = 0;
//
widget.logic.getNearByList();
} else {
widget.logic.refreshController.loadComplete();
}
}
@override
// TODO: implement wantKeepAlive
bool get wantKeepAlive => true;
}

View File

@ -32,6 +32,8 @@ class Complete_materialLogic extends GetxController {
var quToken = ''; var quToken = '';
var headUrl = ''; var headUrl = '';
int unLockWxNum = 0;
late ConfigBean configBean; late ConfigBean configBean;
List<MyConfigData> numbers = []; List<MyConfigData> numbers = [];
@ -51,7 +53,10 @@ class Complete_materialLogic extends GetxController {
var bean = BaseResponse<ResponseBean>.fromJson( var bean = BaseResponse<ResponseBean>.fromJson(
data, (data) => ResponseBean.fromJson(data)); data, (data) => ResponseBean.fromJson(data));
if(bean.isSuccess()){ if(bean.isSuccess()){
unLockWxNum = bean.data.unLockWxNum;
userInfoBean = bean.data.user; userInfoBean = bean.data.user;
state.wxEditingController.text = userInfoBean!.wx_num ;
state.nickName = userInfoBean!.nickname; state.nickName = userInfoBean!.nickname;
state.sex = getGenderContent(userInfoBean!.gender); state.sex = getGenderContent(userInfoBean!.gender);
state.genderId = userInfoBean!.gender.toString(); state.genderId = userInfoBean!.gender.toString();
@ -225,6 +230,26 @@ class Complete_materialLogic extends GetxController {
showOKToast('请上传头像'); showOKToast('请上传头像');
return; return;
} }
if (state.wxEditingController.text.isNotEmpty) {
bool isPass = false;
if (state.wxEditingController.text.length == 11) {
RegExp exp = RegExp(
r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$');
isPass = exp.hasMatch(state.wxEditingController.text);
}
if (state.wxEditingController.text.isNotEmpty && !isPass) {
RegExp wxReg = RegExp(r'^[a-zA-Z][-_a-zA-Z0-9]{5,19}$');
if (!wxReg.hasMatch(state.wxEditingController.text)) {
showOKToast('请输入正确的微信号');
return;
}
}
var result = await DioManager().post(url: Api.updateWxNum,params: {'type':2,'wxNum':state.wxEditingController.text});
print(result);
}
//TODO //TODO
// LatLng location = await getLocation(); // LatLng location = await getLocation();
List<String> interestsList = []; List<String> interestsList = [];

View File

@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
class Complete_materialState { class Complete_materialState {
TextEditingController textEditingController = TextEditingController(); TextEditingController textEditingController = TextEditingController();
TextEditingController wxEditingController = TextEditingController();
TextEditingController descEditingController = TextEditingController(); TextEditingController descEditingController = TextEditingController();
String nickName = ''; String nickName = '';
String sex = ''; String sex = '';

View File

@ -111,6 +111,33 @@ class Complete_materialPage extends StatelessWidget {
), ),
() {}, () {},
img: 'edit'), img: 'edit'),
if (Get.arguments == 'user')
funcWidget(
'微信',
TextField(
controller: controller.state.wxEditingController,
maxLength: 19,
inputFormatters: [
FilteringTextInputFormatter.deny(
RegExp("[^-_a-zA-Z0-9]")),
],
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w500,
fontSize: 14.sp),
decoration: InputDecoration(
counterText:'',
hintText: '请输入微信号',
hintStyle: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w500,
fontSize: 14.sp),
border: InputBorder.none,
),
),
() {},
img: 'edit'),
funcWidget( funcWidget(
'属性', '属性',
Text( Text(

View File

@ -68,8 +68,10 @@ class LoginLogic extends GetxController {
showOKToast('发送成功!'); showOKToast('发送成功!');
if (kDebugMode) { if (kDebugMode) {
//print("验证码:${bean.data!.code}"); //print("验证码:${bean.data!.code}");
// codeEditingController.text = bean.data!.code.toString(); if (bean.data!.code != null) {
// update(); codeEditingController.text = bean.data!.code.toString();
update();
}
} }
t = Timer.periodic(const Duration(milliseconds: 1000), (timer) { t = Timer.periodic(const Duration(milliseconds: 1000), (timer) {

View File

@ -42,6 +42,8 @@ class UserinfoLogic extends GetxController {
bool isBlack = false; bool isBlack = false;
bool isBlackBeen = false; bool isBlackBeen = false;
bool isDestroy = false; bool isDestroy = false;
int unLockWxNum = 0;
final startTime = DateTime.now(); final startTime = DateTime.now();
SharedPreferences? sharedPreferences; SharedPreferences? sharedPreferences;
@override @override
@ -111,7 +113,7 @@ class UserinfoLogic extends GetxController {
if (bean.isSuccess()) { if (bean.isSuccess()) {
isMe = userId.isEmpty; isMe = userId.isEmpty;
isLike = bean.data.isFollow; isLike = bean.data.isFollow;
unLockWxNum = bean.data.unLockWxNum;
isLikeFoMsg = isLikeFoMsg =
"${bean.data.likeMeCount}位圈友感兴趣,其中${bean.data.imageUrgeCount}位已催您更新"; "${bean.data.likeMeCount}位圈友感兴趣,其中${bean.data.imageUrgeCount}位已催您更新";
userInfoBean = bean.data.user; userInfoBean = bean.data.user;
@ -322,6 +324,7 @@ class UserBean {
String nickname; String nickname;
String avatar; String avatar;
String birthday; String birthday;
String wx_num;
int age; int age;
String signature; String signature;
int vip; int vip;
@ -340,6 +343,7 @@ class UserBean {
required this.id, required this.id,
required this.nickname, required this.nickname,
required this.avatar, required this.avatar,
required this.wx_num,
required this.birthday, required this.birthday,
required this.age, required this.age,
required this.signature, required this.signature,
@ -359,6 +363,7 @@ class UserBean {
factory UserBean.fromJson(Map<String, dynamic> json) { factory UserBean.fromJson(Map<String, dynamic> json) {
return UserBean( return UserBean(
id: json['id'], id: json['id'],
wx_num: json['wx_num'] ?? '',
nickname: json['nickname'], nickname: json['nickname'],
avatar: json['avatar'], avatar: json['avatar'],
birthday: json['birthday'], birthday: json['birthday'],
@ -404,6 +409,7 @@ class ResponseBean {
UserBean user; UserBean user;
int likeMeCount; int likeMeCount;
int imageUrgeCount; int imageUrgeCount;
int unLockWxNum;
bool isFollow; bool isFollow;
bool isBlock; bool isBlock;
bool isDestroy; bool isDestroy;
@ -413,6 +419,7 @@ class ResponseBean {
{required this.user, {required this.user,
required this.likeMeCount, required this.likeMeCount,
required this.imageUrgeCount, required this.imageUrgeCount,
required this.unLockWxNum,
required this.accountId, required this.accountId,
required this.isBlock, required this.isBlock,
required this.isDestroy, required this.isDestroy,
@ -421,6 +428,7 @@ class ResponseBean {
factory ResponseBean.fromJson(Map<String, dynamic> json) { factory ResponseBean.fromJson(Map<String, dynamic> json) {
return ResponseBean( return ResponseBean(
accountId: json['account_id'], accountId: json['account_id'],
unLockWxNum : json['unLockWxNum'],
user: UserBean.fromJson(json['user']), user: UserBean.fromJson(json['user']),
likeMeCount: json['like_me_count'], likeMeCount: json['like_me_count'],
imageUrgeCount: json['image_urge_count'], imageUrgeCount: json['image_urge_count'],

View File

@ -1,5 +1,8 @@
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:circle_app/app/userinfo/widgets/home_call_out.dart'; import 'package:circle_app/app/userinfo/widgets/home_call_out.dart';
import 'package:circle_app/common/Widgets/base_tip_widget.dart';
import 'package:circle_app/common/colors/app_color.dart';
import 'package:circle_app/common/const.dart';
import 'package:circle_app/main.dart'; import 'package:circle_app/main.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -78,6 +81,60 @@ class MyTabbedScreenState extends State<UserinfoPage>
centerTitle: logic.userInfoBean != null centerTitle: logic.userInfoBean != null
? "${logic.userInfoBean!.nickname}的主页" ? "${logic.userInfoBean!.nickname}的主页"
: "个人主页", : "个人主页",
actionWdiget: logic.isMe ? GestureDetector(
onTap: () {
showAddWxPicker(logic.userInfoBean!.wx_num!.isNotEmpty ?? false);
},
child:Stack(
alignment: Alignment.center,
children: [
Container(
width: 90.sp,
height: 24.sp,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.sp),
gradient: LinearGradient(
colors: [ Color(0xFF30FFD9),Color(0xFFDD3DF4)],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
),
Container(
width: 88.sp,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(11.sp),
color: Color(0xFF240F3B)
),
alignment: Alignment.center,
height: 22.sp,
child: Text(
'填写微信号',
style: TextStyle(
color: Colors.white, fontSize: 12.sp),
),
)
],
),
// Container(
// alignment: Alignment.center,
// // width: 90.sp,
// height: 24.sp,
// padding:
// EdgeInsets.only(left: 6.sp, right: 6.sp),
// decoration: BoxDecoration(
// color: AppColor.mainColor,
// borderRadius:
// BorderRadiusDirectional.circular(
// 11.sp)),
// child: Text(
// '填写微信号',
// style: TextStyle(
// color: Colors.white, fontSize: 13.sp),
// ),
// ),
) : Container()
), ),
body: Stack( body: Stack(
children: [ children: [
@ -327,7 +384,21 @@ class MyTabbedScreenState extends State<UserinfoPage>
? Container() ? Container()
: _buildInterestsListView(interests), : _buildInterestsListView(interests),
), ),
if (!logic.isMe)
logic.userInfoBean != null ? logic.userInfoBean!.wx_num!.isNotEmpty ? Container(
alignment: Alignment.centerLeft,
// width: 200.sp,
// color: Colors.red,
margin: EdgeInsets.only(left: 20.sp,bottom: 15.sp),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
wxStatusWidget(logic.unLockWxNum == 1,logic.userInfoBean!.wx_num, logic.userInfoBean!.id.toString(),logic.userInfoBean!.avatar!, (){}),
],
)) : Container() : Container(),
titleTab(controller), titleTab(controller),
Expanded( Expanded(
child: PageView( child: PageView(
controller: _pageController, controller: _pageController,
@ -469,6 +540,7 @@ class MyTabbedScreenState extends State<UserinfoPage>
child: Visibility( child: Visibility(
// visible: logic.isShowAlbum, // visible: logic.isShowAlbum,
child: Container( child: Container(
margin: EdgeInsets.only(left: 10.sp),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17), borderRadius: BorderRadius.circular(17),
gradient: const LinearGradient( gradient: const LinearGradient(

View File

@ -0,0 +1,199 @@
import 'package:circle_app/common/colors/app_color.dart';
import 'package:circle_app/network/api.dart';
import 'package:circle_app/network/dio_manager.dart';
import 'package:circle_app/router/app_routers.dart';
import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
class AddWxTip extends StatefulWidget {
bool isHaveWx;
// TODO: add state variables, methods and constructor params
AddWxTip(this.isHaveWx);
@override
State<AddWxTip> createState() => _AddWxTipState();
}
class _AddWxTipState extends State<AddWxTip> {
bool isAuth = false;
String desc = '';
String tip = '';
String title = '';
@override
void initState() {
// TODO: implement initState
super.initState();
loadData();
}
@override
Widget build(BuildContext context) {
// TODO: add widget build method
return Scaffold(
backgroundColor: Colors.transparent,
body: Center(
child: Container(
margin: EdgeInsets.only(left: 15.sp, right: 15.sp),
height: Get.height * 0.65,
child: Column(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
color: Color(0x99000000),
image: DecorationImage(
image: AssetImage(getHomeImage("wx_tip_bg")),
fit: BoxFit.fill,
),
),
child: Container(
color: Color(0x99000000).withOpacity(0.4),
padding: EdgeInsets.all(6.sp),
child: Column(
children: [
Expanded(
child: Container(
child: RawScrollbar(
radius: Radius.circular(20),
// isAlwaysShown: true,
thickness: 2,
thumbColor: Colors.white,
child: SingleChildScrollView(
child: Column(
children: [
Container(
margin: EdgeInsets.only(top: 10.sp,bottom: 5.sp),
child: Image.asset(getHomeImage('wx_tip_title'),height: 18.sp,)),
Container(
padding: EdgeInsets.only(left: 15.sp, right: 15.sp),
child: Text(
desc,
style: TextStyle(
color: Colors.white,
fontSize: 14.sp,
fontWeight: FontWeight.w500,
height: 2.0,
),
)),
Container(
padding: EdgeInsets.only(left: 15.sp, right: 15.sp),
child: Text(
tip,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w500,
fontSize: 14.sp,
height: 2.0,
),
))
],
),
),
),
)),
Container(
margin: EdgeInsets.only(top: 15.sp, right: 15.sp, left: 15.sp,bottom: 15.sp),
child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(child: Container()),
GestureDetector(
onTap: () async {
showOKToast('为了维护站内的社交环境,微信填写必须真实哦~');
var result = await DioManager()
.post(url: Api.updateWxNum, params: {'type': 1});
if (result['code'] == 200) {
Future.delayed(Duration(seconds: 2),() {showOKToast('填写微信成功');});
Get.back(result: '1');
}
},
child: Container(
alignment: Alignment.center,
height: 30.sp,
width: 100.sp,
decoration: BoxDecoration(
color: Colors.blue.withOpacity(0.9),
borderRadius: BorderRadius.circular(4.sp)),
child: Text(
'手机号即微信',
style:
TextStyle(color: Colors.white, fontSize: 14.sp),
),
),
),
Expanded(child: Container()),
GestureDetector(
onTap: () {
showOKToast('为了维护站内的社交环境,微信填写必须真实哦~');
Get.back();
Get.toNamed(
AppRoutes.Complete_materialPage,
arguments: "user",
);
},
child: Container(
height: 30.sp,
width: 100.sp,
// padding: EdgeInsets.only(left: 6.sp, right: 6.sp),
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColor.mainColor,
borderRadius: BorderRadius.circular(4.sp)),
child: Text(
widget.isHaveWx ? ' 更新微信 ':' 填写微信 ',
style:
TextStyle(color: Colors.white, fontSize: 14.sp),
),
),
),
Expanded(child: Container()),
],
),
),
],
),
),
),
),
GestureDetector(
onTap: () {
Get.back();
},
child: Container(
margin: EdgeInsets.only(bottom: 5.sp,top: 10.sp),
alignment: Alignment.center,
child: Image.asset(
getHomeImage('wx_close'),
width: 24.sp,
)),
)
],
),
),
),
);
}
void loadData() async {
var data1 = await DioManager.instance.get(url: Api.popWxNumStr);
desc = data1['content'] ?? '';
title = data1['title'] ?? '';
tip = data1['tip'] ?? '';
setState(() {});
}
}

View File

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:circle_app/common/Widgets/add_wx_tip.dart';
import 'package:circle_app/util/paymentUtil.dart'; import 'package:circle_app/util/paymentUtil.dart';
import 'package:circle_app/util/util.dart'; import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -266,3 +267,9 @@ showJoinCiclePiker(String cicleId, String pirce, String oldPrice, int type,
isScrollControlled: true, isScrollControlled: true,
enableDrag: false); enableDrag: false);
} }
Future showAddWxPicker(bool isHaveWx) {
return Get.bottomSheet(AddWxTip(isHaveWx),isScrollControlled: true,enableDrag: false);
}

View File

@ -0,0 +1,186 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
Widget getGender(String name) {
if (name == "CD") {
return getCd();
} else if (name == "MTF") {
return getMTF();
}
else if(name == "Queer"){
return getQueer();
}
else if(name == "FTM"){
return getFTM();
}
else if(name == "直男"||name == ""){
return getZN();
}
else if(name == "真女"||name == ""){
return getNV();
}else{
return getCd();
}
}
Color getGenderColor(String name){
if (name == "CD") {
return cd;
} else if (name == "MTF") {
return mtf;
}
else if(name == "Queer"){
return queer;
}
else if(name == "FTM"){
return ftm;
}
else if(name == "直男"||name == ""){
return nan;
}
else if(name == "真女"||name == ""){
return nv;
}else{
return cd;
}
}
Color cd = const Color(0xFFF7FAFA);
Color mtf = const Color(0xFFFAA5B8);
Color queer = const Color(0xFF876FE7);
Color ftm = const Color(0xFF42C6FF);
Color nan = const Color(0xFF3994FF);
Color nv = const Color(0xFFFC65ED);
Widget getCd() {
return Container(
padding: EdgeInsets.only(left: 3.sp, right: 3.sp, top: 3.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
color: const Color(0xFFF7FAFA),
// border: Border.all(
// color: logic.wantKnowData[index].isSelect ? const Color(0xFFCE51FF) : const Color(0x1AFFFFFF),
// ),
),
margin: EdgeInsets.only(left: 10.0.sp),
child: Text(
"CD",
style: TextStyle(
color: const Color(0xFF898F99),
fontSize: 12.0.sp,
),
),
);
}
Widget getMTF() {
return Container(
padding: EdgeInsets.only(left: 3.sp, right: 3.sp, top: 3.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
color: const Color(0xFFFAA5B8),
// border: Border.all(
// color: logic.wantKnowData[index].isSelect ? const Color(0xFFCE51FF) : const Color(0x1AFFFFFF),
// ),
),
margin: EdgeInsets.only(left: 10.0.sp),
child: Text(
"MTF",
style: TextStyle(
color: const Color(0xFFF7FAFA),
fontSize: 12.0.sp,
),
),
);
}
Widget getQueer() {
return Container(
padding: EdgeInsets.only(left: 3.sp, right: 3.sp, top: 3.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
color: const Color(0xFF876FE7),
// border: Border.all(
// color: logic.wantKnowData[index].isSelect ? const Color(0xFFCE51FF) : const Color(0x1AFFFFFF),
// ),
),
margin: EdgeInsets.only(left: 10.0.sp),
child: Text(
"Queer",
style: TextStyle(
color: const Color(0xFFF7FAFA),
fontSize: 12.0.sp,
),
),
);
}
Widget getFTM() {
return Container(
padding: EdgeInsets.only(left: 3.sp, right: 3.sp, top: 3.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
color: const Color(0xFF42C6FF),
// border: Border.all(
// color: logic.wantKnowData[index].isSelect ? const Color(0xFFCE51FF) : const Color(0x1AFFFFFF),
// ),
),
margin: EdgeInsets.only(left: 10.0.sp),
child: Text(
"FTM",
style: TextStyle(
color: const Color(0xFFF7FAFA),
fontSize: 12.0.sp,
),
),
);
}
Widget getZN() {
return Container(
padding: EdgeInsets.only(left: 3.sp, right: 3.sp, top: 3.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
color: const Color(0xFF3994FF),
// border: Border.all(
// color: logic.wantKnowData[index].isSelect ? const Color(0xFFCE51FF) : const Color(0x1AFFFFFF),
// ),
),
margin: EdgeInsets.only(left: 10.0.sp),
child: Text(
"直男",
style: TextStyle(
color: const Color(0xFFF7FAFA),
fontSize: 12.0.sp,
),
),
);
}
Widget getNV() {
return Container(
padding: EdgeInsets.only(left: 3.sp, right: 3.sp, top: 3.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
color: const Color(0xFFFC65ED),
// border: Border.all(
// color: logic.wantKnowData[index].isSelect ? const Color(0xFFCE51FF) : const Color(0x1AFFFFFF),
// ),
),
margin: EdgeInsets.only(left: 10.0.sp),
child: Text(
"真女",
style: TextStyle(
color: const Color(0xFFF7FAFA),
fontSize: 12.0.sp,
),
),
);
}

View File

@ -0,0 +1,442 @@
import 'dart:io';
import 'package:circle_app/common/Widgets/open_vip_tip/logic.dart';
import 'package:circle_app/network/api.dart';
import 'package:circle_app/network/dio_manager.dart';
import 'package:circle_app/util/PaymentUtils.dart';
import 'package:circle_app/util/paymentUtil.dart';
import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'base_tip_widget.dart';
class UnlockWxTip extends StatefulWidget {
String userId;
String avatarUrl;
UnlockWxTip(this.userId,this.avatarUrl);
@override
_UnlockWxTipState createState() => _UnlockWxTipState();
}
class _UnlockWxTipState extends State<UnlockWxTip> {
// TODO: add state variables and methods
List<Prices> prices = [];
int selectedIndex = 0;
bool isZfbPrice = false;
@override
void initState() {
// TODO: implement initState
super.initState();
loadData();
}
@override
Widget build(BuildContext context) {
// TODO: add widget build method
return Scaffold(
backgroundColor: Colors.transparent,
body: Stack(
alignment: Alignment.center,
children:[
Container(width: Get.width,height: Get.height,),
Stack(
children: [
Container(
margin: EdgeInsets.only(left: 20.sp,right: 20.sp),
padding: EdgeInsets.all(15.sp),
height: !Platform.isIOS ? 440.sp : 410.sp,
decoration: BoxDecoration(
color: const Color(0xFF393949),
borderRadius: BorderRadius.circular(10.sp)
),
child: Column(
children: [
Container(
margin: EdgeInsets.only(bottom: 10.sp),
alignment: Alignment.center,
child: ClipOval(child: Image.network(widget.avatarUrl,width: 60.sp,height: 60.sp,fit: BoxFit.cover,)),
),
Text(
'解锁TA的微信之外还可以解锁更多微信哦',
style: TextStyle(
color: const Color(0xFFF7FAFA), fontSize: 13.0.sp),
),
SizedBox(height: 10.0.sp),
Expanded(child: Container(
// color: Colors.red,
child: ListView.builder(
// shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: prices.length,
itemBuilder: (context, index) {
return itemView(
context,prices[index], index);
},
),
),),
Platform.isIOS
? Container(
)
: Container(
padding: EdgeInsets.only(bottom: 12.0.sp,top: 12.sp),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
setState(() {
isZfbPrice = true;
});
},
child: Row(
children: [
Image.asset(
isZfbPrice
? getMineImage("icon_pay_select")
: getMineImage("icon_pay_is_no_select"),
width: 20.0.sp,
height: 20.0.sp,
),
SizedBox(width: 8.0.sp),
Image.asset(
getMineImage('icon_cooperate_ali'),
width: 20.0.sp,
height: 20.0.sp,
),
SizedBox(width: 4.0.sp),
Text(
'支付宝支付',
style: TextStyle(
color: const Color(0xFFF7FAFA),
fontSize: 14.0.sp,
),
),
SizedBox(width: 4.0.sp),
Image.asset(
getMineImage('icon_recommend_pay_way'),
width: 32.0.sp,
height: 16.0.sp,
),
],
),
),
SizedBox(width: 24.0.sp),
GestureDetector(
onTap: () {
setState(() {
isZfbPrice = false;
});
},
child: Row(
children: [
Image.asset(
!isZfbPrice
? getMineImage("icon_pay_select")
: getMineImage("icon_pay_is_no_select"),
width: 20.0.sp,
height: 20.0.sp,
),
SizedBox(width: 8.0.sp),
Image.asset(
getMineImage('icon_cooperate_wx'),
width: 20.0.sp,
height: 20.0.sp,
),
SizedBox(width: 4.0.sp),
Text(
'微信支付',
style: TextStyle(
color: const Color(0xFFF7FAFA),
fontSize: 14.0.sp,
),
),
],
),
),
],
),
),
GestureDetector(
onTap: () {
SmartDialog.showLoading();
String itemId = prices[selectedIndex].itemId!;
if (Platform.isIOS ) {
IOSPayment.instance.iosPay(itemId,itemId,3,userId:widget.userId);
} else {
unlockingPayment(prices[selectedIndex].id.toString(), (){
Get.back();
unLockWxSuccessResult(widget.userId);
});
}
},
child: Container(
height: 40.sp,
width: Get.width,
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [
Color(0xFF06F9FA),
Color(0xFFDC5BFD),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
borderRadius: BorderRadius.circular(21.0),
),
child: Center(
child: Text(
'立即解锁',
style: TextStyle(
color: const Color(0xFFF7FAFA),
fontSize: 14.0.sp),
),
),
),
),
],
),
),
Positioned(
top: 8.sp,
right: 20.sp,
child: IconButton(
icon: const Icon(Icons.close, color: Colors.white),
onPressed: () => Get.back(result: 1),
),
),
],
),
] ,
),
);
}
Widget itemView(BuildContext context,Prices price, int index) {
// int present_bean = item.note['present_bean'];
String iconIv = '';
switch (index) {
case 0:
iconIv = getMineImage("icon_recharge_first");
break;
case 1:
iconIv = getMineImage("icon_recharge_second");
break;
case 2:
iconIv = getMineImage("icon_recharge_third");
break;
case 3:
iconIv = getMineImage("icon_recharge_fourth");
break;
}
return GestureDetector(
onTap: () {
selectedIndex = index;
setState(() {
});
},
child: Container(
height: 49.sp,
margin: const EdgeInsets.only(bottom: 10),
decoration: BoxDecoration(
color: index == selectedIndex
? const Color(0xFF464556)
: const Color(0xFF464556),
borderRadius: BorderRadius.circular(6),
border: index == selectedIndex
? Border.all(color: const Color(0xFF21BEAB), width: 1.sp)
: null,
),
child: Container(
margin: EdgeInsets.only(left: 6.sp, right: 6.sp),
child: Row(
children: [
Image.asset(
iconIv, // Replace this with the actual image path
width: 31.sp,
height: 29.sp,
),
SizedBox(width: 8.sp),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
price.desc!,
style: TextStyle(color: Colors.white, fontSize: 14.sp),
),
Text(
"同时对方可获得${price.bonus}跨豆",
style: TextStyle(
color: const Color(0xFFEFD84E), fontSize: 10.0.sp),
),
],),
Expanded(child: Container()),
// To push the next widget to the right edge
Text(
'${price.curPrice}',
style: TextStyle(color: Colors.white, fontSize: 14.sp),
),
],
),
),
));
}
unlockingPayment(String cicleId, Function resultCallback) async {
SmartDialog.showLoading();
if (isZfbPrice) {
var data = await DioManager.instance.post(
url: Api.postAliPayOrder, params: {"product_id": cicleId, "type": 3,'target_id':widget.userId});
var bean = BaseResponse<PayUrlBean>.fromJson(
data, (data) => PayUrlBean.fromJson(data));
if (bean.isSuccess()) {
openAliPay(bean.data.payUrl, (isSuccess, errorMsg) {
if (isSuccess) {
resultCallback(true);
}
});
// showToast(data.toString());
} else {
showOKToast(bean.msg);
}
} else {
var data = await DioManager.instance
.post(url: Api.postWxOrder, params: {"product_id": cicleId, "type": 3,'target_id':widget.userId});
var bean = BaseResponse<PaymentData>.fromJson(
data, (data) => PaymentData.fromJson(data));
if (bean.isSuccess()) {
openWxPay(bean.data, (bool isSuccess, String? errorMessage) {
if (isSuccess) {
resultCallback(true);
} else {
// errorMessage null
}
});
} else {
showOKToast(bean.msg);
}
}
SmartDialog.dismiss();
}
void loadData() async {
var result = await DioManager().get(url: Api.queryUnlockPrice);
if (result['code'] == 200) {
var data = Autogenerated.fromJson(result);
if (data.prices != null) {
prices = data.prices!;
setState(() {
});
}
}
}
}
class Autogenerated {
int? code;
String? msg;
List<Prices>? prices;
Autogenerated({this.code, this.msg, this.prices});
Autogenerated.fromJson(Map<String, dynamic> json) {
code = json['code'];
msg = json['msg'];
if (json['data'] != null) {
prices = <Prices>[];
json['data'].forEach((v) {
prices!.add(new Prices.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['code'] = this.code;
data['msg'] = this.msg;
if (this.prices != null) {
data['prices'] = this.prices!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Prices {
int? bonus;
double? curPrice;
String? desc;
int? expireTime;
int? expireType;
int? id;
String? itemId;
int? oldPrice;
int? show;
int? timesNum;
int? timesNumType;
Prices(
{this.bonus,
this.curPrice,
this.desc,
this.expireTime,
this.expireType,
this.id,
this.itemId,
this.oldPrice,
this.show,
this.timesNum,
this.timesNumType});
Prices.fromJson(Map<String, dynamic> json) {
bonus = json['bonus'];
curPrice = double.parse(json['curPrice'].toString());
desc = json['desc'];
expireTime = json['expireTime'];
expireType = json['expireType'];
id = json['id'];
itemId = json['itemId'];
oldPrice = json['oldPrice'];
show = json['show'];
timesNum = json['timesNum'];
timesNumType = json['timesNumType'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['bonus'] = this.bonus;
data['curPrice'] = this.curPrice;
data['desc'] = this.desc;
data['expireTime'] = this.expireTime;
data['expireType'] = this.expireType;
data['id'] = this.id;
data['itemId'] = this.itemId;
data['oldPrice'] = this.oldPrice;
data['show'] = this.show;
data['timesNum'] = this.timesNum;
data['timesNumType'] = this.timesNumType;
return data;
}
}

View File

@ -0,0 +1,16 @@
import 'dart:ui';
import 'package:flutter/material.dart';
class AppColor {
static Color mainColor = Color(0xFFCE51FF);
static Gradient mainLinearGradient = const LinearGradient(
colors: [
Color(0xFF06F9FA),
Color(0xFFDC5BFD),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
);
}

View File

@ -0,0 +1,91 @@
import 'package:circle_app/common/Widgets/unlock_wx_tip.dart';
import 'package:circle_app/network/api.dart';
import 'package:circle_app/network/dio_manager.dart';
import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:oktoast/oktoast.dart';
const bgAssetImage = DecorationImage(
image: AssetImage('assets/images/base/bg.png'),
fit: BoxFit.cover,
);
const bgBoxDecoration = BoxDecoration(image: bgAssetImage);
wxStatusWidget(bool isUnclock, String wx, String userId, String avatarUrl,
Function callBack) {
double textWidth = boundingTextSize(Get.context!, wx, TextStyle(color: Colors.white, fontSize: 16.sp)).width;
return GestureDetector(
onTap: () async {
if (!isUnclock) {
var result = await DioManager()
.post(url: Api.UnlockWx, params: {'targetUserId': userId});
if (result['code'] == 200) {
callBack();
} else {
Get.bottomSheet(UnlockWxTip(userId, avatarUrl),
isScrollControlled: true, enableDrag: false)
.then((value) {
if (value != null) {
callBack();
}
});
}
} else {
Clipboard.setData(ClipboardData(text: wx));
showToast('微信号复制成功');
}
},
child: Container(
height: 42.sp,
width: (isUnclock ? 60.sp : 100.sp) + textWidth,
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [
Color(0xFF06F9FA),
Color(0xFFDC5BFD),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
borderRadius: BorderRadius.circular(4.sp)),
child: Container(
// width: 88.sp,
margin: EdgeInsets.all(1.sp),
padding: EdgeInsets.only(left: 10.sp, right: 10.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.sp),
color: Color(0xFF240F3B)),
alignment: Alignment.center,
child: Row(
children: [
Image.asset(
getDisCoverImage('wx'),
width: 30.sp,
),
SizedBox(
width: 4.sp,
),
// Expanded(
Text(
wx,
style: TextStyle(color: Colors.white, fontSize: 16.sp),
),
if (!isUnclock)
SizedBox(
width: 14.sp,
),
if (!isUnclock)
Image.asset(
getDisCoverImage('unclock_icon'),
width: 30.sp,
)
],
),
),
));
}

View File

@ -8,6 +8,6 @@ abstract class Values {
static const String mine_images = 'assets/images/mine/'; static const String mine_images = 'assets/images/mine/';
static const String msg_images = 'assets/images/msg/'; static const String msg_images = 'assets/images/msg/';
static const String circle_images = 'assets/images/circle/'; static const String circle_images = 'assets/images/circle/';
static const String discover_images = 'assets/images/circle/';
} }

View File

@ -1,10 +1,10 @@
class Api { class Api {
static const baseUrl = 'https://leyuan666.com/zuul-service/'; // static const baseUrl = 'https://leyuan666.com/zuul-service/';
// static const baseUrl = 'http://192.168.3.55:2000/' ; static const baseUrl = 'http://192.168.3.55:2000/';
// //
@ -32,6 +32,10 @@ class Api {
static const getVipPrice = 'mall-service/vips'; static const getVipPrice = 'mall-service/vips';
//
static const queryUnlockPrice = '/mall-service/wxNum/unlock/queryUnlockPrice';
// //
@ -265,6 +269,24 @@ class Api {
// //
static const inviteFillIn = 'user-service/invite/fillin'; static const inviteFillIn = 'user-service/invite/fillin';
//
static const UnlockWx = 'user-service/wxNum/unlock';
//
static const popWxNumStr = 'user-service/content/popup/wxNum';
//
static const updateWxNum = 'user-service/updateWxNum';
//
static const findPage = 'user-service/findPage/userList';
//
static const uninterested = 'user-service/findPage/uninterested/';
//
static const getFindPageUserByUserId = 'user-service/findPage/getUserByUserId';
} }

View File

@ -9,6 +9,7 @@ import 'package:circle_app/app/call_out/binding.dart';
import 'package:circle_app/app/call_out/view.dart'; import 'package:circle_app/app/call_out/view.dart';
import 'package:circle_app/app/chat/binding.dart'; import 'package:circle_app/app/chat/binding.dart';
import 'package:circle_app/app/chat/view.dart'; import 'package:circle_app/app/chat/view.dart';
import 'package:circle_app/app/circle/discover_page.dart';
import 'package:circle_app/app/circle/view.dart'; import 'package:circle_app/app/circle/view.dart';
import 'package:circle_app/app/feedback/binding.dart'; import 'package:circle_app/app/feedback/binding.dart';
import 'package:circle_app/app/feedback/view.dart'; import 'package:circle_app/app/feedback/view.dart';
@ -121,12 +122,12 @@ class AppPages {
), ),
GetPage( GetPage(
name: AppRoutes.UserInfoActivity, name: AppRoutes.UserInfoActivity,
page: () => UserinfoPage(), page: () => UserinfoPage(),
binding: UserinfoBinding(), binding: UserinfoBinding(),
), ),
GetPage( GetPage(
name: AppRoutes.Call_out, name: AppRoutes.Call_out,
page: () => Call_outPage() , page: () => Call_outPage(),
binding: Call_outBinding(), binding: Call_outBinding(),
), ),
GetPage(name: AppRoutes.Login, page: () => LoginPage()), GetPage(name: AppRoutes.Login, page: () => LoginPage()),
@ -215,6 +216,6 @@ class AppPages {
page: () => InvitePage(), page: () => InvitePage(),
binding: InviteBinding(), binding: InviteBinding(),
), ),
GetPage(name: AppRoutes.DisCover, page: () => DiscoverPage())
]; ];
} }

View File

@ -36,6 +36,10 @@ abstract class AppRoutes {
static const Invite = '/mine/invite'; static const Invite = '/mine/invite';
static const DisCover = '/DisCover';
} }

View File

@ -37,11 +37,13 @@ class IOSPayment {
// iOS订阅监听 // iOS订阅监听
StreamSubscription<List<PurchaseDetails>>? subscription; StreamSubscription<List<PurchaseDetails>>? subscription;
//1 2 //1 2 3
int type = 0; int type = 0;
//IDID //IDID
String typeId = ''; String typeId = '';
String target_id = '';
/// 使 /// 使
Future<bool> isAvailable() async => await _inAppPurchase.isAvailable(); Future<bool> isAvailable() async => await _inAppPurchase.isAvailable();
@ -77,13 +79,19 @@ class IOSPayment {
if (purchaseDetails.status == PurchaseStatus.error) { if (purchaseDetails.status == PurchaseStatus.error) {
showOKToast('支付发生错误'); showOKToast('支付发生错误');
} else if (purchaseDetails.status == PurchaseStatus.purchased) { } else if (purchaseDetails.status == PurchaseStatus.purchased) {
var result = await DioManager.getInstance() Map<String,dynamic> params = {
.post(url: Api.applePayCallBack, params: {
'payload': purchaseDetails.verificationData.serverVerificationData, 'payload': purchaseDetails.verificationData.serverVerificationData,
'transaction_id': purchaseDetails.purchaseID, 'transaction_id': purchaseDetails.purchaseID,
'type': type, 'type': type,
'product_id': int.parse(typeId) 'product_id': int.parse(typeId)
}); };
if (type == 3) {
params['target_id'] = target_id;
}
var result = await DioManager.getInstance()
.post(url: Api.applePayCallBack, params:params);
SmartDialog.dismiss(); SmartDialog.dismiss();
if (result['code'] == 200) { if (result['code'] == 200) {
@ -103,8 +111,11 @@ class IOSPayment {
} }
logic.update(); logic.update();
} }
} else { } else if (type == 2) {
showOKToast('开通会员成功'); showOKToast('开通会员成功');
} else {
showOKToast('解锁微信号成功');
unLockWxSuccessResult(target_id);
} }
} }
await _inAppPurchase.completePurchase(purchaseDetails); await _inAppPurchase.completePurchase(purchaseDetails);
@ -153,7 +164,7 @@ class IOSPayment {
} }
/// ///
void iosPay(String skuInfo, String typeID, int productType) async { void iosPay(String skuInfo, String typeID, int productType,{String userId = ''}) async {
if (!await isAvailable()) { if (!await isAvailable()) {
SmartDialog.dismiss(); SmartDialog.dismiss();
showOKToast('无法连接AppStore请稍后再试'); showOKToast('无法连接AppStore请稍后再试');
@ -174,6 +185,7 @@ class IOSPayment {
return; return;
} }
target_id = userId;
type = productType; type = productType;
typeId = typeID; typeId = typeID;

View File

@ -2,9 +2,13 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:ui'; import 'dart:ui';
import 'package:circle_app/app/circle/widgets/discover.dart';
import 'package:circle_app/app/userinfo/logic.dart';
import 'package:circle_app/common/values/values.dart'; import 'package:circle_app/common/values/values.dart';
import 'package:circle_app/main.dart'; import 'package:circle_app/main.dart';
import 'package:circle_app/network/api.dart';
import 'package:circle_app/router/app_routers.dart'; import 'package:circle_app/router/app_routers.dart';
import 'package:circle_app/util/eventBus.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -29,6 +33,10 @@ String getHomeImage(String image) {
return '${Values.home_images}${image}.png'; return '${Values.home_images}${image}.png';
} }
String getDisCoverImage(String image) {
return '${Values.discover_images}${image}.png';
}
String getLoginImage(String image) { String getLoginImage(String image) {
return '${Values.login_images}${image}.png'; return '${Values.login_images}${image}.png';
} }
@ -57,6 +65,7 @@ String getCircleImage(String image) {
showOKToast(String msg) { showOKToast(String msg) {
showToast( showToast(
msg, msg,
duration: Duration(seconds: msg.length > 10 ? 3 : 2),
position: ToastPosition.center, position: ToastPosition.center,
backgroundColor: Colors.black.withOpacity(0.8), backgroundColor: Colors.black.withOpacity(0.8),
radius: 13.0, radius: 13.0,
@ -90,7 +99,7 @@ loaddingWidget(bool isMore) {
); );
} }
noResultWidget() { noResultWidget({String tip = '正在等待被填充~'}) {
return Container( return Container(
width: Get.width, width: Get.width,
child: Column( child: Column(
@ -104,7 +113,7 @@ noResultWidget() {
height: 8.sp, height: 8.sp,
), ),
Text( Text(
'正在等待被填充~', tip,
style: TextStyle(color: Color(0xffdbdbdb), fontSize: 15.sp), style: TextStyle(color: Color(0xffdbdbdb), fontSize: 15.sp),
), ),
], ],
@ -193,9 +202,9 @@ List<String> orientationList = [];
List<String> roleList = []; List<String> roleList = [];
String getGenderContent(int number) { String getGenderContent(int number) {
if(genderList.length!=0){ if (genderList.length != 0) {
return genderList[number-1]; return genderList[number - 1];
}else { } else {
switch (number) { switch (number) {
case 1: case 1:
return ""; return "";
@ -216,9 +225,9 @@ String getGenderContent(int number) {
} }
String getOrientationContent(int number) { String getOrientationContent(int number) {
if(orientationList.length!=0){ if (orientationList.length != 0) {
return orientationList[number-1]; return orientationList[number - 1];
}else { } else {
switch (number) { switch (number) {
case 1: case 1:
return "异性恋"; return "异性恋";
@ -241,9 +250,9 @@ String getOrientationContent(int number) {
} }
String getRoleContent(int number) { String getRoleContent(int number) {
if(roleList.length!=0){ if (roleList.length != 0) {
return roleList[number-1]; return roleList[number - 1];
}else { } else {
switch (number) { switch (number) {
case 1: case 1:
return "Sado"; return "Sado";
@ -397,11 +406,12 @@ void navigateToCustomRoute(BannerItem bannerItem) {
switch (bannerItem.scene) { switch (bannerItem.scene) {
case "scene_2": case "scene_2":
List<MyConfigData> numbers = []; List<MyConfigData> numbers = [];
if(bannerItem.param!.isNotEmpty){ if (bannerItem.param!.isNotEmpty) {
String paramJson = bannerItem.param.toString(); String paramJson = bannerItem.param.toString();
paramJson = paramJson.replaceAll(r'\', ''); // paramJson = paramJson.replaceAll(r'\', ''); //
Map<String, dynamic> jsonData = json.decode(paramJson); Map<String, dynamic> jsonData = json.decode(paramJson);
numbers.add(MyConfigData(jsonData['id'].toString(), jsonData['name'], false)); numbers.add(MyConfigData(
jsonData['id'].toString(), jsonData['name'], false));
} }
Get.toNamed(AppRoutes.Call_out, arguments: {'numbers': numbers}); Get.toNamed(AppRoutes.Call_out, arguments: {'numbers': numbers});
break; break;
@ -416,13 +426,38 @@ void navigateToCustomRoute(BannerItem bannerItem) {
Get.toNamed(AppRoutes.Invite); Get.toNamed(AppRoutes.Invite);
break; break;
case "scene_4": case "scene_4":
if(bannerItem.param!.isEmpty){ if (bannerItem.param!.isEmpty) {
Get.toNamed(AppRoutes.UserInfoActivity); Get.toNamed(AppRoutes.UserInfoActivity);
}else{ } else {
Get.toNamed(AppRoutes.UserInfoActivity, arguments: bannerItem.param.toString()); Get.toNamed(AppRoutes.UserInfoActivity,
arguments: bannerItem.param.toString());
} }
break; break;
} }
break; break;
} }
} }
unLockWxSuccessResult(String userId) {
String currentRoute = Get.currentRoute;
if (currentRoute == AppRoutes.Home) {
EventBusManager.fire(DiscoverDataRefresh(userId));
} else if (currentRoute == AppRoutes.UserInfoActivity) {
var logic = Get.find<UserinfoLogic>();
logic.fetchUserInfo("${Api.getUserInfoTA + userId}/home");
}
}
Size boundingTextSize(BuildContext context, String text, TextStyle style,
{int maxLines = 2 ^ 31, double maxWidth = double.infinity}) {
if (text == null || text.isEmpty) {
return Size.zero;
}
final TextPainter textPainter = TextPainter(
textDirection: TextDirection.ltr,
locale: Localizations.localeOf(context),
text: TextSpan(text: text, style: style),
maxLines: maxLines)
..layout(maxWidth: maxWidth);
return textPainter.size;
}