主页接入圈子接口
This commit is contained in:
parent
79be1cb9cc
commit
eebdf6a442
@ -1,5 +1,5 @@
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter_install_app/flutter_install_app.dart';
|
// import 'package:flutter_install_app/flutter_install_app.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class AboutappLogic extends GetxController {
|
|||||||
// SmartDialog.dismiss();
|
// SmartDialog.dismiss();
|
||||||
// print(error);
|
// print(error);
|
||||||
// });
|
// });
|
||||||
await AppInstaller.installApk(filePath, actionRequired: false);
|
// await AppInstaller.installApk(filePath, actionRequired: false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -130,7 +130,7 @@ class Call_outLogic extends GetxController {
|
|||||||
'album': myBean,
|
'album': myBean,
|
||||||
'content': textEditingController.text,
|
'content': textEditingController.text,
|
||||||
'interest_id': numbers[0].id,
|
'interest_id': numbers[0].id,
|
||||||
'useQueen': isCheck,
|
'use_queen': isCheck ? 1 : 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
var beandata = BaseResponse<dynamic>.fromJson(
|
var beandata = BaseResponse<dynamic>.fromJson(
|
||||||
|
|||||||
10
circle_app/lib/app/circle/binding.dart
Normal file
10
circle_app/lib/app/circle/binding.dart
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import 'logic.dart';
|
||||||
|
|
||||||
|
class CircleBinding extends Bindings {
|
||||||
|
@override
|
||||||
|
void dependencies() {
|
||||||
|
Get.put(() => CircleLogic());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -14,7 +14,8 @@ class Lists {
|
|||||||
int? id;
|
int? id;
|
||||||
bool? isQueen;
|
bool? isQueen;
|
||||||
User? user;
|
User? user;
|
||||||
|
Map? interest;
|
||||||
|
String? create_time;
|
||||||
Lists(
|
Lists(
|
||||||
{this.album, this.chat, this.content, this.id, this.isQueen, this.user});
|
{this.album, this.chat, this.content, this.id, this.isQueen, this.user});
|
||||||
|
|
||||||
@ -28,6 +29,8 @@ class Lists {
|
|||||||
chat = json['chat'] != null ? new Chat.fromJson(json['chat']) : null;
|
chat = json['chat'] != null ? new Chat.fromJson(json['chat']) : null;
|
||||||
content = json['content'];
|
content = json['content'];
|
||||||
id = json['id'];
|
id = json['id'];
|
||||||
|
interest = json['interest'] ?? {};
|
||||||
|
create_time = json['create_time'] ?? '';
|
||||||
isQueen = json['is_queen'];
|
isQueen = json['is_queen'];
|
||||||
user = json['user'] != null ? new User.fromJson(json['user']) : null;
|
user = json['user'] != null ? new User.fromJson(json['user']) : null;
|
||||||
}
|
}
|
||||||
@ -53,12 +56,14 @@ class Lists {
|
|||||||
class Album {
|
class Album {
|
||||||
int? type;
|
int? type;
|
||||||
String? url;
|
String? url;
|
||||||
|
String? create_time;
|
||||||
|
|
||||||
Album({this.type, this.url});
|
Album({this.type, this.url});
|
||||||
|
|
||||||
Album.fromJson(Map<String, dynamic> json) {
|
Album.fromJson(Map<String, dynamic> json) {
|
||||||
type = json['type'];
|
type = json['type'];
|
||||||
url = json['url'];
|
url = json['url'];
|
||||||
|
create_time = json['create_time'] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
|
|||||||
@ -152,7 +152,7 @@ class _CirclePageState extends State<CirclePage>
|
|||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
shadows: [
|
shadows: const [
|
||||||
Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1))
|
Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1))
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
@ -160,6 +160,9 @@ class _CirclePageState extends State<CirclePage>
|
|||||||
Positioned(
|
Positioned(
|
||||||
right: 0,
|
right: 0,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.toNamed(AppRoutes.MyCircle,arguments: '');
|
||||||
|
},
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
getCircleImage('my_circle'),
|
getCircleImage('my_circle'),
|
||||||
width: 64.sp,
|
width: 64.sp,
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import 'package:get/get.dart';
|
|||||||
class InfoListView extends StatefulWidget {
|
class InfoListView extends StatefulWidget {
|
||||||
// Get.lazyPut(() => ListLogic());
|
// Get.lazyPut(() => ListLogic());
|
||||||
|
|
||||||
CircleLogic logic;
|
var logic;
|
||||||
Circle bean;
|
Circle bean;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
@ -454,7 +454,19 @@ class _InfoListViewState extends State<InfoListView> {
|
|||||||
Positioned(
|
Positioned(
|
||||||
right: 2.sp,
|
right: 2.sp,
|
||||||
top: 2.sp,
|
top: 2.sp,
|
||||||
child: Image.asset(getCircleImage('location')),
|
child:Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
getCircleImage('location'),
|
||||||
|
height: 20.sp,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
lists.user!.city ?? '外星',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 12.sp),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
height: 18.sp,
|
height: 18.sp,
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
@ -478,7 +490,7 @@ class _InfoListViewState extends State<InfoListView> {
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
listsLg?.pushMsgPage(
|
listsLg?.pushHomePage(
|
||||||
lists, lists.id.toString());
|
lists, lists.id.toString());
|
||||||
},
|
},
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
@ -647,7 +659,7 @@ class _InfoListViewState extends State<InfoListView> {
|
|||||||
)),
|
)),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
listsLg?.pushMsgPage(
|
listsLg?.pushHomePage(
|
||||||
lists, widget.bean.id.toString());
|
lists, widget.bean.id.toString());
|
||||||
},
|
},
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
@ -762,7 +774,7 @@ class _InfoListViewState extends State<InfoListView> {
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
listsLg?.pushMsgPage(
|
listsLg?.pushHomePage(
|
||||||
lists, widget.bean.id.toString());
|
lists, widget.bean.id.toString());
|
||||||
},
|
},
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
@ -938,7 +950,7 @@ class _InfoListViewState extends State<InfoListView> {
|
|||||||
)),
|
)),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
listsLg?.pushMsgPage(
|
listsLg?.pushHomePage(
|
||||||
lists, widget.bean.id.toString());
|
lists, widget.bean.id.toString());
|
||||||
},
|
},
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
|
|||||||
@ -48,13 +48,15 @@ class ListLogic extends GetxController {
|
|||||||
callOutMore = true;
|
callOutMore = true;
|
||||||
loadCallOutListData(_circleId);
|
loadCallOutListData(_circleId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadMore() {
|
void loadMore() {
|
||||||
|
if (callOutMore == false) return;
|
||||||
loadCallOutListData(_circleId);
|
loadCallOutListData(_circleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushMsgPage(Lists bean,String cicleId) async {
|
void pushHomePage(Lists bean,String cicleId) async {
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
int userId = prefs.getInt("userId")??0;
|
int userId = prefs.getInt("userId")??0;
|
||||||
if(bean.user!.id==userId){
|
if(bean.user!.id==userId){
|
||||||
@ -74,6 +76,10 @@ class ListLogic extends GetxController {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pushMsgPage(Lists bean,String cicleId) async {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
// TODO: implement onInit
|
||||||
|
|||||||
@ -151,7 +151,12 @@ class MinefragmentPage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _CircleItemView() {
|
Widget _CircleItemView() {
|
||||||
return Container(
|
return GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTap: () {
|
||||||
|
Get.toNamed(AppRoutes.MyCircle,arguments: '');
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
margin: EdgeInsets.only(top: 18),
|
margin: EdgeInsets.only(top: 18),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
@ -185,6 +190,7 @@ class MinefragmentPage extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
9
circle_app/lib/app/my_circle/binding.dart
Normal file
9
circle_app/lib/app/my_circle/binding.dart
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import 'package:circle_app/app/my_circle/logic.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class My_circleBinding extends Bindings {
|
||||||
|
@override
|
||||||
|
void dependencies() {
|
||||||
|
Get.lazyPut(() => MyCircleLogic());
|
||||||
|
}
|
||||||
|
}
|
||||||
59
circle_app/lib/app/my_circle/logic.dart
Normal file
59
circle_app/lib/app/my_circle/logic.dart
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import 'package:circle_app/app/circle/logic.dart';
|
||||||
|
import 'package:circle_app/app/circle/state.dart';
|
||||||
|
import 'package:circle_app/util/util.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../network/api.dart';
|
||||||
|
import '../../network/dio_manager.dart';
|
||||||
|
|
||||||
|
class MyCircleLogic extends GetxController {
|
||||||
|
PageController pageController =
|
||||||
|
PageController(initialPage: 1, viewportFraction: 0.8);
|
||||||
|
InterestsBean circle = InterestsBean(lists: []);
|
||||||
|
final CircleState state = CircleState();
|
||||||
|
int page = 1;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() async {
|
||||||
|
super.onInit();
|
||||||
|
var data = await DioManager.instance
|
||||||
|
.get(url: Api.getMyCircleInterests, params: {"page": page});
|
||||||
|
|
||||||
|
var bean = BaseResponse<InterestsBean>.fromJson(
|
||||||
|
data, (data) => InterestsBean.fromJson(data));
|
||||||
|
circle = bean.data!;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
loadMore() async {
|
||||||
|
page = page++;
|
||||||
|
var data = await DioManager.instance
|
||||||
|
.get(url: Api.getMyCircleInterests, params: {"page": page});
|
||||||
|
var bean = BaseResponse<InterestsBean>.fromJson(
|
||||||
|
data, (data) => InterestsBean.fromJson(data));
|
||||||
|
circle = bean.data!;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
outCircle(String interest_id, bool isStatus) async {
|
||||||
|
var data = await DioManager.instance.post(
|
||||||
|
url: Api.outCrrcle + interest_id + "/join",
|
||||||
|
params: {"status": isStatus ? "0" : "1"});
|
||||||
|
var bean = BaseResponse<String>.fromJson(data, (data) => data);
|
||||||
|
if (bean.code == 200) {
|
||||||
|
circle.lists.forEach((element) {
|
||||||
|
if (element.id.toString() == interest_id.toString()) {
|
||||||
|
element.isJoin = !isStatus;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
showToast(bean.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
Circle getCircleIndex() {
|
||||||
|
return circle.lists[state.index];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
383
circle_app/lib/app/my_circle/view.dart
Normal file
383
circle_app/lib/app/my_circle/view.dart
Normal file
@ -0,0 +1,383 @@
|
|||||||
|
import 'package:circle_app/app/circle/logic.dart';
|
||||||
|
import 'package:circle_app/app/circle/widgets/info_list_view.dart';
|
||||||
|
import 'package:circle_app/app/my_circle/logic.dart';
|
||||||
|
import 'package:circle_app/app/select_circle/logic.dart';
|
||||||
|
import 'package:circle_app/components/my_app_bar.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_swiper/flutter_swiper.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class My_circlePage extends StatefulWidget {
|
||||||
|
My_circlePage({Key? key}) : super(key: key);
|
||||||
|
@override
|
||||||
|
_My_circlePageState createState() => _My_circlePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _My_circlePageState extends State<My_circlePage>
|
||||||
|
with AutomaticKeepAliveClientMixin {
|
||||||
|
@override
|
||||||
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
|
// 是否需要缓存
|
||||||
|
final logic = Get.put(MyCircleLogic());
|
||||||
|
|
||||||
|
final state = Get.find<MyCircleLogic>().state;
|
||||||
|
|
||||||
|
var getContext;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
getContext = context;
|
||||||
|
return Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
height: MediaQuery.of(context).size.height,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color(0xFF423055),
|
||||||
|
image: DecorationImage(
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
image: AssetImage(getBaseImage('home_back')))),
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
body: SafeArea(
|
||||||
|
child: GetBuilder(builder: (MyCircleLogic controller) {
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
height: MediaQuery.of(context).size.height,
|
||||||
|
child: Column(children: [
|
||||||
|
Get.arguments == null ? navigatorItem() : backNavigatorItem(),
|
||||||
|
// Text(controller.state.msg),
|
||||||
|
//组件使用
|
||||||
|
Expanded(
|
||||||
|
child: Swiper(
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
var bean = logic.circle.lists[index];
|
||||||
|
return InfoListView(index, bean, logic);
|
||||||
|
},
|
||||||
|
index: logic.circle.lists.isNotEmpty ? 0 : controller.state.index,
|
||||||
|
itemCount: logic.circle.lists.length,
|
||||||
|
viewportFraction: 0.95,
|
||||||
|
// scale: 0.9,
|
||||||
|
loop: false,
|
||||||
|
onIndexChanged: (index) {
|
||||||
|
controller.state.index = index;
|
||||||
|
if (index == logic.circle.lists.length - 1) {
|
||||||
|
|
||||||
|
logic.loadMore();
|
||||||
|
controller.update();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// pagination: new SwiperPagination(),//如果不填则不显示指示点
|
||||||
|
// control: new SwiperControl(),//如果不填则不显示左右按钮
|
||||||
|
))
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
backNavigatorItem() {
|
||||||
|
return MyAppBar(
|
||||||
|
centerTitle: '我的圈子',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
navigatorItem() {
|
||||||
|
List<String> urlList = [
|
||||||
|
'https://p3-passport.byteimg.com/img/user-avatar/eb429d4dbb3c246f580a6f7894f2b246~100x100.awebp',
|
||||||
|
'https://p3-passport.byteimg.com/img/user-avatar/eb429d4dbb3c246f580a6f7894f2b246~100x100.awebp',
|
||||||
|
'https://p3-passport.byteimg.com/img/user-avatar/eb429d4dbb3c246f580a6f7894f2b246~100x100.awebp'
|
||||||
|
];
|
||||||
|
List<Widget> widgets = [];
|
||||||
|
int index = 0;
|
||||||
|
urlList.forEach((element) {
|
||||||
|
widgets.add(Positioned(
|
||||||
|
left: 15.sp * index,
|
||||||
|
child: circleWidget(element),
|
||||||
|
));
|
||||||
|
index++;
|
||||||
|
});
|
||||||
|
return Container(
|
||||||
|
width: Get.width,
|
||||||
|
padding: EdgeInsets.only(left: 18.sp, right: 18.sp),
|
||||||
|
height: 44.sp,
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Positioned(
|
||||||
|
left: 0,
|
||||||
|
child: Container(
|
||||||
|
|
||||||
|
width: 30.sp * widgets.length,
|
||||||
|
height: 44.sp,
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
children: widgets,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
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: Text(
|
||||||
|
'发现',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Colors.white,
|
||||||
|
shadows: [
|
||||||
|
Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1))
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
right: 0,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.toNamed(AppRoutes.MyCircle,arguments: '',preventDuplicates:false);
|
||||||
|
},
|
||||||
|
child: Image.asset(
|
||||||
|
getCircleImage('my_circle'),
|
||||||
|
width: 64.sp,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
circleWidget(String url, {double width = 30}) {
|
||||||
|
return GestureDetector(
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
getCircleImage('avatar_bg'),
|
||||||
|
width: width.sp,
|
||||||
|
),
|
||||||
|
ClipOval(
|
||||||
|
child: Image.network(
|
||||||
|
url,
|
||||||
|
width: (width - 1).sp,
|
||||||
|
height: (width - 1).sp,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,6 +1,7 @@
|
|||||||
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/userinfo/widgets/home_call_out.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';
|
||||||
@ -320,7 +321,7 @@ class _MyTabbedScreenState extends State<UserinfoPage>
|
|||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
children: [
|
children: [
|
||||||
_imageAdapter(controller),
|
_imageAdapter(controller),
|
||||||
Text("喊话"),
|
HomeCallOutView(controller.userId),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
|
|||||||
662
circle_app/lib/app/userinfo/widgets/home_call_out.dart
Normal file
662
circle_app/lib/app/userinfo/widgets/home_call_out.dart
Normal file
@ -0,0 +1,662 @@
|
|||||||
|
import 'dart:ffi';
|
||||||
|
|
||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:circle_app/app/circle/logic.dart';
|
||||||
|
import 'package:circle_app/app/circle/state.dart';
|
||||||
|
import 'package:circle_app/app/circle/widgets/list_logic.dart';
|
||||||
|
import 'package:circle_app/app/circle/widgets/video_item.dart';
|
||||||
|
import 'package:circle_app/app/userinfo/widgets/home_call_out_logic.dart';
|
||||||
|
import 'package:circle_app/router/app_routers.dart';
|
||||||
|
import 'package:circle_app/util/util.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:get/get_core/src/get_main.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class HomeCallOutView extends StatefulWidget {
|
||||||
|
// Get.lazyPut(() => ListLogic());
|
||||||
|
|
||||||
|
String userId;
|
||||||
|
HomeCallOutView(this.userId, {super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<HomeCallOutView> createState() => _HomeCallOutViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HomeCallOutViewState extends State<HomeCallOutView> {
|
||||||
|
List<String> genderList = ['男', '女,' 'MTF', 'FTM', 'CD', '酷儿'];
|
||||||
|
|
||||||
|
List<String> orientationList = [
|
||||||
|
'异性恋',
|
||||||
|
'同性恋',
|
||||||
|
'双性恋',
|
||||||
|
'泛性恋',
|
||||||
|
'无性恋',
|
||||||
|
'智性恋',
|
||||||
|
'性单恋'
|
||||||
|
];
|
||||||
|
|
||||||
|
List<String> roleList = ['Sado', 'Maso', 'Dom', 'Sub', 'Switch'];
|
||||||
|
|
||||||
|
HomeCallOutLogic? listsLg;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
Get.lazyPut(() => HomeCallOutLogic());
|
||||||
|
listsLg = Get.find<HomeCallOutLogic>();
|
||||||
|
listsLg?.loadCallOutListData(widget.userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
// TODO: implement dispose
|
||||||
|
super.dispose();
|
||||||
|
listsLg?.onClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GetBuilder<HomeCallOutLogic>(
|
||||||
|
assignId: true,
|
||||||
|
builder: (listLogic) {
|
||||||
|
return ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(10.sp),
|
||||||
|
child: Container(
|
||||||
|
width: Get.width,
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: Get.height,
|
||||||
|
width: Get.width,
|
||||||
|
margin: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom + 30.sp),
|
||||||
|
child: RefreshIndicator(
|
||||||
|
onRefresh: () async {
|
||||||
|
listLogic.refreshData();
|
||||||
|
},
|
||||||
|
child: listLogic.lists.isEmpty
|
||||||
|
? loaddingWidget(true)
|
||||||
|
: ListView.builder(
|
||||||
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
controller: listLogic.scrollController,
|
||||||
|
itemCount: listLogic.lists.length + 1,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
if (listLogic.lists.length > index) {
|
||||||
|
Lists lists = listLogic.lists[index];
|
||||||
|
if (lists.isQueen!) {
|
||||||
|
return vipDynamicItem(lists);
|
||||||
|
} else {
|
||||||
|
return normalDynamicItem(lists);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return loaddingWidget(
|
||||||
|
listLogic.callOutMore);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
///至尊喊话
|
||||||
|
vipDynamicItem(Lists lists) {
|
||||||
|
Text descText = Text(
|
||||||
|
lists.content!,
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 14.sp),
|
||||||
|
maxLines: 2,
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
double picHeight = 0.0;
|
||||||
|
|
||||||
|
int type = 0;
|
||||||
|
if (lists.album != null) {
|
||||||
|
if (lists.album!.isNotEmpty) {
|
||||||
|
Album info = lists.album!.first!;
|
||||||
|
type = info.type!;
|
||||||
|
|
||||||
|
if (info.type == 1) {
|
||||||
|
if (lists.album!.length > 3) {
|
||||||
|
picHeight = 218.sp;
|
||||||
|
} else {
|
||||||
|
picHeight = 109.sp;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
picHeight = 140.sp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double titleHeight = textWidth(lists.interest!['title']);
|
||||||
|
double widgetHeight = 115.sp + contentHeight(lists.content!) + (picHeight > 0 ? picHeight + 5 : 0);
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.sp),
|
||||||
|
width: Get.width,
|
||||||
|
height: widgetHeight,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
image: DecorationImage(
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
image: AssetImage(
|
||||||
|
getCircleImage('pic_bg'),
|
||||||
|
))),
|
||||||
|
child: Stack(children: [
|
||||||
|
Positioned(
|
||||||
|
left: 0,
|
||||||
|
top: 2.sp,
|
||||||
|
child: Image.asset(getCircleImage('vip_say')),
|
||||||
|
height: 18.sp,
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
right: 2.sp,
|
||||||
|
top: 2.sp,
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
getCircleImage('location'),
|
||||||
|
width: titleHeight + 15.sp,
|
||||||
|
height: 20.sp,
|
||||||
|
fit: BoxFit.fitWidth,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
lists.interest!['title'],
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 12.sp),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: widgetHeight,
|
||||||
|
width: Get.width,
|
||||||
|
padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 72.sp,
|
||||||
|
child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
getCircleImage('avatar_bg'),
|
||||||
|
width: 42.sp,
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
listsLg?.pushMsgPage(lists, lists.id.toString());
|
||||||
|
},
|
||||||
|
child: ClipOval(
|
||||||
|
child: Image.network(
|
||||||
|
lists.user!.avatar!,
|
||||||
|
width: 40.sp,
|
||||||
|
height: 40.sp,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(left: 8.sp, top: 12.sp),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
height: 72.sp,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
lists.user!.nickname!,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 18.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 8.sp,
|
||||||
|
),
|
||||||
|
lists.user!.vip! == 0
|
||||||
|
? Container()
|
||||||
|
: Image.asset(
|
||||||
|
getCircleImage('vip'),
|
||||||
|
width: 36.sp,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 4.sp,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
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(
|
||||||
|
'${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 12.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
// margin: EdgeInsets.only(top: 4.sp),
|
||||||
|
child: descText,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: picHeight,
|
||||||
|
margin: EdgeInsets.only(top: 5.sp),
|
||||||
|
child: picHeight == 140.sp
|
||||||
|
? ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(6.sp),
|
||||||
|
child: VideoItemWidget(lists.album![0]!.url!))
|
||||||
|
: GridView.builder(
|
||||||
|
itemCount: lists.album!.length,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
gridDelegate:
|
||||||
|
SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 3, //横轴三个子widget
|
||||||
|
crossAxisSpacing: 8.sp,
|
||||||
|
mainAxisSpacing: 8.sp,
|
||||||
|
childAspectRatio: 1.0 //宽高比为1时,子widget
|
||||||
|
),
|
||||||
|
itemBuilder: (contentxt, currentIndex) {
|
||||||
|
Album album = lists.album![currentIndex];
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
var imgList = <String>[];
|
||||||
|
for (var element in lists.album!) {
|
||||||
|
imgList.add(element.url!);
|
||||||
|
}
|
||||||
|
Get.toNamed(AppRoutes.Swiper, arguments: {
|
||||||
|
'imaglist': imgList,
|
||||||
|
'index': currentIndex
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(6.sp),
|
||||||
|
child: CachedNetworkImage(
|
||||||
|
imageUrl: album.url!,
|
||||||
|
errorWidget: (context, url, error) =>
|
||||||
|
Icon(Icons.error),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: Get.width,
|
||||||
|
margin: EdgeInsets.only(top: 4.sp),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
lists.create_time!,
|
||||||
|
style:
|
||||||
|
TextStyle(color: Colors.white, fontSize: 12.sp),
|
||||||
|
),
|
||||||
|
widget.userId.isNotEmpty
|
||||||
|
? Container()
|
||||||
|
: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
showTipPiker(lists.id!.toString(), listsLg!.lists.indexOf(lists));
|
||||||
|
},
|
||||||
|
child: Text('删除',style: TextStyle(color: Colors.red, fontSize: 13.sp),))
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
///普通图文喊话
|
||||||
|
normalDynamicItem(Lists lists) {
|
||||||
|
Text descText = Text(
|
||||||
|
lists.content!,
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 14.sp),
|
||||||
|
// maxLines: 2,
|
||||||
|
);
|
||||||
|
|
||||||
|
double picHeight = 0.0;
|
||||||
|
|
||||||
|
int type = 0;
|
||||||
|
if (lists.album != null) {
|
||||||
|
if (lists.album!.isNotEmpty) {
|
||||||
|
Album info = lists.album!.first!;
|
||||||
|
type = info.type!;
|
||||||
|
|
||||||
|
if (info.type == 1) {
|
||||||
|
if (lists.album!.length > 3) {
|
||||||
|
picHeight = 218.sp;
|
||||||
|
} else {
|
||||||
|
picHeight = 109.sp;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
picHeight = 140.sp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double titleHeight = textWidth(lists.interest!['title']);
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.sp),
|
||||||
|
width: Get.width,
|
||||||
|
height: picHeight > 0 ? 105.sp + contentHeight(lists.content!) + picHeight : 100.sp + contentHeight(lists.content!),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
image: DecorationImage(
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
image: AssetImage(
|
||||||
|
getCircleImage('normal_bg'),
|
||||||
|
))),
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Positioned(
|
||||||
|
right: 2.sp,
|
||||||
|
top: 2.sp,
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
getCircleImage('location'),
|
||||||
|
width: titleHeight + 15.sp,
|
||||||
|
height: 20.sp,
|
||||||
|
fit: BoxFit.fitWidth,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
lists.interest!['title'],
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 12.sp),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// height: 18.sp,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
// height: 130.sp + contentHeight(lists.content!) + picHeight,
|
||||||
|
width: Get.width,
|
||||||
|
// color: Colors.blue,
|
||||||
|
padding: EdgeInsets.only(left: 12.sp, right: 12.sp),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 72.sp,
|
||||||
|
child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
getCircleImage('avatar_bg'),
|
||||||
|
width: 42.sp,
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {},
|
||||||
|
child: ClipOval(
|
||||||
|
child: Image.network(
|
||||||
|
lists.user!.avatar!,
|
||||||
|
width: 40.sp,
|
||||||
|
height: 40.sp,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
),
|
||||||
|
))
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(left: 8.sp, top: 12.sp),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
height: 72.sp,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
lists.user!.nickname! ?? '',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 18.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 8.sp,
|
||||||
|
),
|
||||||
|
lists.user!.vip! == 0
|
||||||
|
? Container()
|
||||||
|
: Image.asset(
|
||||||
|
getCircleImage('vip'),
|
||||||
|
width: 36.sp,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 4.sp,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
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(
|
||||||
|
'${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 12.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
// margin: EdgeInsets.only(top: 4.sp),
|
||||||
|
child: descText,
|
||||||
|
),
|
||||||
|
picHeight > 0
|
||||||
|
? Container(
|
||||||
|
height: picHeight,
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
margin: EdgeInsets.only(top: 5.sp),
|
||||||
|
child: picHeight == 140.sp
|
||||||
|
? ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(6.sp),
|
||||||
|
child: VideoItemWidget(lists.album![0].url!))
|
||||||
|
: GridView.builder(
|
||||||
|
itemCount: lists.album!.length,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
gridDelegate:
|
||||||
|
SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 3, //横轴三个子widget
|
||||||
|
crossAxisSpacing: 8.sp,
|
||||||
|
mainAxisSpacing: 8.sp,
|
||||||
|
childAspectRatio: 1.0 //宽高比为1时,子widget
|
||||||
|
),
|
||||||
|
itemBuilder: (contentxt, currentIndex) {
|
||||||
|
Album album = lists.album![currentIndex];
|
||||||
|
if (album.type == 2) {
|
||||||
|
return ClipRRect(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(6.sp),
|
||||||
|
child: VideoItemWidget(album.url!));
|
||||||
|
}
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
var imgList = <String>[];
|
||||||
|
for (var element in lists.album!) {
|
||||||
|
imgList.add(element.url!);
|
||||||
|
}
|
||||||
|
Get.toNamed(AppRoutes.Swiper, arguments: {
|
||||||
|
'imaglist': imgList,
|
||||||
|
'index': currentIndex
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(6.sp),
|
||||||
|
child: CachedNetworkImage(
|
||||||
|
imageUrl: album.url!,
|
||||||
|
errorWidget: (context, url, error) =>
|
||||||
|
Icon(Icons.error),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}))
|
||||||
|
: Container(),
|
||||||
|
Container(
|
||||||
|
width: Get.width,
|
||||||
|
margin: EdgeInsets.only(top: 4.sp),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
lists.create_time!,
|
||||||
|
style:
|
||||||
|
TextStyle(color: Colors.white, fontSize: 12.sp),
|
||||||
|
),
|
||||||
|
widget.userId.isNotEmpty
|
||||||
|
? Container()
|
||||||
|
: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
showTipPiker(lists.id!.toString(), listsLg!.lists.indexOf(lists));
|
||||||
|
},
|
||||||
|
child: Text('删除',style: TextStyle(color: Colors.red, fontSize: 13.sp),))
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
circleWidget(String url, {double width = 30}) {
|
||||||
|
return GestureDetector(
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
getCircleImage('avatar_bg'),
|
||||||
|
width: width.sp,
|
||||||
|
),
|
||||||
|
ClipOval(
|
||||||
|
child: Image.network(
|
||||||
|
url,
|
||||||
|
width: (width - 1).sp,
|
||||||
|
height: (width - 1).sp,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
double contentHeight(String content) {
|
||||||
|
return calculateTextHeight(
|
||||||
|
content, 14.sp, FontWeight.w300, Get.width - 64.sp, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
double textWidth(value) {
|
||||||
|
TextPainter painter = TextPainter(
|
||||||
|
|
||||||
|
///AUTO:华为手机如果不指定locale的时候,该方法算出来的文字高度是比系统计算偏小的。
|
||||||
|
locale: WidgetsBinding.instance!.window.locale,
|
||||||
|
maxLines: 1,
|
||||||
|
textDirection: TextDirection.ltr,
|
||||||
|
textScaleFactor: 1, //字体缩放大小
|
||||||
|
text: TextSpan(
|
||||||
|
text: value,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.sp,
|
||||||
|
)));
|
||||||
|
painter.layout(maxWidth: 350);
|
||||||
|
return painter.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
showTipPiker(String callOutId,int index) {
|
||||||
|
return Get.bottomSheet(
|
||||||
|
Scaffold(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
body: CupertinoAlertDialog(
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: const <Widget>[
|
||||||
|
Text("是否要删除该喊话?"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: const Text("确定",style: TextStyle(color: Colors.red),),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
listsLg?.removeData(callOutId,index);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: const Text("取消"),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
isScrollControlled: true,
|
||||||
|
enableDrag: false,
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
81
circle_app/lib/app/userinfo/widgets/home_call_out_logic.dart
Normal file
81
circle_app/lib/app/userinfo/widgets/home_call_out_logic.dart
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
import 'package:circle_app/app/circle/state.dart';
|
||||||
|
import 'package:circle_app/common/Widgets/base_tip_widget.dart';
|
||||||
|
import 'package:circle_app/common/Widgets/open_vip_tip/view.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:get/get.dart';
|
||||||
|
|
||||||
|
class HomeCallOutLogic extends GetxController {
|
||||||
|
int callOutPage = 1;
|
||||||
|
bool isLoad = true;
|
||||||
|
bool callOutMore = true;
|
||||||
|
var _userId = '';
|
||||||
|
List<Lists> lists = [];
|
||||||
|
final ScrollController scrollController = ScrollController();
|
||||||
|
|
||||||
|
loadCallOutListData(String userId) async {
|
||||||
|
_userId = userId;
|
||||||
|
var data = await DioManager.instance.get(
|
||||||
|
url: "/up-service/${_userId.isEmpty ? 'my/' : 'user/' + userId}/callouts",
|
||||||
|
params: {"page": callOutPage, "page_size": "20"});
|
||||||
|
if (data["code"] == 200) {
|
||||||
|
List dataList = data["data"]["lists"] ?? [];
|
||||||
|
if (callOutPage == 1) {
|
||||||
|
if (lists.isNotEmpty) {
|
||||||
|
lists.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dataList.isNotEmpty) {
|
||||||
|
callOutMore = true;
|
||||||
|
for (var element in dataList) {
|
||||||
|
lists.add(Lists.fromJson(element));
|
||||||
|
}
|
||||||
|
callOutPage++;
|
||||||
|
}
|
||||||
|
callOutMore = dataList.length == 20;
|
||||||
|
update();
|
||||||
|
} else {
|
||||||
|
showToast(data["msg"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void refreshData() {
|
||||||
|
if (callOutMore == false) return;
|
||||||
|
callOutPage = 1;
|
||||||
|
callOutMore = true;
|
||||||
|
loadCallOutListData(_userId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadMore() {
|
||||||
|
loadCallOutListData(_userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pushMsgPage(Lists bean,String cicleId) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
scrollController.addListener(() {
|
||||||
|
if (scrollController.position.pixels == scrollController.position.maxScrollExtent) {
|
||||||
|
loadMore();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void removeData(String callOutId, int index) async {
|
||||||
|
var data = await DioManager.instance.delete(
|
||||||
|
url: "/up-service/callout/${callOutId}",);
|
||||||
|
if (data['code'] == 200) {
|
||||||
|
showToast('删除成功');
|
||||||
|
lists.removeAt(index);
|
||||||
|
update();
|
||||||
|
} else {
|
||||||
|
showToast('操作失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -7,8 +7,7 @@ Widget bgWidget(BuildContext context,Widget widget) {
|
|||||||
height: MediaQuery.of(context).size.height,
|
height: MediaQuery.of(context).size.height,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill, image: AssetImage(getBaseImage('home_back')))),
|
||||||
image: AssetImage(getBaseImage('home_back')))),
|
child: widget,
|
||||||
child: widget,);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -86,4 +86,43 @@ class Api {
|
|||||||
static const getUrgeStatus = 'up-service/user/';
|
static const getUrgeStatus = 'up-service/user/';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// /up-service/my/interests
|
||||||
|
static const getMyCircleInterests = 'up-service/my/interests';
|
||||||
}
|
}
|
||||||
@ -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/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';
|
||||||
import 'package:circle_app/app/friendslist/binding.dart';
|
import 'package:circle_app/app/friendslist/binding.dart';
|
||||||
@ -22,6 +23,8 @@ import 'package:circle_app/app/minefragment/binding.dart';
|
|||||||
import 'package:circle_app/app/minefragment/view.dart';
|
import 'package:circle_app/app/minefragment/view.dart';
|
||||||
import 'package:circle_app/app/msg/binding.dart';
|
import 'package:circle_app/app/msg/binding.dart';
|
||||||
import 'package:circle_app/app/msg/view.dart';
|
import 'package:circle_app/app/msg/view.dart';
|
||||||
|
import 'package:circle_app/app/my_circle/binding.dart';
|
||||||
|
import 'package:circle_app/app/my_circle/view.dart';
|
||||||
import 'package:circle_app/app/offaccount/binding.dart';
|
import 'package:circle_app/app/offaccount/binding.dart';
|
||||||
import 'package:circle_app/app/offaccount/view.dart';
|
import 'package:circle_app/app/offaccount/view.dart';
|
||||||
import 'package:circle_app/app/photoinfo/binding.dart';
|
import 'package:circle_app/app/photoinfo/binding.dart';
|
||||||
@ -47,6 +50,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|||||||
import 'package:get/get_navigation/src/routes/get_route.dart';
|
import 'package:get/get_navigation/src/routes/get_route.dart';
|
||||||
|
|
||||||
import '../app/blacklist/view.dart';
|
import '../app/blacklist/view.dart';
|
||||||
|
import '../app/circle/binding.dart';
|
||||||
import '../app/splash/view.dart';
|
import '../app/splash/view.dart';
|
||||||
import 'app_routers.dart';
|
import 'app_routers.dart';
|
||||||
|
|
||||||
@ -163,5 +167,10 @@ class AppPages {
|
|||||||
page: () => SplashPage(),
|
page: () => SplashPage(),
|
||||||
binding: SplashBinding(),
|
binding: SplashBinding(),
|
||||||
),
|
),
|
||||||
|
GetPage(
|
||||||
|
name: AppRoutes.MyCircle,
|
||||||
|
page: () => My_circlePage(),
|
||||||
|
binding: My_circleBinding(),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,4 +22,5 @@ abstract class AppRoutes {
|
|||||||
static const Chat = '/chat';
|
static const Chat = '/chat';
|
||||||
static const SelectCircleActivity = '/user/SelectCircleActivity';
|
static const SelectCircleActivity = '/user/SelectCircleActivity';
|
||||||
static const SplashActivity = '/user/SplashActivity';
|
static const SplashActivity = '/user/SplashActivity';
|
||||||
|
static const MyCircle = '/myCircle';
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user