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,
),
);
}