From 738d719fecceb7c36b5967d4f7f24eda66354d8a Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Fri, 2 Oct 2020 19:30:13 +0300 Subject: [PATCH] CAKE-104 | added description parameter to the picker; applied description text in the present provider picker --- .../widgets/present_provider_picker.dart | 3 +++ lib/src/widgets/picker.dart | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/lib/src/screens/exchange/widgets/present_provider_picker.dart b/lib/src/screens/exchange/widgets/present_provider_picker.dart index f4cc7abf1..714bc0bc3 100644 --- a/lib/src/screens/exchange/widgets/present_provider_picker.dart +++ b/lib/src/screens/exchange/widgets/present_provider_picker.dart @@ -58,11 +58,13 @@ class PresentProviderPicker extends StatelessWidget { final items = exchangeViewModel.providersForCurrentPair(); final selectedItem = items.indexOf(exchangeViewModel.provider); final images = []; + String description; for (var provider in items) { switch (provider.description) { case ExchangeProviderDescription.xmrto: images.add(Image.asset('assets/images/xmr_btc.png')); + description = 'To choose ChangeNOW or MorphToken, please change your trading pair first'; break; case ExchangeProviderDescription.changeNow: images.add(Image.asset('assets/images/change_now.png')); @@ -79,6 +81,7 @@ class PresentProviderPicker extends StatelessWidget { images: images, selectedAtIndex: selectedItem, title: S.of(context).change_exchange_provider, + description: description, onItemSelected: (ExchangeProvider provider) => exchangeViewModel.changeProvider(provider: provider)), context: context); diff --git a/lib/src/widgets/picker.dart b/lib/src/widgets/picker.dart index 935237573..17db6e82e 100644 --- a/lib/src/widgets/picker.dart +++ b/lib/src/widgets/picker.dart @@ -12,6 +12,7 @@ class Picker extends StatefulWidget { @required this.items, this.images, @required this.title, + this.description, @required this.onItemSelected, this.mainAxisAlignment = MainAxisAlignment.start, this.isAlwaysShowScrollThumb = false @@ -21,6 +22,7 @@ class Picker extends StatefulWidget { final List items; final List images; final String title; + final String description; final Function(Item) onItemSelected; final MainAxisAlignment mainAxisAlignment; final bool isAlwaysShowScrollThumb; @@ -145,6 +147,26 @@ class PickerState extends State { ); }, ), + ((widget.description != null) + &&(widget.description.isNotEmpty)) + ? Positioned( + bottom: 24, + left: 24, + right: 24, + child: Text( + widget.description, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w500, + fontFamily: 'Poppins', + decoration: TextDecoration.none, + color: Theme.of(context).primaryTextTheme + .title.color + ), + ) + ) + : Offstage(), widget.isAlwaysShowScrollThumb ? CakeScrollbar( backgroundHeight: backgroundHeight,