mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-02-02 19:26:27 +00:00
CAKE-222 | applied adaptive picker to send and settings pages
This commit is contained in:
parent
0e721b7795
commit
39e91c74cd
6 changed files with 7 additions and 17 deletions
|
@ -751,7 +751,6 @@ class SendPage extends BasePage {
|
|||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
onItemSelected: (TransactionPriority priority) =>
|
||||
sendViewModel.setTransactionPriority(priority),
|
||||
isAlwaysShowScrollThumb: isShowScrollThumb,
|
||||
),
|
||||
context: context);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ class SettingsPage extends BasePage {
|
|||
return SettingsPickerCell<dynamic>(
|
||||
title: item.title,
|
||||
selectedItem: item.selectedItem(),
|
||||
isAlwaysShowScrollThumb: item.isAlwaysShowScrollThumb,
|
||||
items: item.items,
|
||||
onItemSelected: (dynamic value) => item.onItemSelected(value),
|
||||
);
|
||||
|
|
|
@ -9,8 +9,7 @@ class SettingsPickerCell<ItemType> extends StandardListRow {
|
|||
{@required String title,
|
||||
this.selectedItem,
|
||||
this.items,
|
||||
this.onItemSelected,
|
||||
this.isAlwaysShowScrollThumb})
|
||||
this.onItemSelected})
|
||||
: super(
|
||||
title: title,
|
||||
isSelected: false,
|
||||
|
@ -24,7 +23,6 @@ class SettingsPickerCell<ItemType> extends StandardListRow {
|
|||
selectedAtIndex: selectedAtIndex,
|
||||
title: S.current.please_select,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
isAlwaysShowScrollThumb: isAlwaysShowScrollThumb,
|
||||
onItemSelected: (ItemType item) =>
|
||||
onItemSelected?.call(item)));
|
||||
});
|
||||
|
@ -32,7 +30,6 @@ class SettingsPickerCell<ItemType> extends StandardListRow {
|
|||
final ItemType selectedItem;
|
||||
final List<ItemType> items;
|
||||
final void Function(ItemType item) onItemSelected;
|
||||
final bool isAlwaysShowScrollThumb;
|
||||
|
||||
@override
|
||||
Widget buildTrailing(BuildContext context) {
|
||||
|
|
|
@ -15,7 +15,6 @@ class Picker<Item extends Object> extends StatefulWidget {
|
|||
this.description,
|
||||
@required this.onItemSelected,
|
||||
this.mainAxisAlignment = MainAxisAlignment.start,
|
||||
this.isAlwaysShowScrollThumb = false
|
||||
});
|
||||
|
||||
final int selectedAtIndex;
|
||||
|
@ -25,7 +24,6 @@ class Picker<Item extends Object> extends StatefulWidget {
|
|||
final String description;
|
||||
final Function(Item) onItemSelected;
|
||||
final MainAxisAlignment mainAxisAlignment;
|
||||
final bool isAlwaysShowScrollThumb;
|
||||
|
||||
@override
|
||||
PickerState createState() => PickerState<Item>(items, images, onItemSelected);
|
||||
|
@ -56,6 +54,8 @@ class PickerState<Item> extends State<Picker> {
|
|||
setState(() {});
|
||||
});
|
||||
|
||||
final isShowScrollThumb = items != null ? items.length > 3 : false;
|
||||
|
||||
return AlertBackground(
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
|
@ -168,13 +168,13 @@ class PickerState<Item> extends State<Picker> {
|
|||
)
|
||||
)
|
||||
: Offstage(),
|
||||
widget.isAlwaysShowScrollThumb
|
||||
? CakeScrollbar(
|
||||
isShowScrollThumb
|
||||
? CakeScrollbar(
|
||||
backgroundHeight: backgroundHeight,
|
||||
thumbHeight: thumbHeight,
|
||||
fromTop: fromTop
|
||||
)
|
||||
: Offstage(),
|
||||
: Offstage(),
|
||||
],
|
||||
)
|
||||
),
|
||||
|
|
|
@ -6,15 +6,13 @@ class PickerListItem<ItemType> extends SettingsListItem {
|
|||
{@required String title,
|
||||
@required this.selectedItem,
|
||||
@required this.items,
|
||||
void Function(ItemType item) onItemSelected,
|
||||
this.isAlwaysShowScrollThumb = false})
|
||||
void Function(ItemType item) onItemSelected})
|
||||
: _onItemSelected = onItemSelected,
|
||||
super(title);
|
||||
|
||||
final ItemType Function() selectedItem;
|
||||
final List<ItemType> items;
|
||||
final void Function(ItemType item) _onItemSelected;
|
||||
final bool isAlwaysShowScrollThumb;
|
||||
|
||||
void onItemSelected(dynamic item) {
|
||||
if (item is ItemType) {
|
||||
|
|
|
@ -55,7 +55,6 @@ abstract class SettingsViewModelBase with Store {
|
|||
PickerListItem(
|
||||
title: S.current.settings_currency,
|
||||
items: FiatCurrency.all,
|
||||
isAlwaysShowScrollThumb: true,
|
||||
selectedItem: () => fiatCurrency,
|
||||
onItemSelected: (FiatCurrency currency) =>
|
||||
setFiatCurrency(currency)),
|
||||
|
@ -63,8 +62,6 @@ abstract class SettingsViewModelBase with Store {
|
|||
title: S.current.settings_fee_priority,
|
||||
items: TransactionPriority.forWalletType(wallet.type),
|
||||
selectedItem: () => transactionPriority,
|
||||
isAlwaysShowScrollThumb:
|
||||
TransactionPriority.forWalletType(wallet.type).length > 3,
|
||||
onItemSelected: (TransactionPriority priority) =>
|
||||
_settingsStore.transactionPriority = priority),
|
||||
SwitcherListItem(
|
||||
|
|
Loading…
Reference in a new issue