Files
PiliPlus/lib/common/widgets/button/toolbar_icon_button.dart
My-Responsitories b33fdf14af tweaks (#2100)
* mod: pgc episode title

* opt: ColorScheme.of

* mod: mpv api version

* opt: log handler

* opt: ext
2026-05-15 09:59:54 +08:00

41 lines
1004 B
Dart

import 'package:flutter/material.dart';
class ToolbarIconButton extends StatelessWidget {
final VoidCallback? onPressed;
final Icon icon;
final bool selected;
final String? tooltip;
const ToolbarIconButton({
super.key,
this.onPressed,
required this.icon,
required this.selected,
this.tooltip,
});
@override
Widget build(BuildContext context) {
final colorScheme = ColorScheme.of(context);
return SizedBox(
width: 36,
height: 36,
child: IconButton(
tooltip: tooltip,
onPressed: onPressed,
icon: icon,
highlightColor: colorScheme.secondaryContainer,
color: selected
? colorScheme.onSecondaryContainer
: colorScheme.outline,
style: ButtonStyle(
padding: const WidgetStatePropertyAll(EdgeInsets.zero),
backgroundColor: WidgetStatePropertyAll(
selected ? colorScheme.secondaryContainer : null,
),
),
),
);
}
}