diff --git a/lib/pages/live/activity/activity_preview_page.dart b/lib/pages/live/activity/activity_preview_page.dart index 816668d..49493eb 100644 --- a/lib/pages/live/activity/activity_preview_page.dart +++ b/lib/pages/live/activity/activity_preview_page.dart @@ -241,7 +241,10 @@ class _ActivityPreviewPageState extends State { child: Row( children: [ LiveUserBar( - initAttention: widget.model.isPraise == 1, + initAttention: widget.userModel.userId == + UserManager.instance.user.info.id + ? true + : widget.model.isPraise == 1, onAttention: () { HttpManager.post( LiveAPI.addFollow, diff --git a/lib/pages/live/live_stream/live_page.dart b/lib/pages/live/live_stream/live_page.dart index b276356..a58f157 100644 --- a/lib/pages/live/live_stream/live_page.dart +++ b/lib/pages/live/live_stream/live_page.dart @@ -568,7 +568,7 @@ class _LivePageState extends State with WidgetsBindingObserver { context: context, builder: (context) { return Material( - color: Colors.black, + color: Colors.white, child: Row( children: [ CustomImageButton( @@ -580,7 +580,7 @@ class _LivePageState extends State with WidgetsBindingObserver { liveId: liveItemId, title: '好友${_streamInfoModel.nickname}正在瑞库客直播,快来一起看看😘', - des: '', + des: '让消费服务生活,让生活充满精致', headUrl: _streamInfoModel.headImgUrl, ); } else { @@ -601,7 +601,30 @@ class _LivePageState extends State with WidgetsBindingObserver { Text( '微信分享', style: TextStyle( - color: Colors.white, + color: Color(0xFF333333), + fontSize: rSP(14), + ), + ), + ], + ), + ), + CustomImageButton( + onPressed: () { + Navigator.pop(context); + ShareTool().clipBoard(liveId: liveItemId); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Image.asset( + ShareToolIcon.copyurl, + width: rSize(40), + height: rSize(40), + ), + Text( + '复制链接', + style: TextStyle( + color: Color(0xFF333333), fontSize: rSP(14), ), ), @@ -679,56 +702,56 @@ class _LivePageState extends State with WidgetsBindingObserver { }, )); }), - _buildVerticalButton(R.ASSETS_LIVE_ALL_SHARE_PNG, '分享', () { - showModalBottomSheet( - context: context, - builder: (context) { - return Material( - color: Colors.black, - child: Row( - children: [ - CustomImageButton( - onPressed: () { - if (UserManager.instance.haveLogin) { - Navigator.pop(context); - ShareTool().liveShare( - context, - liveId: liveItemId, - title: - '好友${_streamInfoModel.nickname}正在瑞库客直播,快来一起看看😘', - des: '', - headUrl: _streamInfoModel.headImgUrl, - ); - } else { - showToast('未登陆,请先登陆'); - CRoute.push(context, UserPage()); - } - }, - padding: EdgeInsets.all(rSize(15)), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Image.asset( - R.ASSETS_SHARE_BOTTOM_SHARE_BOTTOM_WECHAT_PNG, - height: rSize(40), - width: rSize(40), - ), - rHBox(10), - Text( - '微信分享', - style: TextStyle( - color: Colors.white, - fontSize: rSP(14), - ), - ), - ], - ), - ), - ], - ), - ); - }); - }), + // _buildVerticalButton(R.ASSETS_LIVE_ALL_SHARE_PNG, '分享', () { + // showModalBottomSheet( + // context: context, + // builder: (context) { + // return Material( + // color: Colors.black, + // child: Row( + // children: [ + // CustomImageButton( + // onPressed: () { + // if (UserManager.instance.haveLogin) { + // Navigator.pop(context); + // ShareTool().liveShare( + // context, + // liveId: liveItemId, + // title: + // '好友${_streamInfoModel.nickname}正在瑞库客直播,快来一起看看😘', + // des: '', + // headUrl: _streamInfoModel.headImgUrl, + // ); + // } else { + // showToast('未登陆,请先登陆'); + // CRoute.push(context, UserPage()); + // } + // }, + // padding: EdgeInsets.all(rSize(15)), + // child: Column( + // mainAxisSize: MainAxisSize.min, + // children: [ + // Image.asset( + // R.ASSETS_SHARE_BOTTOM_SHARE_BOTTOM_WECHAT_PNG, + // height: rSize(40), + // width: rSize(40), + // ), + // rHBox(10), + // Text( + // '微信分享', + // style: TextStyle( + // color: Colors.white, + // fontSize: rSP(14), + // ), + // ), + // ], + // ), + // ), + // ], + // ), + // ); + // }); + // }), ], ), ), @@ -747,15 +770,23 @@ class _LivePageState extends State with WidgetsBindingObserver { title: UserManager.instance.user.info.nickname, subTitle: '点赞数$_praise', onTapAvatar: () { - showLiveChild( - context, - initAttention: true, - title: _streamInfoModel.nickname, - fans: _liveBaseInfoModel.fans, - follows: _liveBaseInfoModel.follows, - headImg: _liveBaseInfoModel.headImgUrl, - id: _liveBaseInfoModel.userId, - ); + HttpManager.post(LiveAPI.baseInfo, { + 'findUserId': _streamInfoModel.userId, + }).then((resultData) { + if (resultData?.data['data'] != null) { + _liveBaseInfoModel = + LiveBaseInfoModel.fromJson(resultData.data['data']); + } + showLiveChild( + context, + initAttention: true, + title: _streamInfoModel.nickname, + fans: _liveBaseInfoModel.fans, + follows: _liveBaseInfoModel.follows, + headImg: _liveBaseInfoModel.headImgUrl, + id: _liveBaseInfoModel.userId, + ); + }); }, avatar: Api.getImgUrl(UserManager.instance.user.info.headImgUrl), diff --git a/lib/pages/live/live_stream/live_stream_view_page.dart b/lib/pages/live/live_stream/live_stream_view_page.dart index 017eed5..c5003ee 100644 --- a/lib/pages/live/live_stream/live_stream_view_page.dart +++ b/lib/pages/live/live_stream/live_stream_view_page.dart @@ -307,12 +307,11 @@ class _LiveStreamViewPageState extends State { reconnectToLive() { _liveTimer?.cancel(); _liveTimer = Timer(Duration(milliseconds: 5000), () { - _livePlayer.isPlaying().then((value) { - setState(() { - _waitSignal = !value; - }); + setState(() { + _waitSignal = true; }); // _livePlayer.push + _livePlayer.stopPlay(); _livePlayer.startPlay(_streamInfoModel.playUrl, type: PlayType.RTMP); }); } @@ -426,7 +425,9 @@ class _LiveStreamViewPageState extends State { print(''); }, onEventPlayBegin: () { - print('1'); + setState(() { + _waitSignal = false; + }); }, onEventPlayEnd: () { print('`'); diff --git a/lib/pages/live/live_stream/show_goods_list.dart b/lib/pages/live/live_stream/show_goods_list.dart index 72ef3e3..91f8bdf 100644 --- a/lib/pages/live/live_stream/show_goods_list.dart +++ b/lib/pages/live/live_stream/show_goods_list.dart @@ -227,25 +227,27 @@ class _GoodsListDialogState extends State { children: [ SmallCouponWidget(number: num.parse(model.coupon)), rWBox(4), - Container( - height: rSize(18), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(rSize(1)), - border: Border.all( - color: Color(0xFFCC1B4F), - width: rSize(0.5), - ), - ), - child: Text( - '赚${model.commission}', - style: TextStyle( - color: Color(0xFFCC1B4F), - fontSize: rSP(12), - height: 1, - ), - ), - ), + AppConfig.getShowCommission() + ? Container( + height: rSize(18), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(rSize(1)), + border: Border.all( + color: Color(0xFFCC1B4F), + width: rSize(0.5), + ), + ), + child: Text( + '赚${model.commission}', + style: TextStyle( + color: Color(0xFFCC1B4F), + fontSize: rSP(12), + height: 1, + ), + ), + ) + : SizedBox(), Spacer(), Text( '剩余', diff --git a/lib/pages/live/live_stream/widget/live_chat_box.dart b/lib/pages/live/live_stream/widget/live_chat_box.dart index 433473b..e2d0a12 100644 --- a/lib/pages/live/live_stream/widget/live_chat_box.dart +++ b/lib/pages/live/live_stream/widget/live_chat_box.dart @@ -32,12 +32,7 @@ class LiveChatBox extends StatefulWidget { class _LiveChatBoxState extends State { @override Widget build(BuildContext context) { - final Color color = Color.fromRGBO( - 180 + Random().nextInt(55), - 180 + Random().nextInt(55), - 180 + Random().nextInt(55), - 1, - ); + final Color color = Colors.white; return Container( padding: EdgeInsets.symmetric(vertical: rSize(5 / 2)), alignment: Alignment.centerLeft, @@ -61,6 +56,7 @@ class _LiveChatBoxState extends State { style: TextStyle( color: Colors.white, fontSize: rSP(13), + fontWeight: FontWeight.bold, ), ), ]), diff --git a/lib/pages/live/pages/discovery_page.dart b/lib/pages/live/pages/discovery_page.dart index df5a52d..575cd26 100644 --- a/lib/pages/live/pages/discovery_page.dart +++ b/lib/pages/live/pages/discovery_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:recook/constants/header.dart'; import 'package:recook/constants/styles.dart'; import 'package:recook/manager/user_manager.dart'; +import 'package:recook/pages/business/focus/child_focus_page.dart'; import 'package:recook/pages/business/recommend/child_recommend_page.dart'; import 'package:recook/pages/live/sub_page/live_stream_page.dart'; import 'package:recook/pages/live/sub_page/user_home_page.dart'; @@ -104,7 +105,7 @@ class _DiscoveryPageState extends State children: [ LiveStreamPage(), VideoPage(), - RecommendPage(), + FocusPage(), ], )), ], diff --git a/lib/pages/live/pages/goods_window_page.dart b/lib/pages/live/pages/goods_window_page.dart index 38a3fe7..ef737f9 100644 --- a/lib/pages/live/pages/goods_window_page.dart +++ b/lib/pages/live/pages/goods_window_page.dart @@ -1,7 +1,9 @@ +import 'package:extended_image/extended_image.dart'; import 'package:flutter/material.dart'; import 'package:recook/constants/api.dart'; import 'package:recook/constants/header.dart'; import 'package:recook/manager/http_manager.dart'; +import 'package:recook/pages/goods/small_coupon_widget.dart'; import 'package:recook/pages/home/classify/commodity_detail_page.dart'; import 'package:recook/pages/live/models/goods_window_model.dart'; import 'package:recook/pages/user/widget/recook_check_box.dart'; @@ -43,6 +45,7 @@ class _GoodsWindowPageState extends State { @override Widget build(BuildContext context) { return RecookScaffold( + whiteBg: true, title: '商品橱窗', body: Column( children: [ @@ -211,7 +214,7 @@ class _GoodsWindowPageState extends State { _buildGoodsCard(GoodsList model) { return Container( padding: EdgeInsets.symmetric(vertical: rSize(15 / 2)), - height: rSize(86 + 15.0), + height: rSize(120 + 15.0), child: FlatButton( splashColor: Colors.black26, onPressed: _isManager @@ -242,8 +245,8 @@ class _GoodsWindowPageState extends State { child: FadeInImage.assetNetwork( placeholder: R.ASSETS_PLACEHOLDER_NEW_1X1_A_PNG, image: Api.getImgUrl(model.mainPhotoUrl), - height: rSize(86), - width: rSize(86), + height: rSize(120), + width: rSize(120), ), ), rWBox(10), @@ -261,6 +264,113 @@ class _GoodsWindowPageState extends State { fontSize: rSP(14), ), ), + Container( + width: double.infinity, + height: 25, + color: Colors.white, + child: Row( + children: [ + Container( + width: 13 * 1.5, + height: 13 * 1.5, + child: TextUtils.isEmpty(model.brandImg) + ? SizedBox() + : ExtendedImage.network( + Api.getImgUrl(model.brandImg), + fit: BoxFit.fill, + ), + ), + SizedBox( + width: 4, + ), + Text( + TextUtils.isEmpty(model.brandName) + ? "" + : model.brandName, + style: TextStyle( + color: Color(0xffc70404), + fontSize: ScreenAdapterUtils.setSp(12), + ), + ), + ], + ), + ), + Container( + child: Stack( + children: [ + Row( + children: [ + (model.coupon != null && model.coupon != '0') + ? Container( + margin: EdgeInsets.only(right: 5), + child: SmallCouponWidget( + height: 18, + number: num.parse(model.coupon), + ), + ) + : SizedBox(), + AppConfig.commissionByRoleLevel + ? Container( + child: Stack( + alignment: Alignment.center, + children: [ + Container( + margin: + EdgeInsets.symmetric(vertical: 2), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + border: Border.all( + color: Color(0xffec294d), + width: 0.5, + )), + padding: EdgeInsets.symmetric( + horizontal: 3), + child: Text( + "赚" + model.commission, + style: TextStyle( + color: Colors.white.withAlpha(0), + fontSize: + ScreenAdapterUtils.setSp(12), + ), + ), + ), + AppConfig.getShowCommission() + ? Container( + alignment: Alignment.center, + child: Text( + "赚" + model.commission, + style: TextStyle( + color: Color(0xffeb0045), + fontSize: ScreenAdapterUtils + .setSp(12), + ), + ), + ) + : SizedBox(), + ], + ), + ) + : SizedBox(), + Spacer(), + ], + ), + Positioned( + right: 0, + bottom: 0, + top: 0, + child: Text( + "已售${model.salesVolume}件", + style: TextStyle( + color: Color(0xff595757), + fontSize: ScreenAdapterUtils.setSp(12), + ), + ), + ), + ], + ), + ), Spacer(), Row( children: [ @@ -271,15 +381,17 @@ class _GoodsWindowPageState extends State { fontSize: rSP(14), ), ), - model.commission == '0' - ? SizedBox() - : Text( - '/赚${model.commission}', - style: TextStyle( - color: Color(0xFFC92219), - fontSize: rSP(14), - ), - ), + AppConfig.getShowCommission() + ? model.commission == '0' + ? SizedBox() + : Text( + '/赚${model.commission}', + style: TextStyle( + color: Color(0xFFC92219), + fontSize: rSP(14), + ), + ) + : SizedBox(), ], ), ], diff --git a/lib/pages/live/video/video_advance_page.dart b/lib/pages/live/video/video_advance_page.dart index d83575e..e58dae8 100644 --- a/lib/pages/live/video/video_advance_page.dart +++ b/lib/pages/live/video/video_advance_page.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; +import 'package:oktoast/oktoast.dart'; import 'package:recook/constants/constants.dart'; import 'package:recook/constants/header.dart'; import 'package:recook/pages/live/video/upload_video_page.dart'; @@ -80,6 +81,9 @@ class _VideoAdvancePageState extends State { .then((file) { if (file != null) { _coverFile = File(file.path); + showToast('封面选择完成'); + } else { + showToast('未选择封面'); } }); }, diff --git a/lib/utils/date/recook_date_util.dart b/lib/utils/date/recook_date_util.dart index 028e957..f1a96b9 100644 --- a/lib/utils/date/recook_date_util.dart +++ b/lib/utils/date/recook_date_util.dart @@ -52,9 +52,11 @@ class RecookDateUtil { bool get isYesterday => isSameMonth && now.day == (dateTime.day + 1); String get humanDate { - if (isSameMinute) - return '${now.second - dateTime.second}秒前'; - else if (isSameHour) + // if (isSameMinute) + // return '${now.second - dateTime.second}秒前'; + // else + if (isSameMinute && dateTime.second < 60) return '刚刚'; + if (isSameHour) return '${now.minute - dateTime.minute}分钟前'; else if (isToday) return '${now.hour - dateTime.hour}小时前'; diff --git a/lib/utils/share_tool.dart b/lib/utils/share_tool.dart index c9d85b2..1bc1250 100644 --- a/lib/utils/share_tool.dart +++ b/lib/utils/share_tool.dart @@ -93,6 +93,19 @@ class ShareTool { ); } + clipBoard({ + BuildContext context, + @required int liveId, + }) { + String baseUrl = "${AppConfig.debug ? WebApi.testLiveUrl : WebApi.liveUrl}"; + ClipboardData data = new ClipboardData(text: '$baseUrl$liveId'); + Clipboard.setData(data); + Toast.showCustomSuccess( + '链接复制成功', + delayedDuration: Duration(seconds: 0), + ); + } + goodsShare(BuildContext context, {String goodsName = "", String goodsDescription = "",