opt: safearea

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-24 11:35:19 +08:00
parent 039e1696dd
commit 8c7001c801
8 changed files with 211 additions and 169 deletions

View File

@@ -170,14 +170,18 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
titleSpacing: automaticallyImplyLeading ? null : 12, titleSpacing: automaticallyImplyLeading ? null : 12,
automaticallyImplyLeading: automaticallyImplyLeading, automaticallyImplyLeading: automaticallyImplyLeading,
), ),
body: VideoReplyReplyPanel( body: SafeArea(
id: id, top: false,
oid: oid, bottom: false,
rpid: rpid, child: VideoReplyReplyPanel(
source: 'dynamic', id: id,
replyType: ReplyType.values[replyType], oid: oid,
firstFloor: replyItem, rpid: rpid,
onDispose: onDispose, source: 'dynamic',
replyType: ReplyType.values[replyType],
firstFloor: replyItem,
onDispose: onDispose,
),
), ),
); );
if (this.context.orientation == Orientation.portrait) { if (this.context.orientation == Orientation.portrait) {

View File

@@ -92,7 +92,11 @@ class _HotPageState extends CommonPageState<HotPage, HotController>
Get.to( Get.to(
Scaffold( Scaffold(
appBar: AppBar(title: const Text('排行榜')), appBar: AppBar(title: const Text('排行榜')),
body: RankPage(), body: SafeArea(
top: false,
bottom: false,
child: RankPage(),
),
), ),
); );
} }

View File

@@ -168,14 +168,18 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
titleSpacing: automaticallyImplyLeading ? null : 12, titleSpacing: automaticallyImplyLeading ? null : 12,
automaticallyImplyLeading: automaticallyImplyLeading, automaticallyImplyLeading: automaticallyImplyLeading,
), ),
body: VideoReplyReplyPanel( body: SafeArea(
id: id, top: false,
oid: oid, bottom: false,
rpid: rpid, child: VideoReplyReplyPanel(
source: 'dynamic', id: id,
replyType: ReplyType.values[type], oid: oid,
firstFloor: replyItem, rpid: rpid,
onDispose: onDispose, source: 'dynamic',
replyType: ReplyType.values[type],
firstFloor: replyItem,
onDispose: onDispose,
),
), ),
); );
if (this.context.orientation == Orientation.portrait) { if (this.context.orientation == Orientation.portrait) {

View File

@@ -277,12 +277,14 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
() => Text('${controller.liveCount.value}人正在直播'), () => Text('${controller.liveCount.value}人正在直播'),
), ),
), ),
body: CustomScrollView( body: SafeArea(
slivers: [ top: false,
Obx( bottom: false,
() => _buildFollowListBody(controller.followListState.value), child: CustomScrollView(
), slivers: [
], Obx(() => _buildFollowListBody(controller.followListState.value)),
],
),
), ),
); );

View File

@@ -70,15 +70,19 @@ class _SeasonSeriesPageState extends State<SeasonSeriesPage>
appBar: AppBar( appBar: AppBar(
title: Text(item['meta']['name']), title: Text(item['meta']['name']),
), ),
body: MemberVideo( body: SafeArea(
type: isSeason top: false,
? ContributeType.season bottom: false,
: ContributeType.series, child: MemberVideo(
heroTag: widget.heroTag, type: isSeason
mid: widget.mid, ? ContributeType.season
seasonId: isSeason ? id : null, : ContributeType.series,
seriesId: isSeason ? null : id, heroTag: widget.heroTag,
title: item['meta']['name'], mid: widget.mid,
seasonId: isSeason ? id : null,
seriesId: isSeason ? null : id,
title: item['meta']['name'],
),
), ),
), ),
); );

View File

@@ -54,11 +54,13 @@ class _SysMsgPageState extends State<SysMsgPage> {
Widget _buildBody(LoadingState<List<SystemNotifyList>?> loadingState) { Widget _buildBody(LoadingState<List<SystemNotifyList>?> loadingState) {
return switch (loadingState) { return switch (loadingState) {
Loading() => SliverList.builder( Loading() => SliverSafeArea(
itemCount: 12, sliver: SliverList.builder(
itemBuilder: (context, index) { itemCount: 12,
return const MsgFeedSysMsgSkeleton(); itemBuilder: (context, index) {
}, return const MsgFeedSysMsgSkeleton();
},
),
), ),
Success() => loadingState.response?.isNotEmpty == true Success() => loadingState.response?.isNotEmpty == true
? SliverList.separated( ? SliverList.separated(

View File

@@ -1528,34 +1528,37 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
), ),
// 锁 // 锁
Obx( SafeArea(
() => Visibility( child: Obx(
visible: () => Visibility(
plPlayerController.videoType.value != 'live' && isFullScreen, visible:
child: Align( plPlayerController.videoType.value != 'live' && isFullScreen,
alignment: Alignment.centerLeft, child: Align(
child: FractionalTranslation( alignment: Alignment.centerLeft,
translation: const Offset(1, -0.4), child: FractionalTranslation(
child: Visibility( translation: const Offset(1, -0.4),
visible: plPlayerController.showControls.value && child: Visibility(
(isFullScreen || plPlayerController.controlsLock.value), visible: plPlayerController.showControls.value &&
child: DecoratedBox( (isFullScreen || plPlayerController.controlsLock.value),
decoration: BoxDecoration( child: DecoratedBox(
color: const Color(0x45000000), decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), color: const Color(0x45000000),
), borderRadius: BorderRadius.circular(8),
child: ComBtn( ),
icon: Icon( child: ComBtn(
plPlayerController.controlsLock.value icon: Icon(
? FontAwesomeIcons.lock plPlayerController.controlsLock.value
: FontAwesomeIcons.lockOpen, ? FontAwesomeIcons.lock
semanticLabel: : FontAwesomeIcons.lockOpen,
plPlayerController.controlsLock.value ? '解锁' : '锁定', semanticLabel: plPlayerController.controlsLock.value
size: 15, ? '解锁'
color: Colors.white, : '锁定',
size: 15,
color: Colors.white,
),
onTap: () => plPlayerController.onLockControl(
!plPlayerController.controlsLock.value),
), ),
onTap: () => plPlayerController.onLockControl(
!plPlayerController.controlsLock.value),
), ),
), ),
), ),
@@ -1565,80 +1568,83 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
), ),
// 截图 // 截图
Obx( SafeArea(
() => Align( child: Obx(
alignment: Alignment.centerRight, () => Align(
child: FractionalTranslation( alignment: Alignment.centerRight,
translation: const Offset(-1, -0.4), child: FractionalTranslation(
child: Visibility( translation: const Offset(-1, -0.4),
visible: plPlayerController.showControls.value && isFullScreen, child: Visibility(
child: DecoratedBox( visible:
decoration: BoxDecoration( plPlayerController.showControls.value && isFullScreen,
color: const Color(0x45000000), child: DecoratedBox(
borderRadius: BorderRadius.circular(8), decoration: BoxDecoration(
), color: const Color(0x45000000),
child: ComBtn( borderRadius: BorderRadius.circular(8),
icon: const Icon(
Icons.photo_camera,
semanticLabel: '截图',
size: 20,
color: Colors.white,
), ),
onTap: () { child: ComBtn(
SmartDialog.showToast('截图中'); icon: const Icon(
plPlayerController.videoPlayerController Icons.photo_camera,
?.screenshot(format: 'image/png') semanticLabel: '截图',
.then((value) { size: 20,
if (value != null && context.mounted) { color: Colors.white,
SmartDialog.showToast('点击弹窗保存截图'); ),
showDialog( onTap: () {
context: context, SmartDialog.showToast('截图中');
builder: (BuildContext context) { plPlayerController.videoPlayerController
return AlertDialog( ?.screenshot(format: 'image/png')
// title: const Text('点击保存'), .then((value) {
titlePadding: EdgeInsets.zero, if (value != null && context.mounted) {
contentPadding: const EdgeInsets.all(8), SmartDialog.showToast('点击弹窗保存截图');
insetPadding: showDialog(
EdgeInsets.only(left: context.width / 2), context: context,
//移除圆角 builder: (BuildContext context) {
shape: const RoundedRectangleBorder(), return AlertDialog(
content: GestureDetector( // title: const Text('点击保存'),
onTap: () async { titlePadding: EdgeInsets.zero,
String name = DateTime.now().toString(); contentPadding: const EdgeInsets.all(8),
final SaveResult result = insetPadding:
await SaverGallery.saveImage( EdgeInsets.only(left: context.width / 2),
value, //移除圆角
fileName: name, shape: const RoundedRectangleBorder(),
androidRelativePath: content: GestureDetector(
"Pictures/Screenshots", onTap: () async {
skipIfExists: false, String name = DateTime.now().toString();
); final SaveResult result =
await SaverGallery.saveImage(
value,
fileName: name,
androidRelativePath:
"Pictures/Screenshots",
skipIfExists: false,
);
if (result.isSuccess) { if (result.isSuccess) {
Get.back(); Get.back();
SmartDialog.showToast( SmartDialog.showToast(
'$name.png已保存到相册/截图'); '$name.png已保存到相册/截图');
} else { } else {
await SmartDialog.showToast( await SmartDialog.showToast(
'保存失败,${result.errorMessage}'); '保存失败,${result.errorMessage}');
} }
}, },
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints( constraints: BoxConstraints(
maxWidth: context.width / 3, maxWidth: context.width / 3,
maxHeight: context.height / 3, maxHeight: context.height / 3,
),
child: Image.memory(value),
), ),
child: Image.memory(value),
), ),
), );
); },
}, );
); } else {
} else { SmartDialog.showToast('截图失败');
SmartDialog.showToast('截图失败'); }
} });
}); },
}, ),
), ),
), ),
), ),

View File

@@ -133,16 +133,20 @@ class PiliScheme {
), ),
], ],
), ),
body: VideoReplyReplyPanel( body: SafeArea(
oid: int.parse(oid), top: false,
rpid: rpid, bottom: false,
source: 'routePush', child: VideoReplyReplyPanel(
replyType: ReplyType.video, oid: int.parse(oid),
firstFloor: null, rpid: rpid,
id: queryParameters['comment_secondary_id'] != null source: 'routePush',
? int.tryParse( replyType: ReplyType.video,
queryParameters['comment_secondary_id']!) firstFloor: null,
: null, id: queryParameters['comment_secondary_id'] != null
? int.tryParse(
queryParameters['comment_secondary_id']!)
: null,
),
), ),
), ),
); );
@@ -285,13 +289,17 @@ class PiliScheme {
), ),
], ],
), ),
body: VideoReplyReplyPanel( body: SafeArea(
oid: oid, top: false,
rpid: rootId, bottom: false,
id: rpId, child: VideoReplyReplyPanel(
source: 'routePush', oid: oid,
replyType: ReplyType.values[type], rpid: rootId,
firstFloor: null, id: rpId,
source: 'routePush',
replyType: ReplyType.values[type],
firstFloor: null,
),
), ),
), ),
); );
@@ -331,12 +339,16 @@ class PiliScheme {
), ),
], ],
), ),
body: VideoReplyReplyPanel( body: SafeArea(
oid: oid, top: false,
rpid: rpId, bottom: false,
source: 'routePush', child: VideoReplyReplyPanel(
replyType: ReplyType.values[type], oid: oid,
firstFloor: null, rpid: rpId,
source: 'routePush',
replyType: ReplyType.values[type],
firstFloor: null,
),
), ),
), ),
); );
@@ -393,18 +405,22 @@ class PiliScheme {
), ),
], ],
), ),
body: VideoReplyReplyPanel( body: SafeArea(
oid: oid ?? int.parse(dynId), top: false,
rpid: rpid, bottom: false,
source: 'routePush', child: VideoReplyReplyPanel(
replyType: businessId != null oid: oid ?? int.parse(dynId),
? ReplyType.values[businessId] rpid: rpid,
: ReplyType.dynamics, source: 'routePush',
firstFloor: null, replyType: businessId != null
id: queryParameters['comment_secondary_id'] != null ? ReplyType.values[businessId]
? int.tryParse( : ReplyType.dynamics,
queryParameters['comment_secondary_id']!) firstFloor: null,
: null, id: queryParameters['comment_secondary_id'] != null
? int.tryParse(
queryParameters['comment_secondary_id']!)
: null,
),
), ),
), ),
); );