Поправил клавиатуру на экране покупки.

This commit is contained in:
Ivan Murashov
2018-04-25 23:43:05 +03:00
parent 1fb1fe7ec6
commit c84c70b7ca
2 changed files with 14 additions and 4 deletions

View File

@@ -154,6 +154,7 @@ public class ScannerActivity extends AppCompatActivity implements
private void initSwitchButton() { private void initSwitchButton() {
mButton = findViewById(R.id.cardPhoneButton); mButton = findViewById(R.id.cardPhoneButton);
mButton.setOnClickListener(this);
resetSearchType(SearchType.CARD, R.drawable.ic_card, "enter_manual"); resetSearchType(SearchType.CARD, R.drawable.ic_card, "enter_manual");
} }
@@ -379,4 +380,4 @@ public class ScannerActivity extends AppCompatActivity implements
return chain.proceed(request); return chain.proceed(request);
} }
} }
} }

View File

@@ -64,14 +64,17 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
String bonus = ''; String bonus = '';
List<Map> coupons = []; List<Map> coupons = [];
ListView listView; ListView listView;
TextField bonusTextField;
@override @override
Widget getScreenContent() { Widget getScreenContent() {
List<Widget> widgetList = []; List<Widget> widgetList = [];
widgetList.add(getValueWithDescription( widgetList.add(getValueWithDescription(
StringsLocalization.buyer(), StringsLocalization.buyer(),
user['first_name'] == null ? '' : user['first_name'] user['first_name'] == null ? '' : user['first_name']
)); ));
widgetList.add(getValueWithDescription(StringsLocalization.card(), card)); widgetList.add(getValueWithDescription(StringsLocalization.card(), card));
if (app != 'crypto') { if (app != 'crypto') {
@@ -123,12 +126,16 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
) )
)); ));
if (this.coupons.length == 0) {
widgetList.add(new Container(height: 50.0,));
}
listView = new ListView(children: widgetList, controller: scrollController); listView = new ListView(children: widgetList, controller: scrollController);
return listView; return listView;
} }
getBonusInputField() { getBonusInputField() {
var bonusTextField = new TextField( bonusTextField = new TextField(
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
decoration: new InputDecoration.collapsed( decoration: new InputDecoration.collapsed(
hintText: (app != 'crypto') ? StringsLocalization.bonusHint() : StringsLocalization.joysHint(), hintText: (app != 'crypto') ? StringsLocalization.bonusHint() : StringsLocalization.joysHint(),
@@ -448,6 +455,8 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
// TODO: Удалить дублирующийся код. // TODO: Удалить дублирующийся код.
void buildFocusNode() { void buildFocusNode() {
var pos = this.coupons.length > 0 ? 150.0 : 100.0;
sumFocusNode.addListener(() { sumFocusNode.addListener(() {
setState(() { setState(() {
@@ -456,7 +465,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
} }
if (sumFocusNode.hasFocus) { if (sumFocusNode.hasFocus) {
scrollController.animateTo(150.0, duration: new Duration(seconds: 1), curve: Curves.ease); scrollController.animateTo(pos, duration: new Duration(seconds: 1), curve: Curves.ease);
} }
}); });
@@ -470,7 +479,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
} }
if (bonusFocusNode.hasFocus) { if (bonusFocusNode.hasFocus) {
scrollController.animateTo(150.0, duration: new Duration(seconds: 1), curve: Curves.ease); scrollController.animateTo(pos, duration: new Duration(seconds: 1), curve: Curves.ease);
} }
}); });