mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
@@ -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,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user