12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import "package:flutter/material.dart";
- import "package:photos/theme/ente_theme.dart";
- class SelectionActionButton extends StatefulWidget {
- final String labelText;
- final IconData icon;
- final VoidCallback? onTap;
- const SelectionActionButton({
- required this.labelText,
- required this.icon,
- required this.onTap,
- super.key,
- });
- @override
- State<SelectionActionButton> createState() => _SelectionActionButtonState();
- }
- class _SelectionActionButtonState extends State<SelectionActionButton> {
- Color? backgroundColor;
- @override
- Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- return GestureDetector(
- onTap: widget.onTap,
- onTapDown: (details) {
- setState(() {
- backgroundColor = colorScheme.fillFaintPressed;
- });
- },
- onTapUp: (details) {
- setState(() {
- backgroundColor = null;
- });
- },
- onTapCancel: () {
- setState(() {
- backgroundColor = null;
- });
- },
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- color: backgroundColor,
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
- child: SizedBox(
- width: 64,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(
- widget.icon,
- size: 24,
- color: getEnteColorScheme(context).textMuted,
- ),
- const SizedBox(height: 4),
- Text(
- widget.labelText,
- textAlign: TextAlign.center,
- style: getEnteTextTheme(context).miniMuted,
- ),
- ],
- ),
- ),
- ),
- ),
- );
- }
- }
|