mod: 修改样式

This commit is contained in:
guozhigq
2023-07-13 14:16:55 +08:00
parent 0cbf777220
commit 180ba11089
6 changed files with 71 additions and 53 deletions

View File

@ -9,6 +9,7 @@ class LiveRoomController extends GetxController {
String cover = '';
late int roomId;
var liveItem;
late String heroTag;
MeeduPlayerController meeduPlayerController = MeeduPlayerController(
colorTheme: Theme.of(Get.context!).colorScheme.primary,
@ -22,6 +23,7 @@ class LiveRoomController extends GetxController {
super.onInit();
if (Get.arguments != null) {
var args = Get.arguments['liveItem'];
heroTag = Get.arguments['heroTag'];
liveItem = args;
roomId = liveItem.roomId!;
if (args.pic != null && args.pic != '') {

View File

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_meedu_media_kit/meedu_player.dart';
import 'package:get/get.dart';
@ -16,11 +18,29 @@ class LiveRoomPage extends StatefulWidget {
class _LiveRoomPageState extends State<LiveRoomPage> {
final LiveRoomController _liveRoomController = Get.put(LiveRoomController());
MeeduPlayerController? _meeduPlayerController;
StreamSubscription? _playerEventSubs;
bool isShowCover = true;
bool isPlay = true;
@override
void initState() {
super.initState();
_meeduPlayerController = _liveRoomController.meeduPlayerController;
_playerEventSubs = _meeduPlayerController!.onPlayerStatusChanged.listen(
(PlayerStatus status) {
if (status == PlayerStatus.playing) {
isShowCover = false;
setState(() {});
}
},
);
}
@override
void dispose() {
_meeduPlayerController!.dispose();
super.dispose();
}
@override
@ -57,53 +77,49 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
],
),
),
body: Stack(
body: Column(
children: [
Positioned(
top: 0,
left: 0,
right: 0,
child: NetworkImgLayer(
type: 'emote',
src: _liveRoomController.cover,
width: Get.size.width,
height: videoHeight + 45,
),
),
Positioned.fill(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container(
decoration: BoxDecoration(
color:
Theme.of(context).colorScheme.background.withOpacity(0.1),
Hero(
tag: _liveRoomController.heroTag,
child: Stack(
children: [
AspectRatio(
aspectRatio: 16 / 9,
child: MeeduVideoPlayer(
controller: _meeduPlayerController!,
),
),
Visibility(
visible: isShowCover,
child: Positioned(
top: 0,
left: 0,
right: 0,
child: NetworkImgLayer(
type: 'emote',
src: _liveRoomController.liveItem.cover,
width: Get.size.width,
height: videoHeight,
),
),
),
],
)),
if (_liveRoomController.liveItem.watchedShow != null)
Container(
height: 45,
padding: const EdgeInsets.only(left: 12, right: 12),
child: Row(children: [
Text(_liveRoomController.liveItem.watchedShow['text_large']),
]),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background,
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor.withOpacity(0.1)),
),
),
),
),
Scaffold(
backgroundColor: Colors.transparent,
body: Column(
children: [
AspectRatio(
aspectRatio: 16 / 9,
child: MeeduVideoPlayer(
controller: _meeduPlayerController!,
),
),
if (_liveRoomController.liveItem.watchedShow != null)
Container(
color: Theme.of(context).colorScheme.background,
height: 45,
padding: const EdgeInsets.only(left: 12, right: 12),
child: Row(children: [
Text(_liveRoomController
.liveItem.watchedShow['text_large']),
]),
),
],
),
)
],
),
);