opt: get theme color

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-28 21:32:30 +08:00
parent 451a84e696
commit ca993df0c6
149 changed files with 4415 additions and 4803 deletions

View File

@@ -39,26 +39,26 @@ class PBadge extends StatelessWidget {
return const SizedBox.shrink();
}
ColorScheme t = Theme.of(context).colorScheme;
ColorScheme theme = Theme.of(context).colorScheme;
// 背景色
Color bgColor = t.primary;
Color bgColor = theme.primary;
// 前景色
Color color = t.onPrimary;
Color color = theme.onPrimary;
// 边框色
Color borderColor = Colors.transparent;
if (type == 'gray') {
bgColor = Colors.black45;
color = Colors.white;
} else if (type == 'color') {
bgColor = t.secondaryContainer.withOpacity(0.5);
color = t.onSecondaryContainer;
bgColor = theme.secondaryContainer.withOpacity(0.5);
color = theme.onSecondaryContainer;
} else if (type == 'line') {
bgColor = Colors.transparent;
color = t.primary;
borderColor = t.primary;
color = theme.primary;
borderColor = theme.primary;
} else if (type == 'error') {
bgColor = t.error;
color = t.onError;
bgColor = theme.error;
color = theme.onError;
}
late EdgeInsets paddingStyle =

View File

@@ -8,6 +8,7 @@ class CustomToast extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final double toastOpacity = GStorage.setting
.get(SettingBoxKey.defaultToastOp, defaultValue: 1.0) as double;
return Container(
@@ -15,17 +16,14 @@ class CustomToast extends StatelessWidget {
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom + 30),
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 10),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.primaryContainer
.withOpacity(toastOpacity),
color: theme.colorScheme.primaryContainer.withOpacity(toastOpacity),
borderRadius: BorderRadius.circular(20),
),
child: Text(
msg,
style: TextStyle(
fontSize: 13,
color: Theme.of(context).colorScheme.onPrimaryContainer,
color: theme.colorScheme.onPrimaryContainer,
),
),
);
@@ -40,26 +38,25 @@ class LoadingWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final onSurfaceVariant = theme.colorScheme.onSurfaceVariant;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
decoration: BoxDecoration(
color: Theme.of(context).dialogBackgroundColor,
color: theme.dialogBackgroundColor,
borderRadius: BorderRadius.circular(15),
),
child: Column(mainAxisSize: MainAxisSize.min, children: [
//loading animation
CircularProgressIndicator(
strokeWidth: 3,
valueColor: AlwaysStoppedAnimation(
Theme.of(context).colorScheme.onSurfaceVariant),
valueColor: AlwaysStoppedAnimation(onSurfaceVariant),
),
//msg
Container(
margin: const EdgeInsets.only(top: 20),
child: Text(msg,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant)),
child: Text(msg, style: TextStyle(color: onSurfaceVariant)),
),
]),
);

View File

@@ -198,53 +198,57 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
}
@override
Widget get buildPage => Material(
color: widget.showTitle == false
? Colors.transparent
: Theme.of(context).colorScheme.surface,
child: Column(
children: [
_buildToolbar,
if (widget.type == EpisodeType.season &&
widget.list.length > 1) ...[
TabBar(
controller: _tabController,
padding: const EdgeInsets.only(right: 60),
isScrollable: true,
tabs: widget.list.map((item) => Tab(text: item.title)).toList(),
dividerHeight: 1,
dividerColor: Theme.of(context).dividerColor.withOpacity(0.1),
),
Expanded(
child: Material(
color: Colors.transparent,
child: tabBarView(
controller: _tabController,
children: List.generate(
widget.list.length,
(index) => _buildBody(
index,
widget.list[index].episodes,
),
Widget buildPage(ThemeData theme) {
return Material(
color: widget.showTitle == false
? Colors.transparent
: theme.colorScheme.surface,
child: Column(
children: [
_buildToolbar(theme),
if (widget.type == EpisodeType.season && widget.list.length > 1) ...[
TabBar(
controller: _tabController,
padding: const EdgeInsets.only(right: 60),
isScrollable: true,
tabs: widget.list.map((item) => Tab(text: item.title)).toList(),
dividerHeight: 1,
dividerColor: theme.dividerColor.withOpacity(0.1),
),
Expanded(
child: Material(
color: Colors.transparent,
child: tabBarView(
controller: _tabController,
children: List.generate(
widget.list.length,
(index) => _buildBody(
theme,
index,
widget.list[index].episodes,
),
),
),
),
] else
Expanded(
child: enableSlide ? slideList() : buildList,
),
],
),
);
),
] else
Expanded(
child: enableSlide ? slideList(theme) : buildList(theme),
),
],
),
);
}
@override
Widget get buildList => Material(
color: Colors.transparent,
child: _buildBody(0, _getCurrEpisodes),
);
Widget buildList(ThemeData theme) {
return Material(
color: Colors.transparent,
child: _buildBody(theme, 0, _getCurrEpisodes),
);
}
Widget _buildBody(int index, episodes) {
Widget _buildBody(ThemeData theme, int index, episodes) {
return KeepAliveWrapper(
builder: (context) => ScrollablePositionedList.separated(
padding: EdgeInsets.only(
@@ -265,6 +269,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
children: [
Obx(
() => _buildEpisodeItem(
theme: theme,
episode: episode,
index: index,
length: episodes.length,
@@ -293,6 +298,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
)
: Obx(
() => _buildEpisodeItem(
theme: theme,
episode: episode,
index: index,
length: episodes.length,
@@ -310,6 +316,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
}
Widget _buildEpisodeItem({
required ThemeData theme,
required dynamic episode,
required int index,
required int length,
@@ -351,7 +358,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
pubdate = episode.pubTime;
break;
}
late final Color primary = Theme.of(context).colorScheme.primary;
late final Color primary = theme.colorScheme.primary;
return Material(
color: Colors.transparent,
@@ -396,7 +403,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
},
onLongPress: () {
if (cover?.isNotEmpty == true) {
imageSaveDialog(context: context, title: title, cover: cover);
imageSaveDialog(title: title, cover: cover);
}
},
child: Padding(
@@ -450,10 +457,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
title,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: Theme.of(context)
.textTheme
.bodyMedium!
.fontSize,
fontSize: theme.textTheme.bodyMedium!.fontSize,
height: 1.42,
letterSpacing: 0.3,
fontWeight: isCurrentIndex ? FontWeight.bold : null,
@@ -470,7 +474,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
style: TextStyle(
fontSize: 12,
height: 1,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
overflow: TextOverflow.clip,
),
),
@@ -550,14 +554,14 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
},
);
Widget get _buildToolbar => Container(
Widget _buildToolbar(ThemeData theme) => Container(
height: 45,
padding: EdgeInsets.symmetric(
horizontal: widget.showTitle != false ? 14 : 6),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor.withOpacity(0.1),
color: theme.dividerColor.withOpacity(0.1),
),
),
),
@@ -566,7 +570,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
if (widget.showTitle != false)
Text(
widget.type.title,
style: Theme.of(context).textTheme.titleMedium,
style: theme.textTheme.titleMedium,
),
if (_favState != null) Obx(() => _buildFavBtn(_favState!.value)),
mediumButton(

View File

@@ -25,40 +25,43 @@ class HttpError extends StatelessWidget {
);
}
Widget content(BuildContext context) => Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 40),
SvgPicture.asset(
"assets/images/error.svg",
height: 200,
Widget content(BuildContext context) {
final theme = Theme.of(context);
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 40),
SvgPicture.asset(
"assets/images/error.svg",
height: 200,
),
const SizedBox(height: 30),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 5),
child: SelectableText(
errMsg ?? '没有数据',
textAlign: TextAlign.center,
style: theme.textTheme.titleSmall,
scrollPhysics: const NeverScrollableScrollPhysics(),
),
const SizedBox(height: 30),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 5),
child: SelectableText(
errMsg ?? '没有数据',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.titleSmall,
scrollPhysics: const NeverScrollableScrollPhysics(),
),
if (onReload != null)
FilledButton.tonal(
onPressed: onReload,
style: ButtonStyle(
backgroundColor: WidgetStateProperty.resolveWith((states) {
return theme.colorScheme.primary.withAlpha(20);
}),
),
child: Text(
btnText ?? '点击重试',
style: TextStyle(color: theme.colorScheme.primary),
),
),
if (onReload != null)
FilledButton.tonal(
onPressed: onReload,
style: ButtonStyle(
backgroundColor: WidgetStateProperty.resolveWith((states) {
return Theme.of(context).colorScheme.primary.withAlpha(20);
}),
),
child: Text(
btnText ?? '点击重试',
style: TextStyle(color: Theme.of(context).colorScheme.primary),
),
),
SizedBox(height: 40 + MediaQuery.paddingOf(context).bottom),
],
);
SizedBox(height: 40 + MediaQuery.paddingOf(context).bottom),
],
);
}
}

View File

@@ -10,6 +10,7 @@ Widget iconButton({
Color? bgColor,
Color? iconColor,
}) {
late final theme = Theme.of(context);
return SizedBox(
width: size,
height: size,
@@ -19,12 +20,11 @@ Widget iconButton({
icon: Icon(
icon,
size: iconSize ?? size / 2,
color: iconColor ?? Theme.of(context).colorScheme.onSecondaryContainer,
color: iconColor ?? theme.colorScheme.onSecondaryContainer,
),
style: IconButton.styleFrom(
padding: EdgeInsets.zero,
backgroundColor:
bgColor ?? Theme.of(context).colorScheme.secondaryContainer,
backgroundColor: bgColor ?? theme.colorScheme.secondaryContainer,
),
),
);

View File

@@ -9,104 +9,108 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
void imageSaveDialog({
required BuildContext context,
required String? title,
required String? cover,
}) {
final double imgWidth = min(Get.width, Get.height) - 8 * 2;
SmartDialog.show(
animationType: SmartAnimationType.centerScale_otherSlide,
builder: (_) => Container(
width: imgWidth,
margin: const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(10.0),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Stack(
children: [
GestureDetector(
onTap: SmartDialog.dismiss,
child: NetworkImgLayer(
width: imgWidth,
height: imgWidth / StyleString.aspectRatio,
src: cover,
quality: 100,
),
),
Positioned(
right: 8,
top: 8,
child: Container(
width: 30,
height: 30,
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.3),
shape: BoxShape.circle,
),
child: IconButton(
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: SmartDialog.dismiss,
icon: const Icon(
Icons.close,
size: 18,
color: Colors.white,
),
),
),
),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(12, 10, 8, 10),
child: Row(
builder: (context) {
final theme = Theme.of(context);
return Container(
width: imgWidth,
margin: const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
decoration: BoxDecoration(
color: theme.colorScheme.surface,
borderRadius: BorderRadius.circular(10.0),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Stack(
children: [
Expanded(
child: SelectableText(
title ?? '',
style: Theme.of(context).textTheme.titleSmall,
GestureDetector(
onTap: SmartDialog.dismiss,
child: NetworkImgLayer(
width: imgWidth,
height: imgWidth / StyleString.aspectRatio,
src: cover,
quality: 100,
),
),
if (cover?.isNotEmpty == true) ...[
const SizedBox(width: 4),
iconButton(
context: context,
tooltip: '分享',
onPressed: () {
SmartDialog.dismiss();
DownloadUtils.onShareImg(cover!);
},
iconSize: 20,
icon: Icons.share,
bgColor: Colors.transparent,
iconColor: Theme.of(context).colorScheme.onSurfaceVariant,
Positioned(
right: 8,
top: 8,
child: Container(
width: 30,
height: 30,
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.3),
shape: BoxShape.circle,
),
child: IconButton(
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: SmartDialog.dismiss,
icon: const Icon(
Icons.close,
size: 18,
color: Colors.white,
),
),
),
iconButton(
context: context,
tooltip: '保存封面图',
onPressed: () async {
bool saveStatus =
await DownloadUtils.downloadImg(context, [cover!]);
if (saveStatus) {
SmartDialog.dismiss();
}
},
iconSize: 20,
icon: Icons.download,
bgColor: Colors.transparent,
iconColor: Theme.of(context).colorScheme.onSurfaceVariant,
),
],
),
],
),
),
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(12, 10, 8, 10),
child: Row(
children: [
Expanded(
child: SelectableText(
title ?? '',
style: theme.textTheme.titleSmall,
),
),
if (cover?.isNotEmpty == true) ...[
const SizedBox(width: 4),
iconButton(
context: context,
tooltip: '分享',
onPressed: () {
SmartDialog.dismiss();
DownloadUtils.onShareImg(cover!);
},
iconSize: 20,
icon: Icons.share,
bgColor: Colors.transparent,
iconColor: theme.colorScheme.onSurfaceVariant,
),
iconButton(
context: context,
tooltip: '保存封面图',
onPressed: () async {
bool saveStatus = await DownloadUtils.downloadImg(
context,
[cover!],
);
if (saveStatus) {
SmartDialog.dismiss();
}
},
iconSize: 20,
icon: Icons.download,
bgColor: Colors.transparent,
iconColor: theme.colorScheme.onSurfaceVariant,
),
],
],
),
),
],
),
);
},
);
}

View File

@@ -159,6 +159,7 @@ class _BanUserCheckboxState extends State<BanUserCheckbox> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return GestureDetector(
onTap: () {
setState(() => _banUid = !_banUid);
@@ -174,13 +175,13 @@ class _BanUserCheckboxState extends State<BanUserCheckbox> {
? Icons.check_box_outlined
: Icons.check_box_outline_blank,
color: _banUid
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.onSurfaceVariant,
? theme.colorScheme.primary
: theme.colorScheme.onSurfaceVariant,
),
Text(
' 拉黑该用户',
style: TextStyle(
color: _banUid ? Theme.of(context).colorScheme.primary : null,
color: _banUid ? theme.colorScheme.primary : null,
),
),
],

View File

@@ -275,6 +275,7 @@ class _SavePanelState extends State<SavePanel> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: Get.back,
@@ -295,7 +296,7 @@ class _SavePanelState extends State<SavePanel> {
child: Container(
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
color: theme.colorScheme.surface,
borderRadius: BorderRadius.circular(12),
),
child: AnimatedSize(
@@ -332,9 +333,7 @@ class _SavePanelState extends State<SavePanel> {
const EdgeInsets.symmetric(horizontal: 12),
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.onInverseSurface,
color: theme.colorScheme.onInverseSurface,
borderRadius: BorderRadius.circular(8),
),
child: Row(
@@ -369,9 +368,8 @@ class _SavePanelState extends State<SavePanel> {
.toString()
.substring(0, 19),
style: TextStyle(
color: Theme.of(context)
.colorScheme
.outline,
color:
theme.colorScheme.outline,
),
),
],
@@ -405,10 +403,9 @@ class _SavePanelState extends State<SavePanel> {
overflow: TextOverflow
.ellipsis,
style: TextStyle(
color:
Theme.of(context)
.colorScheme
.primary,
color: theme
.colorScheme
.primary,
),
),
const SizedBox(height: 4),
@@ -417,8 +414,7 @@ class _SavePanelState extends State<SavePanel> {
'识别二维码,$viewType$itemType',
textAlign: TextAlign.end,
style: TextStyle(
color: Theme.of(context)
.colorScheme
color: theme.colorScheme
.onSurfaceVariant,
),
),
@@ -431,8 +427,7 @@ class _SavePanelState extends State<SavePanel> {
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 13,
color: Theme.of(context)
.colorScheme
color: theme.colorScheme
.outline,
),
),
@@ -447,9 +442,8 @@ class _SavePanelState extends State<SavePanel> {
child: Container(
color: Get.isDarkMode
? Colors.white
: Theme.of(context)
.colorScheme
.surface,
: theme
.colorScheme.surface,
padding:
const EdgeInsets.all(3),
child: PrettyQrView.data(
@@ -473,9 +467,8 @@ class _SavePanelState extends State<SavePanel> {
child: Image.asset(
'assets/images/logo/logo_2.png',
width: 100,
color: Theme.of(context)
.colorScheme
.onSurfaceVariant,
color: theme
.colorScheme.onSurfaceVariant,
),
),
],
@@ -517,8 +510,8 @@ class _SavePanelState extends State<SavePanel> {
context: context,
icon: Icons.clear,
onPressed: Get.back,
bgColor: Theme.of(context).colorScheme.onInverseSurface,
iconColor: Theme.of(context).colorScheme.onSurfaceVariant,
bgColor: theme.colorScheme.onInverseSurface,
iconColor: theme.colorScheme.onSurfaceVariant,
),
const SizedBox(width: 40),
iconButton(

View File

@@ -64,7 +64,6 @@ class VideoCardH extends StatelessWidget {
onLongPress!();
} else {
imageSaveDialog(
context: context,
title: videoItem.title,
cover: videoItem.pic,
);
@@ -213,6 +212,7 @@ class VideoCardH extends StatelessWidget {
}
Widget videoContent(BuildContext context) {
final theme = Theme.of(context);
String pubdate = showPubdate
? Utils.dateFormat(videoItem.pubdate!, formatType: 'day')
: '';
@@ -234,13 +234,12 @@ class VideoCardH extends StatelessWidget {
TextSpan(
text: i['text'],
style: TextStyle(
fontSize:
Theme.of(context).textTheme.bodyMedium!.fontSize,
fontSize: theme.textTheme.bodyMedium!.fontSize,
height: 1.42,
letterSpacing: 0.3,
color: i['type'] == 'em'
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.onSurface,
? theme.colorScheme.primary
: theme.colorScheme.onSurface,
),
),
],
@@ -253,7 +252,7 @@ class VideoCardH extends StatelessWidget {
videoItem.title,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: Theme.of(context).textTheme.bodyMedium!.fontSize,
fontSize: theme.textTheme.bodyMedium!.fontSize,
height: 1.42,
letterSpacing: 0.3,
),
@@ -268,7 +267,7 @@ class VideoCardH extends StatelessWidget {
style: TextStyle(
fontSize: 12,
height: 1,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
overflow: TextOverflow.clip,
),
),

View File

@@ -38,7 +38,6 @@ class VideoCardHGrpc extends StatelessWidget {
child: InkWell(
borderRadius: BorderRadius.circular(12),
onLongPress: () => imageSaveDialog(
context: context,
title: videoItem.smallCoverV5.base.title,
cover: videoItem.smallCoverV5.base.cover,
),
@@ -110,6 +109,7 @@ class VideoCardHGrpc extends StatelessWidget {
}
Widget videoContent(context) {
final theme = Theme.of(context);
return Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -119,7 +119,7 @@ class VideoCardHGrpc extends StatelessWidget {
videoItem.smallCoverV5.base.title,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: Theme.of(context).textTheme.bodyMedium!.fontSize,
fontSize: theme.textTheme.bodyMedium!.fontSize,
height: 1.42,
letterSpacing: 0.3,
),
@@ -132,9 +132,9 @@ class VideoCardHGrpc extends StatelessWidget {
videoItem.smallCoverV5.rightDesc1,
maxLines: 1,
style: TextStyle(
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
fontSize: theme.textTheme.labelMedium!.fontSize,
height: 1,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
overflow: TextOverflow.clip,
),
),
@@ -143,9 +143,9 @@ class VideoCardHGrpc extends StatelessWidget {
videoItem.smallCoverV5.rightDesc2,
maxLines: 1,
style: TextStyle(
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
fontSize: theme.textTheme.labelMedium!.fontSize,
height: 1,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
overflow: TextOverflow.clip,
),
),

View File

@@ -31,7 +31,6 @@ class VideoCardHMemberVideo extends StatelessWidget {
children: [
InkWell(
onLongPress: () => imageSaveDialog(
context: context,
title: videoItem.title,
cover: videoItem.cover,
),
@@ -185,6 +184,7 @@ class VideoCardHMemberVideo extends StatelessWidget {
}
Widget videoContent(context) {
final theme = Theme.of(context);
return Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -197,11 +197,11 @@ class VideoCardHMemberVideo extends StatelessWidget {
fontWeight: videoItem.bvid != null && videoItem.bvid == bvid
? FontWeight.bold
: null,
fontSize: Theme.of(context).textTheme.bodyMedium!.fontSize,
fontSize: theme.textTheme.bodyMedium!.fontSize,
height: 1.42,
letterSpacing: 0.3,
color: videoItem.bvid != null && videoItem.bvid == bvid
? Theme.of(context).colorScheme.primary
? theme.colorScheme.primary
: null,
),
maxLines: 2,
@@ -216,7 +216,7 @@ class VideoCardHMemberVideo extends StatelessWidget {
style: TextStyle(
fontSize: 12,
height: 1,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
overflow: TextOverflow.clip,
),
),

View File

@@ -38,8 +38,8 @@ class VideoCardV extends StatelessWidget {
break;
case 'av':
String bvid = videoItem.bvid ?? IdUtils.av2bv(videoItem.aid!);
int cid = videoItem.cid!;
if (cid == -1) {
int? cid = videoItem.cid;
if (cid == null || cid == 0 || cid == -1) {
cid = await SearchHttp.ab2c(aid: videoItem.aid, bvid: bvid);
}
PageUtils.toVideoPage(
@@ -100,7 +100,6 @@ class VideoCardV extends StatelessWidget {
child: InkWell(
onTap: () => onPushDetail(Utils.makeHeroTag(videoItem.aid)),
onLongPress: () => imageSaveDialog(
context: context,
title: videoItem.title,
cover: videoItem.pic,
),
@@ -152,6 +151,7 @@ class VideoCardV extends StatelessWidget {
}
Widget videoContent(context) {
final theme = Theme.of(context);
return Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(6, 5, 6, 5),
@@ -168,7 +168,7 @@ class VideoCardV extends StatelessWidget {
),
),
),
videoStat(context),
videoStat(context, theme),
Row(
children: [
if (videoItem.goto == 'bangumi') ...[
@@ -217,9 +217,8 @@ class VideoCardV extends StatelessWidget {
overflow: TextOverflow.clip,
style: TextStyle(
height: 1.5,
fontSize:
Theme.of(context).textTheme.labelMedium!.fontSize,
color: Theme.of(context).colorScheme.outline,
fontSize: theme.textTheme.labelMedium!.fontSize,
color: theme.colorScheme.outline,
),
),
),
@@ -232,7 +231,7 @@ class VideoCardV extends StatelessWidget {
);
}
Widget videoStat(context) {
Widget videoStat(BuildContext context, ThemeData theme) {
return Row(
children: [
StatView(
@@ -254,8 +253,8 @@ class VideoCardV extends StatelessWidget {
maxLines: 1,
TextSpan(
style: TextStyle(
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
color: Theme.of(context).colorScheme.outline.withOpacity(0.8),
fontSize: theme.textTheme.labelSmall!.fontSize,
color: theme.colorScheme.outline.withOpacity(0.8),
),
text: Utils.formatTimestampToRelativeTime(videoItem.pubdate)),
),
@@ -268,8 +267,8 @@ class VideoCardV extends StatelessWidget {
maxLines: 1,
TextSpan(
style: TextStyle(
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
color: Theme.of(context).colorScheme.outline.withOpacity(0.8),
fontSize: theme.textTheme.labelSmall!.fontSize,
color: theme.colorScheme.outline.withOpacity(0.8),
),
text: Utils.shortenChineseDateString(
videoItem.desc!.split(' · ').last)),

View File

@@ -64,7 +64,6 @@ class VideoCardVMemberHome extends StatelessWidget {
child: InkWell(
onTap: () => onPushDetail(Utils.makeHeroTag(videoItem.bvid)),
onLongPress: () => imageSaveDialog(
context: context,
title: videoItem.title,
cover: videoItem.cover,
),