From 6e0ed83332a80e4e6a9059f2764ab99c1f8df5fd Mon Sep 17 00:00:00 2001 From: laiiihz Date: Wed, 28 Oct 2020 10:30:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BD=95=E6=92=AD=E5=BC=80?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 2 + .../live/live_stream/live_blur_page.dart | 45 ++++++++++++++++++- lib/pages/live/live_stream/live_page.dart | 3 +- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 63c8529..59856bb 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -535,4 +535,6 @@ class LiveAPI { ///直播同意协议 static const String liveAgree = '/v1/live/live/agree'; + + static const String recordLive = '/v1/live/live/transcribe'; } diff --git a/lib/pages/live/live_stream/live_blur_page.dart b/lib/pages/live/live_stream/live_blur_page.dart index c822ab0..4631fdf 100644 --- a/lib/pages/live/live_stream/live_blur_page.dart +++ b/lib/pages/live/live_stream/live_blur_page.dart @@ -1,5 +1,6 @@ import 'dart:ui'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:recook/constants/api.dart'; import 'package:recook/constants/header.dart'; @@ -35,6 +36,7 @@ class LiveBlurPage extends StatefulWidget { class _LiveBlurPageState extends State { bool _isAttention = false; + bool _saveVideo = false; @override void initState() { super.initState(); @@ -142,7 +144,8 @@ class _LiveBlurPageState extends State { endIndent: rSize(16), ), GridView( - padding: EdgeInsets.symmetric(horizontal: rSize(54)), + padding: EdgeInsets.symmetric( + horizontal: rSize(54), vertical: 0), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3), children: [ @@ -157,7 +160,38 @@ class _LiveBlurPageState extends State { physics: NeverScrollableScrollPhysics(), shrinkWrap: true, ), - rHBox(82), + Divider( + height: rSize(40), + thickness: rSize(1), + color: Colors.white.withOpacity(0.06), + indent: rSize(16), + endIndent: rSize(16), + ), + Row( + children: [ + Spacer(), + Text( + '直播保存', + style: TextStyle( + color: Colors.white, + fontSize: rSP(16), + ), + ), + rWBox(20), + CupertinoSwitch( + value: _saveVideo, + onChanged: (state) { + setState(() { + _saveVideo = !_saveVideo; + }); + }, + activeColor: Color(0xFFDB2D2D), + trackColor: Color(0x99D8D8D8), + ), + rWBox(45), + ], + ), + rHBox(32), MaterialButton( height: rSize(40), minWidth: rSize(209), @@ -169,6 +203,12 @@ class _LiveBlurPageState extends State { ), ), onPressed: () { + if (_saveVideo) + HttpManager.post(LiveAPI.recordLive, { + 'liveItemId': widget.streamModel.id, + }).then((result) { + print(result); + }); Navigator.pop(context); }, color: Color(0xFFDB2D2D), @@ -256,6 +296,7 @@ class _LiveBlurPageState extends State { _buildColumn(String title, String subTitle) { return Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ Text( title, diff --git a/lib/pages/live/live_stream/live_page.dart b/lib/pages/live/live_stream/live_page.dart index a72b88b..94fa866 100644 --- a/lib/pages/live/live_stream/live_page.dart +++ b/lib/pages/live/live_stream/live_page.dart @@ -689,12 +689,13 @@ class _LivePageState extends State { if (resultData?.data['data'] == null) Navigator.pop(context); else { - CRoute.transparent( + CRoute.pushReplace( context, LiveBlurPage( context: context, isLive: true, exitModel: LiveExitModel.fromJson(resultData.data['data']), + streamModel: _streamInfoModel, )); } });