停止直播弹框

master
laiiihz 4 years ago
parent c7223d0bd1
commit 1ff08255bb

@ -136,9 +136,25 @@ class _LivePageState extends State<LivePage> with WidgetsBindingObserver {
super.dispose();
}
Future<bool> checkPop() async {
return await showDialog(
context: context,
child: NormalTextDialog(
title: '确认停止直播间吗',
content: '',
items: ['确认'],
deleteItem: '取消',
type: NormalTextDialogType.delete,
listener: (_) => Navigator.pop(context, true),
deleteListener: () => Navigator.pop(context),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
return WillPopScope(
child: Scaffold(
backgroundColor: Colors.grey,
body: Stack(
children: [
@ -462,7 +478,8 @@ class _LivePageState extends State<LivePage> with WidgetsBindingObserver {
_praise = model.praise;
});
TencentImPlugin.applyJoinGroup(
groupId: model.groupId, reason: 'enterLive');
groupId: model.groupId,
reason: 'enterLive');
TencentImPlugin.addListener(parseMessage);
group = TencentGroupTool.fromId(model.groupId);
}
@ -733,7 +750,8 @@ class _LivePageState extends State<LivePage> with WidgetsBindingObserver {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
_buildVerticalButton(R.ASSETS_LIVE_FLIP_CAM_PNG, '翻转', () {
_buildVerticalButton(R.ASSETS_LIVE_FLIP_CAM_PNG, '翻转',
() {
_livePusher.switchCamera();
}),
_buildVerticalButton(R.ASSETS_LIVE_WHITE_CART_PNG, '商品',
@ -819,8 +837,8 @@ class _LivePageState extends State<LivePage> with WidgetsBindingObserver {
'findUserId': _streamInfoModel.userId,
}).then((resultData) {
if (resultData?.data['data'] != null) {
_liveBaseInfoModel =
LiveBaseInfoModel.fromJson(resultData.data['data']);
_liveBaseInfoModel = LiveBaseInfoModel.fromJson(
resultData.data['data']);
}
showLiveChild(
context,
@ -833,8 +851,8 @@ class _LivePageState extends State<LivePage> with WidgetsBindingObserver {
);
});
},
avatar:
Api.getImgUrl(UserManager.instance.user.info.headImgUrl),
avatar: Api.getImgUrl(
UserManager.instance.user.info.headImgUrl),
),
Spacer(),
MorePeople(
@ -933,8 +951,8 @@ class _LivePageState extends State<LivePage> with WidgetsBindingObserver {
children: [
Container(
child: FadeInImage.assetNetwork(
placeholder:
R.ASSETS_PLACEHOLDER_NEW_1X1_A_PNG,
placeholder: R
.ASSETS_PLACEHOLDER_NEW_1X1_A_PNG,
image: Api.getImgUrl(
nowGoodList.mainPhotoUrl,
),
@ -996,6 +1014,12 @@ class _LivePageState extends State<LivePage> with WidgetsBindingObserver {
),
],
),
),
onWillPop: () async {
bool result = (await checkPop()) == true;
if (result) _stopLive();
return false;
},
);
}

Loading…
Cancel
Save