Skip to content

Conversation

@sbaranov
Copy link
Contributor

@sbaranov sbaranov commented Mar 23, 2018

Fixes #14916.
Requires flutter/engine#4853.

Engine roll includes:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs documentation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or you could make it private.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you leave it public, it should probably be called "index" to match enums.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put a blank line between the sentences, so that only the first is considered part of the "brief" description

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here and above, maybe instead of "numeric" use "[number]"?
also, maybe link to [new TextInputType.numberWithOptions] to say how to set this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also maybe mention that it defaults to null if the type isn't number?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you need [new TextInputType.numberWithOptions] to make that xref work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, using "new" here even though the actual usage is with "const"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// not /// since this isn't documentation we would want to make public, it's a comment.

Copy link
Contributor Author

@sbaranov sbaranov Mar 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, style guide says "Use /// for public-quality private documentation".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid => with multiline expressions in general (we make some exceptions in build methods where the result is more readable)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you probably don't need this identical check, this is a very cheap set of values to compare

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(i don't have a good intuition about whether it's worth including the identical checks or not. In general we have tended to start by not including them, then add them when it becomes obvious that the normal path is starting to be a bit heavy.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just pass in the value, not the value's hashCode. Did you find this pattern somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blindly copied from where it used complex object.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent by 2 rather than 4.

This is a case where => looks ok, though we usually would either do it all on one line, or use a block with return.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's surprisingly fancy, why not just inline the name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from another class down below, assumed it's some kind of convention on the team. Will happily change to plain format.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent by 2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw: if you're using dartfmt, it usually does a better job when you give trailing commas

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add tests for:

  • == and hashCode (not the specific code, just that it's the same when == is the same, and different otherwise)
  • toString
  • that signed and decimal can both be set, that they default to false for number and null for non-number

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in text_field.test.dart.

@Hixie
Copy link
Contributor

Hixie commented Mar 23, 2018

LGTM

@cbracken
Copy link
Member

lgtm

@sbaranov sbaranov merged commit c5288c7 into flutter:master Mar 28, 2018
@sbaranov sbaranov deleted the numeric_keyboard branch March 28, 2018 15:33
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
* Support for decimal and signed numeric keyboard

* Comments

* Rebase.

* Roll engine to dd6f46c
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support numberDecimal and numberSigned keyboard type

4 participants