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

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

View File

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

View File

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

View File

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

View File

@@ -60,9 +60,7 @@ class ReplyItem extends StatelessWidget {
return MorePanel(
item: replyItem!,
onDelete: (rpid) {
if (onDelete != null) {
onDelete!(rpid, null);
}
onDelete?.call(rpid, null);
},
);
},
@@ -318,9 +316,7 @@ class ReplyItem extends StatelessWidget {
replyItem: replyItem,
replyReply: replyReply,
onDelete: (rpid) {
if (onDelete != null) {
onDelete!(rpid, replyItem!.rpid);
}
onDelete?.call(rpid, replyItem!.rpid);
},
),
),
@@ -339,10 +335,7 @@ class ReplyItem extends StatelessWidget {
child: TextButton(
onPressed: () {
feedBack();
if (onReply != null) {
onReply!();
return;
}
onReply?.call();
},
child: Row(children: [
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',
},
);
if (result == true && onDelete != null) {
onDelete!(item.rpid!);
if (result == true) {
onDelete?.call(item.rpid!);
}
break;
case 'copyAll':
@@ -1056,10 +1049,7 @@ class MorePanel extends StatelessWidget {
SmartDialog.dismiss();
if (result['status']) {
SmartDialog.showToast('删除成功');
// Get.back();
if (onDelete != null) {
onDelete!(item.rpid!);
}
onDelete?.call(item.rpid!);
} else {
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;
_publishStream.add(false);
}
if (widget.onSaveReply != null) {
widget.onSaveReply!(value);
}
widget.onSaveReply?.call(value);
},
focusNode: _focusNode,
decoration: const InputDecoration(
@@ -537,8 +535,6 @@ class _ReplyPageState extends State<ReplyPage>
selection:
TextSelection.collapsed(offset: cursorPosition + emote.text!.length),
);
if (widget.onSaveReply != null) {
widget.onSaveReply!(_replyContentController.text);
}
widget.onSaveReply?.call(_replyContentController.text);
}
}

View File

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