feat: 搜索结果跳转直播

This commit is contained in:
guozhigq
2023-08-07 16:43:57 +08:00
parent d46cff80e1
commit 8aac1dd714
5 changed files with 74 additions and 60 deletions

View File

@ -224,10 +224,12 @@ class SearchLiveItemModel {
this.liveTime,
this.uname,
this.uface,
this.face,
this.userCover,
this.type,
this.title,
this.cover,
this.pic,
this.online,
this.rankIndex,
this.rankScore,
@ -242,16 +244,19 @@ class SearchLiveItemModel {
String? liveTime;
String? uname;
String? uface;
String? face;
String? userCover;
String? type;
List? title;
String? cover;
String? pic;
int? online;
int? rankIndex;
int? rankScore;
int? roomid;
int? attentions;
String? cateName;
Map? watchedShow;
SearchLiveItemModel.fromJson(Map<String, dynamic> json) {
rankOffset = json['rank_offset'];
@ -260,10 +265,12 @@ class SearchLiveItemModel {
liveTime = json['live_time'];
uname = json['uname'];
uface = json['uface'];
face = json['uface'];
userCover = json['user_cover'];
type = json['type'];
title = Em.regTitle(json['title']);
cover = json['cover'];
pic = json['cover'];
online = json['online'];
rankIndex = json['rank_index'];
rankScore = json['rank_score'];

View File

@ -31,6 +31,9 @@ class LiveRoomController extends GetxController {
liveItem = Get.arguments['liveItem'];
heroTag = Get.arguments['heroTag'] ?? '';
if (liveItem.pic != null && liveItem.pic != '') {
cover = liveItem.pic;
}
if (liveItem.cover != null && liveItem.cover != '') {
cover = liveItem.cover;
}
}

View File

@ -112,68 +112,67 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
],
),
),
if (_liveRoomController.liveItem.watchedShow != null)
Container(
height: 45,
padding: const EdgeInsets.only(left: 12, right: 12),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background,
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor.withOpacity(0.1)),
Container(
height: 45,
padding: const EdgeInsets.only(left: 12, right: 12),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background,
border: Border(
bottom: BorderSide(
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,
),
),
),
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,
),
),
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(plPlayerController!.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: () => {},
// plPlayerController!.goToFullscreen(context),
icon: const Icon(
Icons.fullscreen,
),
),
SizedBox(
width: 38,
height: 38,
child: IconButton(
onPressed: () => _liveRoomController
.setVolumn(plPlayerController!.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: () => {},
// plPlayerController!.goToFullscreen(context),
icon: const Icon(
Icons.fullscreen,
),
),
),
]),
),
),
]),
),
],
),
);

View File

@ -211,13 +211,13 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
return Obx(
() => Container(
width: double.infinity,
padding: const EdgeInsets.fromLTRB(10, 25, 4, 0),
padding: const EdgeInsets.fromLTRB(10, 25, 6, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (_searchController.historyList.isNotEmpty)
Padding(
padding: const EdgeInsets.fromLTRB(6, 0, 1, 2),
padding: const EdgeInsets.fromLTRB(6, 0, 0, 2),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/constants.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/utils/utils.dart';
@ -32,6 +33,7 @@ class LiveItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
String heroTag = Utils.makeHeroTag(liveItem.roomid);
return Card(
elevation: 0,
clipBehavior: Clip.hardEdge,
@ -40,7 +42,10 @@ class LiveItem extends StatelessWidget {
),
margin: EdgeInsets.zero,
child: InkWell(
onTap: () {},
onTap: () async {
Get.toNamed('/liveRoom?roomid=${liveItem.roomid}',
arguments: {'liveItem': liveItem, 'heroTag': heroTag});
},
child: Column(
children: [
ClipRRect(
@ -58,7 +63,7 @@ class LiveItem extends StatelessWidget {
return Stack(
children: [
Hero(
tag: Utils.makeHeroTag(liveItem.roomid),
tag: heroTag,
child: NetworkImgLayer(
src: liveItem.cover,
type: 'emote',