Fix Popup width constraint and add focus orders

This commit is contained in:
Godwin Asuquo 2023-02-20 23:24:19 +02:00
parent 17aa72e460
commit 44b1eec81d
12 changed files with 508 additions and 522 deletions

View file

@ -334,7 +334,7 @@ Route<dynamic> createRoute(RouteSettings settings) {
getIt.get<ContactListPage>()); getIt.get<ContactListPage>());
case Routes.pickerAddressBook: case Routes.pickerAddressBook:
final selectedCurrency = settings.arguments as CryptoCurrency; final selectedCurrency = settings.arguments as CryptoCurrency?;
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
builder: (_) => getIt.get<ContactListPage>(param1: selectedCurrency)); builder: (_) => getIt.get<ContactListPage>(param1: selectedCurrency));

View file

@ -1,13 +1,9 @@
import 'dart:ui';
import 'package:cake_wallet/exchange/exchange_provider.dart'; import 'package:cake_wallet/exchange/exchange_provider.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart'; import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:keyboard_actions/keyboard_actions.dart'; import 'package:keyboard_actions/keyboard_actions.dart';
import 'package:keyboard_actions/keyboard_actions_config.dart';
import 'package:keyboard_actions/keyboard_actions_item.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
@ -78,7 +74,7 @@ class ExchangeTemplatePage extends BasePage {
config: KeyboardActionsConfig( config: KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.IOS, keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
keyboardBarColor: keyboardBarColor:
Theme.of(context).accentTextTheme!.bodyText1!.backgroundColor!, Theme.of(context).accentTextTheme.bodyText1!.backgroundColor!,
nextFocus: false, nextFocus: false,
actions: [ actions: [
KeyboardActionsItem( KeyboardActionsItem(
@ -103,115 +99,114 @@ class ExchangeTemplatePage extends BasePage {
), ),
gradient: LinearGradient( gradient: LinearGradient(
colors: [ colors: [
Theme.of(context).primaryTextTheme!.bodyText2!.color!, Theme.of(context).primaryTextTheme.bodyText2!.color!,
Theme.of(context).primaryTextTheme!.bodyText2!.decorationColor!, Theme.of(context).primaryTextTheme.bodyText2!.decorationColor!,
], ],
stops: [0.35, 1.0], stops: [0.35, 1.0],
begin: Alignment.topLeft, begin: Alignment.topLeft,
end: Alignment.bottomRight), end: Alignment.bottomRight),
), ),
child: Column( child: FocusTraversalGroup(
children: <Widget>[ policy: OrderedTraversalPolicy(),
Container( child: Column(
decoration: BoxDecoration( children: <Widget>[
borderRadius: BorderRadius.only( Container(
bottomLeft: Radius.circular(24), decoration: BoxDecoration(
bottomRight: Radius.circular(24) borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(24),
bottomRight: Radius.circular(24)
),
gradient: LinearGradient(
colors: [
Theme.of(context)
.primaryTextTheme.subtitle2!
.color!,
Theme.of(context)
.primaryTextTheme.subtitle2!
.decorationColor!,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight),
), ),
gradient: LinearGradient( padding: EdgeInsets.fromLTRB(24, 90, 24, 32),
colors: [ child: Observer(
Theme.of(context)
.primaryTextTheme!
.subtitle2!
.color!,
Theme.of(context)
.primaryTextTheme!
.subtitle2!
.decorationColor!,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight),
),
padding: EdgeInsets.fromLTRB(24, 90, 24, 32),
child: Observer(
builder: (_) => ExchangeCard(
amountFocusNode: _depositAmountFocus,
key: depositKey,
title: S.of(context).you_will_send,
initialCurrency:
exchangeViewModel.depositCurrency,
initialWalletName: depositWalletName ?? '',
initialAddress: exchangeViewModel
.depositCurrency ==
exchangeViewModel.wallet.currency
? exchangeViewModel.wallet.walletAddresses.address
: exchangeViewModel.depositAddress,
initialIsAmountEditable: true,
initialIsAddressEditable: exchangeViewModel
.isDepositAddressEnabled,
isAmountEstimated: false,
hasRefundAddress: true,
isMoneroWallet: exchangeViewModel.isMoneroWallet,
currencies: CryptoCurrency.all,
onCurrencySelected: (currency) =>
exchangeViewModel.changeDepositCurrency(
currency: currency),
imageArrow: arrowBottomPurple,
currencyButtonColor: Colors.transparent,
addressButtonsColor:
Theme.of(context).focusColor!,
borderColor: Theme.of(context)
.primaryTextTheme!
.bodyText1!
.color!,
currencyValueValidator: AmountValidator(
type: exchangeViewModel.wallet.type),
//addressTextFieldValidator: AddressValidator(
// type: exchangeViewModel.depositCurrency),
),
),
),
Padding(
padding: EdgeInsets.only(top: 29, left: 24, right: 24),
child: Observer(
builder: (_) => ExchangeCard( builder: (_) => ExchangeCard(
amountFocusNode: _receiveAmountFocus, amountFocusNode: _depositAmountFocus,
key: receiveKey, key: depositKey,
title: S.of(context).you_will_get, title: S.of(context).you_will_send,
initialCurrency: initialCurrency:
exchangeViewModel.receiveCurrency, exchangeViewModel.depositCurrency,
initialWalletName: receiveWalletName ?? '', initialWalletName: depositWalletName ?? '',
initialAddress: initialAddress: exchangeViewModel
exchangeViewModel.receiveCurrency == .depositCurrency ==
exchangeViewModel.wallet.currency exchangeViewModel.wallet.currency
? exchangeViewModel.wallet.walletAddresses.address ? exchangeViewModel.wallet.walletAddresses.address
: exchangeViewModel.receiveAddress, : exchangeViewModel.depositAddress,
initialIsAmountEditable: initialIsAmountEditable: true,
exchangeViewModel.provider is initialIsAddressEditable: exchangeViewModel
XMRTOExchangeProvider ? true : false, .isDepositAddressEnabled,
initialIsAddressEditable: isAmountEstimated: false,
exchangeViewModel.isReceiveAddressEnabled, hasRefundAddress: true,
isAmountEstimated: true,
isMoneroWallet: exchangeViewModel.isMoneroWallet, isMoneroWallet: exchangeViewModel.isMoneroWallet,
currencies: exchangeViewModel.receiveCurrencies, currencies: CryptoCurrency.all,
onCurrencySelected: (currency) => onCurrencySelected: (currency) =>
exchangeViewModel.changeReceiveCurrency( exchangeViewModel.changeDepositCurrency(
currency: currency), currency: currency),
imageArrow: arrowBottomCakeGreen, imageArrow: arrowBottomPurple,
currencyButtonColor: Colors.transparent, currencyButtonColor: Colors.transparent,
addressButtonsColor: addressButtonsColor:
Theme.of(context).focusColor!, Theme.of(context).focusColor,
borderColor: Theme.of(context) borderColor: Theme.of(context)
.primaryTextTheme! .primaryTextTheme.bodyText1!
.bodyText1! .color!,
.decorationColor!,
currencyValueValidator: AmountValidator( currencyValueValidator: AmountValidator(
type: exchangeViewModel.wallet.type), type: exchangeViewModel.wallet.type),
//addressTextFieldValidator: AddressValidator( //addressTextFieldValidator: AddressValidator(
// type: exchangeViewModel.receiveCurrency), // type: exchangeViewModel.depositCurrency),
)), ),
) ),
], ),
Padding(
padding: EdgeInsets.only(top: 29, left: 24, right: 24),
child: Observer(
builder: (_) => ExchangeCard(
amountFocusNode: _receiveAmountFocus,
key: receiveKey,
title: S.of(context).you_will_get,
initialCurrency:
exchangeViewModel.receiveCurrency,
initialWalletName: receiveWalletName ?? '',
initialAddress:
exchangeViewModel.receiveCurrency ==
exchangeViewModel.wallet.currency
? exchangeViewModel.wallet.walletAddresses.address
: exchangeViewModel.receiveAddress,
initialIsAmountEditable:
exchangeViewModel.provider is
XMRTOExchangeProvider ? true : false,
initialIsAddressEditable:
exchangeViewModel.isReceiveAddressEnabled,
isAmountEstimated: true,
isMoneroWallet: exchangeViewModel.isMoneroWallet,
currencies: exchangeViewModel.receiveCurrencies,
onCurrencySelected: (currency) =>
exchangeViewModel.changeReceiveCurrency(
currency: currency),
imageArrow: arrowBottomCakeGreen,
currencyButtonColor: Colors.transparent,
addressButtonsColor:
Theme.of(context).focusColor,
borderColor: Theme.of(context)
.primaryTextTheme.bodyText1!
.decorationColor!,
currencyValueValidator: AmountValidator(
type: exchangeViewModel.wallet.type),
//addressTextFieldValidator: AddressValidator(
// type: exchangeViewModel.receiveCurrency),
)),
)
],
),
), ),
), ),
bottomSectionPadding: bottomSectionPadding:
@ -230,8 +225,7 @@ class ExchangeTemplatePage extends BasePage {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme! .primaryTextTheme.headline1!
.headline1!
.decorationColor!, .decorationColor!,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 12), fontSize: 12),

View file

@ -1,8 +1,7 @@
import 'dart:ui';
import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker_item_widget.dart'; import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker_item_widget.dart';
import 'package:cake_wallet/src/screens/exchange/widgets/picker_item.dart'; import 'package:cake_wallet/src/screens/exchange/widgets/picker_item.dart';
import 'package:cake_wallet/src/widgets/alert_close_button.dart'; import 'package:cake_wallet/src/widgets/alert_close_button.dart';
import 'package:flutter/cupertino.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cake_wallet/src/widgets/alert_background.dart'; import 'package:cake_wallet/src/widgets/alert_background.dart';
@ -54,7 +53,7 @@ class CurrencyPickerState extends State<CurrencyPicker> {
if (subString.isNotEmpty) { if (subString.isNotEmpty) {
subPickerItemsList = items subPickerItemsList = items
.where((element) => .where((element) =>
(element.title != null ? element.title.toLowerCase().contains(subString.toLowerCase()) : false) || (element.title.toLowerCase().contains(subString.toLowerCase())) ||
(element.tag != null ? element.tag!.toLowerCase().contains(subString.toLowerCase()) : false) || (element.tag != null ? element.tag!.toLowerCase().contains(subString.toLowerCase()) : false) ||
(element.name != null ? element.name!.toLowerCase().contains(subString.toLowerCase()) : false)) (element.name != null ? element.name!.toLowerCase().contains(subString.toLowerCase()) : false))
.toList(); .toList();
@ -67,11 +66,9 @@ class CurrencyPickerState extends State<CurrencyPicker> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AlertBackground( return AlertBackground(
child: Stack( child: Column(
alignment: Alignment.center,
children: [
Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
if (widget.title?.isNotEmpty ?? false) if (widget.title?.isNotEmpty ?? false)
Container( Container(
@ -93,10 +90,11 @@ class CurrencyPickerState extends State<CurrencyPicker> {
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(30)), borderRadius: BorderRadius.all(Radius.circular(30)),
child: Container( child: Container(
color: Theme.of(context).accentTextTheme!.headline6!.color!, color: Theme.of(context).accentTextTheme.headline6!.color!,
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints( constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.65, maxHeight: MediaQuery.of(context).size.height * 0.65,
maxWidth: ResponsiveLayoutUtil.kPopupWidth
), ),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -132,7 +130,7 @@ class CurrencyPickerState extends State<CurrencyPicker> {
), ),
), ),
Divider( Divider(
color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!, color: Theme.of(context).accentTextTheme.headline6!.backgroundColor!,
height: 1, height: 1,
), ),
if (widget.selectedAtIndex != -1) if (widget.selectedAtIndex != -1)
@ -170,8 +168,7 @@ class CurrencyPickerState extends State<CurrencyPicker> {
), ),
), ),
), ),
], SizedBox(height: ResponsiveLayoutUtil.kPopupSpaceHeight),
),
AlertCloseButton(), AlertCloseButton(),
], ],
), ),

View file

@ -12,17 +12,20 @@ class DesktopExchangeCardsSection extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return FocusTraversalGroup(
children: <Widget>[ policy: OrderedTraversalPolicy(),
Padding( child: Column(
padding: EdgeInsets.only(top: 55, left: 24, right: 24), children: <Widget>[
child: firstExchangeCard, Padding(
), padding: EdgeInsets.only(top: 55, left: 24, right: 24),
Padding( child: firstExchangeCard,
padding: EdgeInsets.only(top: 29, left: 24, right: 24), ),
child: secondExchangeCard, Padding(
), padding: EdgeInsets.only(top: 29, left: 24, right: 24),
], child: secondExchangeCard,
),
],
),
); );
} }
} }

View file

@ -159,7 +159,7 @@ class ExchangeCardState extends State<ExchangeCard> {
final copyImage = Image.asset('assets/images/copy_content.png', final copyImage = Image.asset('assets/images/copy_content.png',
height: 16, height: 16,
width: 16, width: 16,
color: Theme.of(context).primaryTextTheme!.headline3!.color!); color: Theme.of(context).primaryTextTheme.headline3!.color!);
return Container( return Container(
width: double.infinity, width: double.infinity,
@ -174,7 +174,7 @@ class ExchangeCardState extends State<ExchangeCard> {
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Theme.of(context).textTheme!.headline5!.color!), color: Theme.of(context).textTheme.headline5!.color!),
) )
], ],
), ),
@ -209,7 +209,7 @@ class ExchangeCardState extends State<ExchangeCard> {
child: Container( child: Container(
height: 32, height: 32,
decoration: BoxDecoration( decoration: BoxDecoration(
color: widget.addressButtonsColor ?? Theme.of(context).primaryTextTheme!.headline4!.color!, color: widget.addressButtonsColor ?? Theme.of(context).primaryTextTheme.headline4!.color!,
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(6))), BorderRadius.all(Radius.circular(6))),
child: Center( child: Center(
@ -220,8 +220,7 @@ class ExchangeCardState extends State<ExchangeCard> {
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme! .primaryTextTheme.headline4!
.headline4!
.decorationColor!)), .decorationColor!)),
), ),
), ),
@ -240,34 +239,36 @@ class ExchangeCardState extends State<ExchangeCard> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Flexible( Flexible(
child: BaseTextFormField( child: FocusTraversalOrder(
focusNode: widget.amountFocusNode, order: NumericFocusOrder(1),
controller: amountController, child: BaseTextFormField(
enabled: _isAmountEditable, focusNode: widget.amountFocusNode,
textAlign: TextAlign.left, controller: amountController,
keyboardType: TextInputType.numberWithOptions( enabled: _isAmountEditable,
signed: false, decimal: true), textAlign: TextAlign.left,
inputFormatters: [ keyboardType: TextInputType.numberWithOptions(
FilteringTextInputFormatter.deny( signed: false, decimal: true),
RegExp('[\\-|\\ ]')) inputFormatters: [
], FilteringTextInputFormatter.deny(
hintText: '0.0000', RegExp('[\\-|\\ ]'))
borderColor: Colors.transparent, ],
//widget.borderColor, hintText: '0.0000',
textStyle: TextStyle( borderColor: Colors.transparent,
fontSize: 16, //widget.borderColor,
fontWeight: FontWeight.w600, textStyle: TextStyle(
color: Colors.white), fontSize: 16,
placeholderTextStyle: TextStyle( fontWeight: FontWeight.w600,
fontSize: 16, color: Colors.white),
fontWeight: FontWeight.w600, placeholderTextStyle: TextStyle(
color: Theme.of(context) fontSize: 16,
.accentTextTheme! fontWeight: FontWeight.w600,
.headline1! color: Theme.of(context)
.decorationColor!), .accentTextTheme.headline1!
validator: _isAmountEditable .decorationColor!),
? widget.currencyValueValidator validator: _isAmountEditable
: null), ? widget.currencyValueValidator
: null),
),
), ),
if (widget.hasAllAmount) if (widget.hasAllAmount)
Container( Container(
@ -275,8 +276,7 @@ class ExchangeCardState extends State<ExchangeCard> {
width: 32, width: 32,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme! .primaryTextTheme.headline4!
.headline4!
.color!, .color!,
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(6))), BorderRadius.all(Radius.circular(6))),
@ -289,8 +289,7 @@ class ExchangeCardState extends State<ExchangeCard> {
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme! .primaryTextTheme.headline4!
.headline4!
.decorationColor!)), .decorationColor!)),
), ),
), ),
@ -301,8 +300,7 @@ class ExchangeCardState extends State<ExchangeCard> {
], ],
)), )),
Divider(height: 1,color: Theme.of(context) Divider(height: 1,color: Theme.of(context)
.primaryTextTheme! .primaryTextTheme.headline5!
.headline5!
.decorationColor!), .decorationColor!),
Padding( Padding(
padding: EdgeInsets.only(top: 5), padding: EdgeInsets.only(top: 5),
@ -320,8 +318,7 @@ class ExchangeCardState extends State<ExchangeCard> {
fontSize: 10, fontSize: 10,
height: 1.2, height: 1.2,
color: Theme.of(context) color: Theme.of(context)
.accentTextTheme! .accentTextTheme.headline1!
.headline1!
.decorationColor!), .decorationColor!),
) )
: Offstage(), : Offstage(),
@ -335,8 +332,7 @@ class ExchangeCardState extends State<ExchangeCard> {
fontSize: 10, fontSize: 10,
height: 1.2, height: 1.2,
color: Theme.of(context) color: Theme.of(context)
.accentTextTheme! .accentTextTheme.headline1!
.headline1!
.decorationColor!)) .decorationColor!))
: Offstage(), : Offstage(),
])), ])),
@ -350,71 +346,75 @@ class ExchangeCardState extends State<ExchangeCard> {
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context) color: Theme.of(context)
.accentTextTheme! .accentTextTheme.headline1!
.headline1!
.decorationColor!), .decorationColor!),
)) ))
: Offstage(), : Offstage(),
_isAddressEditable _isAddressEditable
? Padding( ? FocusTraversalOrder(
padding: EdgeInsets.only(top: 20), order: NumericFocusOrder(2),
child: AddressTextField( child: Padding(
focusNode: widget.addressFocusNode, padding: EdgeInsets.only(top: 20),
controller: addressController, child: AddressTextField(
onURIScanned: (uri) { focusNode: widget.addressFocusNode,
final paymentRequest = PaymentRequest.fromUri(uri); controller: addressController,
addressController.text = paymentRequest.address; onURIScanned: (uri) {
final paymentRequest = PaymentRequest.fromUri(uri);
if (amountController.text.isNotEmpty) { addressController.text = paymentRequest.address;
_showAmountPopup(context, paymentRequest);
return; if (amountController.text.isNotEmpty) {
} _showAmountPopup(context, paymentRequest);
widget.amountFocusNode?.requestFocus(); return;
amountController.text = paymentRequest.amount; }
}, widget.amountFocusNode?.requestFocus();
placeholder: widget.hasRefundAddress amountController.text = paymentRequest.amount;
? S.of(context).refund_address },
: null, placeholder: widget.hasRefundAddress
options: [ ? S.of(context).refund_address
AddressTextFieldOption.paste, : null,
AddressTextFieldOption.qrCode, options: [
AddressTextFieldOption.addressBook, AddressTextFieldOption.paste,
], AddressTextFieldOption.qrCode,
isBorderExist: false, AddressTextFieldOption.addressBook,
textStyle: TextStyle( ],
fontSize: 16, isBorderExist: false,
fontWeight: FontWeight.w600, textStyle: TextStyle(
color: Colors.white), fontSize: 16,
hintStyle: TextStyle( fontWeight: FontWeight.w600,
fontSize: 16, color: Colors.white),
fontWeight: FontWeight.w600, hintStyle: TextStyle(
color: Theme.of(context) fontSize: 16,
.accentTextTheme! fontWeight: FontWeight.w600,
.headline1! color: Theme.of(context)
.decorationColor!), .accentTextTheme.headline1!
buttonColor: widget.addressButtonsColor, .decorationColor!),
validator: widget.addressTextFieldValidator, buttonColor: widget.addressButtonsColor,
onPushPasteButton: widget.onPushPasteButton, validator: widget.addressTextFieldValidator,
onPushAddressBookButton: widget.onPushAddressBookButton, onPushPasteButton: widget.onPushPasteButton,
selectedCurrency: _selectedCurrency onPushAddressBookButton: widget.onPushAddressBookButton,
selectedCurrency: _selectedCurrency
),
), ),
)
)
: Padding( : Padding(
padding: EdgeInsets.only(top: 10), padding: EdgeInsets.only(top: 10),
child: Builder( child: Builder(
builder: (context) => Stack(children: <Widget>[ builder: (context) => Stack(children: <Widget>[
BaseTextFormField( FocusTraversalOrder(
controller: addressController, order: NumericFocusOrder(3),
readOnly: true, child: BaseTextFormField(
borderColor: Colors.transparent, controller: addressController,
suffixIcon: readOnly: true,
SizedBox(width: _isMoneroWallet ? 80 : 36), borderColor: Colors.transparent,
textStyle: TextStyle( suffixIcon:
fontSize: 16, SizedBox(width: _isMoneroWallet ? 80 : 36),
fontWeight: FontWeight.w600, textStyle: TextStyle(
color: Colors.white), fontSize: 16,
validator: widget.addressTextFieldValidator), fontWeight: FontWeight.w600,
color: Colors.white),
validator: widget.addressTextFieldValidator),
),
Positioned( Positioned(
top: 2, top: 2,
right: 0, right: 0,
@ -457,8 +457,7 @@ class ExchangeCardState extends State<ExchangeCard> {
child: Image.asset( child: Image.asset(
'assets/images/open_book.png', 'assets/images/open_book.png',
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme! .primaryTextTheme.headline4!
.headline4!
.decorationColor!, .decorationColor!,
)), )),
)), )),

View file

@ -117,136 +117,137 @@ class SendPage extends BasePage {
key: _formKey, key: _formKey,
child: ScrollableWithBottomSection( child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(bottom: 24), contentPadding: EdgeInsets.only(bottom: 24),
content: Column( content: FocusTraversalGroup(
children: <Widget>[ policy: OrderedTraversalPolicy(),
Container( child: Column(
height: _sendCardHeight(context), children: <Widget>[
child: Observer( Container(
builder: (_) { height: _sendCardHeight(context),
return PageView.builder( child: Observer(
scrollDirection: Axis.horizontal, builder: (_) {
controller: controller, return PageView.builder(
itemCount: sendViewModel.outputs.length,
itemBuilder: (context, index) {
final output = sendViewModel.outputs[index];
return SendCard(
key: output.key,
output: output,
sendViewModel: sendViewModel,
initialPaymentRequest: initialPaymentRequest,
);
});
},
)),
Padding(
padding:
EdgeInsets.only(top: 10, left: 24, right: 24, bottom: 10),
child: Container(
height: 10,
child: Observer(
builder: (_) {
final count = sendViewModel.outputs.length;
return count > 1
? SmoothPageIndicator(
controller: controller,
count: count,
effect: ScrollingDotsEffect(
spacing: 6.0,
radius: 6.0,
dotWidth: 6.0,
dotHeight: 6.0,
dotColor: Theme.of(context)
.primaryTextTheme!
.headline3!
.backgroundColor!,
activeDotColor: Theme.of(context)
.primaryTextTheme!
.headline2!
.backgroundColor!),
)
: Offstage();
},
),
),
),
if (sendViewModel.hasMultiRecipient)
Container(
height: 40,
width: double.infinity,
padding: EdgeInsets.only(left: 24),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Observer(
builder: (_) {
final templates = sendViewModel.templates;
final itemCount = templates.length;
return Row(
children: <Widget>[
AddTemplateButton(
onTap: () => Navigator.of(context).pushNamed(Routes.sendTemplate),
currentTemplatesLength: templates.length,
),
ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
shrinkWrap: true, controller: controller,
physics: NeverScrollableScrollPhysics(), itemCount: sendViewModel.outputs.length,
itemCount: itemCount,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final template = templates[index]; final output = sendViewModel.outputs[index];
return TemplateTile(
key: UniqueKey(), return SendCard(
to: template.name, key: output.key,
amount: template.isCurrencySelected ? template.amount : template.amountFiat, output: output,
from: template.isCurrencySelected ? template.cryptoCurrency : template.fiatCurrency, sendViewModel: sendViewModel,
onTap: () async { initialPaymentRequest: initialPaymentRequest,
final fiatFromTemplate = FiatCurrency.all.singleWhere((element) => element.title == template.fiatCurrency);
final output = _defineCurrentOutput();
output.address = template.address;
if(template.isCurrencySelected){
output.setCryptoAmount(template.amount);
}else{
sendViewModel.setFiatCurrency(fiatFromTemplate);
output.setFiatAmount(template.amountFiat);
}
output.resetParsedAddress();
await output.fetchParsedAddress(context);
},
onRemove: () {
showPopUp<void>(
context: context,
builder: (dialogContext) {
return AlertWithTwoActions(
alertTitle: S.of(context).template,
alertContent: S
.of(context)
.confirm_delete_template,
rightButtonText: S.of(context).delete,
leftButtonText: S.of(context).cancel,
actionRightButton: () {
Navigator.of(dialogContext).pop();
sendViewModel.sendTemplateViewModel
.removeTemplate(
template: template);
},
actionLeftButton: () =>
Navigator.of(dialogContext)
.pop());
},
);
},
); );
}, });
), },
], )),
); Padding(
}, padding:
EdgeInsets.only(top: 10, left: 24, right: 24, bottom: 10),
child: Container(
height: 10,
child: Observer(
builder: (_) {
final count = sendViewModel.outputs.length;
return count > 1
? SmoothPageIndicator(
controller: controller,
count: count,
effect: ScrollingDotsEffect(
spacing: 6.0,
radius: 6.0,
dotWidth: 6.0,
dotHeight: 6.0,
dotColor: Theme.of(context)
.primaryTextTheme.headline3!
.backgroundColor!,
activeDotColor: Theme.of(context)
.primaryTextTheme.headline2!
.backgroundColor!),
)
: Offstage();
},
),
), ),
), ),
) if (sendViewModel.hasMultiRecipient)
], Container(
height: 40,
width: double.infinity,
padding: EdgeInsets.only(left: 24),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Observer(
builder: (_) {
final templates = sendViewModel.templates;
final itemCount = templates.length;
return Row(
children: <Widget>[
AddTemplateButton(
onTap: () => Navigator.of(context).pushNamed(Routes.sendTemplate),
currentTemplatesLength: templates.length,
),
ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: itemCount,
itemBuilder: (context, index) {
final template = templates[index];
return TemplateTile(
key: UniqueKey(),
to: template.name,
amount: template.isCurrencySelected ? template.amount : template.amountFiat,
from: template.isCurrencySelected ? template.cryptoCurrency : template.fiatCurrency,
onTap: () async {
final fiatFromTemplate = FiatCurrency.all.singleWhere((element) => element.title == template.fiatCurrency);
final output = _defineCurrentOutput();
output.address = template.address;
if(template.isCurrencySelected){
output.setCryptoAmount(template.amount);
}else{
sendViewModel.setFiatCurrency(fiatFromTemplate);
output.setFiatAmount(template.amountFiat);
}
output.resetParsedAddress();
await output.fetchParsedAddress(context);
},
onRemove: () {
showPopUp<void>(
context: context,
builder: (dialogContext) {
return AlertWithTwoActions(
alertTitle: S.of(context).template,
alertContent: S
.of(context)
.confirm_delete_template,
rightButtonText: S.of(context).delete,
leftButtonText: S.of(context).cancel,
actionRightButton: () {
Navigator.of(dialogContext).pop();
sendViewModel.sendTemplateViewModel
.removeTemplate(
template: template);
},
actionLeftButton: () =>
Navigator.of(dialogContext)
.pop());
},
);
},
);
},
),
],
);
},
),
),
)
],
),
), ),
bottomSectionPadding: bottomSectionPadding:
EdgeInsets.only(left: 24, right: 24, bottom: 24), EdgeInsets.only(left: 24, right: 24, bottom: 24),
@ -261,8 +262,7 @@ class SendPage extends BasePage {
text: 'Change your asset (${sendViewModel.selectedCryptoCurrency})', text: 'Change your asset (${sendViewModel.selectedCryptoCurrency})',
color: Colors.transparent, color: Colors.transparent,
textColor: Theme.of(context) textColor: Theme.of(context)
.accentTextTheme! .accentTextTheme.headline3!
.headline3!
.decorationColor!, .decorationColor!,
) )
) )
@ -280,13 +280,11 @@ class SendPage extends BasePage {
text: S.of(context).add_receiver, text: S.of(context).add_receiver,
color: Colors.transparent, color: Colors.transparent,
textColor: Theme.of(context) textColor: Theme.of(context)
.accentTextTheme! .accentTextTheme.headline3!
.headline3!
.decorationColor!, .decorationColor!,
isDottedBorder: true, isDottedBorder: true,
borderColor: Theme.of(context) borderColor: Theme.of(context)
.primaryTextTheme! .primaryTextTheme.headline3!
.headline3!
.decorationColor!, .decorationColor!,
)), )),
Observer( Observer(
@ -306,7 +304,7 @@ class SendPage extends BasePage {
item.address.isEmpty || item.cryptoAmount.isEmpty) item.address.isEmpty || item.cryptoAmount.isEmpty)
.toList(); .toList();
if (notValidItems?.isNotEmpty ?? false) { if (notValidItems.isNotEmpty ?? false) {
showErrorValidationAlert(context); showErrorValidationAlert(context);
return; return;
} }
@ -315,7 +313,7 @@ class SendPage extends BasePage {
}, },
text: S.of(context).send, text: S.of(context).send,
color: Theme.of(context).accentTextTheme!.bodyText1!.color!, color: Theme.of(context).accentTextTheme.bodyText1!.color!,
textColor: Colors.white, textColor: Colors.white,
isLoading: sendViewModel.state is IsExecutingState || isLoading: sendViewModel.state is IsExecutingState ||
sendViewModel.state is TransactionCommitting, sendViewModel.state is TransactionCommitting,

View file

@ -58,12 +58,13 @@ class AddressTextField extends StatelessWidget {
TextFormField( TextFormField(
onFieldSubmitted: (_) => FocusScope.of(context).unfocus(), onFieldSubmitted: (_) => FocusScope.of(context).unfocus(),
enabled: isActive, enabled: isActive,
autofocus: true,
controller: controller, controller: controller,
focusNode: focusNode, focusNode: focusNode,
style: textStyle ?? style: textStyle ??
TextStyle( TextStyle(
fontSize: 16, fontSize: 16,
color: Theme.of(context).primaryTextTheme!.headline6!.color!), color: Theme.of(context).primaryTextTheme.headline6!.color!),
decoration: InputDecoration( decoration: InputDecoration(
suffixIcon: SizedBox( suffixIcon: SizedBox(
width: prefixIconWidth * options.length + width: prefixIconWidth * options.length +
@ -115,8 +116,7 @@ class AddressTextField extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: buttonColor ?? color: buttonColor ??
Theme.of(context) Theme.of(context)
.accentTextTheme! .accentTextTheme.headline6!
.headline6!
.color!, .color!,
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(6))), BorderRadius.all(Radius.circular(6))),
@ -124,8 +124,7 @@ class AddressTextField extends StatelessWidget {
'assets/images/paste_ios.png', 'assets/images/paste_ios.png',
color: iconColor ?? color: iconColor ??
Theme.of(context) Theme.of(context)
.primaryTextTheme! .primaryTextTheme.headline4!
.headline4!
.decorationColor!, .decorationColor!,
)), )),
)), )),
@ -142,8 +141,7 @@ class AddressTextField extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: buttonColor ?? color: buttonColor ??
Theme.of(context) Theme.of(context)
.accentTextTheme! .accentTextTheme.headline6!
.headline6!
.color!, .color!,
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(6))), BorderRadius.all(Radius.circular(6))),
@ -151,8 +149,7 @@ class AddressTextField extends StatelessWidget {
'assets/images/qr_code_icon.png', 'assets/images/qr_code_icon.png',
color: iconColor ?? color: iconColor ??
Theme.of(context) Theme.of(context)
.primaryTextTheme! .primaryTextTheme.headline4!
.headline4!
.decorationColor!, .decorationColor!,
)), )),
)) ))
@ -171,8 +168,7 @@ class AddressTextField extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: buttonColor ?? color: buttonColor ??
Theme.of(context) Theme.of(context)
.accentTextTheme! .accentTextTheme.headline6!
.headline6!
.color!, .color!,
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(6))), BorderRadius.all(Radius.circular(6))),
@ -180,8 +176,7 @@ class AddressTextField extends StatelessWidget {
'assets/images/open_book.png', 'assets/images/open_book.png',
color: iconColor ?? color: iconColor ??
Theme.of(context) Theme.of(context)
.primaryTextTheme! .primaryTextTheme.headline4!
.headline4!
.decorationColor!, .decorationColor!,
)), )),
)) ))

View file

@ -13,9 +13,7 @@ class AlertCloseButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Positioned( return GestureDetector(
bottom: 60,
child: GestureDetector(
onTap: () => Navigator.of(context).pop(), onTap: () => Navigator.of(context).pop(),
child: Container( child: Container(
height: 42, height: 42,
@ -28,7 +26,6 @@ class AlertCloseButton extends StatelessWidget {
child: image ?? closeButton, child: image ?? closeButton,
), ),
), ),
)
); );
} }
} }

View file

@ -64,6 +64,7 @@ class BaseTextFormField extends StatelessWidget {
readOnly: readOnly, readOnly: readOnly,
initialValue: initialValue, initialValue: initialValue,
focusNode: focusNode, focusNode: focusNode,
autofocus: true,
controller: controller, controller: controller,
keyboardType: keyboardType, keyboardType: keyboardType,
textInputAction: textInputAction, textInputAction: textInputAction,
@ -78,7 +79,7 @@ class BaseTextFormField extends StatelessWidget {
TextStyle( TextStyle(
fontSize: 16.0, fontSize: 16.0,
color: color:
textColor ?? Theme.of(context).primaryTextTheme!.headline6!.color!), textColor ?? Theme.of(context).primaryTextTheme.headline6!.color!),
decoration: InputDecoration( decoration: InputDecoration(
prefix: prefix, prefix: prefix,
prefixIcon: prefixIcon, prefixIcon: prefixIcon,
@ -92,17 +93,17 @@ class BaseTextFormField extends StatelessWidget {
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: borderColor ?? color: borderColor ??
Theme.of(context).primaryTextTheme!.headline6!.backgroundColor!, Theme.of(context).primaryTextTheme.headline6!.backgroundColor!,
width: borderWidth)), width: borderWidth)),
disabledBorder: UnderlineInputBorder( disabledBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: borderColor ?? color: borderColor ??
Theme.of(context).primaryTextTheme!.headline6!.backgroundColor!, Theme.of(context).primaryTextTheme.headline6!.backgroundColor!,
width: borderWidth)), width: borderWidth)),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: borderColor ?? color: borderColor ??
Theme.of(context).primaryTextTheme!.headline6!.backgroundColor!, Theme.of(context).primaryTextTheme.headline6!.backgroundColor!,
width: borderWidth))), width: borderWidth))),
validator: validator, validator: validator,
); );

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/alert_background.dart'; import 'package:cake_wallet/src/widgets/alert_background.dart';
import 'package:cake_wallet/src/widgets/alert_close_button.dart'; import 'package:cake_wallet/src/widgets/alert_close_button.dart';
@ -32,77 +33,76 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AlertBackground( return AlertBackground(
child: Stack( child: Center(
alignment: Alignment.center, child: Column(
children: <Widget>[ mainAxisSize: MainAxisSize.min,
Column( children: <Widget>[
mainAxisSize: MainAxisSize.min, if (widget.title.isNotEmpty)
children: <Widget>[ Container(
if (widget.title?.isNotEmpty ?? false) padding: EdgeInsets.symmetric(horizontal: 24),
Container( child: Text(
padding: EdgeInsets.symmetric(horizontal: 24), widget.title,
child: Text( textAlign: TextAlign.center,
widget.title, style: TextStyle(
textAlign: TextAlign.center, fontSize: 18,
style: TextStyle( fontFamily: 'Lato',
fontSize: 18, fontWeight: FontWeight.bold,
fontFamily: 'Lato', decoration: TextDecoration.none,
fontWeight: FontWeight.bold, color: Colors.white,
decoration: TextDecoration.none, ),
color: Colors.white,
), ),
), ),
), Padding(
Padding( padding: EdgeInsets.only(left: 24, right: 24, top: 24),
padding: EdgeInsets.only(left: 24, right: 24, top: 24), child: ClipRRect(
child: ClipRRect( borderRadius: BorderRadius.all(Radius.circular(30)),
borderRadius: BorderRadius.all(Radius.circular(30)), child: Container(
child: Container( color: Theme.of(context).accentTextTheme.headline6!.color!,
color: Theme.of(context).accentTextTheme!.headline6!.color!, child: ConstrainedBox(
child: ConstrainedBox( constraints: BoxConstraints(
constraints: BoxConstraints( maxHeight: MediaQuery.of(context).size.height * 0.65,
maxHeight: MediaQuery.of(context).size.height * 0.65, maxWidth: ResponsiveLayoutUtil.kPopupWidth,
), ),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Flexible( Flexible(
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: <Widget>[ children: <Widget>[
(items?.length ?? 0) > 3 (items.length) > 3
? Scrollbar( ? Scrollbar(
controller: controller, controller: controller,
child: itemsList(), child: itemsList(),
) )
: itemsList(), : itemsList(),
], ],
),
), ),
), ],
], ),
), ),
), ),
), ),
), ),
) SizedBox(height: ResponsiveLayoutUtil.kPopupSpaceHeight),
], AlertCloseButton(),
), ],
AlertCloseButton(), ),
],
), ),
); );
} }
Widget itemsList() { Widget itemsList() {
return Container( return Container(
color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!, color: Theme.of(context).accentTextTheme.headline6!.backgroundColor!,
child: ListView.separated( child: ListView.separated(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
controller: controller, controller: controller,
shrinkWrap: true, shrinkWrap: true,
separatorBuilder: (context, index) => widget.isSeparated separatorBuilder: (context, index) => widget.isSeparated
? Divider( ? Divider(
color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!, color: Theme.of(context).accentTextTheme.headline6!.backgroundColor!,
height: 1, height: 1,
) )
: const SizedBox(), : const SizedBox(),
@ -121,13 +121,13 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
}, },
child: Container( child: Container(
height: 55, height: 55,
color: Theme.of(context).accentTextTheme!.headline6!.color!, color: Theme.of(context).accentTextTheme.headline6!.color!,
padding: EdgeInsets.only(left: 24, right: 24), padding: EdgeInsets.only(left: 24, right: 24),
child: CheckboxListTile( child: CheckboxListTile(
value: item.value, value: item.value,
activeColor: item.value activeColor: item.value
? Palette.blueCraiola ? Palette.blueCraiola
: Theme.of(context).accentTextTheme!.subtitle1!.decorationColor!, : Theme.of(context).accentTextTheme.subtitle1!.decorationColor!,
checkColor: Colors.white, checkColor: Colors.white,
title: widget.displayItem?.call(item) ?? title: widget.displayItem?.call(item) ??
Text( Text(
@ -138,7 +138,7 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: item.isDisabled color: item.isDisabled
? Colors.grey.withOpacity(0.5) ? Colors.grey.withOpacity(0.5)
: Theme.of(context).primaryTextTheme!.headline6!.color!, : Theme.of(context).primaryTextTheme.headline6!.color!,
decoration: TextDecoration.none, decoration: TextDecoration.none,
), ),
), ),

View file

@ -1,5 +1,6 @@
// ignore_for_file: deprecated_member_use // ignore_for_file: deprecated_member_use
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/alert_background.dart'; import 'package:cake_wallet/src/widgets/alert_background.dart';
import 'package:cake_wallet/src/widgets/alert_close_button.dart'; import 'package:cake_wallet/src/widgets/alert_close_button.dart';
@ -70,108 +71,106 @@ class _PickerState<Item> extends State<Picker> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AlertBackground( return AlertBackground(
child: Stack( child: Column(
alignment: Alignment.center, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Column( if (widget.title?.isNotEmpty ?? false)
mainAxisSize: MainAxisSize.min, Container(
children: <Widget>[ padding: EdgeInsets.symmetric(horizontal: 24),
if (widget.title?.isNotEmpty ?? false) child: Text(
Container( widget.title!,
padding: EdgeInsets.symmetric(horizontal: 24), textAlign: TextAlign.center,
child: Text( style: TextStyle(
widget.title!, fontSize: 18,
textAlign: TextAlign.center, fontFamily: 'Lato',
style: TextStyle( fontWeight: FontWeight.bold,
fontSize: 18, decoration: TextDecoration.none,
fontFamily: 'Lato', color: Colors.white,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: Colors.white,
),
),
), ),
Padding( ),
padding: EdgeInsets.only(left: 24, right: 24, top: 24), ),
child: ClipRRect( Padding(
borderRadius: BorderRadius.all(Radius.circular(30)), padding: EdgeInsets.only(left: 24, right: 24, top: 24),
child: Container( child: ClipRRect(
color: Theme.of(context).accentTextTheme.headline6!.color!, borderRadius: BorderRadius.all(Radius.circular(30)),
child: ConstrainedBox( child: Container(
constraints: BoxConstraints( color: Theme.of(context).accentTextTheme.headline6!.color!,
maxHeight: MediaQuery.of(context).size.height * 0.65, child: ConstrainedBox(
), constraints: BoxConstraints(
child: Column( maxHeight: MediaQuery.of(context).size.height * 0.65,
mainAxisSize: MainAxisSize.min, maxWidth: ResponsiveLayoutUtil.kPopupWidth,
children: [ ),
if (widget.hintText != null) child: Column(
Padding( mainAxisSize: MainAxisSize.min,
padding: const EdgeInsets.all(16), children: [
child: TextFormField( if (widget.hintText != null)
controller: searchController, Padding(
style: TextStyle(color: Theme.of(context).primaryTextTheme.headline6!.color!), padding: const EdgeInsets.all(16),
decoration: InputDecoration( child: TextFormField(
hintText: widget.hintText, controller: searchController,
prefixIcon: Image.asset("assets/images/search_icon.png"), style: TextStyle(color: Theme.of(context).primaryTextTheme.headline6!.color!),
filled: true, decoration: InputDecoration(
fillColor: Theme.of(context).accentTextTheme.headline3!.color!, hintText: widget.hintText,
alignLabelWithHint: false, prefixIcon: Image.asset("assets/images/search_icon.png"),
contentPadding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16), filled: true,
enabledBorder: OutlineInputBorder( fillColor: Theme.of(context).accentTextTheme.headline3!.color!,
borderRadius: BorderRadius.circular(14), alignLabelWithHint: false,
borderSide: const BorderSide( contentPadding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16),
color: Colors.transparent, enabledBorder: OutlineInputBorder(
)), borderRadius: BorderRadius.circular(14),
focusedBorder: OutlineInputBorder( borderSide: const BorderSide(
borderRadius: BorderRadius.circular(14), color: Colors.transparent,
borderSide: const BorderSide( )),
color: Colors.transparent, focusedBorder: OutlineInputBorder(
)), borderRadius: BorderRadius.circular(14),
), borderSide: const BorderSide(
color: Colors.transparent,
)),
), ),
), ),
Divider(
color: Theme.of(context).accentTextTheme.headline6!.backgroundColor!,
height: 1,
), ),
if (widget.selectedAtIndex != -1) buildSelectedItem(), Divider(
Flexible( color: Theme.of(context).accentTextTheme.headline6!.backgroundColor!,
child: Stack( height: 1,
alignment: Alignment.center, ),
children: <Widget>[ if (widget.selectedAtIndex != -1) buildSelectedItem(),
items.length > 3 ? Scrollbar( Flexible(
controller: controller, child: Stack(
child: itemsList(), alignment: Alignment.center,
) : itemsList(), children: <Widget>[
(widget.description?.isNotEmpty ?? false) items.length > 3 ? Scrollbar(
? Positioned( controller: controller,
bottom: 24, child: itemsList(),
left: 24, ) : itemsList(),
right: 24, (widget.description?.isNotEmpty ?? false)
child: Text( ? Positioned(
widget.description!, bottom: 24,
textAlign: TextAlign.center, left: 24,
style: TextStyle( right: 24,
fontSize: 12, child: Text(
fontWeight: FontWeight.w500, widget.description!,
fontFamily: 'Lato', textAlign: TextAlign.center,
decoration: TextDecoration.none, style: TextStyle(
color: Theme.of(context).primaryTextTheme.headline6!.color!, fontSize: 12,
), fontWeight: FontWeight.w500,
fontFamily: 'Lato',
decoration: TextDecoration.none,
color: Theme.of(context).primaryTextTheme.headline6!.color!,
), ),
) ),
: Offstage(), )
], : Offstage(),
), ],
), ),
], ),
), ],
),
), ),
), ),
) ),
], ),
), ),
SizedBox(height: ResponsiveLayoutUtil.kPopupSpaceHeight),
AlertCloseButton(), AlertCloseButton(),
], ],
), ),

View file

@ -3,6 +3,9 @@ import 'package:flutter/material.dart';
class ResponsiveLayoutUtil { class ResponsiveLayoutUtil {
static const double _kMobileThreshold = 900; static const double _kMobileThreshold = 900;
static const double kDesktopMaxWidthConstraint = 400; static const double kDesktopMaxWidthConstraint = 400;
static const double kPopupWidth = 400;
static const double kPopupSpaceHeight = 100;
const ResponsiveLayoutUtil._(); const ResponsiveLayoutUtil._();