opt: code

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-28 16:16:40 +08:00
parent 1f71dc9a67
commit f4866258d2
41 changed files with 943 additions and 1223 deletions

View File

@@ -168,7 +168,7 @@ class _AppExpansionPanelListState extends State<AppExpansionPanelList> {
if (widget.expansionCallback != null && if (widget.expansionCallback != null &&
childIndex != index && childIndex != index &&
child.value == _currentOpenPanel?.value) { child.value == _currentOpenPanel?.value) {
widget.expansionCallback!(childIndex, false); widget.expansionCallback?.call(childIndex, false);
} }
} }

View File

@@ -6,90 +6,83 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/flutter_html.dart';
class ArticleContent extends StatelessWidget { Widget articleContent({
const ArticleContent({ required BuildContext context,
super.key, required List<ArticleContentModel> list,
required this.list, }) {
}); List<String>? imgList = list
.where((item) => item.pic != null)
final List<ArticleContentModel> list; .toList()
.map((item) => item.pic?.pics?.first.url ?? '')
@override .toList();
Widget build(BuildContext context) { return SliverList.separated(
List<String>? imgList = list itemCount: list.length,
.where((item) => item.pic != null) itemBuilder: (_, index) {
.toList() ArticleContentModel item = list[index];
.map((item) => item.pic?.pics?.first.url ?? '') if (item.text != null) {
.toList(); List<InlineSpan> spanList = [];
return SliverList.separated( item.text?.nodes?.forEach((item) {
itemCount: list.length, spanList.add(TextSpan(
itemBuilder: (_, index) { text: item.word?.words,
ArticleContentModel item = list[index]; style: TextStyle(
if (item.text != null) { letterSpacing: 0.3,
List<InlineSpan> spanList = []; fontSize: FontSize.large.value,
item.text?.nodes?.forEach((item) { height: LineHeight.percent(125).size,
spanList.add(TextSpan( fontStyle:
text: item.word?.words, item.word?.style?.italic == true ? FontStyle.italic : null,
style: TextStyle( color: item.word?.color != null
letterSpacing: 0.3, ? Color(int.parse(
fontSize: FontSize.large.value, item.word!.color!.replaceFirst('#', 'FF'),
height: LineHeight.percent(125).size, radix: 16,
fontStyle: ))
item.word?.style?.italic == true ? FontStyle.italic : null, : null,
color: item.word?.color != null decoration: item.word?.style?.strikethrough == true
? Color(int.parse( ? TextDecoration.lineThrough
item.word!.color!.replaceFirst('#', 'FF'), : null,
radix: 16, fontWeight:
)) item.word?.style?.bold == true ? FontWeight.bold : null,
: null,
decoration: item.word?.style?.strikethrough == true
? TextDecoration.lineThrough
: null,
fontWeight:
item.word?.style?.bold == true ? FontWeight.bold : null,
),
));
});
return SelectableText.rich(TextSpan(children: spanList));
} else if (item.line != null) {
return Container(
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(vertical: 10),
child: CachedNetworkImage(
imageUrl: item.line?.pic?.url?.http2https ?? '',
height: item.line?.pic?.height?.toDouble(),
), ),
); ));
} else if (item.pic != null) { });
return LayoutBuilder( return SelectableText.rich(TextSpan(children: spanList));
builder: (_, constraints) => GestureDetector( } else if (item.line != null) {
onTap: () { return Container(
showDialog( alignment: Alignment.center,
useSafeArea: false, padding: const EdgeInsets.symmetric(vertical: 10),
context: context, child: CachedNetworkImage(
builder: (context) { imageUrl: item.line?.pic?.url?.http2https ?? '',
return ImagePreview( height: item.line?.pic?.height?.toDouble(),
initialPage: imgList.indexOf(item.pic!.pics!.first.url!), ),
imgList: imgList, );
); } else if (item.pic != null) {
}, return LayoutBuilder(
); builder: (_, constraints) => GestureDetector(
}, onTap: () {
child: NetworkImgLayer( showDialog(
width: constraints.maxWidth, useSafeArea: false,
height: constraints.maxWidth * context: context,
item.pic!.pics!.first.height! / builder: (context) {
item.pic!.pics!.first.width!, return ImagePreview(
src: item.pic!.pics!.first.url, initialPage: imgList.indexOf(item.pic!.pics!.first.url!),
), imgList: imgList,
);
},
);
},
child: NetworkImgLayer(
width: constraints.maxWidth,
height: constraints.maxWidth *
item.pic!.pics!.first.height! /
item.pic!.pics!.first.width!,
src: item.pic!.pics!.first.url,
), ),
); ),
} else { );
return const SizedBox.shrink(); } else {
// return Text('unsupported content'); return const SizedBox.shrink();
} // return Text('unsupported content');
}, }
separatorBuilder: (context, index) => const SizedBox(height: 10), },
); separatorBuilder: (context, index) => const SizedBox(height: 10),
} );
} }

View File

@@ -3,139 +3,125 @@ import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/flutter_html.dart';
import 'network_img_layer.dart'; import 'network_img_layer.dart';
// ignore: must_be_immutable Widget htmlRender({
class HtmlRender extends StatelessWidget { required BuildContext context,
const HtmlRender({ String? htmlContent,
this.htmlContent, int? imgCount,
this.imgCount, List<String>? imgList,
this.imgList, required double constrainedWidth,
required this.constrainedWidth, }) {
super.key, return SelectionArea(
}); child: Html(
data: htmlContent,
final String? htmlContent; onLinkTap: (String? url, Map<String, String> buildContext, attributes) {},
final int? imgCount; extensions: [
final List<String>? imgList; TagExtension(
final double constrainedWidth; tagsToExtend: <String>{'img'},
builder: (ExtensionContext extensionContext) {
@override try {
Widget build(BuildContext context) { final Map<String, dynamic> attributes = extensionContext.attributes;
// double textScale = final List<dynamic> key = attributes.keys.toList();
// setting.get(SettingBoxKey.defaultTextScale, defaultValue: 1.0); String imgUrl = key.contains('src')
return SelectionArea( ? attributes['src'] as String
child: Html( : attributes['data-src'] as String;
data: htmlContent, if (imgUrl.startsWith('//')) {
onLinkTap: (String? url, Map<String, String> buildContext, attributes) {}, imgUrl = 'https:$imgUrl';
extensions: [ }
TagExtension( if (imgUrl.startsWith('http://')) {
tagsToExtend: <String>{'img'}, imgUrl = imgUrl.replaceAll('http://', 'https://');
builder: (ExtensionContext extensionContext) { }
try { imgUrl = imgUrl.contains('@') ? imgUrl.split('@').first : imgUrl;
final Map<String, dynamic> attributes = final bool isEmote = imgUrl.contains('/emote/');
extensionContext.attributes; final bool isMall = imgUrl.contains('/mall/');
final List<dynamic> key = attributes.keys.toList(); if (isMall) {
String imgUrl = key.contains('src')
? attributes['src'] as String
: attributes['data-src'] as String;
if (imgUrl.startsWith('//')) {
imgUrl = 'https:$imgUrl';
}
if (imgUrl.startsWith('http://')) {
imgUrl = imgUrl.replaceAll('http://', 'https://');
}
imgUrl = imgUrl.contains('@') ? imgUrl.split('@').first : imgUrl;
final bool isEmote = imgUrl.contains('/emote/');
final bool isMall = imgUrl.contains('/mall/');
if (isMall) {
return const SizedBox();
}
// bool inTable =
// extensionContext.element!.previousElementSibling == null ||
// extensionContext.element!.nextElementSibling == null;
// imgUrl = Utils().imageUrl(imgUrl!);
// return Image.network(
// imgUrl,
// width: isEmote ? 22 : null,
// height: isEmote ? 22 : null,
// );
return GestureDetector(
onTap: () {
showDialog(
useSafeArea: false,
context: context,
builder: (context) {
return ImagePreview(
initialPage: 0,
imgList: [imgUrl],
);
},
);
},
child: NetworkImgLayer(
width: isEmote ? 22 : constrainedWidth,
height: isEmote ? 22 : 200,
src: imgUrl,
ignoreHeight: !isEmote,
),
);
} catch (err) {
return const SizedBox(); return const SizedBox();
} }
}, // bool inTable =
), // extensionContext.element!.previousElementSibling == null ||
], // extensionContext.element!.nextElementSibling == null;
style: { // imgUrl = Utils().imageUrl(imgUrl!);
'html': Style( // return Image.network(
fontSize: FontSize.large, // imgUrl,
lineHeight: LineHeight.percent(160), // width: isEmote ? 22 : null,
letterSpacing: 0.3, // height: isEmote ? 22 : null,
), // );
// 'br': Style(margin: Margins.zero, padding: HtmlPaddings.zero), return GestureDetector(
'body': Style(margin: Margins.zero, padding: HtmlPaddings.zero), onTap: () {
'a': Style( showDialog(
color: Theme.of(context).colorScheme.primary, useSafeArea: false,
textDecoration: TextDecoration.none, context: context,
), builder: (context) {
'br': Style( return ImagePreview(
lineHeight: LineHeight.percent(-1), initialPage: 0,
), imgList: [imgUrl],
'p': Style( );
margin: Margins.only(bottom: 4), },
// margin: Margins.zero, );
), },
'span': Style( child: NetworkImgLayer(
fontSize: FontSize.medium, width: isEmote ? 22 : constrainedWidth,
height: Height(1.8), height: isEmote ? 22 : 200,
), src: imgUrl,
'div': Style(height: Height.auto()), ignoreHeight: !isEmote,
'li > p': Style( ),
display: Display.inline, );
), } catch (err) {
'li': Style( return const SizedBox();
padding: HtmlPaddings.only(bottom: 4), }
textAlign: TextAlign.justify, },
), ),
'img': Style(margin: Margins.only(top: 4, bottom: 4)), ],
'h1,h2': Style( style: {
fontSize: FontSize.xLarge, 'html': Style(
fontWeight: FontWeight.bold, fontSize: FontSize.large,
margin: Margins.only(bottom: 8), lineHeight: LineHeight.percent(160),
), letterSpacing: 0.3,
'h3,h4,h5': Style( ),
fontSize: FontSize.large, // 'br': Style(margin: Margins.zero, padding: HtmlPaddings.zero),
fontWeight: FontWeight.bold, 'body': Style(margin: Margins.zero, padding: HtmlPaddings.zero),
margin: Margins.only(bottom: 4), 'a': Style(
), color: Theme.of(context).colorScheme.primary,
'figcaption': Style( textDecoration: TextDecoration.none,
fontSize: FontSize.medium, ),
textAlign: TextAlign.center, 'br': Style(
// margin: Margins.only(top: 4), lineHeight: LineHeight.percent(-1),
), ),
'strong': Style(fontWeight: FontWeight.bold), 'p': Style(
'figure': Style( margin: Margins.only(bottom: 4),
margin: Margins.zero, // margin: Margins.zero,
), ),
}, 'span': Style(
)); fontSize: FontSize.medium,
} height: Height(1.8),
),
'div': Style(height: Height.auto()),
'li > p': Style(
display: Display.inline,
),
'li': Style(
padding: HtmlPaddings.only(bottom: 4),
textAlign: TextAlign.justify,
),
'img': Style(margin: Margins.only(top: 4, bottom: 4)),
'h1,h2': Style(
fontSize: FontSize.xLarge,
fontWeight: FontWeight.bold,
margin: Margins.only(bottom: 8),
),
'h3,h4,h5': Style(
fontSize: FontSize.large,
fontWeight: FontWeight.bold,
margin: Margins.only(bottom: 4),
),
'figcaption': Style(
fontSize: FontSize.medium,
textAlign: TextAlign.center,
// margin: Margins.only(top: 4),
),
'strong': Style(fontWeight: FontWeight.bold),
'figure': Style(
margin: Margins.zero,
),
},
));
} }

View File

@@ -13,53 +13,6 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import '../../utils/storage.dart'; import '../../utils/storage.dart';
import '../../utils/utils.dart'; import '../../utils/utils.dart';
class ListSheet {
ListSheet({
this.index,
this.season,
required this.episodes,
this.bvid,
this.aid,
required this.currentCid,
required this.changeFucCall,
required this.context,
this.scaffoldState,
});
final dynamic index;
final dynamic season;
final dynamic episodes;
final String? bvid;
final int? aid;
final int currentCid;
final Function changeFucCall;
final BuildContext context;
final ScaffoldState? scaffoldState;
late PersistentBottomSheetController bottomSheetController;
Widget get listSheetContent => ListSheetContent(
index: index,
season: season,
episodes: episodes,
bvid: bvid,
aid: aid,
currentCid: currentCid,
changeFucCall: changeFucCall,
onClose: bottomSheetController.close,
);
void buildShowBottomSheet() {
bottomSheetController = scaffoldState?.showBottomSheet(
(context) => listSheetContent,
) ??
showBottomSheet(
context: context,
builder: (context) => listSheetContent,
);
}
}
class ListSheetContent extends StatefulWidget { class ListSheetContent extends StatefulWidget {
const ListSheetContent({ const ListSheetContent({
super.key, super.key,
@@ -80,7 +33,7 @@ class ListSheetContent extends StatefulWidget {
final int? aid; final int? aid;
final int currentCid; final int currentCid;
final Function changeFucCall; final Function changeFucCall;
final Function() onClose; final VoidCallback? onClose;
@override @override
State<ListSheetContent> createState() => _ListSheetContentState(); State<ListSheetContent> createState() => _ListSheetContentState();
@@ -184,7 +137,7 @@ class _ListSheetContentState extends State<ListSheetContent>
} }
} }
SmartDialog.showToast('切换到:$title'); SmartDialog.showToast('切换到:$title');
widget.onClose(); widget.onClose?.call();
widget.changeFucCall( widget.changeFucCall(
episode is bangumi.EpisodeItem ? episode.epId : null, episode is bangumi.EpisodeItem ? episode.epId : null,
episode.runtimeType.toString() == "EpisodeItem" episode.runtimeType.toString() == "EpisodeItem"

View File

@@ -53,31 +53,21 @@ class LiveCard extends StatelessWidget {
child: AnimatedOpacity( child: AnimatedOpacity(
opacity: 1, opacity: 1,
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
child: LiveStat( child: liveStat(context),
// view: liveItem.stat.view,
// danmaku: liveItem.stat.danmaku,
// duration: liveItem.duration,
online: liveItem.online as int,
),
), ),
), ),
], ],
); );
}), }),
), ),
LiveContent(liveItem: liveItem) liveContent(context)
], ],
), ),
), ),
); );
} }
}
class LiveContent extends StatelessWidget { Widget liveContent(context) {
final dynamic liveItem;
const LiveContent({super.key, required this.liveItem});
@override
Widget build(BuildContext context) {
return Padding( return Padding(
// 多列 // 多列
padding: const EdgeInsets.fromLTRB(8, 8, 6, 7), padding: const EdgeInsets.fromLTRB(8, 8, 6, 7),
@@ -109,15 +99,8 @@ class LiveContent extends StatelessWidget {
), ),
); );
} }
}
class LiveStat extends StatelessWidget { Widget liveStat(context) {
const LiveStat({super.key, required this.online});
final int? online;
@override
Widget build(BuildContext context) {
return Container( return Container(
height: 45, height: 45,
padding: const EdgeInsets.only(top: 22, left: 8, right: 8), padding: const EdgeInsets.only(top: 22, left: 8, right: 8),
@@ -149,7 +132,7 @@ class LiveStat extends StatelessWidget {
// ], // ],
// ), // ),
Text( Text(
online.toString(), liveItem.online.toString(),
style: const TextStyle(fontSize: 11, color: Colors.white), style: const TextStyle(fontSize: 11, color: Colors.white),
) )
], ],

View File

@@ -53,7 +53,7 @@ class OverlayPop extends StatelessWidget {
style: ButtonStyle( style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero), padding: WidgetStateProperty.all(EdgeInsets.zero),
), ),
onPressed: () => closeFn!(), onPressed: () => closeFn?.call(),
icon: const Icon( icon: const Icon(
Icons.close, Icons.close,
size: 18, size: 18,
@@ -93,7 +93,7 @@ class OverlayPop extends StatelessWidget {
: (videoItem.cover as String).http2https) : (videoItem.cover as String).http2https)
], ],
); );
closeFn!(); closeFn?.call();
}, },
icon: const Icon(Icons.download, size: 20), icon: const Icon(Icons.download, size: 20),
) )

View File

@@ -1,40 +1,36 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:PiliPalaX/utils/utils.dart'; import 'package:PiliPalaX/utils/utils.dart';
class StatDanMu extends StatelessWidget { Widget statDanMu({
final String? theme; required BuildContext context,
final dynamic danmu; String? theme,
final String? size; dynamic danmu,
String? size,
const StatDanMu({super.key, this.theme, this.danmu, this.size}); }) {
Map<String, Color> colorObject = {
@override 'white': Colors.white,
Widget build(BuildContext context) { 'gray': Theme.of(context).colorScheme.outline.withOpacity(0.8),
Map<String, Color> colorObject = { 'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
'white': Colors.white, };
'gray': Theme.of(context).colorScheme.outline.withOpacity(0.8), Color color = colorObject[theme]!;
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.7), return Row(
}; children: [
Color color = colorObject[theme]!; Icon(
return Row( Icons.subtitles_outlined,
children: [ size: 14,
Icon( color: color,
Icons.subtitles_outlined, ),
size: 14, const SizedBox(width: 2),
Text(
Utils.numFormat(danmu!),
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: size == 'medium' ? 12 : 11,
color: color, color: color,
), ),
const SizedBox(width: 2), overflow: TextOverflow.clip,
Text( semanticsLabel: '${Utils.numFormat(danmu!)}条弹幕',
Utils.numFormat(danmu!), )
style: TextStyle( ],
fontWeight: FontWeight.w400, );
fontSize: size == 'medium' ? 12 : 11,
color: color,
),
overflow: TextOverflow.clip,
semanticsLabel: '${Utils.numFormat(danmu!)}条弹幕',
)
],
);
}
} }

View File

@@ -1,44 +1,40 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:PiliPalaX/utils/utils.dart'; import 'package:PiliPalaX/utils/utils.dart';
class StatView extends StatelessWidget { Widget statView({
final String? theme; required BuildContext context,
final dynamic view; String? theme,
final String? size; dynamic view,
final String? goto; String? size,
String? goto,
const StatView({super.key, this.theme, this.view, this.size, this.goto}); }) {
Map<String, Color> colorObject = {
@override 'white': Colors.white,
Widget build(BuildContext context) { 'gray': Theme.of(context).colorScheme.outline.withOpacity(0.8),
Map<String, Color> colorObject = { 'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
'white': Colors.white, };
'gray': Theme.of(context).colorScheme.outline.withOpacity(0.8), Color color = colorObject[theme]!;
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.7), return Row(
}; children: [
Color color = colorObject[theme]!; Icon(
return Row( goto == 'picture'
children: [ ? Icons.remove_red_eye_outlined
Icon( : Icons.play_circle_outlined,
goto == 'picture' size: 13,
? Icons.remove_red_eye_outlined color: color,
: Icons.play_circle_outlined, ),
size: 13, const SizedBox(width: 2),
Text(
Utils.numFormat(view!),
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: size == 'medium' ? 12 : 11,
color: color, color: color,
), ),
const SizedBox(width: 2), overflow: TextOverflow.clip,
Text( semanticsLabel:
Utils.numFormat(view!), '${Utils.numFormat(view!)}${goto == "picture" ? "浏览" : "播放"}',
style: TextStyle( ),
fontWeight: FontWeight.w400, ],
fontSize: size == 'medium' ? 12 : 11, );
color: color,
),
overflow: TextOverflow.clip,
semanticsLabel:
'${Utils.numFormat(view!)}${goto == "picture" ? "浏览" : "播放"}',
),
],
);
}
} }

View File

@@ -55,11 +55,7 @@ class VideoCardH extends StatelessWidget {
}, },
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
onLongPress: () { onLongPress: longPress,
if (longPress != null) {
longPress!();
}
},
onTap: () async { onTap: () async {
if (type == 'ketang') { if (type == 'ketang') {
SmartDialog.showToast('课堂视频暂不支持播放'); SmartDialog.showToast('课堂视频暂不支持播放');
@@ -120,14 +116,7 @@ class VideoCardH extends StatelessWidget {
}, },
), ),
), ),
VideoContent( videoContent(context)
videoItem: videoItem,
source: source,
showOwner: showOwner,
showView: showView,
showDanmaku: showDanmaku,
showPubdate: showPubdate,
)
], ],
); );
}, },
@@ -146,28 +135,8 @@ class VideoCardH extends StatelessWidget {
), ),
]); ]);
} }
}
class VideoContent extends StatelessWidget { Widget videoContent(context) {
final dynamic videoItem;
final String source;
final bool showOwner;
final bool showView;
final bool showDanmaku;
final bool showPubdate;
const VideoContent({
super.key,
required this.videoItem,
this.source = 'normal',
this.showOwner = true,
this.showView = true,
this.showDanmaku = true,
this.showPubdate = false,
});
@override
Widget build(BuildContext context) {
String pubdate = showPubdate String pubdate = showPubdate
? Utils.dateFormat(videoItem.pubdate!, formatType: 'day') ? Utils.dateFormat(videoItem.pubdate!, formatType: 'day')
: ''; : '';
@@ -258,14 +227,16 @@ class VideoContent extends StatelessWidget {
Row( Row(
children: [ children: [
if (showView) ...[ if (showView) ...[
StatView( statView(
context: context,
theme: 'gray', theme: 'gray',
view: videoItem.stat.view as int, view: videoItem.stat.view as int,
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
], ],
if (showDanmaku) if (showDanmaku)
StatDanMu( statDanMu(
context: context,
theme: 'gray', theme: 'gray',
danmu: videoItem.stat.danmu as int, danmu: videoItem.stat.danmu as int,
), ),

View File

@@ -50,11 +50,7 @@ class VideoCardHGrpc extends StatelessWidget {
// }, // },
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
onLongPress: () { onLongPress: longPress,
if (longPress != null) {
longPress!();
}
},
onTap: () async { onTap: () async {
if (type == 'ketang') { if (type == 'ketang') {
SmartDialog.showToast('课堂视频暂不支持播放'); SmartDialog.showToast('课堂视频暂不支持播放');
@@ -121,14 +117,7 @@ class VideoCardHGrpc extends StatelessWidget {
}, },
), ),
), ),
VideoContent( videoContent(context)
videoItem: videoItem,
source: source,
showOwner: showOwner,
showView: showView,
showDanmaku: showDanmaku,
showPubdate: showPubdate,
)
], ],
); );
}, },
@@ -147,32 +136,8 @@ class VideoCardHGrpc extends StatelessWidget {
// ), // ),
]); ]);
} }
}
class VideoContent extends StatelessWidget { Widget videoContent(context) {
final card.Card videoItem;
final String source;
final bool showOwner;
final bool showView;
final bool showDanmaku;
final bool showPubdate;
const VideoContent({
super.key,
required this.videoItem,
this.source = 'normal',
this.showOwner = true,
this.showView = true,
this.showDanmaku = true,
this.showPubdate = false,
});
@override
Widget build(BuildContext context) {
// String pubdate = showPubdate
// ? Utils.dateFormat(videoItem.pubdate!, formatType: 'day')
// : '';
// if (pubdate != '') pubdate += ' ';
return Expanded( return Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(10, 0, 6, 0), padding: const EdgeInsets.fromLTRB(10, 0, 6, 0),

View File

@@ -30,11 +30,7 @@ class VideoCardHMemberVideo extends StatelessWidget {
return Stack(children: [ return Stack(children: [
InkWell( InkWell(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
onLongPress: () { onLongPress: longPress,
if (longPress != null) {
longPress!();
}
},
onTap: () async { onTap: () async {
try { try {
Get.toNamed('/video?bvid=$bvid&cid=${videoItem.firstCid}', Get.toNamed('/video?bvid=$bvid&cid=${videoItem.firstCid}',
@@ -87,9 +83,7 @@ class VideoCardHMemberVideo extends StatelessWidget {
}, },
), ),
), ),
VideoContent( videoContent(context)
videoItem: videoItem,
)
], ],
); );
}, },
@@ -106,18 +100,8 @@ class VideoCardHMemberVideo extends StatelessWidget {
), ),
]); ]);
} }
}
class VideoContent extends StatelessWidget { Widget videoContent(context) {
final Item videoItem;
const VideoContent({
super.key,
required this.videoItem,
});
@override
Widget build(BuildContext context) {
return Expanded( return Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(10, 0, 6, 0), padding: const EdgeInsets.fromLTRB(10, 0, 6, 0),
@@ -157,14 +141,16 @@ class VideoContent extends StatelessWidget {
const SizedBox(height: 3), const SizedBox(height: 3),
Row( Row(
children: [ children: [
StatView( statView(
context: context,
theme: 'gray', theme: 'gray',
// view: videoItem.season?['view_content'] ?? // view: videoItem.season?['view_content'] ??
// videoItem.viewContent, // videoItem.viewContent,
view: videoItem.viewContent, view: videoItem.viewContent,
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
StatDanMu( statDanMu(
context: context,
theme: 'gray', theme: 'gray',
// danmu: videoItem.season?['danmaku'] ?? videoItem.danmaku, // danmu: videoItem.season?['danmaku'] ?? videoItem.danmaku,
danmu: videoItem.danmaku, danmu: videoItem.danmaku,

View File

@@ -158,11 +158,7 @@ class VideoCardV extends StatelessWidget {
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
child: InkWell( child: InkWell(
onTap: () async => onPushDetail(heroTag), onTap: () async => onPushDetail(heroTag),
onLongPress: () { onLongPress: longPress,
if (longPress != null) {
longPress!();
}
},
child: Column( child: Column(
children: [ children: [
AspectRatio( AspectRatio(
@@ -194,7 +190,7 @@ class VideoCardV extends StatelessWidget {
); );
}), }),
), ),
VideoContent(videoItem: videoItem) videoContent(context)
], ],
), ),
), ),
@@ -211,13 +207,8 @@ class VideoCardV extends StatelessWidget {
)), )),
]); ]);
} }
}
class VideoContent extends StatelessWidget { Widget videoContent(context) {
final dynamic videoItem;
const VideoContent({super.key, required this.videoItem});
@override
Widget build(BuildContext context) {
return Expanded( return Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(6, 5, 6, 5), padding: const EdgeInsets.fromLTRB(6, 5, 6, 5),
@@ -241,9 +232,7 @@ class VideoContent extends StatelessWidget {
), ),
const Spacer(), const Spacer(),
// const SizedBox(height: 2), // const SizedBox(height: 2),
VideoStat( videoStat(context),
videoItem: videoItem,
),
Row( Row(
children: [ children: [
if (videoItem.goto == 'bangumi') ...[ if (videoItem.goto == 'bangumi') ...[
@@ -303,28 +292,20 @@ class VideoContent extends StatelessWidget {
), ),
); );
} }
}
class VideoStat extends StatelessWidget { Widget videoStat(context) {
final dynamic videoItem;
const VideoStat({
super.key,
required this.videoItem,
});
@override
Widget build(BuildContext context) {
return Row( return Row(
children: [ children: [
StatView( statView(
context: context,
theme: 'gray', theme: 'gray',
view: videoItem.stat.view, view: videoItem.stat.view,
goto: videoItem.goto, goto: videoItem.goto,
), ),
const SizedBox(width: 6), const SizedBox(width: 6),
if (videoItem.goto != 'picture') if (videoItem.goto != 'picture')
StatDanMu( statDanMu(
context: context,
theme: 'gray', theme: 'gray',
danmu: videoItem.stat.danmu, danmu: videoItem.stat.danmu,
), ),

View File

@@ -147,11 +147,7 @@ class VideoCardVMemberHome extends StatelessWidget {
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
child: InkWell( child: InkWell(
onTap: () async => onPushDetail(heroTag), onTap: () async => onPushDetail(heroTag),
onLongPress: () { onLongPress: longPress,
if (longPress != null) {
longPress!();
}
},
child: Column( child: Column(
children: [ children: [
AspectRatio( AspectRatio(

View File

@@ -312,7 +312,8 @@ class _BangumiInfoState extends State<BangumiInfo>
), ),
Row( Row(
children: [ children: [
StatView( statView(
context: context,
theme: 'gray', theme: 'gray',
view: !widget.loadingStatus view: !widget.loadingStatus
? widget.bangumiDetail!.stat!['views'] ? widget.bangumiDetail!.stat!['views']
@@ -320,7 +321,8 @@ class _BangumiInfoState extends State<BangumiInfo>
size: 'medium', size: 'medium',
), ),
const SizedBox(width: 6), const SizedBox(width: 6),
StatDanMu( statDanMu(
context: context,
theme: 'gray', theme: 'gray',
danmu: !widget.loadingStatus danmu: !widget.loadingStatus
? widget ? widget

View File

@@ -59,13 +59,15 @@ class IntroDetail extends StatelessWidget {
const SizedBox(height: 4), const SizedBox(height: 4),
Row( Row(
children: [ children: [
StatView( statView(
context: context,
theme: 'gray', theme: 'gray',
view: bangumiDetail!.stat!['views'], view: bangumiDetail!.stat!['views'],
size: 'medium', size: 'medium',
), ),
const SizedBox(width: 6), const SizedBox(width: 6),
StatDanMu( statDanMu(
context: context,
theme: 'gray', theme: 'gray',
danmu: bangumiDetail!.stat!['danmakus'], danmu: bangumiDetail!.stat!['danmakus'],
size: 'medium', size: 'medium',

View File

@@ -123,20 +123,15 @@ class BangumiCardV extends StatelessWidget {
}), }),
), ),
), ),
BangumiContent(bangumiItem: bangumiItem) bagumiContent(context)
], ],
), ),
), ),
), ),
); );
} }
}
class BangumiContent extends StatelessWidget { Widget bagumiContent(context) {
const BangumiContent({super.key, required this.bangumiItem});
final dynamic bangumiItem;
@override
Widget build(BuildContext context) {
return Expanded( return Expanded(
child: Padding( child: Padding(
// 多列 // 多列

View File

@@ -254,9 +254,7 @@ class MorePanel extends StatelessWidget {
TextButton( TextButton(
onPressed: () { onPressed: () {
Get.back(); Get.back();
if (onRemove != null) { onRemove?.call(item.idStr);
onRemove!(item.idStr);
}
}, },
child: const Text('确定'), child: const Text('确定'),
), ),

View File

@@ -255,9 +255,7 @@ class MorePanel extends StatelessWidget {
TextButton( TextButton(
onPressed: () { onPressed: () {
Get.back(); Get.back();
if (onRemove != null) { onRemove?.call(item.idStr);
onRemove!(item.idStr);
}
}, },
child: const Text('确定'), child: const Text('确定'),
), ),

View File

@@ -1,4 +1,3 @@
import 'package:PiliPalaX/models/user/fav_folder.dart';
import 'package:PiliPalaX/utils/utils.dart'; import 'package:PiliPalaX/utils/utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:PiliPalaX/common/constants.dart'; import 'package:PiliPalaX/common/constants.dart';
@@ -48,7 +47,7 @@ class FavItem extends StatelessWidget {
}, },
), ),
), ),
VideoContent(favFolderItem: favFolderItem) videoContent(context)
], ],
), ),
); );
@@ -57,14 +56,8 @@ class FavItem extends StatelessWidget {
), ),
); );
} }
}
class VideoContent extends StatelessWidget { Widget videoContent(context) {
final FavFolderItemData favFolderItem;
const VideoContent({super.key, required this.favFolderItem});
@override
Widget build(BuildContext context) {
return Expanded( return Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(10, 2, 6, 0), padding: const EdgeInsets.fromLTRB(10, 2, 6, 0),

View File

@@ -116,11 +116,7 @@ class FavVideoCardH extends StatelessWidget {
}, },
), ),
), ),
VideoContent( videoContent(context)
videoItem: videoItem,
callFn: callFn,
searchType: searchType,
)
], ],
), ),
); );
@@ -131,21 +127,8 @@ class FavVideoCardH extends StatelessWidget {
), ),
); );
} }
}
class VideoContent extends StatelessWidget { Widget videoContent(context) {
final dynamic videoItem;
final Function? callFn;
final int? searchType;
const VideoContent({
super.key,
required this.videoItem,
this.callFn,
this.searchType,
});
@override
Widget build(BuildContext context) {
return Expanded( return Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(10, 2, 6, 0), padding: const EdgeInsets.fromLTRB(10, 2, 6, 0),
@@ -195,13 +178,17 @@ class VideoContent extends StatelessWidget {
padding: const EdgeInsets.only(top: 2), padding: const EdgeInsets.only(top: 2),
child: Row( child: Row(
children: [ children: [
StatView( statView(
context: context,
theme: 'gray', theme: 'gray',
view: videoItem.cntInfo['play'], view: videoItem.cntInfo['play'],
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
StatDanMu( statDanMu(
theme: 'gray', danmu: videoItem.cntInfo['danmaku']), context: context,
theme: 'gray',
danmu: videoItem.cntInfo['danmaku'],
),
const Spacer(), const Spacer(),
], ],
), ),
@@ -236,7 +223,7 @@ class VideoContent extends StatelessWidget {
)), )),
TextButton( TextButton(
onPressed: () async { onPressed: () async {
await callFn!(); await callFn?.call();
Get.back(); Get.back();
}, },
child: const Text('确定取消'), child: const Text('确定取消'),

View File

@@ -37,7 +37,7 @@ class HistoryItem extends StatelessWidget {
onTap: () async { onTap: () async {
if (ctr!.enableMultiple.value) { if (ctr!.enableMultiple.value) {
feedBack(); feedBack();
onChoose!(); onChoose?.call();
return; return;
} }
if (videoItem.history.business.contains('article')) { if (videoItem.history.business.contains('article')) {
@@ -158,8 +158,8 @@ class HistoryItem extends StatelessWidget {
if (!ctr!.enableMultiple.value) { if (!ctr!.enableMultiple.value) {
feedBack(); feedBack();
ctr!.enableMultiple.value = true; ctr!.enableMultiple.value = true;
onChoose!(); onChoose?.call();
onUpdateMultiple!(); onUpdateMultiple?.call();
} }
}, },
child: Column( child: Column(
@@ -264,7 +264,7 @@ class HistoryItem extends StatelessWidget {
), ),
onPressed: () { onPressed: () {
feedBack(); feedBack();
onChoose!(); onChoose?.call();
}, },
icon: Icon(Icons.done_all_outlined, icon: Icon(Icons.done_all_outlined,
color: Theme.of(context) color: Theme.of(context)
@@ -301,7 +301,7 @@ class HistoryItem extends StatelessWidget {
) )
], ],
), ),
VideoContent(videoItem: videoItem, ctr: ctr) videoContent(context)
], ],
), ),
); );
@@ -312,15 +312,8 @@ class HistoryItem extends StatelessWidget {
), ),
); );
} }
}
class VideoContent extends StatelessWidget { Widget videoContent(context) {
final dynamic videoItem;
final dynamic ctr;
const VideoContent({super.key, required this.videoItem, this.ctr});
@override
Widget build(BuildContext context) {
return Expanded( return Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(10, 2, 6, 0), padding: const EdgeInsets.fromLTRB(10, 2, 6, 0),

View File

@@ -448,12 +448,14 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
sliver: Obx( sliver: Obx(
() => _htmlRenderCtr.loaded.value () => _htmlRenderCtr.loaded.value
? _htmlRenderCtr.response['isJsonContent'] == true ? _htmlRenderCtr.response['isJsonContent'] == true
? ArticleContent( ? articleContent(
context: context,
list: _htmlRenderCtr.response['content'], list: _htmlRenderCtr.response['content'],
) )
: SliverToBoxAdapter( : SliverToBoxAdapter(
child: LayoutBuilder( child: LayoutBuilder(
builder: (_, constraints) => HtmlRender( builder: (_, constraints) => htmlRender(
context: context,
htmlContent: _htmlRenderCtr.response['content'], htmlContent: _htmlRenderCtr.response['content'],
constrainedWidth: constraints.maxWidth, constrainedWidth: constraints.maxWidth,
), ),

View File

@@ -29,11 +29,7 @@ class LiveCardV extends StatelessWidget {
Get.toNamed('/liveRoom?roomid=${liveItem.roomId}', Get.toNamed('/liveRoom?roomid=${liveItem.roomId}',
arguments: {'liveItem': liveItem, 'heroTag': heroTag}); arguments: {'liveItem': liveItem, 'heroTag': heroTag});
}, },
onLongPress: () { onLongPress: longPress,
if (longPress != null) {
longPress!();
}
},
child: Column( child: Column(
children: [ children: [
ClipRRect( ClipRRect(
@@ -60,9 +56,7 @@ class LiveCardV extends StatelessWidget {
child: AnimatedOpacity( child: AnimatedOpacity(
opacity: 1, opacity: 1,
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
child: VideoStat( child: videoStat(context),
liveItem: liveItem,
),
), ),
), ),
], ],
@@ -70,19 +64,14 @@ class LiveCardV extends StatelessWidget {
}), }),
), ),
), ),
LiveContent(liveItem: liveItem) liveContent(context)
], ],
), ),
), ),
); );
} }
}
class LiveContent extends StatelessWidget { Widget liveContent(context) {
final dynamic liveItem;
const LiveContent({super.key, required this.liveItem});
@override
Widget build(BuildContext context) {
return Expanded( return Expanded(
flex: 1, flex: 1,
child: Padding( child: Padding(
@@ -92,7 +81,7 @@ class LiveContent extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
liveItem.title, '${liveItem.title}',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@@ -105,7 +94,7 @@ class LiveContent extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
liveItem.uname, '${liveItem.uname}',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: TextStyle( style: TextStyle(
fontSize: fontSize:
@@ -123,18 +112,8 @@ class LiveContent extends StatelessWidget {
), ),
); );
} }
}
class VideoStat extends StatelessWidget { Widget videoStat(context) {
final LiveItemModel? liveItem;
const VideoStat({
super.key,
required this.liveItem,
});
@override
Widget build(BuildContext context) {
return Container( return Container(
height: 50, height: 50,
padding: const EdgeInsets.only(top: 26, left: 10, right: 10), padding: const EdgeInsets.only(top: 26, left: 10, right: 10),
@@ -153,14 +132,14 @@ class VideoStat extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
liveItem!.areaName!, '${liveItem.areaName}',
style: const TextStyle(fontSize: 11, color: Colors.white), style: const TextStyle(fontSize: 11, color: Colors.white),
semanticsLabel: "${liveItem!.areaName!}直播", semanticsLabel: "${liveItem.areaName}直播",
), ),
Text( Text(
liveItem!.watchedShow!['text_small'], liveItem.watchedShow!['text_small'],
style: const TextStyle(fontSize: 11, color: Colors.white), style: const TextStyle(fontSize: 11, color: Colors.white),
semanticsLabel: "${liveItem!.watchedShow!['text_small']}围观", semanticsLabel: "${liveItem.watchedShow?['text_small']}围观",
), ),
], ],
), ),

View File

@@ -68,7 +68,8 @@ class MemberCoinsItem extends StatelessWidget {
const SizedBox(height: 4), const SizedBox(height: 4),
Row( Row(
children: [ children: [
StatView( statView(
context: context,
view: coinItem.view, view: coinItem.view,
theme: 'gray', theme: 'gray',
), ),

View File

@@ -72,7 +72,8 @@ class MemberSeasonsItem extends StatelessWidget {
const SizedBox(height: 4), const SizedBox(height: 4),
Row( Row(
children: [ children: [
StatView( statView(
context: context,
view: seasonItem.view, view: seasonItem.view,
theme: 'gray', theme: 'gray',
), ),

View File

@@ -27,7 +27,7 @@ class HotKeyword extends StatelessWidget {
borderRadius: BorderRadius.circular(3), borderRadius: BorderRadius.circular(3),
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
child: InkWell( child: InkWell(
onTap: () => onClick!(i.keyword), onTap: () => onClick?.call(i.keyword),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 2, left: 2,

View File

@@ -29,10 +29,10 @@ class SearchText extends StatelessWidget {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
onSelect!(searchText); onSelect?.call(searchText);
}, },
onLongPress: () { onLongPress: () {
onLongSelect!(searchText); onLongSelect?.call(searchText);
}, },
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
child: Padding( child: Padding(

View File

@@ -163,7 +163,7 @@ class CustomFilterChip extends StatelessWidget {
// Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5), // Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
side: BorderSide.none, side: BorderSide.none,
onSelected: (bool selected) => callFn!(selected), onSelected: (bool selected) => callFn?.call(selected),
), ),
); );
} }

View File

@@ -56,10 +56,7 @@ class SubItem extends StatelessWidget {
}, },
), ),
), ),
VideoContent( videoContent(context)
subFolderItem: subFolderItem,
cancelSub: cancelSub,
)
], ],
), ),
); );
@@ -68,15 +65,8 @@ class SubItem extends StatelessWidget {
), ),
); );
} }
}
class VideoContent extends StatelessWidget { Widget videoContent(context) {
final SubFolderItemData subFolderItem;
final Function(SubFolderItemData)? cancelSub;
const VideoContent({super.key, required this.subFolderItem, this.cancelSub});
@override
Widget build(BuildContext context) {
// subFolderItem.type == 11播单 // subFolderItem.type == 11播单
// subFolderItem.type == 21合集 // subFolderItem.type == 21合集
// 其它:其它 // 其它:其它
@@ -130,7 +120,7 @@ class VideoContent extends StatelessWidget {
height: 35, height: 35,
width: 35, width: 35,
child: IconButton( child: IconButton(
onPressed: () => cancelSub?.call(subFolderItem), onPressed: () => cancelSub(subFolderItem),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.outline, foregroundColor: Theme.of(context).colorScheme.outline,
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),

View File

@@ -91,10 +91,7 @@ class SubVideoCardH extends StatelessWidget {
}, },
), ),
), ),
VideoContent( videoContent(context)
videoItem: videoItem,
searchType: searchType,
)
], ],
), ),
); );
@@ -105,19 +102,8 @@ class SubVideoCardH extends StatelessWidget {
), ),
); );
} }
}
class VideoContent extends StatelessWidget { Widget videoContent(context) {
final dynamic videoItem;
final int? searchType;
const VideoContent({
super.key,
required this.videoItem,
this.searchType,
});
@override
Widget build(BuildContext context) {
return Expanded( return Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(10, 2, 6, 0), padding: const EdgeInsets.fromLTRB(10, 2, 6, 0),
@@ -127,7 +113,7 @@ class VideoContent extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
videoItem.title, '${videoItem.title}',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@@ -147,13 +133,17 @@ class VideoContent extends StatelessWidget {
padding: const EdgeInsets.only(top: 2), padding: const EdgeInsets.only(top: 2),
child: Row( child: Row(
children: [ children: [
StatView( statView(
context: context,
theme: 'gray', theme: 'gray',
view: videoItem.cntInfo['play'], view: videoItem.cntInfo?['play'],
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
StatDanMu( statDanMu(
theme: 'gray', danmu: videoItem.cntInfo['danmaku']), context: context,
theme: 'gray',
danmu: videoItem.cntInfo?['danmaku'],
),
const Spacer(), const Spacer(),
], ],
), ),

View File

@@ -444,7 +444,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
onTap: showIntroDetail, onTap: showIntroDetail,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
StatView( statView(
context: context,
theme: 'gray', theme: 'gray',
view: !loadingStatus view: !loadingStatus
? widget.videoDetail?.stat?.view ?? '-' ? widget.videoDetail?.stat?.view ?? '-'
@@ -452,7 +453,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
size: 'medium', size: 'medium',
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
StatDanMu( statDanMu(
context: context,
theme: 'gray', theme: 'gray',
danmu: !loadingStatus danmu: !loadingStatus
? widget.videoDetail?.stat?.danmu ?? '-' ? widget.videoDetail?.stat?.danmu ?? '-'

View File

@@ -32,13 +32,11 @@ class ActionRowItem extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () => { onTap: () => {
feedBack(), feedBack(),
onTap!(), onTap?.call(),
}, },
onLongPress: () { onLongPress: () {
feedBack(); feedBack();
if (onLongPress != null) { onLongPress?.call();
onLongPress!();
}
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(15, 7, 15, 7), padding: const EdgeInsets.fromLTRB(15, 7, 15, 7),

View File

@@ -56,13 +56,15 @@ class IntroDetail extends StatelessWidget {
const SizedBox(height: 6), const SizedBox(height: 6),
Row( Row(
children: [ children: [
StatView( statView(
context: context,
theme: 'gray', theme: 'gray',
view: videoDetail!.stat!.view, view: videoDetail!.stat!.view,
size: 'medium', size: 'medium',
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
StatDanMu( statDanMu(
context: context,
theme: 'gray', theme: 'gray',
danmu: videoDetail!.stat!.danmu, danmu: videoDetail!.stat!.danmu,
size: 'medium', size: 'medium',

View File

@@ -61,7 +61,7 @@ class MenuRow extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () => { onTap: () => {
feedBack(), feedBack(),
onTap!(), onTap?.call(),
}, },
child: Container( child: Container(
padding: const EdgeInsets.fromLTRB(13, 5.5, 13, 4.5), padding: const EdgeInsets.fromLTRB(13, 5.5, 13, 4.5),
@@ -120,7 +120,7 @@ class ActionRowLineItem extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () => { onTap: () => {
feedBack(), feedBack(),
onTap!(), onTap?.call(),
}, },
child: Container( child: Container(
padding: const EdgeInsets.fromLTRB(13, 5.5, 13, 4.5), padding: const EdgeInsets.fromLTRB(13, 5.5, 13, 4.5),

View File

@@ -60,9 +60,7 @@ class ReplyItem extends StatelessWidget {
return MorePanel( return MorePanel(
item: replyItem!, item: replyItem!,
onDelete: (rpid) { onDelete: (rpid) {
if (onDelete != null) { onDelete?.call(rpid, null);
onDelete!(rpid, null);
}
}, },
); );
}, },
@@ -318,9 +316,7 @@ class ReplyItem extends StatelessWidget {
replyItem: replyItem, replyItem: replyItem,
replyReply: replyReply, replyReply: replyReply,
onDelete: (rpid) { onDelete: (rpid) {
if (onDelete != null) { onDelete?.call(rpid, replyItem!.rpid);
onDelete!(rpid, replyItem!.rpid);
}
}, },
), ),
), ),
@@ -339,10 +335,7 @@ class ReplyItem extends StatelessWidget {
child: TextButton( child: TextButton(
onPressed: () { onPressed: () {
feedBack(); feedBack();
if (onReply != null) { onReply?.call();
onReply!();
return;
}
}, },
child: Row(children: [ child: Row(children: [
Icon(Icons.reply, Icon(Icons.reply,
@@ -990,8 +983,8 @@ class MorePanel extends StatelessWidget {
'https://www.bilibili.com/h5/comment/report?mid=${item.mid}&oid=${item.oid}&pageType=1&rpid=${item.rpid}&platform=android', 'https://www.bilibili.com/h5/comment/report?mid=${item.mid}&oid=${item.oid}&pageType=1&rpid=${item.rpid}&platform=android',
}, },
); );
if (result == true && onDelete != null) { if (result == true) {
onDelete!(item.rpid!); onDelete?.call(item.rpid!);
} }
break; break;
case 'copyAll': case 'copyAll':
@@ -1056,10 +1049,7 @@ class MorePanel extends StatelessWidget {
SmartDialog.dismiss(); SmartDialog.dismiss();
if (result['status']) { if (result['status']) {
SmartDialog.showToast('删除成功'); SmartDialog.showToast('删除成功');
// Get.back(); onDelete?.call(item.rpid!);
if (onDelete != null) {
onDelete!(item.rpid!);
}
} else { } else {
SmartDialog.showToast('删除失败, ${result["msg"]}'); SmartDialog.showToast('删除失败, ${result["msg"]}');
} }

File diff suppressed because it is too large Load Diff

View File

@@ -292,9 +292,7 @@ class _ReplyPageState extends State<ReplyPage>
_enablePublish = false; _enablePublish = false;
_publishStream.add(false); _publishStream.add(false);
} }
if (widget.onSaveReply != null) { widget.onSaveReply?.call(value);
widget.onSaveReply!(value);
}
}, },
focusNode: _focusNode, focusNode: _focusNode,
decoration: const InputDecoration( decoration: const InputDecoration(
@@ -537,8 +535,6 @@ class _ReplyPageState extends State<ReplyPage>
selection: selection:
TextSelection.collapsed(offset: cursorPosition + emote.text!.length), TextSelection.collapsed(offset: cursorPosition + emote.text!.length),
); );
if (widget.onSaveReply != null) { widget.onSaveReply?.call(_replyContentController.text);
widget.onSaveReply!(_replyContentController.text);
}
} }
} }

View File

@@ -1350,20 +1350,28 @@ class _VideoDetailPageState extends State<VideoDetailPage>
} }
showEpisodes(index, season, episodes, bvid, aid, cid) { showEpisodes(index, season, episodes, bvid, aid, cid) {
ListSheet( PersistentBottomSheetController? bottomSheetController;
index: index,
season: season, Widget listSheetContent() => ListSheetContent(
episodes: episodes, index: index,
bvid: bvid, season: season,
aid: aid, episodes: episodes,
currentCid: cid, bvid: bvid,
changeFucCall: videoDetailController.videoType == SearchType.media_bangumi aid: aid,
? bangumiIntroController.changeSeasonOrbangu currentCid: cid,
: videoIntroController.changeSeasonOrbangu, changeFucCall:
context: context, videoDetailController.videoType == SearchType.media_bangumi
scaffoldState: isFullScreen ? bangumiIntroController.changeSeasonOrbangu
? videoDetailController.scaffoldKey.currentState : videoIntroController.changeSeasonOrbangu,
: videoDetailController.childKey.currentState, onClose: bottomSheetController?.close,
).buildShowBottomSheet(); );
bottomSheetController = isFullScreen
? videoDetailController.scaffoldKey.currentState?.showBottomSheet(
(context) => listSheetContent(),
)
: videoDetailController.scaffoldKey.currentState?.showBottomSheet(
(context) => listSheetContent(),
);
} }
} }

View File

@@ -301,9 +301,7 @@ class PlPlayerController {
static Future<void> playIfExists( static Future<void> playIfExists(
{bool repeat = false, bool hideControls = true}) async { {bool repeat = false, bool hideControls = true}) async {
// await _instance?.play(repeat: repeat, hideControls: hideControls); // await _instance?.play(repeat: repeat, hideControls: hideControls);
if (_playCallBack != null) { _playCallBack?.call();
_playCallBack!();
}
} }
// try to get PlayerStatus // try to get PlayerStatus

View File

@@ -371,18 +371,14 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
.episodes!; .episodes!;
// changeFucCall = bangumiIntroController!.changeSeasonOrbangu; // changeFucCall = bangumiIntroController!.changeSeasonOrbangu;
} }
if (widget.showEpisodes != null) { widget.showEpisodes?.call(
widget.showEpisodes!( index,
index, isPage ? null : videoIntroController?.videoDetail.value.ugcSeason,
isPage episodes,
? null bvid,
: videoIntroController?.videoDetail.value.ugcSeason, IdUtils.bv2av(bvid),
episodes, currentCid,
bvid, );
IdUtils.bv2av(bvid),
currentCid,
);
}
}, },
), ),
), ),

View File

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
class ComBtn extends StatelessWidget { class ComBtn extends StatelessWidget {
final Widget? icon; final Widget? icon;
final Function? fuc; final GestureTapCallback? fuc;
const ComBtn({ const ComBtn({
this.icon, this.icon,
@@ -16,9 +16,7 @@ class ComBtn extends StatelessWidget {
width: 34, width: 34,
height: 34, height: 34,
child: InkWell( child: InkWell(
onTap: () { onTap: fuc,
fuc!();
},
child: icon!, child: icon!,
), ),
); );