mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 20:09:23 +00:00
68 lines
1.7 KiB
Dart
68 lines
1.7 KiB
Dart
/*
|
|
* This file is part of Stack Wallet.
|
|
*
|
|
* Copyright (c) 2023 Cypher Stack
|
|
* All Rights Reserved.
|
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
|
* Generated by Cypher Stack on 2023-05-26
|
|
*
|
|
*/
|
|
|
|
import 'package:flutter/material.dart';
|
|
import '../../themes/stack_colors.dart';
|
|
import '../../utilities/text_styles.dart';
|
|
|
|
class SettingsMenuItem<T> extends StatelessWidget {
|
|
const SettingsMenuItem({
|
|
super.key,
|
|
required this.icon,
|
|
required this.label,
|
|
required this.value,
|
|
required this.group,
|
|
required this.onChanged,
|
|
});
|
|
|
|
final Widget icon;
|
|
final String label;
|
|
final T value;
|
|
final T group;
|
|
final void Function(T) onChanged;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return TextButton(
|
|
//if val == group, then button is selected, otherwise unselected
|
|
style: value == group
|
|
? Theme.of(context)
|
|
.extension<StackColors>()!
|
|
.getDesktopSettingsButtonStyle(context)
|
|
: Theme.of(context)
|
|
.extension<StackColors>()!
|
|
.getDesktopSettingsButtonStyle(context),
|
|
onPressed: () {
|
|
onChanged(value);
|
|
},
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: 16,
|
|
horizontal: 16,
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
icon,
|
|
const SizedBox(
|
|
width: 12,
|
|
),
|
|
Text(
|
|
label,
|
|
style: value == group //checks if option is selected
|
|
? STextStyles.settingsMenuItemSelected(context)
|
|
: STextStyles.settingsMenuItem(context),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|