mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-21 06:18:42 +02:00
26 lines
751 B
Dart
26 lines
751 B
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:cake_wallet/view_model/settings/settings_list_item.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class ChoicesListItem<ItemType> extends SettingsListItem {
|
|
ChoicesListItem(
|
|
{required String title,
|
|
required this.selectedItem,
|
|
required this.items,
|
|
this.displayItem,
|
|
void Function(ItemType item)? onItemSelected})
|
|
: _onItemSelected = onItemSelected,
|
|
super(title);
|
|
|
|
final ItemType selectedItem;
|
|
final List<ItemType> items;
|
|
final String Function(ItemType item)? displayItem;
|
|
final void Function(ItemType item)? _onItemSelected;
|
|
|
|
void onItemSelected(dynamic item) {
|
|
if (item is ItemType) {
|
|
_onItemSelected?.call(item);
|
|
}
|
|
}
|
|
}
|