获取点赞数

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 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:flutter_redux/flutter_redux.dart';
import 'package:oktoast/oktoast.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/manager/user_manager.dart';
import 'package:recook/models/user_brief_info_model.dart'; import 'package:recook/models/user_brief_info_model.dart';
import 'package:recook/models/user_model.dart'; import 'package:recook/models/user_model.dart';
@ -39,20 +41,13 @@ void main() async {
//im //im
TencentImPlugin.init(appid: '1400435566'); TencentImPlugin.init(appid: '1400435566');
//
TencentLive.instance.init(
licenseUrl:
'http://license.vod2.myqcloud.com/license/v1/9bc083b7b7c2101699499d193c40921b/TXLiveSDK.licence',
licenseKey: 'cf903ae78afbb05b5128f8961bf08f64',
);
AppConfig.initial(useEncrypt: false AppConfig.initial(useEncrypt: false
/// ///
// useEncrypt: true // useEncrypt: true
); );
// //
bool isDebug = true; bool isDebug = false;
AppConfig.setDebug(isDebug); AppConfig.setDebug(isDebug);
bool inTest = Test.test(); bool inTest = Test.test();
@ -122,6 +117,16 @@ class MyAppState extends State<MyApp> {
// ShareSDKRegister register = ShareSDKRegister(); // ShareSDKRegister register = ShareSDKRegister();
// register.setupQQ("1109724223", "UGWklum7WWI03ll9"); // register.setupQQ("1109724223", "UGWklum7WWI03ll9");
// SharesdkPlugin.regist(register); // 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 { Future<void> initPlatformState() async {

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

@ -51,8 +51,11 @@ class _GoodsListDialogState extends State<GoodsListDialog> {
return DraggableScrollableSheet( return DraggableScrollableSheet(
minChildSize: 0.5, minChildSize: 0.5,
maxChildSize: 0.9, maxChildSize: 0.9,
initialChildSize: 0.5,
expand: false,
builder: (context, scrollController) { builder: (context, scrollController) {
return Column( return Column(
mainAxisSize: MainAxisSize.max,
children: [ children: [
Material( Material(
color: Colors.transparent, color: Colors.transparent,
@ -85,6 +88,7 @@ class _GoodsListDialogState extends State<GoodsListDialog> {
child: ListView.separated( child: ListView.separated(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
controller: scrollController, controller: scrollController,
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return _buildGoodsCard(widget.models[index], index); return _buildGoodsCard(widget.models[index], index);
}, },
@ -417,33 +421,46 @@ showGoodsListDialog(
int initExplain, int initExplain,
int id, int id,
}) { }) {
showGeneralDialog( showModalBottomSheet(
context: context, context: context,
pageBuilder: (context, animation, secondaryAnimation) { builder: (context) {
return Align( return GoodsListDialog(
alignment: Alignment.bottomCenter,
child: GoodsListDialog(
models: models, models: models,
isLive: isLive, isLive: isLive,
onExplain: onExplain, onExplain: onExplain,
initExplain: initExplain, initExplain: initExplain,
id: id, id: id,
onLive: onLive, 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