Skip to content

Commit

Permalink
TV直播卡片支持显示人气
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyaocz committed Mar 13, 2024
1 parent 0f22c11 commit 9f989de
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:simple_live_tv_app/app/app_focus_node.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class CategoryDetailController extends BasePageController<LiveRoomItemExt> {
title: e.title,
cover: e.cover,
userName: e.userName,
online: e.online,
),
)
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class CategoryDetailPage extends GetView<CategoryDetailController> {
title: item.title,
focusNode: item.focusNode,
roomId: item.roomId,
online: item.online,
onTap: () {
AppNavigator.toLiveRoomDetail(
site: controller.site,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class HotliveController extends BasePageController<LiveRoomItemExt> {
title: e.title,
cover: e.cover,
userName: e.userName,
online: e.online,
))
.toList();
}
Expand All @@ -57,6 +58,7 @@ class LiveRoomItemExt extends LiveRoomItem {
required super.title,
required super.cover,
required super.userName,
super.online = 0,
});

AppFocusNode focusNode = AppFocusNode();
Expand Down
1 change: 1 addition & 0 deletions simple_live_tv_app/lib/modules/hot_live/hot_live_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class HotLivePage extends GetView<HotliveController> {
title: item.title,
focusNode: item.focusNode,
roomId: item.roomId,
online: item.online,
onTap: () {
AppNavigator.toLiveRoomDetail(
site: controller.site,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class SearchRoomController extends BasePageController<LiveRoomItemExt> {
title: e.title,
cover: e.cover,
userName: e.userName,
online: e.online,
))
.toList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class SearchRoomPage extends GetView<SearchRoomController> {
title: item.title,
focusNode: item.focusNode,
roomId: item.roomId,
online: item.online,
onTap: () {
AppNavigator.toLiveRoomDetail(
site: controller.site,
Expand Down
62 changes: 56 additions & 6 deletions simple_live_tv_app/lib/widgets/card/live_room_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:simple_live_tv_app/app/app_focus_node.dart';
import 'package:simple_live_tv_app/app/app_style.dart';
import 'package:simple_live_tv_app/app/utils.dart';
import 'package:simple_live_tv_app/widgets/highlight_widget.dart';
import 'package:simple_live_tv_app/widgets/net_image.dart';
import 'package:marquee/marquee.dart';
Expand All @@ -12,6 +13,7 @@ class LiveRoomCard extends StatelessWidget {
final String title;
final String anchor;
final String roomId;
final int online;
final bool autofocus;
final AppFocusNode focusNode;
final Function()? onTap;
Expand All @@ -21,6 +23,7 @@ class LiveRoomCard extends StatelessWidget {
required this.anchor,
required this.roomId,
required this.focusNode,
required this.online,
this.autofocus = false,
this.onTap,
super.key,
Expand All @@ -42,12 +45,59 @@ class LiveRoomCard extends StatelessWidget {
topLeft: Radius.circular(16.w),
topRight: Radius.circular(16.w),
),
child: AspectRatio(
aspectRatio: 16 / 9,
child: NetImage(
cover,
cacheWidth: 400,
),
child: Stack(
children: [
AspectRatio(
aspectRatio: 16 / 9,
child: NetImage(
cover,
cacheWidth: 400,
),
),
Positioned(
right: 8.w,
top: 8.w,
child: Container(
padding:
AppStyle.edgeInsetsH8.copyWith(top: 4.w, bottom: 4.w),
decoration: BoxDecoration(
color: focusNode.isFoucsed.value
? Colors.white
: Colors.black54,
borderRadius: AppStyle.radius8,
),
child: Text.rich(
TextSpan(
text: "",
children: [
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Padding(
padding: AppStyle.edgeInsetsR8,
child: Icon(
Icons.whatshot,
color: focusNode.isFoucsed.value
? Colors.orange
: Colors.white,
size: 20.w,
),
),
),
TextSpan(
text: Utils.onlineToString(online),
),
],
),
style: TextStyle(
fontSize: 20.w,
color: focusNode.isFoucsed.value
? Colors.black
: Colors.white,
),
),
),
),
],
),
// child: Container(
// height: 200.w,
Expand Down

0 comments on commit 9f989de

Please sign in to comment.