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

View File

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

View File

@ -112,7 +112,6 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
], ],
), ),
), ),
if (_liveRoomController.liveItem.watchedShow != null)
Container( Container(
height: 45, height: 45,
padding: const EdgeInsets.only(left: 12, right: 12), padding: const EdgeInsets.only(left: 12, right: 12),

View File

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

View File

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