Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-10-12 20:56:19 +08:00
parent f6ca007815
commit 510bfe01be
34 changed files with 154 additions and 189 deletions

View File

@@ -1,50 +1,35 @@
import 'package:flutter/material.dart';
Widget iconButton({
required BuildContext context,
BuildContext? context,
String? tooltip,
required IconData icon,
required Icon icon,
required VoidCallback? onPressed,
double size = 36,
double? iconSize,
Color? bgColor,
Color? iconColor,
}) {
late final theme = Theme.of(context);
Color? backgroundColor = bgColor;
Color? foregroundColor = iconColor;
if (context != null) {
final colorScheme = ColorScheme.of(context);
backgroundColor = colorScheme.secondaryContainer;
foregroundColor = colorScheme.onSecondaryContainer;
}
return SizedBox(
width: size,
height: size,
child: IconButton(
icon: icon,
tooltip: tooltip,
onPressed: onPressed,
icon: Icon(
icon,
size: iconSize ?? size / 2,
color: iconColor ?? theme.colorScheme.onSecondaryContainer,
),
style: IconButton.styleFrom(
padding: EdgeInsets.zero,
backgroundColor: bgColor ?? theme.colorScheme.secondaryContainer,
iconSize: iconSize ?? size / 2,
backgroundColor: backgroundColor,
foregroundColor: foregroundColor,
),
),
);
}
Widget mediumButton({
String? tooltip,
IconData? icon,
VoidCallback? onPressed,
}) {
return SizedBox(
width: 34,
height: 34,
child: IconButton(
tooltip: tooltip,
icon: Icon(icon),
style: const ButtonStyle(
padding: WidgetStatePropertyAll(EdgeInsets.zero),
),
onPressed: onPressed,
),
);
}

View File

@@ -19,20 +19,16 @@ void imageSaveDialog({
animationType: SmartAnimationType.centerScale_otherSlide,
builder: (context) {
final theme = Theme.of(context);
late final iconColor = theme.colorScheme.onSurfaceVariant;
Widget iconBtn({
String? tooltip,
required IconData icon,
required Icon icon,
required VoidCallback? onPressed,
}) {
return iconButton(
context: context,
onPressed: onPressed,
iconSize: 20,
icon: icon,
bgColor: Colors.transparent,
iconColor: iconColor,
iconSize: 20,
onPressed: onPressed,
);
}
@@ -105,7 +101,7 @@ void imageSaveDialog({
(res) => SmartDialog.showToast(res['msg']),
),
},
icon: Icons.watch_later_outlined,
icon: const Icon(Icons.watch_later_outlined),
),
if (cover?.isNotEmpty == true) ...[
if (Utils.isMobile)
@@ -115,7 +111,7 @@ void imageSaveDialog({
SmartDialog.dismiss();
ImageUtils.onShareImg(cover!);
},
icon: Icons.share,
icon: const Icon(Icons.share),
),
iconBtn(
tooltip: '保存封面图',
@@ -128,7 +124,7 @@ void imageSaveDialog({
SmartDialog.dismiss();
}
},
icon: Icons.download,
icon: const Icon(Icons.download),
),
],
],