mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
44 lines
1.1 KiB
Dart
44 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class ToolbarIconButton extends StatelessWidget {
|
|
final VoidCallback onPressed;
|
|
final Icon icon;
|
|
final String toolbarType;
|
|
final bool selected;
|
|
final String tooltip;
|
|
|
|
const ToolbarIconButton({
|
|
super.key,
|
|
required this.onPressed,
|
|
required this.icon,
|
|
required this.toolbarType,
|
|
required this.selected,
|
|
required this.tooltip,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
width: 36,
|
|
height: 36,
|
|
child: IconButton(
|
|
tooltip: tooltip,
|
|
onPressed: onPressed,
|
|
icon: icon,
|
|
highlightColor: Theme.of(context).colorScheme.secondaryContainer,
|
|
color: selected
|
|
? Theme.of(context).colorScheme.onSecondaryContainer
|
|
: Theme.of(context).colorScheme.outline,
|
|
style: ButtonStyle(
|
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
|
return selected
|
|
? Theme.of(context).colorScheme.secondaryContainer
|
|
: null;
|
|
}),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|