mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
Merge pull request #680 from cake-tech/CW-275-fix-picker-search-issue
Fix Settings Pickers Search
This commit is contained in:
commit
915b265f69
2 changed files with 5 additions and 6 deletions
|
@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:cake_wallet/src/widgets/picker.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
|
||||
class SettingsPickerCell<ItemType extends Object> extends StandardListRow {
|
||||
class SettingsPickerCell<ItemType> extends StandardListRow {
|
||||
SettingsPickerCell(
|
||||
{required String title,
|
||||
required this.selectedItem,
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
|
||||
|
||||
class Picker<Item extends Object> extends StatefulWidget {
|
||||
class Picker<Item> extends StatefulWidget {
|
||||
Picker({
|
||||
required this.selectedAtIndex,
|
||||
required this.items,
|
||||
|
@ -39,7 +39,7 @@ class Picker<Item extends Object> extends StatefulWidget {
|
|||
_PickerState<Item> createState() => _PickerState<Item>(items, images, onItemSelected);
|
||||
}
|
||||
|
||||
class _PickerState<Item> extends State<Picker> {
|
||||
class _PickerState<Item> extends State<Picker<Item>> {
|
||||
_PickerState(this.items, this.images, this.onItemSelected);
|
||||
|
||||
final Function(Item) onItemSelected;
|
||||
|
@ -59,7 +59,7 @@ class _PickerState<Item> extends State<Picker> {
|
|||
images = [];
|
||||
for (int i=0;i<widget.items.length;i++) {
|
||||
if (widget.matchingCriteria?.call(widget.items[i], searchController.text) ?? true) {
|
||||
items.add(widget.items[i] as Item);
|
||||
items.add(widget.items[i]);
|
||||
images.add(widget.images[i]);
|
||||
}
|
||||
}
|
||||
|
@ -238,8 +238,7 @@ class _PickerState<Item> extends State<Picker> {
|
|||
child: Padding(
|
||||
padding: EdgeInsets.only(left: image != null ? 12 : 0),
|
||||
child: Text(
|
||||
// What a hack (item as) ?
|
||||
widget.displayItem?.call(item as Object) ?? item.toString(),
|
||||
widget.displayItem?.call(item) ?? item.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontFamily: 'Lato',
|
||||
|
|
Loading…
Reference in a new issue