opt: pages

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-21 18:40:39 +08:00
parent 4c56fcd6a8
commit f94cb2a4b5
21 changed files with 728 additions and 748 deletions

View File

@@ -275,174 +275,168 @@ class _ListSheetContentState extends State<ListSheetContent>
@override
Widget build(BuildContext context) {
return ColoredBox(
color: Theme.of(context).colorScheme.surface,
child: Column(
children: [
Container(
height: 45,
padding: EdgeInsets.symmetric(
horizontal: widget.showTitle != false ? 14 : 6),
child: Row(
children: [
if (widget.showTitle != false)
Text(
'合集(${_isList ? widget.season.epCount : episodes?.length ?? ''})',
style: Theme.of(context).textTheme.titleMedium,
),
StreamBuilder(
stream: _favStream?.stream,
builder: (context, snapshot) => snapshot.hasData
? mediumButton(
tooltip: _seasonFav == 1 ? '取消订阅' : '订阅',
icon: _seasonFav == 1
? Icons.notifications_off_outlined
: Icons.notifications_active_outlined,
onPressed: () async {
dynamic result = await VideoHttp.seasonFav(
isFav: _seasonFav == 1,
seasonId: widget.season.id,
);
if (result['status']) {
SmartDialog.showToast(
'${_seasonFav == 1 ? '取消' : ''}订阅成功');
_seasonFav = _seasonFav == 1 ? 0 : 1;
_favStream?.add(_seasonFav);
} else {
SmartDialog.showToast(result['msg']);
}
},
)
: const SizedBox.shrink(),
return Column(
children: [
Container(
height: 45,
padding: EdgeInsets.symmetric(
horizontal: widget.showTitle != false ? 14 : 6),
child: Row(
children: [
if (widget.showTitle != false)
Text(
'合集(${_isList ? widget.season.epCount : episodes?.length ?? ''})',
style: Theme.of(context).textTheme.titleMedium,
),
mediumButton(
tooltip: '跳至顶部',
icon: Icons.vertical_align_top,
onPressed: () {
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: !reverse[_ctr?.index ?? 0]
? 0
: _isList
? widget.season.sections[_ctr?.index].episodes
.length -
1
: episodes.length - 1,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
mediumButton(
tooltip: '跳至底部',
icon: Icons.vertical_align_bottom,
onPressed: () {
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: !reverse[_ctr?.index ?? 0]
? _isList
? widget.season.sections[_ctr?.index].episodes
.length -
1
: episodes.length - 1
: 0,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
mediumButton(
tooltip: '跳至当前',
icon: Icons.my_location,
onPressed: () async {
if (_ctr != null && _ctr?.index != (_index)) {
_ctr?.animateTo(_index);
await Future.delayed(const Duration(milliseconds: 225));
}
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: currentIndex,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
if (widget.isSupportReverse == true)
if (!_isList)
_reverseButton
else
StreamBuilder(
stream: _indexStream?.stream,
initialData: _index,
builder: (context, snapshot) {
return snapshot.data == _index
? _reverseButton
: const SizedBox.shrink();
},
),
const Spacer(),
StreamBuilder(
stream: _indexStream?.stream,
initialData: _index,
builder: (context, snapshot) => mediumButton(
tooltip: reverse[snapshot.data] ? '顺序' : '倒序',
icon: !reverse[snapshot.data]
? MdiIcons.sortNumericAscending
: MdiIcons.sortNumericDescending,
onPressed: () {
setState(() {
reverse[_ctr?.index ?? 0] = !reverse[_ctr?.index ?? 0];
});
StreamBuilder(
stream: _favStream?.stream,
builder: (context, snapshot) => snapshot.hasData
? mediumButton(
tooltip: _seasonFav == 1 ? '取消订阅' : '订阅',
icon: _seasonFav == 1
? Icons.notifications_off_outlined
: Icons.notifications_active_outlined,
onPressed: () async {
dynamic result = await VideoHttp.seasonFav(
isFav: _seasonFav == 1,
seasonId: widget.season.id,
);
if (result['status']) {
SmartDialog.showToast(
'${_seasonFav == 1 ? '取消' : ''}订阅成功');
_seasonFav = _seasonFav == 1 ? 0 : 1;
_favStream?.add(_seasonFav);
} else {
SmartDialog.showToast(result['msg']);
}
},
)
: const SizedBox.shrink(),
),
mediumButton(
tooltip: '跳至顶部',
icon: Icons.vertical_align_top,
onPressed: () {
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: !reverse[_ctr?.index ?? 0]
? 0
: _isList
? widget.season.sections[_ctr?.index].episodes
.length -
1
: episodes.length - 1,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
mediumButton(
tooltip: '跳至底部',
icon: Icons.vertical_align_bottom,
onPressed: () {
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: !reverse[_ctr?.index ?? 0]
? _isList
? widget.season.sections[_ctr?.index].episodes
.length -
1
: episodes.length - 1
: 0,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
mediumButton(
tooltip: '跳至当前',
icon: Icons.my_location,
onPressed: () async {
if (_ctr != null && _ctr?.index != (_index)) {
_ctr?.animateTo(_index);
await Future.delayed(const Duration(milliseconds: 225));
}
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: currentIndex,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
if (widget.isSupportReverse == true)
if (!_isList)
_reverseButton
else
StreamBuilder(
stream: _indexStream?.stream,
initialData: _index,
builder: (context, snapshot) {
return snapshot.data == _index
? _reverseButton
: const SizedBox.shrink();
},
),
const Spacer(),
StreamBuilder(
stream: _indexStream?.stream,
initialData: _index,
builder: (context, snapshot) => mediumButton(
tooltip: reverse[snapshot.data] ? '顺序' : '倒序',
icon: !reverse[snapshot.data]
? MdiIcons.sortNumericAscending
: MdiIcons.sortNumericDescending,
onPressed: () {
setState(() {
reverse[_ctr?.index ?? 0] = !reverse[_ctr?.index ?? 0];
});
},
),
if (widget.onClose != null)
mediumButton(
tooltip: '关闭',
icon: Icons.close,
onPressed: widget.onClose,
),
],
),
),
Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
if (_isList)
Material(
color: Theme.of(context).colorScheme.surface,
child: TabBar(
controller: _ctr,
padding: const EdgeInsets.only(right: 60),
isScrollable: true,
tabs: (widget.season.sections as List)
.map((item) => Tab(text: item.title))
.toList(),
dividerHeight: 1,
dividerColor: Theme.of(context).dividerColor.withOpacity(0.1),
),
),
Expanded(
child: _isList
? Material(
color: Theme.of(context).colorScheme.surface,
child: TabBarView(
controller: _ctr,
children: List.generate(
widget.season.sections.length,
(index) => _buildBody(
index, widget.season.sections[index].episodes),
),
),
)
: Material(
color: Theme.of(context).colorScheme.surface,
child: _buildBody(null, episodes),
),
if (widget.onClose != null)
mediumButton(
tooltip: '关闭',
icon: Icons.close,
onPressed: widget.onClose,
),
],
),
],
),
),
Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
if (_isList)
TabBar(
controller: _ctr,
padding: const EdgeInsets.only(right: 60),
isScrollable: true,
tabs: (widget.season.sections as List)
.map((item) => Tab(text: item.title))
.toList(),
dividerHeight: 1,
dividerColor: Theme.of(context).dividerColor.withOpacity(0.1),
),
Expanded(
child: _isList
? Material(
color: Colors.transparent,
child: TabBarView(
controller: _ctr,
children: List.generate(
widget.season.sections.length,
(index) => _buildBody(
index, widget.season.sections[index].episodes),
),
),
)
: Material(
color: Colors.transparent,
child: _buildBody(null, episodes),
),
),
],
);
}

View File

@@ -42,133 +42,135 @@ class VideoCardH extends StatelessWidget {
try {
type = videoItem.type;
} catch (_) {}
return Stack(children: [
Semantics(
label: Utils.videoItemSemantics(videoItem),
excludeSemantics: true,
// customSemanticsActions: <CustomSemanticsAction, void Function()>{
// for (var item in actions)
// CustomSemanticsAction(
// label: item.title.isEmpty ? 'label' : item.title): item.onTap!,
// },
child: InkWell(
onLongPress: () {
if (onLongPress != null) {
onLongPress!();
} else {
imageSaveDialog(
context: context,
title: videoItem.title is String
? videoItem.title
: videoItem.title is List
? (videoItem.title as List)
.map((item) => item['text'])
.join()
: '',
cover: videoItem.pic,
);
}
},
onTap: () async {
if (onTap != null) {
onTap?.call();
return;
}
if (type == 'ketang') {
SmartDialog.showToast('课堂视频暂不支持播放');
return;
}
if (videoItem is HotVideoItemModel &&
videoItem.redirectUrl?.isNotEmpty == true) {
if (Utils.viewPgcFromUri(videoItem.redirectUrl!)) {
return Stack(
children: [
Semantics(
label: Utils.videoItemSemantics(videoItem),
excludeSemantics: true,
// customSemanticsActions: <CustomSemanticsAction, void Function()>{
// for (var item in actions)
// CustomSemanticsAction(
// label: item.title.isEmpty ? 'label' : item.title): item.onTap!,
// },
child: InkWell(
onLongPress: () {
if (onLongPress != null) {
onLongPress!();
} else {
imageSaveDialog(
context: context,
title: videoItem.title is String
? videoItem.title
: videoItem.title is List
? (videoItem.title as List)
.map((item) => item['text'])
.join()
: '',
cover: videoItem.pic,
);
}
},
onTap: () async {
if (onTap != null) {
onTap?.call();
return;
}
}
try {
final int cid =
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
Get.toNamed(
'/video?bvid=$bvid&cid=$cid',
arguments: {
'videoItem': videoItem,
'heroTag': Utils.makeHeroTag(aid)
},
);
} catch (err) {
SmartDialog.showToast(err.toString());
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,
vertical: 5,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder:
(BuildContext context, BoxConstraints boxConstraints) {
final double maxWidth = boxConstraints.maxWidth;
final double maxHeight = boxConstraints.maxHeight;
return Stack(
children: [
NetworkImgLayer(
src: videoItem.pic as String,
width: maxWidth,
height: maxHeight,
),
if (videoItem is HotVideoItemModel &&
videoItem.pgcLabel?.isNotEmpty == true)
PBadge(
text: videoItem.pgcLabel,
top: 6.0,
right: 6.0,
if (type == 'ketang') {
SmartDialog.showToast('课堂视频暂不支持播放');
return;
}
if (videoItem is HotVideoItemModel &&
videoItem.redirectUrl?.isNotEmpty == true) {
if (Utils.viewPgcFromUri(videoItem.redirectUrl!)) {
return;
}
}
try {
final int cid = videoItem.cid ??
await SearchHttp.ab2c(aid: aid, bvid: bvid);
Get.toNamed(
'/video?bvid=$bvid&cid=$cid',
arguments: {
'videoItem': videoItem,
'heroTag': Utils.makeHeroTag(aid)
},
);
} catch (err) {
SmartDialog.showToast(err.toString());
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,
vertical: 5,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (BuildContext context,
BoxConstraints boxConstraints) {
final double maxWidth = boxConstraints.maxWidth;
final double maxHeight = boxConstraints.maxHeight;
return Stack(
children: [
NetworkImgLayer(
src: videoItem.pic as String,
width: maxWidth,
height: maxHeight,
),
if (videoItem.duration != 0)
PBadge(
text: Utils.timeFormat(videoItem.duration!),
right: 6.0,
bottom: 6.0,
type: 'gray',
),
if (type != 'video')
PBadge(
text: type,
left: 6.0,
bottom: 6.0,
type: 'primary',
),
// if (videoItem.rcmdReason != null &&
// videoItem.rcmdReason.content != '')
// pBadge(videoItem.rcmdReason.content, context,
// 6.0, 6.0, null, null),
],
);
},
if (videoItem is HotVideoItemModel &&
videoItem.pgcLabel?.isNotEmpty == true)
PBadge(
text: videoItem.pgcLabel,
top: 6.0,
right: 6.0,
),
if (videoItem.duration != 0)
PBadge(
text: Utils.timeFormat(videoItem.duration!),
right: 6.0,
bottom: 6.0,
type: 'gray',
),
if (type != 'video')
PBadge(
text: type,
left: 6.0,
bottom: 6.0,
type: 'primary',
),
// if (videoItem.rcmdReason != null &&
// videoItem.rcmdReason.content != '')
// pBadge(videoItem.rcmdReason.content, context,
// 6.0, 6.0, null, null),
],
);
},
),
),
),
const SizedBox(width: 10),
videoContent(context),
],
const SizedBox(width: 10),
videoContent(context),
],
),
),
),
),
),
if (source == 'normal')
Positioned(
bottom: 0,
right: 12,
child: VideoPopupMenu(
size: 29,
iconSize: 17,
videoItem: videoItem,
if (source == 'normal')
Positioned(
bottom: 0,
right: 12,
child: VideoPopupMenu(
size: 29,
iconSize: 17,
videoItem: videoItem,
),
),
),
]);
],
);
}
Widget videoContent(context) {

View File

@@ -53,7 +53,7 @@ void main() async {
],
);
}
if (GStorage.badCertificateCallback) {
if (BuildConfig.isDebug || GStorage.badCertificateCallback) {
HttpOverrides.global = _CustomHttpOverrides();
}
await setupServiceLocator();

View File

@@ -22,10 +22,8 @@ class IntroDetail extends StatelessWidget {
fontSize: 12,
color: Theme.of(context).colorScheme.onSurface,
);
return Container(
color: Theme.of(context).colorScheme.surface,
return Padding(
padding: const EdgeInsets.only(left: 14, right: 14),
// height: Utils.getSheetHeight(context),
child: Column(
children: [
Container(

View File

@@ -329,7 +329,7 @@ abstract class ReplyController extends CommonController {
dynamic mid,
}) async {
// biliSendCommAntifraud
if (_biliSendCommAntifraud && Platform.isAndroid) {
if (Platform.isAndroid && _biliSendCommAntifraud) {
try {
List<Cookie> cookies = await Request.cookieManager.cookieJar
.loadForRequest(Uri.parse(HttpString.apiBaseUrl));

View File

@@ -179,6 +179,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
ScaffoldState? scaffoldState = Scaffold.maybeOf(context);
if (scaffoldState != null) {
scaffoldState.showBottomSheet(
backgroundColor: Colors.transparent,
(context) => MediaQuery.removePadding(
context: context,
removeLeft: true,

View File

@@ -168,6 +168,7 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
ScaffoldState? scaffoldState = Scaffold.maybeOf(context);
if (scaffoldState != null) {
scaffoldState.showBottomSheet(
backgroundColor: Colors.transparent,
(context) => MediaQuery.removePadding(
context: context,
removeLeft: true,

View File

@@ -120,6 +120,7 @@ class MemberController extends GetxController {
await Get.bottomSheet(
GroupPanel(mid: mid),
isScrollControlled: true,
backgroundColor: Theme.of(context).colorScheme.surface,
);
Get.back();
},

View File

@@ -133,6 +133,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
context: context,
isScrollControlled: true,
clipBehavior: Clip.hardEdge,
backgroundColor: Theme.of(context).colorScheme.surface,
builder: (context) {
return Column(
mainAxisSize: MainAxisSize.min,

View File

@@ -298,9 +298,10 @@ class VideoDetailController extends GetxController
}
// 稍后再看面板展开
showMediaListPanel() {
showMediaListPanel(context) {
if (mediaList.isNotEmpty) {
childKey.currentState?.showBottomSheet(
backgroundColor: Theme.of(context).colorScheme.surface,
(context) => MediaListPanel(
mediaList: mediaList,
changeMediaList: (bvid, cid, aid, cover) {
@@ -1235,6 +1236,7 @@ class VideoDetailController extends GetxController
childKey.currentState?.showBottomSheet(
enableDrag: false,
(context) => _postPanel(),
backgroundColor: Colors.transparent,
);
}
}

View File

@@ -28,7 +28,6 @@ import 'package:share_plus/share_plus.dart';
import '../../../../http/search.dart';
import '../../../../models/model_hot_video_item.dart';
import '../related/index.dart';
import 'widgets/group_panel.dart';
class VideoIntroController extends GetxController
with GetTickerProviderStateMixin {
@@ -852,17 +851,6 @@ class VideoIntroController extends GetxController
return true;
}
// 设置关注分组
void setFollowGroup() {
if (videoDetail.value.owner == null) {
return;
}
Get.bottomSheet(
GroupPanel(mid: videoDetail.value.owner!.mid!),
isScrollControlled: true,
);
}
// ai总结
Future aiConclusion() async {
SmartDialog.showLoading(msg: '正在获取AI总结');

View File

@@ -38,184 +38,172 @@ class _FavPanelState extends State<FavPanel> {
}
return false;
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
color: Theme.of(context).colorScheme.surface,
),
child: Column(
children: [
AppBar(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(18),
),
),
leading: IconButton(
tooltip: '关闭',
onPressed: Get.back,
icon: const Icon(Icons.close_outlined),
),
title: const Text('添加到收藏夹'),
actions: [
TextButton.icon(
onPressed: () {
Get.toNamed('/createFav')?.then((data) {
if (data != null) {
(widget.ctr?.favFolderData.value as FavFolderData?)
?.list
?.insert(1, data);
widget.ctr?.favFolderData.refresh();
}
});
},
icon: Icon(
Icons.add,
color: Theme.of(context).colorScheme.primary,
),
label: const Text('新建收藏夹'),
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 18, vertical: 14),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -2,
),
),
),
const SizedBox(width: 16),
],
child: Column(
children: [
AppBar(
backgroundColor: Colors.transparent,
leading: IconButton(
tooltip: '关闭',
onPressed: Get.back,
icon: const Icon(Icons.close_outlined),
),
Expanded(
child: Material(
color: Theme.of(context).colorScheme.surface,
child: FutureBuilder(
future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
// TODO: refactor
if (snapshot.data is! Map) {
return HttpError(
isSliver: false,
title: const Text('添加到收藏夹'),
actions: [
TextButton.icon(
onPressed: () {
Get.toNamed('/createFav')?.then((data) {
if (data != null) {
(widget.ctr?.favFolderData.value as FavFolderData?)
?.list
?.insert(1, data);
widget.ctr?.favFolderData.refresh();
}
});
},
icon: Icon(
Icons.add,
color: Theme.of(context).colorScheme.primary,
),
label: const Text('新建收藏夹'),
style: TextButton.styleFrom(
padding:
const EdgeInsets.symmetric(horizontal: 18, vertical: 14),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -2,
),
),
),
const SizedBox(width: 16),
],
),
Expanded(
child: FutureBuilder(
future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
// TODO: refactor
if (snapshot.data is! Map) {
return HttpError(
isSliver: false,
callback: () => setState(() {
_futureBuilderFuture = widget.ctr.queryVideoInFolder();
}),
);
}
Map data = snapshot.data as Map;
if (data['status']) {
return Obx(
() => Material(
color: Colors.transparent,
child: ListView.builder(
controller: widget.scrollController,
itemCount: widget.ctr.favFolderData.value.list.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () => widget.ctr.onChoose(
widget.ctr.favFolderData.value.list[index]
.favState !=
1,
index),
dense: true,
leading: Utils.isPublic(widget
.ctr.favFolderData.value.list[index].attr)
? const Icon(Icons.folder_outlined)
: const Icon(Icons.lock_outline),
minLeadingWidth: 0,
title: Text(widget
.ctr.favFolderData.value.list[index].title!),
subtitle: Text(
'${widget.ctr.favFolderData.value.list[index].mediaCount}个内容 . ${Utils.isPublicText(widget.ctr.favFolderData.value.list[index].attr)}',
),
trailing: Transform.scale(
scale: 0.9,
child: Checkbox(
value: widget.ctr.favFolderData.value
.list[index].favState ==
1,
onChanged: (bool? checkValue) =>
widget.ctr.onChoose(checkValue!, index),
),
),
);
},
),
),
);
} else {
return CustomScrollView(
controller: widget.scrollController,
slivers: [
HttpError(
errMsg: data['msg'],
callback: () => setState(() {
_futureBuilderFuture =
widget.ctr.queryVideoInFolder();
}),
);
}
Map data = snapshot.data as Map;
if (data['status']) {
return Obx(
() => ListView.builder(
controller: widget.scrollController,
itemCount:
widget.ctr.favFolderData.value.list.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () => widget.ctr.onChoose(
widget.ctr.favFolderData.value.list[index]
.favState !=
1,
index),
dense: true,
leading: Utils.isPublic(widget.ctr.favFolderData
.value.list[index].attr)
? const Icon(Icons.folder_outlined)
: const Icon(Icons.lock_outline),
minLeadingWidth: 0,
title: Text(widget.ctr.favFolderData.value
.list[index].title!),
subtitle: Text(
'${widget.ctr.favFolderData.value.list[index].mediaCount}个内容 . ${Utils.isPublicText(widget.ctr.favFolderData.value.list[index].attr)}',
),
trailing: Transform.scale(
scale: 0.9,
child: Checkbox(
value: widget.ctr.favFolderData.value
.list[index].favState ==
1,
onChanged: (bool? checkValue) =>
widget.ctr.onChoose(checkValue!, index),
),
),
);
},
),
);
} else {
return CustomScrollView(
controller: widget.scrollController,
slivers: [
HttpError(
errMsg: data['msg'],
callback: () => setState(() {
_futureBuilderFuture =
widget.ctr.queryVideoInFolder();
}),
)
],
);
}
} else {
// 骨架屏
return const Center(
child: CircularProgressIndicator(),
);
}
},
)
],
);
}
} else {
// 骨架屏
return const Center(
child: CircularProgressIndicator(),
);
}
},
),
),
Divider(
height: 1,
color: Theme.of(context).disabledColor.withOpacity(0.08),
),
Padding(
padding: EdgeInsets.only(
left: 20,
right: 20,
top: 12,
bottom: MediaQuery.of(context).padding.bottom + 12,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
TextButton(
onPressed: () => Get.back(),
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
visualDensity: const VisualDensity(
horizontal: -1,
vertical: -2,
),
foregroundColor: Theme.of(context).colorScheme.outline,
backgroundColor:
Theme.of(context).colorScheme.onInverseSurface,
),
child: const Text('取消'),
),
),
),
Divider(
height: 1,
color: Theme.of(context).disabledColor.withOpacity(0.08),
),
Padding(
padding: EdgeInsets.only(
left: 20,
right: 20,
top: 12,
bottom: MediaQuery.of(context).padding.bottom + 12,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
TextButton(
onPressed: () => Get.back(),
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
visualDensity: const VisualDensity(
horizontal: -1,
vertical: -2,
),
foregroundColor: Theme.of(context).colorScheme.outline,
backgroundColor:
Theme.of(context).colorScheme.onInverseSurface,
const SizedBox(width: 25),
FilledButton.tonal(
onPressed: () async {
feedBack();
await widget.ctr.actionFavVideo();
},
style: FilledButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
visualDensity: const VisualDensity(
horizontal: -1,
vertical: -2,
),
child: const Text('取消'),
),
const SizedBox(width: 25),
FilledButton.tonal(
onPressed: () async {
feedBack();
await widget.ctr.actionFavVideo();
},
style: FilledButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
visualDensity: const VisualDensity(
horizontal: -1,
vertical: -2,
),
),
child: const Text('完成'),
),
],
),
child: const Text('完成'),
),
],
),
],
),
),
],
),
);
}

View File

@@ -77,126 +77,116 @@ class _GroupPanelState extends State<GroupPanel> {
}
return false;
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
color: Theme.of(context).colorScheme.surface,
),
child: Column(
children: <Widget>[
AppBar(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(18),
),
),
leading: IconButton(
tooltip: '关闭',
onPressed: Get.back,
icon: const Icon(Icons.close_outlined)),
title: const Text('设置关注分组'),
),
Expanded(
child: Material(
color: Theme.of(context).colorScheme.surface,
child: FutureBuilder(
future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
// TODO: refactor
if (snapshot.data is! Map) {
return HttpError(
isSliver: false,
callback: () => setState(() {
_futureBuilderFuture = MemberHttp.followUpTags();
}),
);
}
Map data = snapshot.data as Map;
if (data['status']) {
return ListView.builder(
controller: widget.scrollController,
itemCount: tagsList.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () {
tagsList[index].checked =
!tagsList[index].checked!;
showDefaultBtn =
!tagsList.any((e) => e.checked == true);
setState(() {});
},
dense: true,
leading: const Icon(Icons.group_outlined),
minLeadingWidth: 0,
title: Text(tagsList[index].name ?? ''),
subtitle: tagsList[index].tip != ''
? Text(tagsList[index].tip ?? '')
: null,
trailing: Transform.scale(
scale: 0.9,
child: Checkbox(
value: tagsList[index].checked,
onChanged: (bool? checkValue) {
tagsList[index].checked = checkValue;
showDefaultBtn =
!tagsList.any((e) => e.checked == true);
setState(() {});
},
),
child: Column(
children: <Widget>[
AppBar(
backgroundColor: Colors.transparent,
leading: IconButton(
tooltip: '关闭',
onPressed: Get.back,
icon: const Icon(Icons.close_outlined)),
title: const Text('设置关注分组'),
),
Expanded(
child: FutureBuilder(
future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
// TODO: refactor
if (snapshot.data is! Map) {
return HttpError(
isSliver: false,
callback: () => setState(() {
_futureBuilderFuture = MemberHttp.followUpTags();
}),
);
}
Map data = snapshot.data as Map;
if (data['status']) {
return Material(
color: Colors.transparent,
child: ListView.builder(
controller: widget.scrollController,
itemCount: tagsList.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () {
tagsList[index].checked =
!tagsList[index].checked!;
showDefaultBtn =
!tagsList.any((e) => e.checked == true);
setState(() {});
},
dense: true,
leading: const Icon(Icons.group_outlined),
minLeadingWidth: 0,
title: Text(tagsList[index].name ?? ''),
subtitle: tagsList[index].tip != ''
? Text(tagsList[index].tip ?? '')
: null,
trailing: Transform.scale(
scale: 0.9,
child: Checkbox(
value: tagsList[index].checked,
onChanged: (bool? checkValue) {
tagsList[index].checked = checkValue;
showDefaultBtn =
!tagsList.any((e) => e.checked == true);
setState(() {});
},
),
);
},
);
} else {
return CustomScrollView(
controller: widget.scrollController,
slivers: [
HttpError(
errMsg: data['msg'],
callback: () => setState(() {}),
),
],
);
}
} else {
// 骨架屏
return const Center(
child: CircularProgressIndicator(),
);
}
},
),
),
);
},
),
);
} else {
return CustomScrollView(
controller: widget.scrollController,
slivers: [
HttpError(
errMsg: data['msg'],
callback: () => setState(() {}),
),
],
);
}
} else {
// 骨架屏
return const Center(
child: CircularProgressIndicator(),
);
}
},
),
Divider(
height: 1,
color: Theme.of(context).disabledColor.withOpacity(0.08),
),
Divider(
height: 1,
color: Theme.of(context).disabledColor.withOpacity(0.08),
),
Padding(
padding: EdgeInsets.only(
left: 20,
right: 20,
top: 12,
bottom: MediaQuery.of(context).padding.bottom + 12,
),
Padding(
padding: EdgeInsets.only(
left: 20,
right: 20,
top: 12,
bottom: MediaQuery.of(context).padding.bottom + 12,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () => onSave(),
style: TextButton.styleFrom(
padding: const EdgeInsets.only(left: 30, right: 30),
foregroundColor: Theme.of(context).colorScheme.onPrimary,
backgroundColor: Theme.of(context).colorScheme.primary,
),
child: Text(showDefaultBtn ? '保存至默认分组' : '保存'),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () => onSave(),
style: TextButton.styleFrom(
padding: const EdgeInsets.only(left: 30, right: 30),
foregroundColor: Theme.of(context).colorScheme.onPrimary,
backgroundColor: Theme.of(context).colorScheme.primary,
),
],
),
child: Text(showDefaultBtn ? '保存至默认分组' : '保存'),
),
],
),
],
),
),
],
),
);
}

View File

@@ -19,10 +19,8 @@ class IntroDetail extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Theme.of(context).colorScheme.surface,
return Padding(
padding: const EdgeInsets.only(left: 14, right: 14),
// height: Utils.getSheetHeight(context),
child: Column(
children: [
InkWell(

View File

@@ -64,24 +64,8 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
toolbarHeight: 36,
actions: [
iconButton(
context: context,
onPressed: Get.back,
tooltip: '关闭',
icon: Icons.clear,
size: 28,
),
const SizedBox(width: 16),
],
),
body: Obx(
() => _buildUserPage(_controller.userState.value),
),
return Obx(
() => _buildUserPage(_controller.userState.value),
);
}
@@ -90,11 +74,25 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
Loading() => loadingWidget,
Success() => Column(
children: [
const SizedBox(height: 4),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
iconButton(
context: context,
onPressed: Get.back,
tooltip: '关闭',
icon: Icons.clear,
size: 32,
),
const SizedBox(width: 16),
],
),
_buildUserInfo(userState.response),
const SizedBox(height: 5),
Expanded(
child: Obx(() => _buildVideoList(_controller.loadingState.value)),
)
),
],
),
Error() => errorWidget(
@@ -159,46 +157,49 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
Widget _buildVideoList(LoadingState loadingState) {
return switch (loadingState) {
Loading() => loadingWidget,
Success() => CustomScrollView(
slivers: [
_buildSliverHeader,
SliverPadding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom + 80,
),
sliver: SliverGrid(
gridDelegate: SliverGridDelegateWithExtentAndRatio(
mainAxisSpacing: 2,
maxCrossAxisExtent: Grid.mediumCardWidth * 2,
childAspectRatio: StyleString.aspectRatio * 2.2,
Success() => Material(
color: Colors.transparent,
child: CustomScrollView(
slivers: [
_buildSliverHeader,
SliverPadding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom + 80,
),
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index == loadingState.response.length - 1) {
_controller.onLoadMore();
}
return VideoCardHMemberVideo(
videoItem: loadingState.response[index],
bvid: _bvid,
onTap: () {
final Item videoItem = loadingState.response[index];
widget.videoIntroController.changeSeasonOrbangu(
null,
videoItem.bvid,
videoItem.firstCid,
IdUtils.bv2av(videoItem.bvid!),
videoItem.cover,
);
_bvid = videoItem.bvid;
setState(() {});
},
);
},
childCount: loadingState.response.length,
sliver: SliverGrid(
gridDelegate: SliverGridDelegateWithExtentAndRatio(
mainAxisSpacing: 2,
maxCrossAxisExtent: Grid.mediumCardWidth * 2,
childAspectRatio: StyleString.aspectRatio * 2.2,
),
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index == loadingState.response.length - 1) {
_controller.onLoadMore();
}
return VideoCardHMemberVideo(
videoItem: loadingState.response[index],
bvid: _bvid,
onTap: () {
final Item videoItem = loadingState.response[index];
widget.videoIntroController.changeSeasonOrbangu(
null,
videoItem.bvid,
videoItem.firstCid,
IdUtils.bv2av(videoItem.bvid!),
videoItem.cover,
);
_bvid = videoItem.bvid;
setState(() {});
},
);
},
childCount: loadingState.response.length,
),
),
),
),
],
],
),
),
Error() => errorWidget(
errMsg: loadingState.errMsg,

View File

@@ -1116,7 +1116,7 @@ class MorePanel extends StatelessWidget {
@override
Widget build(BuildContext context) {
Color errorColor = Theme.of(context).colorScheme.error;
return Container(
return Padding(
padding: EdgeInsets.only(
bottom: MediaQueryData.fromView(
WidgetsBinding.instance.platformDispatcher.views.single)

View File

@@ -1159,7 +1159,7 @@ class ReplyItemGrpc extends StatelessWidget {
}
Color errorColor = Theme.of(context).colorScheme.error;
return Container(
return Padding(
padding: EdgeInsets.only(
bottom: MediaQueryData.fromView(
WidgetsBinding.instance.platformDispatcher.views.single)

View File

@@ -497,6 +497,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
upMid: _videoReplyReplyController.upMid,
showDialogue: () {
_key.currentState?.showBottomSheet(
backgroundColor: Colors.transparent,
(context) => VideoReplyReplyPanel(
oid: replyItem.oid.toInt(),
rpid: replyItem.root.toInt(),

View File

@@ -887,13 +887,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
if (videoDetailController.videoType ==
SearchType.video &&
videoDetailController.showRelatedVideo)
CustomScrollView(
controller: _introController,
slivers: [
RelatedVideoPanel(
key: relatedVideoPanelKey,
heroTag: heroTag),
],
Material(
color: Colors.transparent,
child: CustomScrollView(
controller: _introController,
slivers: [
RelatedVideoPanel(
key: relatedVideoPanelKey,
heroTag: heroTag),
],
),
),
if (videoDetailController.showReply)
videoReplyPanel,
@@ -1502,62 +1505,67 @@ class _VideoDetailPageState extends State<VideoDetailPage>
);
Widget videoIntro([bool needRelated = true]) {
Widget introPanel() => CustomScrollView(
key: const PageStorageKey<String>('简介'),
controller: needRelated ? _introController : null,
slivers: [
if (videoDetailController.videoType == SearchType.video) ...[
VideoIntroPanel(
heroTag: heroTag,
showAiBottomSheet: showAiBottomSheet,
showIntroDetail: showIntroDetail,
showEpisodes: showEpisodes,
onShowMemberPage: onShowMemberPage,
),
if (needRelated && videoDetailController.showRelatedVideo) ...[
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.only(top: StyleString.safeSpace),
child: Divider(
height: 1,
indent: 12,
endIndent: 12,
color: Theme.of(context)
.colorScheme
.outline
.withOpacity(0.08),
Widget introPanel() => Material(
color: Colors.transparent,
child: CustomScrollView(
key: const PageStorageKey<String>('简介'),
controller: needRelated ? _introController : null,
slivers: [
if (videoDetailController.videoType == SearchType.video) ...[
VideoIntroPanel(
heroTag: heroTag,
showAiBottomSheet: showAiBottomSheet,
showIntroDetail: showIntroDetail,
showEpisodes: showEpisodes,
onShowMemberPage: onShowMemberPage,
),
if (needRelated && videoDetailController.showRelatedVideo) ...[
SliverToBoxAdapter(
child: Padding(
padding:
const EdgeInsets.only(top: StyleString.safeSpace),
child: Divider(
height: 1,
indent: 12,
endIndent: 12,
color: Theme.of(context)
.colorScheme
.outline
.withOpacity(0.08),
),
),
),
),
RelatedVideoPanel(key: relatedVideoPanelKey, heroTag: heroTag),
] else
SliverToBoxAdapter(
child: SizedBox(
height: MediaQuery.paddingOf(context).bottom +
StyleString.safeSpace,
RelatedVideoPanel(
key: relatedVideoPanelKey, heroTag: heroTag),
] else
SliverToBoxAdapter(
child: SizedBox(
height: MediaQuery.paddingOf(context).bottom +
StyleString.safeSpace,
),
),
] else if (videoDetailController.videoType ==
SearchType.media_bangumi)
Obx(
() => BangumiIntroPanel(
heroTag: heroTag,
cid: videoDetailController.cid.value,
showEpisodes: showEpisodes,
showIntroDetail: showIntroDetail,
),
),
] else if (videoDetailController.videoType ==
SearchType.media_bangumi)
Obx(
() => BangumiIntroPanel(
heroTag: heroTag,
cid: videoDetailController.cid.value,
showEpisodes: showEpisodes,
showIntroDetail: showIntroDetail,
SliverToBoxAdapter(
child: SizedBox(
height: MediaQuery.paddingOf(context).bottom +
(videoDetailController.isPlayAll &&
MediaQuery.orientationOf(context) ==
Orientation.landscape
? 75
: 0),
),
),
SliverToBoxAdapter(
child: SizedBox(
height: MediaQuery.paddingOf(context).bottom +
(videoDetailController.isPlayAll &&
MediaQuery.orientationOf(context) ==
Orientation.landscape
? 75
: 0),
),
)
],
)
],
),
);
if (videoDetailController.isPlayAll) {
return Stack(
@@ -1570,7 +1578,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: videoDetailController.showMediaListPanel,
onTap: () => videoDetailController.showMediaListPanel(context),
borderRadius: const BorderRadius.all(Radius.circular(14)),
child: Container(
height: 54,
@@ -1745,6 +1753,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
int oid = replyItem.oid.toInt();
int rpid = GlobalData().grpcReply ? replyItem.id.toInt() : replyItem.rpid;
videoDetailController.childKey.currentState?.showBottomSheet(
backgroundColor: Colors.transparent,
(context) => VideoReplyReplyPanel(
id: id,
oid: oid,
@@ -1764,6 +1773,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
showAiBottomSheet() {
videoDetailController.childKey.currentState?.showBottomSheet(
enableDrag: true,
backgroundColor: Theme.of(context).colorScheme.surface,
(context) => AiDetail(modelResult: videoIntroController.modelResult),
);
}
@@ -1771,6 +1781,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
showIntroDetail(videoDetail, videoTags) {
videoDetailController.childKey.currentState?.showBottomSheet(
enableDrag: true,
backgroundColor: Theme.of(context).colorScheme.surface,
(context) => videoDetail is BangumiInfoModel
? bangumi.IntroDetail(
bangumiDetail: videoDetail,
@@ -1814,9 +1825,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
},
);
if (isFullScreen) {
Utils.showFSSheet(child: listSheetContent(), isFullScreen: isFullScreen);
Utils.showFSSheet(
child: Material(
color: Theme.of(context).colorScheme.surface,
child: listSheetContent(),
),
isFullScreen: isFullScreen,
);
} else {
videoDetailController.childKey.currentState?.showBottomSheet(
backgroundColor: Theme.of(context).colorScheme.surface,
(context) => listSheetContent(),
);
}
@@ -2035,6 +2053,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
Utils.showFSSheet(child: listSheetContent(), isFullScreen: isFullScreen);
} else {
videoDetailController.childKey.currentState?.showBottomSheet(
backgroundColor: Colors.transparent,
(context) => listSheetContent(),
);
}
@@ -2056,6 +2075,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
void onShowMemberPage(mid) {
videoDetailController.childKey.currentState?.showBottomSheet(
backgroundColor: Theme.of(context).colorScheme.surface,
(context) {
return HorizontalMemberPage(
mid: mid,

View File

@@ -63,53 +63,45 @@ class _MediaListPanelState extends State<MediaListPanel> {
@override
Widget build(BuildContext context) {
return DecoratedBox(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
),
child: Column(
children: [
AppBar(
toolbarHeight: 45,
automaticallyImplyLeading: false,
titleSpacing: 16,
title: Text(widget.panelTitle ?? '稍后再看'),
actions: [
Obx(
() => mediumButton(
tooltip: desc.value ? '顺序播放' : '倒序播放',
icon: desc.value
? MdiIcons.sortAscending
: MdiIcons.sortDescending,
onPressed: () {
widget.onReverse();
desc.value = !desc.value;
},
),
return Column(
children: [
AppBar(
toolbarHeight: 45,
automaticallyImplyLeading: false,
titleSpacing: 16,
title: Text(widget.panelTitle ?? '稍后再看'),
actions: [
Obx(
() => mediumButton(
tooltip: desc.value ? '顺序播放' : '倒序播放',
icon: desc.value
? MdiIcons.sortAscending
: MdiIcons.sortDescending,
onPressed: () {
widget.onReverse();
desc.value = !desc.value;
},
),
mediumButton(
tooltip: '关闭',
icon: Icons.close,
onPressed: Get.back,
),
const SizedBox(width: 14),
],
),
Expanded(
child: Material(
color: Theme.of(context).colorScheme.surface,
child: widget.loadPrevious != null
? refreshIndicator(
onRefresh: () async {
await widget.loadPrevious!();
},
child: _buildList,
)
: _buildList,
),
),
],
),
mediumButton(
tooltip: '关闭',
icon: Icons.close,
onPressed: Get.back,
),
const SizedBox(width: 14),
],
),
Expanded(
child: widget.loadPrevious != null
? refreshIndicator(
onRefresh: () async {
await widget.loadPrevious!();
},
child: _buildList,
)
: _buildList,
),
],
);
}

View File

@@ -320,6 +320,7 @@ class Utils {
context: context,
useSafeArea: true,
isScrollControlled: true,
backgroundColor: Theme.of(context).colorScheme.surface,
sheetAnimationStyle: AnimationStyle(curve: Curves.ease),
builder: (BuildContext context) {
return DraggableScrollableSheet(
@@ -701,6 +702,7 @@ class Utils {
context: context,
useSafeArea: true,
isScrollControlled: true,
backgroundColor: Theme.of(context).colorScheme.surface,
sheetAnimationStyle: AnimationStyle(curve: Curves.ease),
builder: (BuildContext context) {
return DraggableScrollableSheet(