mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-20 00:56:31 +08:00
opt ui
Closes #1050 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -41,8 +41,8 @@ Widget mediumButton({
|
||||
child: IconButton(
|
||||
tooltip: tooltip,
|
||||
icon: Icon(icon),
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStateProperty.all(EdgeInsets.zero),
|
||||
style: const ButtonStyle(
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
),
|
||||
|
||||
@@ -29,7 +29,7 @@ class ToolbarIconButton extends StatelessWidget {
|
||||
? theme.colorScheme.onSecondaryContainer
|
||||
: theme.colorScheme.outline,
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStateProperty.all(EdgeInsets.zero),
|
||||
padding: const WidgetStatePropertyAll(EdgeInsets.zero),
|
||||
backgroundColor: WidgetStatePropertyAll(
|
||||
selected ? theme.colorScheme.secondaryContainer : null,
|
||||
),
|
||||
|
||||
@@ -13,7 +13,7 @@ class CustomToast extends StatelessWidget {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
return Container(
|
||||
margin: EdgeInsets.only(
|
||||
bottom: MediaQuery.paddingOf(context).bottom + 30,
|
||||
bottom: MediaQuery.viewPaddingOf(context).bottom + 30,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
|
||||
@@ -146,7 +146,7 @@ class _DynamicSliverAppBarMediumState extends State<DynamicSliverAppBarMedium> {
|
||||
);
|
||||
}
|
||||
|
||||
final padding = MediaQuery.paddingOf(context).top;
|
||||
final padding = MediaQuery.viewPaddingOf(context).top;
|
||||
return SliverAppBar.medium(
|
||||
leading: widget.leading,
|
||||
automaticallyImplyLeading: widget.automaticallyImplyLeading,
|
||||
|
||||
@@ -67,12 +67,12 @@ void imageSaveDialog({
|
||||
color: Colors.black.withValues(alpha: 0.3),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: IconButton(
|
||||
child: const IconButton(
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStateProperty.all(EdgeInsets.zero),
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: SmartDialog.dismiss,
|
||||
icon: const Icon(
|
||||
icon: Icon(
|
||||
Icons.close,
|
||||
size: 18,
|
||||
color: Colors.white,
|
||||
|
||||
@@ -335,7 +335,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
||||
right: 0,
|
||||
child: Container(
|
||||
padding:
|
||||
MediaQuery.paddingOf(context) +
|
||||
MediaQuery.viewPaddingOf(context) +
|
||||
const EdgeInsets.fromLTRB(12, 8, 20, 8),
|
||||
decoration: _enablePageView
|
||||
? BoxDecoration(
|
||||
|
||||
@@ -60,7 +60,7 @@ class HttpError extends StatelessWidget {
|
||||
style: TextStyle(color: theme.colorScheme.primary),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 40 + MediaQuery.paddingOf(context).bottom),
|
||||
SizedBox(height: 40 + MediaQuery.viewPaddingOf(context).bottom),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
29
lib/common/widgets/view_safe_area.dart
Normal file
29
lib/common/widgets/view_safe_area.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ViewSafeArea extends StatelessWidget {
|
||||
const ViewSafeArea({
|
||||
super.key,
|
||||
this.top = false,
|
||||
this.left = true,
|
||||
this.right = true,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
final bool top;
|
||||
final bool left;
|
||||
final bool right;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
EdgeInsets padding = MediaQuery.viewPaddingOf(context);
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: top ? padding.top : 0.0,
|
||||
left: left ? padding.left : 0.0,
|
||||
right: right ? padding.right : 0.0,
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
23
lib/common/widgets/view_sliver_safe_area.dart
Normal file
23
lib/common/widgets/view_sliver_safe_area.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ViewSliverSafeArea extends StatelessWidget {
|
||||
const ViewSliverSafeArea({
|
||||
super.key,
|
||||
required this.sliver,
|
||||
});
|
||||
|
||||
final Widget sliver;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
EdgeInsets padding = MediaQuery.viewPaddingOf(context);
|
||||
return SliverPadding(
|
||||
padding: EdgeInsets.only(
|
||||
left: padding.left,
|
||||
right: padding.right,
|
||||
bottom: padding.bottom + 100,
|
||||
),
|
||||
sliver: sliver,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user