circle_app/circle_app/lib/app/circle/view.dart

1140 lines
40 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'dart:math';
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/vicinity.dart';
import 'package:circle_app/app/dialog/ScreenBottomSheetDialog.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_pickers/pickers.dart';
import 'package:flutter_pickers/style/picker_style.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../select_circle/logic.dart';
import '../userinfo/logic.dart';
import 'logic.dart';
const bgWidget = DecorationImage(
fit: BoxFit.fill, image: AssetImage('assets/images/base/home_back.png'));
class CirclePage extends StatefulWidget {
CirclePage({Key? key}) : super(key: key);
@override
State<CirclePage> createState() => _CirclePageState();
}
class _CirclePageState extends State<CirclePage>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
late TabController _tabController;
late PageController _pageController;
@override
bool get wantKeepAlive => true;
@override
void initState() {
super.initState();
int initIndex = Random().nextInt(3);
_pageController = PageController(initialPage: initIndex);
_tabController = TabController(length: 3, vsync: this, initialIndex: initIndex);
_tabController.addListener(_handleTabChange);
}
void _handleTabChange() {
// 在这里可以执行滑动监听后的逻辑操作
// 比如根据当前选中的标签执行其他操作
// int currentIndex = .toString());
logic.isShowCircle = _tabController.index == 0;
logic.update();
}
// 是否需要缓存
final logic = Get.put(CircleLogic());
final state = Get.find<CircleLogic>().state;
var getContext;
@override
void dispose() {
_tabController.removeListener(_handleTabChange); // 移除监听
_tabController.dispose();
_pageController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
getContext = context;
return GetBuilder<CircleLogic>(builder: (logic) {
return Scaffold(
backgroundColor: Colors.transparent,
body: SafeArea(
child: GetBuilder(builder: (CircleLogic controller) {
return Stack(
children: [
Column(children: [
Obx(() {
return navigatorItem(controller.statistics.value);
}),
// Text(controller.state.msg),
//组件使用
]),
Container(
margin: EdgeInsets.only(top: 45.sp),
child: PageView(
controller: _pageController,
onPageChanged: (index) {
_tabController.animateTo(index);
print("index=" + index.toString());
},
children: [
circleList(controller),
Vicinity(controller),
Discover(0)
],
),
),
_tabController.index == 0
? Positioned(
bottom: 36.sp,
right: 10.sp,
child: GestureDetector(
onTap: () async {
List<MyConfigData> numbers = [];
numbers.add(MyConfigData(
logic.getCircleIndex().id.toString(),
logic.getCircleIndex().title!,
false));
var data = await Get.toNamed(AppRoutes.Call_out,
arguments: {'numbers': numbers});
},
child: Image.asset(
getCircleImage('send_msg'),
width: 60.sp,
)))
: Center()
],
);
}),
),
);
});
}
Widget vicinityList(CircleLogic controller) {
return SmartRefresher(
controller: logic.refreshController,
onRefresh: _onRefresh,
onLoading: _onLoading,
enablePullUp: logic.myVip > 0,
child: ListView.builder(
padding: EdgeInsets.all(10.sp),
itemCount: logic.myVip == 0
? logic.vicinityList.length + 2
: logic.vicinityList.length + 1,
itemBuilder: (context, index) {
if (index == 0) {
return bannerView(controller);
} else {
if (logic.myVip == 0 && index == logic.vicinityList.length + 1) {
return showVipView();
} else {
return ListItem(logic.vicinityList[index - 1], index - 1);
}
}
},
),
);
}
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 {
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 _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,
),
),
),
),
),
),
),
],
),
),
);
}
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 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",
),
);
}
void _onRefresh() async {
logic.vicinityPage = 1;
logic.offset = 0;
logic.getNearByList();
// logic.refreshController.refreshCompleted();
}
void _onLoading() async {
if (logic.myVip > 0) {
logic.vicinityPage = logic.vicinityPage + 1;
// logic.offset = 0;
//
logic.getNearByList();
} else {
logic.refreshController.loadComplete();
}
}
Widget bannerView(CircleLogic controller) {
return SizedBox(
height: 160.sp,
// margin: EdgeInsets.symmetric(horizontal: 16.sp),
child: Swiper(
autoplay: logic.bannerList.length > 1,
controller: logic.swiperController,
autoplayDelay: 6000,
loop: logic.bannerList.length > 1 ? true : false,
// index:logic.index,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () async {
// print(logic.bannerList[index].param);
navigateToCustomRoute(logic.bannerList[index]);
},
child: SizedBox(
width: Get.width,
child: ClipRRect(
borderRadius: BorderRadius.circular(15.sp),
child: CachedNetworkImage(
imageUrl: logic.bannerList[index].picUrl,
fit: BoxFit.fill,
width: Get.width,
),
)),
);
},
itemCount: logic.bannerList.length,
pagination: SwiperPagination(
margin: EdgeInsets.all(5.0.sp), // 设置外边距
alignment: Alignment.bottomCenter,
builder: DotSwiperPaginationBuilder(
color: Color(0x00FFFFFF), // 小圆点的颜色
activeColor: logic.bannerList.length == 1
? Color(0x00FFFFFF)
: Color(0x00FFFFFF), // 当前索引小圆点的颜色
),
),
// control: new SwiperControl(), //左右的那个箭头,在某模拟器中会出现蓝线
),
);
}
Widget circleList(CircleLogic controller) {
return Swiper(
itemBuilder: (BuildContext context, int index) {
var bean = logic.circle.lists[index];
// final GlobalKey<InfoListViewState> infoListViewKey = GlobalKey<InfoListViewState>();
return InfoListView(index, bean, logic);
},
onIndexChanged: (index) {
controller.state.index = index;
if (index == logic.circle.lists.length - 1) {
logic.loadMore();
}
print(index.toString());
},
index: controller.state.index,
itemCount: logic.circle.lists.length,
viewportFraction: 0.93,
// scale: 0.9,
loop: false,
// key: UniqueKey(),
// pagination: new SwiperPagination(),//如果不填则不显示指示点
// control: new SwiperControl(),//如果不填则不显示左右按钮
);
}
Widget navigatorItem(DataModel statistics) {
List<String> urlList = [];
List infoList = [];
if (statistics != null) {
infoList = statistics.lastVisitUsers;
if (infoList.isNotEmpty) {
for (var element in infoList) {
if (element["avatar"] != null && element["avatar"].contains("http")) {
urlList.add(element["avatar"]);
}
// urlList.add(element["avatar"]);
}
}
}
List<Widget> widgets = [];
for (int i = 0; i < urlList.length; i++) {
var element = urlList[i];
widgets.add(Positioned(
left: 15.sp * i,
child: circleWidget(element),
));
}
if (statistics != null && widgets.isNotEmpty) {
widgets.add(Positioned(
left: 15.sp * urlList.length,
child: circleWidget(statistics.visitCount.toString()),
));
}
return Container(
width: Get.width,
padding: EdgeInsets.only(left: 18.sp, right: 18.sp),
height: 44.sp,
child: Stack(
alignment: Alignment.center,
children: [
_tabController.index == 0
? Positioned(
left: 0,
child: GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.Invite);
},
child: Container(
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.6.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17.0),
color: const Color(0xFF392D53),
),
child: Padding(
padding: EdgeInsets.only(
top: 5.sp,
bottom: 4.sp,
left: 8.sp,
right: 8.sp,
),
child: const Center(
child: Text(
"邀请得会员",
style: TextStyle(
fontSize: 11,
color: Colors.white,
),
),
),
),
),
),
))
: _tabController.index == 1
? Positioned(
left: 0,
child: GestureDetector(
onTap: () {
showCityPiker(context);
},
child: Row(
children: [
Image.asset(
getCircleImage('icon_city'),
width: 24.sp,
),
Container(
margin: EdgeInsets.only(left: 4.sp, top: 4.sp),
child: Text(
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(
alignment: Alignment.center,
//padding: EdgeInsets.symmetric(horizontal: 10.sp),
height: 27.sp,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TabBar(
isScrollable: true,
controller: _tabController,
labelPadding: EdgeInsets.symmetric(horizontal: 13.0),
indicator: UnderlineTabIndicator(
borderSide: BorderSide(
color: const Color(0xFF00FFF4),
),
),
indicatorColor: const Color(0xFF00FFF4),
indicatorWeight: 2.sp,
labelColor: const Color(0xFF00FFF4),
unselectedLabelColor: const Color(0xB3FFFFFF),
indicatorSize: TabBarIndicatorSize.label,
indicatorPadding: EdgeInsets.only(left: 12.sp, right: 12.sp),
tabs: [
Tab(
child: Text(
'圈子',
style: TextStyle(
fontSize: 20.sp,
),
),
),
Tab(
child: Text(
'附近',
style: TextStyle(
fontSize: 20.sp,
),
),
),
Tab(
child: Text(
'发现',
style: TextStyle(
fontSize: 20.sp,
),
),
),
],
labelStyle: TextStyle(
color: const Color(0xFF00FFF4),
fontSize: 18.sp,
shadows: [
Shadow(
color: const Color(0xFFF657FF).withOpacity(0.5),
offset: Offset(0, -2), // 阴影偏移
blurRadius: 3, // 阴影模糊半径
// spreadRadius: 0
),
],
),
unselectedLabelStyle: TextStyle(
// color: const Color(0xB3FFFFFF),
fontSize: 18.sp,
shadows: [
Shadow(
// color: const Color(0xFFF657FF),
offset: const Offset(0, -1),
blurRadius: 3.0.sp,
),
],
),
onTap: (index) {
_pageController.animateToPage(
index, // 目标页面索引
duration: const Duration(milliseconds: 300), // 动画时长
curve: Curves.ease, // 动画曲线
);
if (index == 2) {
EventBusManager.fire(DiscovrScrollTap());
} else if (index == 1) {
EventBusManager.fire(NearScrollTap());
} else if (index == 0) {
EventBusManager.fire(ScrollToTop());
}
},
),
],
),
),
Positioned(
right: 0,
child: _tabController.index == 0
? GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.MyCircle, arguments: '');
},
child: Image.asset(
getCircleImage('my_circle'),
width: 64.sp,
),
)
: GestureDetector(
onTap: () {
_showBottomSheet(context);
},
child: Image.asset(
getCircleImage('icon_screen'),
width: 30.sp,
),
),
),
],
),
);
}
void _showBottomSheet(BuildContext context) {
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (BuildContext context) {
return ScreenBottomSheetDialog(
genderList: _tabController.index == 1 ? logic.genderList : logic.dis_genderList,
orientationList: _tabController.index == 1 ? logic.orientationList : logic.dis_orientationList,
roleList: _tabController.index == 1 ? logic.roleList : logic.dis_roleList,
callback: (genderList, orientationList, roleList) {
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
},
);
}
circleWidget(String url, {double width = 30}) {
return GestureDetector(
child: Stack(
alignment: Alignment.center,
children: [
Image.asset(
getCircleImage('avatar_bg'),
width: width.sp,
),
url.contains("http")
? ClipOval(
child: Image.network(
url,
width: (width - 1).sp,
height: (width - 1).sp,
fit: BoxFit.cover,
),
)
: Text(
url,
style: TextStyle(color: Color(0xffF756FF), fontSize: 12.sp),
)
],
));
}
void _showTextContentDialog(BuildContext context, String msg) {
showDialog(
context: context,
builder: (BuildContext context) {
return Dialog(
backgroundColor: Colors.transparent,
child: Container(
height: 300.sp,
padding: EdgeInsets.all(1.0),
child: Stack(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(10.0),
gradient: LinearGradient(
colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
),
Container(
margin: EdgeInsets.all(1.sp),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(10.0),
gradient: LinearGradient(
colors: [Color(0xFF4C3E5F), Color(0xFF324140)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
),
Container(
margin: EdgeInsets.only(top: 24.sp),
child: Column(
children: [
Container(
margin: EdgeInsets.only(
top: 12.sp, left: 14.sp, right: 14.sp),
alignment: Alignment.center,
child: Text(
msg,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xCCF7FAFA), fontSize: 16.sp),
),
),
],
),
)
],
),
),
);
},
);
}
void _showOutCircleDialog(
BuildContext context, CircleLogic controller, Circle bean) {
showDialog(
context: context,
builder: (BuildContext context) {
return Dialog(
backgroundColor: Colors.transparent,
child: Container(
height: 160.sp,
padding: EdgeInsets.all(1.0),
child: Stack(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(10.0),
gradient: LinearGradient(
colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
),
Container(
margin: EdgeInsets.all(1.sp),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(10.0),
gradient: LinearGradient(
colors: [Color(0xFF4C3E5F), Color(0xFF324140)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
),
Container(
margin: EdgeInsets.only(top: 24.sp),
child: Column(
children: [
Center(
child: Text(
"提示",
style:
TextStyle(color: Colors.white, fontSize: 16.sp),
),
),
Container(
margin: EdgeInsets.only(
top: 12.sp, left: 14.sp, right: 14.sp),
alignment: Alignment.center,
child: Text(
"是否确认退出该圈子。",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xCCF7FAFA), fontSize: 16.sp),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
margin: EdgeInsets.only(top: 30.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17),
gradient: LinearGradient(
colors: [
Color(0x26FFFFFF),
Color(0x26FFFFFF),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
padding: EdgeInsets.only(
top: 10.sp,
bottom: 10.sp,
left: 52.sp,
right: 52.sp),
child: Text(
"",
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
),
),
SizedBox(width: 24.sp),
GestureDetector(
onTap: () {
Navigator.pop(context);
logic.outCircle(bean.id.toString(), bean.isJoin!);
},
child: Container(
margin: EdgeInsets.only(top: 24.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17),
gradient: LinearGradient(
colors: [
Color(0xFF06F9FA),
Color(0xFFDC5BFD),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
padding: EdgeInsets.only(
top: 10.sp,
bottom: 10.sp,
left: 52.sp,
right: 52.sp),
child: Text(
"",
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
),
)
],
)
],
),
)
],
),
),
);
},
);
}
showCityPiker(context) {
Pickers.showMultiLinkPicker(context,
pickerStyle: DefaultPickerStyle.dark(),
data: logic.cityMap,
columeNum: 2, onConfirm: (List res, List<int> position) {
print(res);
// print(logic.cityMap[res[0]][res[1]][0]);
// controller.state.city = controller.cityMap[res[0]][res[1]][0];
// logic.state.city = res[1];
logic.cityName = res[1];
_onRefresh();
// logic.getSuccess();
// logic.update();
}
// onConfirm:(String province, String city, String? town){
// controller.state.role = city;
// controller.update();
//
// }
);
}
String modifyCityName(String cityName) {
if (cityName.endsWith("")) {
cityName = cityName.substring(0, cityName.length - 1);
}
if (cityName.length > 4) {
cityName = cityName.substring(0, 4) + "...";
}
return cityName;
}
}
class DefaultPickerStyle extends PickerStyle {
DefaultPickerStyle({bool haveRadius: false, String? title}) {
if (haveRadius) {
this.headDecoration = BoxDecoration(
color: Colors.white,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10), topRight: Radius.circular(10)));
}
if (title != null && title != '') {
this.title = Center(
child:
Text(title, style: TextStyle(color: Colors.grey, fontSize: 14)));
}
}
/// 夜间
DefaultPickerStyle.dark({bool haveRadius: false, String? title}) {
this.commitButton = Container(
alignment: Alignment.center,
padding: const EdgeInsets.only(left: 12, right: 22),
child: Text('确定', style: TextStyle(color: Colors.white, fontSize: 16.0)),
);
this.cancelButton = Container(
alignment: Alignment.center,
padding: const EdgeInsets.only(left: 22, right: 12),
child: Text('取消', style: TextStyle(color: Colors.white, fontSize: 16.0)),
);
this.headDecoration = BoxDecoration(
color: Color(0xFF4A3E5D),
borderRadius: !haveRadius
? null
: BorderRadius.only(
topLeft: Radius.circular(10), topRight: Radius.circular(10)));
if (title != null && title != '') {
this.title = Center(
child:
Text(title, style: TextStyle(color: Colors.white, fontSize: 14)));
}
this.backgroundColor = Color(0xFF4A3E5D)!;
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);
}