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

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() {
mButton = findViewById(R.id.cardPhoneButton);
mButton.setOnClickListener(this);
resetSearchType(SearchType.CARD, R.drawable.ic_card, "enter_manual");
}

View File

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