fix custom rate issue (#1579)

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
Serhii
2024-08-10 00:49:27 +03:00
committed by GitHub
co-authored by Omar Hatem
parent 14e99daa73
commit acadee6ed5
5 changed files with 19 additions and 6 deletions
@@ -17,7 +17,7 @@ class StandardPickerListItem<T> extends TransactionDetailsListItem {
final List<T> items;
final String Function(T item, double sliderValue) displayItem;
final Function(double) onSliderChanged;
final Function(T) onItemSelected;
final Function(T item, double sliderValue) onItemSelected;
final int selectedIdx;
final double? maxValue;
final int customItemIndex;
+3 -2
View File
@@ -23,7 +23,7 @@ class StandardPickerList<T> extends StatefulWidget {
final int customItemIndex;
final String Function(T item, double sliderValue) displayItem;
final Function(double) onSliderChanged;
final Function(T) onItemSelected;
final Function(T item, double sliderValue) onItemSelected;
final String value;
final int selectedIdx;
final double customValue;
@@ -50,6 +50,7 @@ class _StandardPickerListState<T> extends State<StandardPickerList<T>> {
@override
Widget build(BuildContext context) {
String adaptedDisplayItem(T item) => widget.displayItem(item, customValue);
String adaptedOnItemSelected(T item) => widget.onItemSelected(item, customValue).toString();
return Column(
children: [
@@ -74,7 +75,7 @@ class _StandardPickerListState<T> extends State<StandardPickerList<T>> {
},
onItemSelected: (T item) {
setState(() => selectedIdx = widget.items.indexOf(item));
value = widget.onItemSelected(item).toString();
value = adaptedOnItemSelected(item);
},
),
),