mod: 直播详情页样式修改

This commit is contained in:
guozhigq
2023-07-19 19:14:52 +08:00
parent 70a35deefc
commit 5abb483b2b
4 changed files with 111 additions and 9 deletions

View File

@ -90,7 +90,7 @@ class LiveContent extends StatelessWidget {
return Expanded( return Expanded(
child: Padding( child: Padding(
// 多列 // 多列
padding: const EdgeInsets.fromLTRB(8, 8, 6, 4), padding: const EdgeInsets.fromLTRB(8, 7, 6, 4),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [

View File

@ -10,11 +10,14 @@ class LiveRoomController extends GetxController {
late int roomId; late int roomId;
var liveItem; var liveItem;
late String heroTag; late String heroTag;
double volume = 0.0;
// 静音状态
RxBool volumeOff = false.obs;
MeeduPlayerController meeduPlayerController = MeeduPlayerController( MeeduPlayerController meeduPlayerController = MeeduPlayerController(
colorTheme: Theme.of(Get.context!).colorScheme.primary, colorTheme: Theme.of(Get.context!).colorScheme.primary,
pipEnabled: true, pipEnabled: true,
controlsStyle: ControlsStyle.youtube, controlsStyle: ControlsStyle.live,
enabledButtons: const EnabledButtons(pip: true), enabledButtons: const EnabledButtons(pip: true),
); );
@ -45,6 +48,7 @@ class LiveRoomController extends GetxController {
), ),
autoplay: true, autoplay: true,
); );
volume = meeduPlayerController.volume.value;
} }
Future queryLiveInfo() async { Future queryLiveInfo() async {
@ -59,4 +63,18 @@ class LiveRoomController extends GetxController {
playerInit(videoUrl); playerInit(videoUrl);
} }
} }
void setVolumn(value) {
if (value == 0) {
// 设置音量
volumeOff.value = false;
meeduPlayerController.setVolume(volume);
} else {
// 取消音量
volume = value;
volumeOff.value = true;
meeduPlayerController.setVolume(0);
}
print('🌹:${volumeOff.value}');
}
} }

View File

@ -69,13 +69,20 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
_liveRoomController.liveItem.uname, _liveRoomController.liveItem.uname,
style: const TextStyle(fontSize: 14), style: const TextStyle(fontSize: 14),
), ),
const SizedBox(height: 3), const SizedBox(height: 1),
Text(_liveRoomController.liveItem.title, Text(_liveRoomController.liveItem.watchedShow['text_large'],
style: const TextStyle(fontSize: 12)), style: const TextStyle(fontSize: 12)),
], ],
) ),
], ],
), ),
actions: [
SizedBox(
height: 34,
child: ElevatedButton(onPressed: () {}, child: const Text('关注')),
),
const SizedBox(width: 12),
],
), ),
body: Column( body: Column(
children: [ children: [
@ -86,6 +93,36 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
AspectRatio( AspectRatio(
aspectRatio: 16 / 9, aspectRatio: 16 / 9,
child: MeeduVideoPlayer( child: MeeduVideoPlayer(
header: (BuildContext context,
MeeduPlayerController _meeduPlayerController,
Responsive) {
return AppBar(
backgroundColor: Colors.transparent,
primary: false,
elevation: 0,
scrolledUnderElevation: 0,
foregroundColor: Colors.white,
automaticallyImplyLeading: false,
centerTitle: false,
title: Text(_liveRoomController.liveItem.title,
style: const TextStyle(fontSize: 12)),
actions: [
SizedBox(
width: 38,
height: 38,
child: IconButton(
onPressed: () =>
_meeduPlayerController.enterPip(context),
icon: const Icon(
Icons.branding_watermark_outlined,
size: 19,
),
),
),
const SizedBox(width: 12)
],
);
},
controller: _meeduPlayerController!, controller: _meeduPlayerController!,
), ),
), ),
@ -110,9 +147,6 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
Container( Container(
height: 45, height: 45,
padding: const EdgeInsets.only(left: 12, right: 12), padding: const EdgeInsets.only(left: 12, right: 12),
child: Row(children: [
Text(_liveRoomController.liveItem.watchedShow['text_large']),
]),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
border: Border( border: Border(
@ -120,6 +154,56 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
color: Theme.of(context).dividerColor.withOpacity(0.1)), color: Theme.of(context).dividerColor.withOpacity(0.1)),
), ),
), ),
child: Row(children: <Widget>[
// SizedBox(
// width: 38,
// height: 38,
// child: IconButton(
// onPressed: () {},
// icon: const Icon(
// Icons.subtitles_outlined,
// size: 21,
// ),
// ),
// ),
const Spacer(),
// SizedBox(
// width: 38,
// height: 38,
// child: IconButton(
// onPressed: () {},
// icon: const Icon(
// Icons.hd_outlined,
// size: 20,
// ),
// ),
// ),
SizedBox(
width: 38,
height: 38,
child: IconButton(
onPressed: () => _liveRoomController
.setVolumn(_meeduPlayerController!.volume.value),
icon: Obx(() => Icon(
_liveRoomController.volumeOff.value
? Icons.volume_off_outlined
: Icons.volume_up_outlined,
size: 21,
)),
),
),
SizedBox(
width: 38,
height: 38,
child: IconButton(
onPressed: () =>
_meeduPlayerController!.goToFullscreen(context),
icon: const Icon(
Icons.fullscreen,
),
),
),
]),
), ),
], ],
), ),

View File

@ -424,7 +424,7 @@ packages:
description: description:
path: package path: package
ref: feature-custom ref: feature-custom
resolved-ref: ea73de29401ab35126ef3eac68270b2e6c3ef4e0 resolved-ref: "3b879c2ea736ade61236f82d5009230e054db5dd"
url: "https://github.com/guozhigq/flutter_meedu_media_kit.git" url: "https://github.com/guozhigq/flutter_meedu_media_kit.git"
source: git source: git
version: "4.2.12" version: "4.2.12"