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

@ -576,6 +576,7 @@ class DynamicLiveModel {
String? areaName;
String? title;
int? liveStartTime;
Map? watchedShow;
DynamicLiveModel.fromJson(Map<String, dynamic> json) {
content = json['content'];
@ -594,6 +595,7 @@ class DynamicLiveModel {
areaName = livePlayInfo['area_name'];
title = livePlayInfo['title'];
liveStartTime = livePlayInfo['live_start_time'];
watchedShow = livePlayInfo['watched_show'];
}
}
}

View File

@ -140,13 +140,6 @@ class _DynamicsPageState extends State<DynamicsPage>
thumbDecoration: BoxDecoration(
color: Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.circular(20),
border: Border.all(
width: 1,
color: Theme.of(context)
.colorScheme
.surfaceVariant
.withOpacity(0.7),
),
),
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,

View File

@ -13,8 +13,9 @@ final DynamicsController _dynamicsController = Get.put(DynamicsController());
Widget liveRcmdPanel(item, context, {floor = 1}) {
TextStyle authorStyle =
TextStyle(color: Theme.of(context).colorScheme.primary);
int liveStatus = item.modules.moduleDynamic.major.liveRcmd.liveStatus;
DynamicLiveModel liveRcmd = item.modules.moduleDynamic.major.liveRcmd;
int liveStatus = liveRcmd.liveStatus!;
Map watchedShow = liveRcmd.watchedShow!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -74,6 +75,8 @@ Widget liveRcmdPanel(item, context, {floor = 1}) {
src: item.modules.moduleDynamic.major.liveRcmd.cover,
),
),
pBadge(watchedShow['text_large'], context, 6, 56, null, null,
type: 'gray'),
pBadge(
liveStatus == 1 ? '直播中' : '直播结束', context, 6, 6, null, null),
Positioned(

View File

@ -94,7 +94,7 @@ Widget videoSeasonWidget(item, context, type, {floor = 1}) {
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
gradient: const LinearGradient(
begin: Alignment.topCenter,
begin: Alignment.center,
end: Alignment.bottomCenter,
colors: <Color>[
Colors.transparent,
@ -115,7 +115,9 @@ Widget videoSeasonWidget(item, context, type, {floor = 1}) {
color: Colors.white),
child: Row(
children: [
Text(content.durationText ?? ''),
pBadge(content.durationText ?? '', context, null,
null, 0, 0,
type: 'gray'),
if (content.durationText != null)
const SizedBox(width: 10),
Text(content.stat.play + '次围观'),

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']),
]),
),
],
),
)
],
),
);