mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-19 05:58:50 +02:00
25 lines
720 B
Dart
25 lines
720 B
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:cake_wallet/view_model/settings/settings_list_item.dart';
|
|
|
|
class PickerListItem<ItemType> extends SettingsListItem {
|
|
PickerListItem(
|
|
{@required String title,
|
|
@required this.selectedItem,
|
|
@required this.items,
|
|
this.displayItem,
|
|
void Function(ItemType item) onItemSelected})
|
|
: _onItemSelected = onItemSelected,
|
|
super(title);
|
|
|
|
final ItemType Function() 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);
|
|
}
|
|
}
|
|
}
|