修改圈子描述展开,跳转IM页面
This commit is contained in:
parent
0872ad95fd
commit
3190df9b41
@ -95,6 +95,7 @@ class Circle {
|
|||||||
String title;
|
String title;
|
||||||
String intro;
|
String intro;
|
||||||
double amount;
|
double amount;
|
||||||
|
bool is_limit;
|
||||||
double oldAmount;
|
double oldAmount;
|
||||||
String lastCalloutTime;
|
String lastCalloutTime;
|
||||||
bool isJoin;
|
bool isJoin;
|
||||||
@ -105,6 +106,7 @@ class Circle {
|
|||||||
|
|
||||||
Circle({
|
Circle({
|
||||||
required this.id,
|
required this.id,
|
||||||
|
required this.is_limit,
|
||||||
required this.image,
|
required this.image,
|
||||||
required this.title,
|
required this.title,
|
||||||
required this.intro,
|
required this.intro,
|
||||||
@ -125,6 +127,7 @@ class Circle {
|
|||||||
|
|
||||||
return Circle(
|
return Circle(
|
||||||
id: json['id'],
|
id: json['id'],
|
||||||
|
is_limit: json['is_limit'] ?? false,
|
||||||
image: json['image'],
|
image: json['image'],
|
||||||
title: json['title'],
|
title: json['title'],
|
||||||
intro: json['intro'],
|
intro: json['intro'],
|
||||||
|
|||||||
@ -144,7 +144,7 @@ class _CirclePageState extends State<CirclePage>
|
|||||||
left: 0,
|
left: 0,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.toNamed(AppRoutes.FriendsActivity,arguments: '2');
|
Get.toNamed(AppRoutes.VisitorListActivity);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:circle_app/app/call_out/logic.dart';
|
||||||
import 'package:circle_app/app/circle/logic.dart';
|
import 'package:circle_app/app/circle/logic.dart';
|
||||||
import 'package:circle_app/app/circle/state.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/list_logic.dart';
|
||||||
import 'package:circle_app/app/circle/widgets/video_item.dart';
|
import 'package:circle_app/app/circle/widgets/video_item.dart';
|
||||||
|
import 'package:circle_app/common/Widgets/base_tip_widget.dart';
|
||||||
|
import 'package:circle_app/common/Widgets/text_more.dart';
|
||||||
|
import 'package:circle_app/main.dart';
|
||||||
import 'package:circle_app/network/dio_manager.dart';
|
import 'package:circle_app/network/dio_manager.dart';
|
||||||
import 'package:circle_app/router/app_routers.dart';
|
import 'package:circle_app/router/app_routers.dart';
|
||||||
import 'package:circle_app/util/util.dart';
|
import 'package:circle_app/util/util.dart';
|
||||||
@ -165,7 +169,18 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushMsgPage(Lists bean, String cicleId) async {}
|
void pushMsgPage(Lists bean, String cicleId) async {
|
||||||
|
if (widget.bean.is_limit) {
|
||||||
|
showJoinCiclePiker(cicleId,widget.bean.amount.toString(),widget.bean.oldAmount.toString(),2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await DioManager.instance.get(
|
||||||
|
url: "/up-service/callout/$circleId/chat",);
|
||||||
|
if (data["code"] == 200) {
|
||||||
|
pushChatPage(data['data']['account_id'], bean.user!.nickname!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -253,27 +268,20 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
image: AssetImage(
|
image: AssetImage(
|
||||||
getCircleImage('circle_desc')))),
|
getCircleImage('circle_desc')))),
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.only(top: 14.sp),
|
margin: EdgeInsets.only(top: 10.sp),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
|
margin: EdgeInsets.only(bottom: 7.sp),
|
||||||
width: Get.width,
|
width: Get.width,
|
||||||
height: 30.sp,
|
height: 30.sp,
|
||||||
child: GestureDetector(
|
child: HideText(text: widget.bean.intro,additionText: '查看更多',maxLines: 2,style: TextStyle(color: Colors.white, fontSize: 10.sp),additionStyle: TextStyle(color: Color(0xFFFF4DF6), fontSize: 10.sp),onTap: () {
|
||||||
onTap: () {
|
|
||||||
_showTextContentDialog(
|
_showTextContentDialog(
|
||||||
context, widget.bean.intro);
|
context, widget.bean.intro);
|
||||||
},
|
},),
|
||||||
child: RichText(
|
|
||||||
overflow: TextOverflow.fade,
|
|
||||||
maxLines: 2,
|
|
||||||
text: TextSpan(
|
|
||||||
children: <InlineSpan>[
|
|
||||||
descSpan,
|
|
||||||
span
|
|
||||||
])),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
behavior:HitTestBehavior.opaque,
|
behavior:HitTestBehavior.opaque,
|
||||||
onTap: (){
|
onTap: (){
|
||||||
@ -515,6 +523,7 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
left: 12.sp * index,
|
left: 12.sp * index,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
||||||
pushOtherPeopleHomePage(element.id.toString());
|
pushOtherPeopleHomePage(element.id.toString());
|
||||||
},
|
},
|
||||||
child: circleWidget(element.avatar!,element.id.toString(), width: 24),
|
child: circleWidget(element.avatar!,element.id.toString(), width: 24),
|
||||||
@ -609,6 +618,10 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
if (widget.bean.is_limit) {
|
||||||
|
showJoinCiclePiker(widget.bean.id.toString(),widget.bean.amount.toString(),widget.bean.oldAmount.toString(),1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
pushHomePage(lists, lists.id.toString());
|
pushHomePage(lists, lists.id.toString());
|
||||||
},
|
},
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
@ -777,8 +790,9 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
)),
|
)),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
pushHomePage(
|
pushMsgPage(lists, widget.bean.id.toString());
|
||||||
lists, widget.bean.id.toString());
|
// pushHomePage(
|
||||||
|
// lists, widget.bean.id.toString());
|
||||||
},
|
},
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
getCircleImage('chat'),
|
getCircleImage('chat'),
|
||||||
@ -829,6 +843,10 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
left: 12.sp * index,
|
left: 12.sp * index,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
// if (widget.bean.is_limit) {
|
||||||
|
// showJoinCiclePiker(widget.bean.id.toString(),widget.bean.amount.toString(),widget.bean.oldAmount.toString(),1);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
pushOtherPeopleHomePage(element.id.toString());
|
pushOtherPeopleHomePage(element.id.toString());
|
||||||
},
|
},
|
||||||
child: circleWidget(element.avatar!,element.id.toString(), width: 24),
|
child: circleWidget(element.avatar!,element.id.toString(), width: 24),
|
||||||
@ -895,6 +913,10 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
if (widget.bean.is_limit) {
|
||||||
|
showJoinCiclePiker(widget.bean.id.toString(),widget.bean.amount.toString(),widget.bean.oldAmount.toString(),1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
pushHomePage(
|
pushHomePage(
|
||||||
lists, widget.bean.id.toString());
|
lists, widget.bean.id.toString());
|
||||||
},
|
},
|
||||||
@ -1074,8 +1096,9 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
)),
|
)),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
pushHomePage(
|
|
||||||
lists, widget.bean.id.toString());
|
|
||||||
|
pushMsgPage(lists, widget.bean.id.toString());
|
||||||
},
|
},
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
getCircleImage('chat'),
|
getCircleImage('chat'),
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
// ignore_for_file: empty_catches
|
// ignore_for_file: empty_catches
|
||||||
|
|
||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart';
|
import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation_item.dart';
|
import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation_item.dart';
|
||||||
@ -119,6 +120,7 @@ class TIMConversationItem extends TIMUIKitStatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
|
// color: Colors.red,
|
||||||
padding: const EdgeInsets.only(top: 0, bottom: 2, right: 0),
|
padding: const EdgeInsets.only(top: 0, bottom: 2, right: 0),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: isDesktopScreen ? 40 : 44,
|
width: isDesktopScreen ? 40 : 44,
|
||||||
@ -128,11 +130,8 @@ class TIMConversationItem extends TIMUIKitStatelessWidget {
|
|||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
ClipOval(
|
ClipOval(
|
||||||
child: Avatar(
|
child: CachedNetworkImage(imageUrl: faceUrl,fit: BoxFit.cover,width: isDesktopScreen ? 40 : 44,
|
||||||
onlineStatus: onlineStatus,
|
height: isDesktopScreen ? 40 : 44,)
|
||||||
faceUrl: faceUrl,
|
|
||||||
showName: nickName,
|
|
||||||
type: convType),
|
|
||||||
),
|
),
|
||||||
if (unreadCount != 0)
|
if (unreadCount != 0)
|
||||||
Positioned(
|
Positioned(
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class MsgPage extends StatelessWidget {
|
|||||||
left: 0,
|
left: 0,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.toNamed(AppRoutes.FriendsActivity,arguments: '1');
|
Get.toNamed(AppRoutes.LikeListActivity);
|
||||||
},
|
},
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
@ -248,7 +248,7 @@ class MsgPage extends StatelessWidget {
|
|||||||
msgWdiget(context) {
|
msgWdiget(context) {
|
||||||
return TIMConversation(
|
return TIMConversation(
|
||||||
onTapItem: (selectedConv) {
|
onTapItem: (selectedConv) {
|
||||||
Get.toNamed(AppRoutes.Chat);
|
Get.toNamed(AppRoutes.Chat,arguments: selectedConv);
|
||||||
},
|
},
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.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';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -119,7 +120,7 @@ class VisitorlistPage extends StatelessWidget {
|
|||||||
// Pla
|
// Pla
|
||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(onTap: (){
|
GestureDetector(onTap: (){
|
||||||
|
pushChatPage(item.accountId, item.user.nickname);
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,24 +1,29 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
|
||||||
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_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
joiinCircileTipWdiget(String cicleId) {
|
joiinCircileTipWdiget(String cicleId,String pirce,String oldPrice,String title) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
body: Container(
|
body: Container(
|
||||||
width: Get.width,
|
width: Get.width,
|
||||||
height: Get.height,
|
height: Get.height,
|
||||||
child: Container(
|
alignment: Alignment.center,
|
||||||
|
child:
|
||||||
|
Stack(
|
||||||
|
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
width: 339.sp,
|
width: 339.sp,
|
||||||
height: 330.sp,
|
height: 330.sp,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill,
|
||||||
image: AssetImage(getCircleImage('add_tip_bg')))),
|
image: AssetImage(getCircleImage('add_tip_bg'))))),
|
||||||
child: Stack(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
children: [
|
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 5.sp,
|
top: 5.sp,
|
||||||
right: 12.sp,
|
right: 12.sp,
|
||||||
@ -34,7 +39,7 @@ joiinCircileTipWdiget(String cicleId) {
|
|||||||
Positioned(
|
Positioned(
|
||||||
top: 24.sp,
|
top: 24.sp,
|
||||||
child: Text(
|
child: Text(
|
||||||
'解锁圈子才能主动私聊',
|
title,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 16.sp),
|
style: TextStyle(color: Colors.white, fontSize: 16.sp),
|
||||||
)),
|
)),
|
||||||
Positioned(
|
Positioned(
|
||||||
@ -78,7 +83,7 @@ joiinCircileTipWdiget(String cicleId) {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'¥18',
|
'¥$pirce',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Color(0xffE845FF),
|
color: Color(0xffE845FF),
|
||||||
fontSize: 16.sp,
|
fontSize: 16.sp,
|
||||||
@ -88,7 +93,7 @@ joiinCircileTipWdiget(String cicleId) {
|
|||||||
width: 2.sp,
|
width: 2.sp,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'(原价60)',
|
'(原价$oldPrice)',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white70,
|
color: Colors.white70,
|
||||||
fontSize: 16.sp,
|
fontSize: 16.sp,
|
||||||
@ -103,12 +108,14 @@ joiinCircileTipWdiget(String cicleId) {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
showJoinCiclePiker(String cicleId) {
|
showJoinCiclePiker(String cicleId,String pirce,String oldPrice,int type) {
|
||||||
|
|
||||||
|
String title = ['解锁圈子才能发布喊话','解锁圈子才能查看主页','解锁圈子才能主动私聊'][type];
|
||||||
return Get.bottomSheet(
|
return Get.bottomSheet(
|
||||||
joiinCircileTipWdiget(cicleId),
|
joiinCircileTipWdiget(cicleId,pirce,oldPrice,title),
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
enableDrag: false
|
enableDrag: false
|
||||||
);
|
);
|
||||||
|
|||||||
97
circle_app/lib/common/Widgets/text_more.dart
Normal file
97
circle_app/lib/common/Widgets/text_more.dart
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
import 'package:flutter/gestures.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
///文字超出一定行,自动隐藏,并添加入"...查看更多详情"为它设置点击事件
|
||||||
|
class HideText extends StatefulWidget {
|
||||||
|
|
||||||
|
HideText({
|
||||||
|
required this.text, //正常字
|
||||||
|
required this.style, //正常字样式
|
||||||
|
required this.additionText, //附加字,如点击查看更多
|
||||||
|
this.additionStyle, //附加字的样式
|
||||||
|
this.maxLines = 3, //行数,不传 默认为3
|
||||||
|
this.additionUrl, //点击附加字跳转URL
|
||||||
|
this.additionParams,
|
||||||
|
this.onTap,//点击附加字跳转时携带的参数
|
||||||
|
}) : assert(text != null),
|
||||||
|
assert(additionText != null);
|
||||||
|
final String text;
|
||||||
|
final TextStyle style;
|
||||||
|
final String? additionText;
|
||||||
|
final TextStyle? additionStyle;
|
||||||
|
final int? maxLines;
|
||||||
|
final String? additionUrl;
|
||||||
|
GestureTapCallback? onTap;
|
||||||
|
final Map<String, dynamic>? additionParams;
|
||||||
|
@override
|
||||||
|
_HideTextState createState() => _HideTextState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HideTextState extends State<HideText> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
// padding: const EdgeInsets.only(top: 10),
|
||||||
|
child: _textPaint([TextSpan(text: widget.text, style : widget.style)]).didExceedMaxLines ? RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: "${widget.text.substring(0, _fontNum())}",
|
||||||
|
style: widget.style,
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
children: [
|
||||||
|
TextSpan(text: "...", style: widget.style),
|
||||||
|
TextSpan(text: "${widget.additionText}", style: widget.additionStyle,recognizer: TapGestureRecognizer()
|
||||||
|
..onTap =
|
||||||
|
widget.onTap
|
||||||
|
// if(isNotBlank(widget.additionUrl)) {
|
||||||
|
// FlutterBoost.singleton.open(widget.additionUrl);
|
||||||
|
// }additionUrl
|
||||||
|
)
|
||||||
|
],
|
||||||
|
|
||||||
|
)
|
||||||
|
]
|
||||||
|
),
|
||||||
|
) : Container( //未超出指定行数的话全部显示
|
||||||
|
child: Text(
|
||||||
|
widget.text,
|
||||||
|
style: widget.style,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
TextPainter _textPaint(List<InlineSpan> children){
|
||||||
|
return TextPainter(
|
||||||
|
maxLines: widget.maxLines,
|
||||||
|
text: TextSpan(
|
||||||
|
children: children
|
||||||
|
),
|
||||||
|
textDirection: TextDirection.ltr)
|
||||||
|
..layout(maxWidth: Get.width - 60.sp); //若新功能宽度不一致,可尝试修改,
|
||||||
|
//UIUtils.screenWidth(context)是自定义的获取屏幕宽度的方法
|
||||||
|
}
|
||||||
|
|
||||||
|
int _fontNum(){ //计算最多可容纳正常字的数目,可优化
|
||||||
|
int num = 0;
|
||||||
|
int skip = 1;
|
||||||
|
while(true){
|
||||||
|
bool isExceed = widget.text.length < num + skip || _textPaint([TextSpan(text: widget.text.substring(0, num + skip) + "...", style: widget.style),
|
||||||
|
TextSpan(text: widget.additionText, style: widget.additionStyle)]).didExceedMaxLines;
|
||||||
|
if(!isExceed) {
|
||||||
|
num = num + skip;
|
||||||
|
skip *= 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(isExceed && skip == 1){
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
skip = skip ~/ 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user