mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 侧边栏、动态重构,排行改为首页分区,平板、折叠屏、竖屏视频新适配,播放页可隐藏黑边、截图、点踩,弹幕粗细调整,默认关闭后台播放,弹窗接受返回
This commit is contained in:
@@ -7,6 +7,8 @@ import 'package:PiliPalaX/common/widgets/http_error.dart';
|
||||
import 'package:PiliPalaX/common/widgets/no_data.dart';
|
||||
import 'package:PiliPalaX/common/widgets/video_card_h.dart';
|
||||
|
||||
import '../../common/constants.dart';
|
||||
import '../../utils/grid.dart';
|
||||
import 'controller.dart';
|
||||
|
||||
class MemberSearchPage extends StatefulWidget {
|
||||
@@ -48,150 +50,132 @@ class _MemberSearchPageState extends State<MemberSearchPage>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
actions: [
|
||||
IconButton(
|
||||
tooltip: '搜索',
|
||||
onPressed: () => _memberSearchCtr.submit(),
|
||||
icon: const Icon(CupertinoIcons.search, size: 22)),
|
||||
const SizedBox(width: 10)
|
||||
],
|
||||
title: Obx(
|
||||
() => TextField(
|
||||
autofocus: true,
|
||||
focusNode: _memberSearchCtr.searchFocusNode,
|
||||
controller: _memberSearchCtr.controller.value,
|
||||
textInputAction: TextInputAction.search,
|
||||
onChanged: (value) => _memberSearchCtr.onChange(value),
|
||||
decoration: InputDecoration(
|
||||
hintText: _memberSearchCtr.hintText,
|
||||
border: InputBorder.none,
|
||||
suffixIcon: IconButton(
|
||||
tooltip: '清空',
|
||||
icon: Icon(
|
||||
Icons.clear,
|
||||
size: 22,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
actions: [
|
||||
IconButton(
|
||||
tooltip: '搜索',
|
||||
onPressed: () => _memberSearchCtr.submit(),
|
||||
icon: const Icon(CupertinoIcons.search, size: 22)),
|
||||
const SizedBox(width: 10)
|
||||
],
|
||||
title: Obx(
|
||||
() => TextField(
|
||||
autofocus: true,
|
||||
focusNode: _memberSearchCtr.searchFocusNode,
|
||||
controller: _memberSearchCtr.controller.value,
|
||||
textInputAction: TextInputAction.search,
|
||||
onChanged: (value) => _memberSearchCtr.onChange(value),
|
||||
decoration: InputDecoration(
|
||||
hintText: _memberSearchCtr.hintText,
|
||||
border: InputBorder.none,
|
||||
suffixIcon: IconButton(
|
||||
tooltip: '清空',
|
||||
icon: Icon(
|
||||
Icons.clear,
|
||||
size: 22,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
onPressed: () => _memberSearchCtr.onClear(),
|
||||
),
|
||||
onPressed: () => _memberSearchCtr.onClear(),
|
||||
),
|
||||
onSubmitted: (String value) => _memberSearchCtr.submit(),
|
||||
),
|
||||
onSubmitted: (String value) => _memberSearchCtr.submit(),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Obx(
|
||||
() => Column(
|
||||
children: _memberSearchCtr.loadingStatus.value == 'init'
|
||||
? [
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text('搜索「${_memberSearchCtr.uname.value}」的动态、视频'),
|
||||
),
|
||||
),
|
||||
]
|
||||
: [
|
||||
// TabBar(
|
||||
// controller: _tabController,
|
||||
// tabs: const [
|
||||
// Tab(text: "视频"),
|
||||
// Tab(text: "动态"),
|
||||
// ],
|
||||
// ),
|
||||
Expanded(
|
||||
child:
|
||||
// TabBarView(
|
||||
// controller: _tabController,
|
||||
// children: [
|
||||
FutureBuilder(
|
||||
future: _memberSearchCtr.searchArchives(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
Map data = snapshot.data as Map;
|
||||
if (data['status']) {
|
||||
return Obx(
|
||||
body: Obx(
|
||||
() {
|
||||
if (_memberSearchCtr.loadingStatus.value == 'init') {
|
||||
return Center(
|
||||
child: Text('搜索「${_memberSearchCtr.uname.value}」的动态、视频'),
|
||||
);
|
||||
}
|
||||
return CustomScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
controller: scrollController,
|
||||
slivers: <Widget>[
|
||||
FutureBuilder(
|
||||
future: _memberSearchCtr.searchArchives(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done &&
|
||||
snapshot.hasData) {
|
||||
Map data = snapshot.data as Map;
|
||||
if (data['status']) {
|
||||
return SliverPadding(
|
||||
padding:
|
||||
const EdgeInsets.all(StyleString.safeSpace),
|
||||
sliver: Obx(
|
||||
() => _memberSearchCtr.archiveList.isNotEmpty
|
||||
? ListView.builder(
|
||||
controller: scrollController,
|
||||
itemCount:
|
||||
_memberSearchCtr.archiveList.length +
|
||||
1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index ==
|
||||
_memberSearchCtr
|
||||
.archiveList.length) {
|
||||
return Container(
|
||||
height: MediaQuery.of(context)
|
||||
.padding
|
||||
.bottom +
|
||||
60,
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context)
|
||||
.padding
|
||||
.bottom),
|
||||
child: Center(
|
||||
child: Obx(
|
||||
() => Text(
|
||||
_memberSearchCtr
|
||||
.loadingText.value,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline,
|
||||
fontSize: 13),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return VideoCardH(
|
||||
videoItem: _memberSearchCtr
|
||||
.archiveList[index]);
|
||||
}
|
||||
? SliverGrid(
|
||||
gridDelegate:
|
||||
SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString
|
||||
.safeSpace,
|
||||
crossAxisSpacing: StyleString
|
||||
.safeSpace,
|
||||
maxCrossAxisExtent: Grid.maxRowWidth *
|
||||
2,
|
||||
childAspectRatio:
|
||||
StyleString.aspectRatio * 2.3,
|
||||
mainAxisExtent: 0),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return VideoCardH(
|
||||
videoItem: _memberSearchCtr
|
||||
.archiveList[index]);
|
||||
},
|
||||
)
|
||||
childCount: _memberSearchCtr.archiveList
|
||||
.length))
|
||||
: _memberSearchCtr.loadingStatus.value ==
|
||||
'loading'
|
||||
? ListView.builder(
|
||||
itemCount: 10,
|
||||
itemBuilder: (context, index) {
|
||||
? SliverGrid(
|
||||
gridDelegate:
|
||||
SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing:
|
||||
StyleString.cardSpace,
|
||||
crossAxisSpacing:
|
||||
StyleString.safeSpace,
|
||||
maxCrossAxisExtent:
|
||||
Grid.maxRowWidth * 2,
|
||||
childAspectRatio:
|
||||
StyleString.aspectRatio *
|
||||
2.1,
|
||||
mainAxisExtent: 0),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return const VideoCardHSkeleton();
|
||||
},
|
||||
)
|
||||
: const CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
NoData(),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
HttpError(
|
||||
errMsg: data['msg'],
|
||||
fn: () => setState(() {}),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// 骨架屏
|
||||
return ListView.builder(
|
||||
itemCount: 10,
|
||||
itemBuilder: (context, index) {
|
||||
return const VideoCardHSkeleton();
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
// ],
|
||||
// ),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}, childCount: 10))
|
||||
: const NoData(),
|
||||
));
|
||||
} else {
|
||||
return HttpError(
|
||||
errMsg: data['msg'],
|
||||
fn: () => setState(() {}),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// 骨架屏
|
||||
return SliverPadding(
|
||||
padding: const EdgeInsets.all(StyleString.safeSpace),
|
||||
sliver: SliverGrid(
|
||||
gridDelegate:
|
||||
SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
maxCrossAxisExtent: Grid.maxRowWidth * 2,
|
||||
childAspectRatio:
|
||||
StyleString.aspectRatio * 2.3,
|
||||
mainAxisExtent: 0),
|
||||
delegate:
|
||||
SliverChildBuilderDelegate((context, index) {
|
||||
return const VideoCardHSkeleton();
|
||||
}, childCount: 10)));
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user