stack_wallet/lib/pages_desktop_specific/home/desktop_menu_item.dart

59 lines
1.5 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/text_styles.dart';
class DesktopMenuItem<T> extends StatelessWidget {
const DesktopMenuItem({
Key? key,
required this.icon,
required this.label,
required this.value,
required this.group,
required this.onChanged,
2022-09-16 17:26:12 +00:00
required this.iconOnly,
}) : super(key: key);
final Widget icon;
final String label;
final T value;
final T group;
final void Function(T) onChanged;
2022-09-16 17:26:12 +00:00
final bool iconOnly;
@override
Widget build(BuildContext context) {
return TextButton(
style: value == group
? CFColors.getDesktopMenuButtonColorSelected(context)
: CFColors.getDesktopMenuButtonColor(context),
onPressed: () {
onChanged(value);
},
child: Padding(
2022-09-16 17:26:12 +00:00
padding: EdgeInsets.symmetric(
vertical: 16,
2022-09-16 17:26:12 +00:00
horizontal: iconOnly ? 0 : 16,
),
child: Row(
2022-09-16 17:26:12 +00:00
mainAxisAlignment:
iconOnly ? MainAxisAlignment.center : MainAxisAlignment.start,
children: [
icon,
2022-09-16 17:26:12 +00:00
if (!iconOnly)
const SizedBox(
width: 12,
),
if (!iconOnly)
Text(
label,
style: value == group
? STextStyles.desktopMenuItemSelected
: STextStyles.desktopMenuItem,
),
],
),
),
);
}
}