获取点赞数

master
laiiihz 5 years ago
parent 1a0c900c9d
commit 051b495c80

@ -529,4 +529,6 @@ class LiveAPI {
///
static const String getLiveInfo = '/v1/live/live/info';
static const String liveLicense = '/v1/live/live/license';
}

@ -8,6 +8,8 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:oktoast/oktoast.dart';
import 'package:recook/constants/api.dart';
import 'package:recook/manager/http_manager.dart';
import 'package:recook/manager/user_manager.dart';
import 'package:recook/models/user_brief_info_model.dart';
import 'package:recook/models/user_model.dart';
@ -39,20 +41,13 @@ void main() async {
//im
TencentImPlugin.init(appid: '1400435566');
//
TencentLive.instance.init(
licenseUrl:
'http://license.vod2.myqcloud.com/license/v1/9bc083b7b7c2101699499d193c40921b/TXLiveSDK.licence',
licenseKey: 'cf903ae78afbb05b5128f8961bf08f64',
);
AppConfig.initial(useEncrypt: false
///
// useEncrypt: true
);
//
bool isDebug = true;
bool isDebug = false;
AppConfig.setDebug(isDebug);
bool inTest = Test.test();
@ -122,6 +117,16 @@ class MyAppState extends State<MyApp> {
// ShareSDKRegister register = ShareSDKRegister();
// register.setupQQ("1109724223", "UGWklum7WWI03ll9");
// SharesdkPlugin.regist(register);
HttpManager.post(LiveAPI.liveLicense, {}).then((resultData) {
String key = resultData.data['data']['key'];
String licenseURL = resultData.data['data']['licenseUrl'];
//
TencentLive.instance.init(
licenseUrl: licenseURL,
licenseKey: key,
);
});
}
Future<void> initPlatformState() async {

@ -61,6 +61,8 @@ class _LiveStreamViewPageState extends State<LiveStreamViewPage> {
List<GroupMemberEntity> _groupMembers = [];
int _praise = 0;
@override
void initState() {
super.initState();
@ -78,6 +80,7 @@ class _LiveStreamViewPageState extends State<LiveStreamViewPage> {
else {
setState(() {
_streamInfoModel = model;
_praise = model.praise;
isAttention = _streamInfoModel.isFollow == 1;
});
TencentImPlugin.applyJoinGroup(
@ -158,6 +161,12 @@ class _LiveStreamViewPageState extends State<LiveStreamViewPage> {
showDetailWindow = false;
});
break;
case 'Praise':
int extra = customParams['data']['addPraise'];
// int nowPraise = customParams['data']['praise'];
_praise += extra;
setState(() {});
break;
case 'Explain':
int goodsId = customParams['data']['goodsId'];
nowGoodList = _streamInfoModel.goodsLists.where((element) {
@ -184,6 +193,7 @@ class _LiveStreamViewPageState extends State<LiveStreamViewPage> {
));
}
break;
case 'Notice':
chatObjects.insertAll(
0,
@ -345,7 +355,7 @@ class _LiveStreamViewPageState extends State<LiveStreamViewPage> {
);
},
title: _streamInfoModel.nickname,
subTitle: '点赞数 ${_streamInfoModel.praise}',
subTitle: '点赞数 $_praise',
avatar: _streamInfoModel.headImgUrl,
),
Spacer(),

@ -51,8 +51,11 @@ class _GoodsListDialogState extends State<GoodsListDialog> {
return DraggableScrollableSheet(
minChildSize: 0.5,
maxChildSize: 0.9,
initialChildSize: 0.5,
expand: false,
builder: (context, scrollController) {
return Column(
mainAxisSize: MainAxisSize.max,
children: [
Material(
color: Colors.transparent,
@ -85,6 +88,7 @@ class _GoodsListDialogState extends State<GoodsListDialog> {
child: ListView.separated(
padding: EdgeInsets.zero,
controller: scrollController,
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
return _buildGoodsCard(widget.models[index], index);
},
@ -417,33 +421,46 @@ showGoodsListDialog(
int initExplain,
int id,
}) {
showGeneralDialog(
showModalBottomSheet(
context: context,
pageBuilder: (context, animation, secondaryAnimation) {
return Align(
alignment: Alignment.bottomCenter,
child: GoodsListDialog(
models: models,
isLive: isLive,
onExplain: onExplain,
initExplain: initExplain,
id: id,
onLive: onLive,
),
builder: (context) {
return GoodsListDialog(
models: models,
isLive: isLive,
onExplain: onExplain,
initExplain: initExplain,
id: id,
onLive: onLive,
);
},
transitionBuilder: (context, animation, secondaryAnimation, child) {
return Transform.translate(
offset: Offset(
0, (1 - Curves.easeInOutCubic.transform(animation.value)) * 500),
child: child,
);
},
barrierColor: Colors.black26,
barrierLabel: 'label',
barrierDismissible: true,
transitionDuration: Duration(milliseconds: 500),
);
// showGeneralDialog(
// context: context,
// pageBuilder: (context, animation, secondaryAnimation) {
// return Align(
// alignment: Alignment.bottomCenter,
// child: GoodsListDialog(
// models: models,
// isLive: isLive,
// onExplain: onExplain,
// initExplain: initExplain,
// id: id,
// onLive: onLive,
// ),
// );
// },
// transitionBuilder: (context, animation, secondaryAnimation, child) {
// return Transform.translate(
// offset: Offset(
// 0, (1 - Curves.easeInOutCubic.transform(animation.value)) * 500),
// child: child,
// );
// },
// barrierColor: Colors.black26,
// barrierLabel: 'label',
// barrierDismissible: true,
// transitionDuration: Duration(milliseconds: 500),
// );
}
/**

Loading…
Cancel
Save