mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-09 04:24:53 +08:00
@@ -15,13 +15,13 @@ class LiveSearchChildController
|
||||
@override
|
||||
void checkIsEnd(int length) {
|
||||
switch (searchType) {
|
||||
case LiveSearchType.room:
|
||||
case .room:
|
||||
if (controller.counts.first != -1 &&
|
||||
length >= controller.counts.first) {
|
||||
isEnd = true;
|
||||
}
|
||||
break;
|
||||
case LiveSearchType.user:
|
||||
case .user:
|
||||
if (controller.counts[1] != -1 && length >= controller.counts[1]) {
|
||||
isEnd = true;
|
||||
}
|
||||
@@ -32,10 +32,10 @@ class LiveSearchChildController
|
||||
@override
|
||||
List? getDataList(response) {
|
||||
switch (searchType) {
|
||||
case LiveSearchType.room:
|
||||
case .room:
|
||||
controller.counts[searchType.index] = response.room?.totalRoom ?? 0;
|
||||
return response.room?.list;
|
||||
case LiveSearchType.user:
|
||||
case .user:
|
||||
controller.counts[searchType.index] = response.user?.totalUser ?? 0;
|
||||
return response.user?.list;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class _LiveSearchChildPageState extends State<LiveSearchChildPage>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
double padding = widget.searchType == LiveSearchType.room ? 12 : 0;
|
||||
double padding = widget.searchType == .room ? 12 : 0;
|
||||
return refreshIndicator(
|
||||
onRefresh: _controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
@@ -60,12 +60,12 @@ class _LiveSearchChildPageState extends State<LiveSearchChildPage>
|
||||
|
||||
Widget get _buildLoading {
|
||||
return switch (widget.searchType) {
|
||||
LiveSearchType.room => SliverGrid.builder(
|
||||
.room => SliverGrid.builder(
|
||||
gridDelegate: roomDelegate,
|
||||
itemBuilder: (context, index) => const VideoCardVSkeleton(),
|
||||
itemCount: 10,
|
||||
),
|
||||
LiveSearchType.user => SliverGrid.builder(
|
||||
.user => SliverGrid.builder(
|
||||
gridDelegate: userDelegate,
|
||||
itemBuilder: (context, index) => const MsgFeedTopSkeleton(),
|
||||
itemCount: 12,
|
||||
@@ -94,7 +94,7 @@ class _LiveSearchChildPageState extends State<LiveSearchChildPage>
|
||||
? Builder(
|
||||
builder: (context) {
|
||||
return switch (widget.searchType) {
|
||||
LiveSearchType.room => SliverGrid.builder(
|
||||
.room => SliverGrid.builder(
|
||||
gridDelegate: roomDelegate,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == response.length - 1) {
|
||||
@@ -106,7 +106,7 @@ class _LiveSearchChildPageState extends State<LiveSearchChildPage>
|
||||
},
|
||||
itemCount: response.length,
|
||||
),
|
||||
LiveSearchType.user => SliverGrid.builder(
|
||||
.user => SliverGrid.builder(
|
||||
gridDelegate: userDelegate,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == response.length - 1) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:PiliPlus/models/common/live/live_search_type.dart';
|
||||
import 'package:PiliPlus/pages/live_search/child/controller.dart';
|
||||
import 'package:PiliPlus/utils/extension/scroll_controller_ext.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
@@ -20,11 +19,11 @@ class LiveSearchController extends GetxController
|
||||
final RxList<int> counts = <int>[-1, -1].obs;
|
||||
|
||||
late final roomCtr = Get.put(
|
||||
LiveSearchChildController(this, LiveSearchType.room),
|
||||
LiveSearchChildController(this, .room),
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
late final userCtr = Get.put(
|
||||
LiveSearchChildController(this, LiveSearchType.user),
|
||||
LiveSearchChildController(this, .user),
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:PiliPlus/common/widgets/scaffold.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/common/widgets/view_safe_area.dart';
|
||||
import 'package:PiliPlus/models/common/live/live_search_type.dart';
|
||||
import 'package:PiliPlus/pages/live_search/child/view.dart';
|
||||
import 'package:PiliPlus/pages/live_search/controller.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -95,11 +94,11 @@ class _LiveSearchPageState extends State<LiveSearchPage> {
|
||||
children: [
|
||||
LiveSearchChildPage(
|
||||
controller: _controller.roomCtr,
|
||||
searchType: LiveSearchType.room,
|
||||
searchType: .room,
|
||||
),
|
||||
LiveSearchChildPage(
|
||||
controller: _controller.userCtr,
|
||||
searchType: LiveSearchType.user,
|
||||
searchType: .user,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:PiliPlus/common/assets.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/image_type.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_search/user_item.dart';
|
||||
import 'package:PiliPlus/utils/num_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
@@ -32,7 +31,7 @@ class LiveSearchUserItem extends StatelessWidget {
|
||||
src: item.face,
|
||||
width: 42,
|
||||
height: 42,
|
||||
type: ImageType.avatar,
|
||||
type: .avatar,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Column(
|
||||
|
||||
Reference in New Issue
Block a user