64 lines
1.6 KiB
Dart
64 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
|
|
class ProfileActionButton extends StatelessWidget {
|
|
const ProfileActionButton({
|
|
super.key,
|
|
required this.icon,
|
|
required this.label,
|
|
required this.isSelected,
|
|
required this.onPressed,
|
|
});
|
|
|
|
final IconData icon;
|
|
final String label;
|
|
final bool isSelected;
|
|
final VoidCallback onPressed;
|
|
|
|
static const _buttonPadding = EdgeInsets.symmetric(
|
|
horizontal: 28,
|
|
vertical: 24,
|
|
);
|
|
static const _iconSize = 28.0;
|
|
static const _contentGap = 12.0;
|
|
static const _borderRadius = 16.0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final colorScheme = theme.colorScheme;
|
|
final backgroundColor = colorScheme.onSecondary;
|
|
final borderColor = isSelected
|
|
? colorScheme.primary
|
|
: colorScheme.onPrimary;
|
|
final textColor = colorScheme.primary;
|
|
|
|
return TextButton(
|
|
onPressed: onPressed,
|
|
style: TextButton.styleFrom(
|
|
padding: _buttonPadding,
|
|
backgroundColor: backgroundColor,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(_borderRadius),
|
|
side: BorderSide(color: borderColor),
|
|
),
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(icon, color: textColor, size: _iconSize),
|
|
const SizedBox(height: _contentGap),
|
|
Text(
|
|
label,
|
|
textAlign: TextAlign.center,
|
|
style: theme.textTheme.bodyMedium?.copyWith(
|
|
color: textColor,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|