Commit Graph

368 Commits

Author SHA1 Message Date
Kate Lovett
7d95e8e0c1
Splitting golden file versioning out as an argument of matchesGoldenFile (#33880)
* Splitting golden file versioning out as an argument of matchesGoldenFile

* Fixing description implementation.

* Removing unused imports

* Removing unused import

* Review feedback
2019-06-18 11:32:13 -07:00
Jonah Williams
3ae6abd9e8
Compatibility pass on flutter/material tests for JavaScript compilation. (9) (#33378) 2019-06-12 17:06:01 -07:00
chunhtai
38a5bbb44e
fix empty selection arrow when double clicked on empty read only textfield in ios (#34068) 2019-06-10 09:19:41 -07:00
Justin McCandless
ce4f15cd69
Toggle toolbar exception fix (#34055)
Stop a text editing error from happening
2019-06-10 08:06:24 -07:00
Justin McCandless
a35d6615ee
Double double tap toggles instead of error (#33802)
Fix exception that was happening when double-double-tapping a TextField (or double long tapping).
2019-06-04 10:39:08 -07:00
Justin McCandless
fce54ae685
Handles hidden by keyboard (#32838)
Extra space when scrolling to selected input so that the selection caret is visible.
2019-06-04 08:37:29 -07:00
Kate Lovett
04015b987b
Fixing duplicate test names. (#33805) 2019-06-04 07:01:52 -07:00
chunhtai
730025fa17
fix issue 14014 read only text field (#32059) 2019-06-03 14:00:43 -07:00
Jonah Williams
6619ab8fea
Add web safe indirection to Platform.isPlatform getters (2) (#33780) 2019-06-03 13:16:14 -07:00
Jonah Williams
cd1d40a7c9
Revert "Add web safe indirection to Platform.isPlatform getters (#33406)" (#33776)
This reverts commit d92b3b40d2.
2019-06-03 11:08:30 -07:00
Jonah Williams
d92b3b40d2
Add web safe indirection to Platform.isPlatform getters (#33406) 2019-06-03 10:55:36 -07:00
Justin McCandless
d963e4fe35
Text selection handles are sometimes not interactive (#31852)
The text selection handles now feel a lot more responsive, and their implementation was cleaned up a bit.
2019-05-30 12:31:18 -07:00
Tong Mu
fa3fbc89a3
Material allows "select all" when not collapsed (#32950)
This PR enables "Select all" on MaterialTextSelection when text is partially selected.
2019-05-30 10:03:31 -07:00
Harry Terkelsen
13e9bfcc94
Add binaryMessenger constructor argument to platform channels (#30406)
* Deprecates `BinaryMessages` in favor of a default instance of `BinaryMessenger`, called `defaultBinaryMessenger`
* Platform channels use the `defaultBinaryMessenger` for their binaryMessenger default argument.
2019-05-28 11:18:22 -07:00
Justin McCandless
6031c56d4c
Material Long Press Text Handle Flash (#32911)
Fix a bug where holding down on text selection caused the handles to flash. The fix was to only update selection when it actually changed.
2019-05-23 08:15:59 -07:00
chunhtai
3f92640521
Visual selection is not adjusted when changing text selection with TalkBack (#32832) 2019-05-16 14:41:39 -07:00
Greg Spencer
bb3c660522
Implements focus handling and hover for Material buttons. (#31438)
This implements focus and hover handling for Material buttons. It inserts Focus widgets into the tree in order to allow buttons to be focusable via keyboard traversal (a.k.a. TAB traversal), and Listener widgets into the InkWell to allow the detection of hover states for widgets.

Addresses #11344, #1608, and #13264.
2019-05-14 20:48:29 -07:00
Mouad Debbar
bcae3563d4
Redo: Show/hide toolbar and handles based on device kind (#32704) 2019-05-14 11:04:16 -07:00
Mouad Debbar
ef5abcc6bf
Revert "Show/hide toolbar and handles based on device kind (#29683)" (#32702)
This reverts commit 18ca37542d.
2019-05-14 09:33:04 -07:00
Mouad Debbar
18ca37542d
Show/hide toolbar and handles based on device kind (#29683) 2019-05-14 08:50:23 -07:00
Greg Spencer
a5053bfb29
Fix transforms for things with RenderPointerListeners (#32535)
This fixes #32525, because it now marks the compositing bits as needing to be recalculated if the mouse tracker changes its idea of whether or not a mouse is attached.

This bug occurred because the test framework was leaking state from one test to the next (the state about whether a mouse pointer was active), and so even though there was a "passing" test when run in order with the other tests in the file, when the test was run individually (or first), it would have failed and caught the bug.

This adds an assert to make sure that after each test there are no simulated mouse pointers connected, and now calls removePointer in all of the tests where this was a problem.
2019-05-13 15:48:12 -07:00
Greg Spencer
d2fe08628d
Implements FocusTraversalPolicy and DefaultFocusTraversal features. (#30076)
This implements a DefaultFocusTraversal widget to describe the focus traversal policy for its children, defined by a FocusTraversalPolicy object from which custom policies may be created. Pre-defined policies include widget-order traversal, "reading order" traversal and directional traversal.
2019-05-09 20:24:23 -07:00
Michael Goderbauer
1621baafc7
Introduce separate HitTestResults for Box and Sliver (#31894) 2019-05-09 10:00:01 +02:00
chunhtai
21efdff8a5
fix issue 32212 Text field keyboard selection crashes (#32256) 2019-05-07 15:07:11 -07:00
yaheng
57d6666462 Fix text selection toolbar appearing under obstructions (#29809) 2019-05-06 11:18:09 -07:00
Gary Qian
4102486d63
Center iOS caret, remove constant offsets that do not scale (#31687) 2019-04-30 17:41:01 -07:00
liyuqian
71a89a469a
Reland "Fix text field selection toolbar under Opacity (#31097)" (#31802)
This reverts commit 120a1fc47f.

Updated the golden file
2019-04-30 09:47:32 -07:00
Jonah Williams
120a1fc47f
Revert "Fix text field selection toolbar under Opacity (#31097)" (#31800) 2019-04-29 12:57:35 -07:00
liyuqian
e427c2dd86
Fix text field selection toolbar under Opacity (#31097)
## Description

As we've introduced offset to the Opacity layer, we have to override
`applyTransform` to make Leader/FollowerLayer work correctly.

## Related Issues

Fixes https://github.com/flutter/flutter/issues/30587

Together with https://github.com/flutter/engine/pull/8585,
this test will also exercise test against
https://github.com/flutter/flutter/issues/30586.

## Tests

I added the following tests:
* text field selection toolbar renders correctly inside opacity
2019-04-29 11:25:41 -07:00
Greg Spencer
7775c23784
[Re-Land] Implement focus traversal for desktop platforms. (#31614)
This re-lands the Focus changes in #30040. Correctness changes in routes.dart, and removes the automatic requesting of focus on reparent when there is no current focus, which caused undesirable selections.

Addresses #11344, #1608, #13264, and #1678
Fixes #30084
Fixes #26704
2019-04-25 16:26:58 -07:00
Justin McCandless
a21a1f4105
iOS selection handles are invisible (#31332)
Fix a bug where text selection handles were invisible in iOS
2019-04-25 12:32:10 -07:00
Greg Spencer
590cc27b31
Revert "Implement focus traversal for desktop platforms, shoehorn edition. (#30040)" (#31461)
This reverts commit 4218c0bc38.
2019-04-22 18:02:35 -07:00
Greg Spencer
4218c0bc38
Implement focus traversal for desktop platforms, shoehorn edition. (#30040)
Implements focus traversal for desktop platforms, including re-implementing the existing focus manager and focus tree.

This implements a Focus widget that can be put into a widget tree to allow input focus to be given to a particular part of a widget tree.

It incorporates with the existing FocusScope and FocusNode infrastructure, and has minimal breakage to the API, although FocusScope.reparentIfNeeded is removed, replaced by a call to FocusAttachment.reparent(), so this is a breaking change:

FocusScopeNodes must now be attached to the focus tree using FocusScopeNode.attach, which takes a context and an optional onKey callback, and returns a FocusAttachment that should be kept by the widget that hosts the FocusScopeNode. This is necessary because of the need to make sure that the focus tree reflects the widget hierarchy.

Callers that used to call FocusScope(context).reparentIfNeeded in their build method will call reparent  on a FocusAttachment instead, which they will obtain by calling FocusScopeNode.attach in their initState method. Widgets that own FocusNodes will need to call dispose on the focus node in their dispose method.

Addresses #11344, #1608, #13264, and #1678
Fixes #30084
Fixes #26704
2019-04-22 09:51:40 -07:00
Justin McCandless
6e1b143fed
Text field scroll physics (#31088)
TextField and CupertinoTextField can now specify scrollPhysics. Cupertino defaults to bouncing now.
2019-04-22 07:42:59 -07:00
Justin McCandless
ed91a3be49
Fix cursor outside of input width (#30525)
* Disallow cursor from appearing beyond the width of the input.

* Test that verifies the cursor can't exceed the width of the input

* Use constant from editable.dart to explain 1 pixel difference in test

* Fix failing test that tested the case of overflowing spaces
2019-04-10 10:35:03 -05:00
Jonah Williams
3c93b65a9b
Update to latest matcher (#30019) 2019-03-27 17:21:10 -07:00
Mouad Debbar
c80366a160
Avoid flickering while dragging to select text (#29563) 2019-03-21 13:25:29 -07:00
Alexandre Ardhuin
a6af422874
some spaces formatting (#29452)
* some space formattings

* always use blocks in if-else if a block is used

* format spaces in for and while

* allow multiline if conditions

* fix missing space
2019-03-20 23:23:31 +01:00
Mouad Debbar
5787fc3ae2
Fix text selection when user is dragging in the opposite direction (#29395) 2019-03-15 13:09:27 -07:00
Justin McCandless
6d8f539971
Text field height attempt 2 (#29250)
Adds the `minLines` and `expands` parameters for controlling text height.  The original PR was reverted, so this one contains a few extra fixes for the tests that were broken.
2019-03-14 18:01:11 -07:00
Todd Volkert
f21497ee8c
Revert "Fix TextField height issues (#27205)" (#29093)
This reverts commit 9e9f48dabb.
2019-03-09 01:17:58 -08:00
Alexandre Ardhuin
a0d1f93b07
fix block formatting (#29051) 2019-03-09 09:03:11 +01:00
Justin McCandless
9e9f48dabb
Fix TextField height issues (#27205)
* Create new TextField attribute to control maxLength behaviour

* Create test case for maxLinesIncrementalHeight

* fix maxLinesIncrementalHeight set method

* fix editable_test.dart

* Just introducing some proposed API additions, renaming to expands

* Pass minLines and expands through to child widgets and validate

* minLines can't be null, and expands can't be true when maxLines is 1

* Implement minLines and maxLines height sizing logic

* Simplify minLines validation logic

* expands parameter proof of concept

* min/max mixup bug fix, and tests work with expands false

* Test expands=true cases, and fix textPainter.height being out of date

* Test all behavior matrix cases

* min/max assertion more strict, can't be equal

* Tests work that were missing expands serialization

* Action sheet tests no longer fail due to rounding error

* TextFieldFocus test no longer mysteriously fails

* TODOs for making expands nullable. Will depend on how Expanded wrapping works

* Expanded growth happens when expanded is true and maxLines is null

* Test Expanded wrapper

* No more overflow when wrapped in Expanded

* Docs improvements

* expands can be null

* Simplify error cases to support existing behavior

* Docs examples and other docs cleanup

* Expansion up to perfectly meet the parent size

* Fix analyze null error

* Fix test after move to nullable expands

* minLines defaults to null

* expands is now exclusively for expanding to parent height and not growth between min and max

* _layout rewritten to handle max height. Need to fix prefix tests and
reenable expands

* Tests for textfield overflowing parent

* layoutLineBox is documented and private

* expands works in new _layout

* _layout return numbers seem to perfectly match original _layout

* inputWidth comment after trying it out and failing tests

* Fix analyze errors

* WIP prefix/suffix do affect height

* Prefix/suffix and icons affect height, tests pass, but I'm still visually verifying identical to original

* Tall prefix test that verifies pixel perfect layout

* Fix overflowing edge case and test it

* Clean up comments, old code, and todos

* Changing _expands causes relayout. Wasnt able to figure out how to test though...

* Clean up code review comments

* Fix misalignment when tall prefix and border, and clean up related test

* Simple code review cleanup

* Bring back inputWidth to _layout method

* Fix rounding errors showing up in mac tests

* Fix flake by reordering tests. Without this, the dreaded intrinsicwidth flake is reproducible 50% of the time on my machine.

* Fix more rounding error mac tests
2019-03-08 12:22:43 -08:00
Alexandre Ardhuin
440ce8fde6
Fix indentations of statements in BlockFunctionBody (#28933)
* fix indentof statements in BlockFunctionBody

* fix indentof statements in BlockFunctionBody in tests
2019-03-07 21:09:28 +01:00
Mouad Debbar
b94bf87c70
Text selection via mouse (#28290) 2019-03-01 13:57:10 -08:00
Alexandre Ardhuin
387f885481
Add missing trailing commas (#28673)
* add trailing commas on list/map/parameters

* add trailing commas on Invocation with nb of arg>1

* add commas for widget containing widgets

* add trailing commas if instantiation contains trailing comma

* revert bad change
2019-03-01 08:17:55 +01:00
xster
b09e64e142
Support iOS devices reporting pressure data of 0 (#28478) 2019-02-26 14:16:25 -08:00
xster
ec00e974d0
Add long-press-move support for text fields 2 (#28242) 2019-02-25 14:34:54 -08:00
Gary Qian
7b5a769b31
Force line height in TextFields with strut (#27612) 2019-02-23 03:35:37 -08:00
Alexandre Ardhuin
5169ab5974
format parameter list (#27261) 2019-02-21 09:27:07 +01:00
jslavitz
2c558fdb21
Adds fix for NAN value and pressure values outside of device reported min and max (#26659)
* Fix for nan pressure values and values outside min and max pressure ranges
2019-02-20 16:15:53 -08:00
xster
39b1ff1aa3
revert 26001 (#28032) 2019-02-20 15:34:44 -08:00
Gary Qian
29618f0b04
Roll engine for flutter/engine#7791 - Add trailing whitespace tracking. 2019-02-15 10:28:21 -08:00
jslavitz
1196dbe94a
Fixes a cursor offset mistake for Material on iOS (#27851)
* Fixes offset and unblocks roll
2019-02-13 12:25:25 -08:00
xster
892c8919c7
Add long-press-drag cursor move support on iOS (#26001) 2019-02-12 15:10:48 -08:00
Hans Muller
944ede85ff
TextField should only set EditableText.cursorOffset for iOS (#27663) 2019-02-08 14:31:35 -08:00
xster
32b9c2f07e
Add more RenderEditable test coverage (#27003) 2019-02-05 00:54:54 -08:00
jslavitz
d2a2a5cfe2
Adds a fade in and out, rounds corners, fixes offset and fixes height of cursor on iOS (#24876)
* Fixes cursor on iOS devices
2019-01-28 19:49:19 -08:00
Justin McCandless
14faa8d935
Fix rounding error in build tests (#26652) 2019-01-16 09:48:04 -08:00
Justin McCandless
105026cd68
Fix descenders cutoff in TextField (#26309)
* Include caret gaps in position calculation to avoid descender cutoff

* Calculate caret offset instead of exposing it

* Test that textfields scroll vertically by full line height

* Only add offset to end of caret to avoid going above 0.0

* Fix and test horizontal vs. vertical scrolling

* CR: docs and top caret offset logic

* Take max instead of assuming caretRect.top is always a full line down

* Always subtract caretOffset from caretTop since caretRect.top can be negative
2019-01-16 08:13:00 -08:00
Justin McCandless
de2470ffa4
InputDecorator Count Widget (#25095)
* Allow a widget to be specified for the textfield count, and allow no count at all

* Test all possible states for counter and counterText

* Docs for counter

* counter is a function that generates a widget

* Tests use counter as function

* Fix analyze error in docs

* InputDecoration has counter widget, TextField has buildCounter function

* InputDecorator tests expect counter to be widget again and include
buildCounter

* counter widget example that might actually fit

* Clarify accessiblity concerns in docs

* Include isFocused param for accessibility

* Fix analyze error

* Improve docs per code review

* Rearrange getEffectiveDecoration a bit for clarity

* Fix analyze error about hashValues params

* Clean up docs and redundant code per code review

* Code review doc improvement

* Automatically wrap buildCounter widget in a Semantics widget for accessibility
2019-01-14 15:22:42 -08:00
jslavitz
4377083810
Selects a word on force tap (#25683)
* adds force press select word functionality
2019-01-14 10:29:51 -08:00
jslavitz
cea4aa9b7b
Teach drag start behaviors to DragGestureRecognizer (#26246)
* the onStart callback will report the location of the pointer where it wins the gesture arena by default instead of the pointer down location. Fixes all tests related to changing this default value.
2019-01-09 10:53:47 -08:00
jslavitz
e4fb4fe279
Revert "Teach drag start behaviors to DragGestureRecognizer (#23424)" (#26209)
This reverts commit 08538f91f0.
2019-01-07 17:59:03 -08:00
jslavitz
08538f91f0
Teach drag start behaviors to DragGestureRecognizer (#23424)
* Adds start behavior option to the drag gesture recognizer and makes it the default option when a drag gesture recognizer is created. Also fixes all the tests to work correctly with the new default behavior.
2019-01-07 15:11:12 -08:00
Hans Muller
dae7e7b9f2
Fix typos introduced with the TextField.onTap PR, udpated debugFillProperties (#26088) 2019-01-04 14:52:36 -08:00
Justin McCandless
9161ec42cb
Include cursor in textfield intrinsic width measurement (#25055)
* Include cursor in textfield intrinsic width measurement

* Add cursorWidth assertion, add comment about assumed cursor width, and test null stepWidth
2018-12-26 08:56:02 -08:00
xster
b3b764c9d3
Revise Android and iOS gestures on Material TextField (#24457) 2018-12-20 16:54:19 -08:00
Justin McCandless
a039b2ca8c
Revert "Revert "obscureText and enableInteractiveSelection defaults"" (#25342)
* Revert "Add imports section to sample code templates, and more docs. (#25184)"

This reverts commit 95b0124785.

* Revert "Use stderr instead of stdout to contain errors in flutter attach test (#25305)"

This reverts commit 2b819dd257.

* Revert "Allow detection of taps on TabBar (#23919)"

This reverts commit 01694ab62d.

* Revert "a549981da Roll src/third_party/skia a69b10312977..5eb29448dfbd (1 commits) (flutter/engine#7211) (#25333)"

This reverts commit a37099f3b1.

* Revert "Revert "obscureText and enableInteractiveSelection defaults (#24527)" (#25335)"

This reverts commit c5457068df.

* Password fields are no longer selectable nor copiable
2018-12-17 11:15:27 -08:00
Justin McCandless
c5457068df
Revert "obscureText and enableInteractiveSelection defaults (#24527)" (#25335)
This reverts commit f8f5953d80.
2018-12-13 11:58:37 -08:00
Justin McCandless
f8f5953d80
obscureText and enableInteractiveSelection defaults (#24527)
* obscureText true defaults to disabling selection

* Tests and comments for selectable text field

* Improve selection docs

* Refactor so that all enableInteractiveSelection params are null by default, delegate to selectionEnabled

* Fix selection param macros
2018-12-13 11:09:13 -08:00
Justin McCandless
952d24bf1e
Text field style merge (#24449)
* Merge TextField style with global style so that style changes don't override unspecified fields

* Test that a style param is merged with the theme

* Test a few more style properties

* Analysis fix
2018-12-13 08:32:55 -08:00
Justin McCandless
9a8e2f0c4b
Validate style in TextField (#24587)
* Validate style in TextField

* Fix analyze problems

* Use assert and move to top

* Simplified assertion
2018-12-12 09:44:43 -08:00
Trevor Wang
114335dff0 Support TextField multi-line hint text #20941 (#24976) 2018-12-11 22:46:05 -08:00
Hans Muller
94dab8fe91
Added TextField.onTap() (#24536) 2018-11-19 18:06:44 -08:00
S McDowall
87156df6d9 Optionally show the text field length but not the max (#24183)
If maxLength is set to TextField.noMaxLength then continue to show the character counter but do not display the max input length value.
2018-11-14 16:04:39 -08:00
Hans Muller
4bb62b4348
Stop TextFields from wobbling within scrollables (#24015) 2018-11-07 14:27:25 -08:00
jslavitz
503ae8cbfd
Adds Text Direction functionality to the TextField (#23609)
* added textDirection to TextField
2018-10-30 11:21:48 -07:00
Gary Qian
6827d0920b
Same cursor offset within lines for all TextAffinities to prevent cursor shifting/moving. (#23485) 2018-10-26 10:21:25 -07:00
Hans Muller
4f4050bf47
Support for disabling interactive TextField caret and selection (#22924)
Make it possible to disable TextField's default handlers for tap and long press. If enableInteractiveSelection is false then taps no longer move the text caret and long-press no longer selects text and shows the cut/copy/paste menu. Accessibility is similarly limited.
2018-10-18 09:14:27 -07:00
Alexandre Ardhuin
0fb84e96c7
Prefer void to null (#22977)
* Future<void> main

* Future<void>.delayed

* prefer_void_to_Null

* address review comments
2018-10-16 22:03:06 +02:00
matthew-carroll
04a26778c5
Revert "Reversion for roll (#22984)" (#23029)
This reverts commit 80f80ab08c.
2018-10-12 16:31:34 -07:00
matthew-carroll
80f80ab08c
Reversion for roll (#22984)
For G3 Roll:

* Revert "MaterialButton must honor its minWidth and height parameters (#22919)"

This reverts commit a02332335a.

* Revert "Update uses of ButtonTheme.bar: pass along the current Theme's colorScheme (#22827)"

This reverts commit 655bf6a290.

* Revert "ButtonTheme.of().colorScheme defers to Theme (#22880)"

This reverts commit a590940e45.

* Revert "Bring TextTheme into alignment with the current Material spec (#22330)"

This reverts commit 8bfb4b3ee5.

* Revert "Added ColorScheme, updated ThemeData, ButtonTheme, material buttons (#22013)"

This reverts commit eea3465ae7.

* Manual adjustments to fix reversion issues.
2018-10-11 18:17:46 -07:00
Hans Muller
8bfb4b3ee5
Bring TextTheme into alignment with the current Material spec (#22330) 2018-10-09 17:00:15 -07:00
Alexandre Ardhuin
f62afdcf57
add missing type parameter on methods (#22096) 2018-10-01 21:29:08 +02:00
Dan Field
ea5435c2ef
Widgets app refactor (#22269)
* Refactor of cupertino/material/widgets app

* update docs 

* Update tests for const
2018-09-25 13:57:12 -04:00
Dan Field
a52bd81560
Revert "Refactor of cupertino/material/widgets app (#22161)" (#22249)
This reverts commit 61cf946ba8.
2018-09-25 00:25:50 -04:00
Dan Field
61cf946ba8
Refactor of cupertino/material/widgets app (#22161)
* Make CupertinoApp and MaterialApp both use WidgetsApp for Navigator

* Make CupertinoApp and MaterialApp const constructors

* Make WidgetsApp routes aware

* Update tests
2018-09-24 23:55:03 -04:00
Jonah Williams
85b4670b2a
Revert "Implement Double Tap Handling in TextField and Editable" (#22051)
* Revert "Revert "Add RichText support to find.text" (#22046)"

This reverts commit 8e70421913.

* Revert "Implement Double Tap Handling in TextField and Editable (#21264)"

This reverts commit 02e87334dd.
2018-09-19 14:59:23 -07:00
Niko Yuwono
02e87334dd Implement Double Tap Handling in TextField and Editable (#21264)
Thanks @NikoYuwono for getting this working! We appreciate your help!

* Implement Double Tap Handling in TextField and Editable

* Fix test broken by the change and add test for double tap

* Fix affected tests

* Remove unnecessary new

* Fix test
2018-09-19 13:35:33 -07:00
Jonah Williams
bf7c27095c
Make helper and error text separate widgets, make error and counter live region (#21752) 2018-09-18 13:39:21 -07:00
Jonah Williams
5ea987db1d
Adjust floating label height when font size is larrrrgeee (#21248) 2018-09-12 14:17:43 -07:00
Alexandre Ardhuin
d927c93310
Unnecessary new (#20138)
* enable lint unnecessary_new

* fix tests

* fix tests

* fix tests
2018-09-12 08:29:29 +02:00
jslavitz
9dce4b8259
Shortcuts (#21558)
* added shortcuts and delete functionality

* added first test

*  afew chnages

* a few changes

* hope this works

* small change

* small changes

* fixed nits

* final changes:

* fixed initializing formals

* update comment

* minor change:

* added line

* final changes

* random change

* changed function to void

* one more

* removed line

* dis betta work

* final change

* actual final chnge
2018-09-10 13:47:04 -07:00
Jonah Williams
11943ce7e7
Revert "Shortcuts (#21083)" (#21556)
This reverts commit 6e7f3e6f5a.
2018-09-07 10:36:52 -07:00
jslavitz
6e7f3e6f5a
Shortcuts (#21083)
* added shortcuts and delete functionality

* added first test

*  afew chnages

* a few changes

* hope this works

* small change

* small changes

* fixed nits

* final changes:

* fixed initializing formals

* update comment

* minor change:

* added line

* final changes
2018-09-07 10:28:35 -07:00
Jonah Williams
3b309bda07
Add a localization for counter text, separate into own semantic node (#21029) 2018-08-28 12:39:24 -07:00
jslavitz
3900d42bfa
Control, Shift and Arrow Key functionality for Chromebook (#20204)
* added keyboard functionatliy to android builds

* Added tests

* almost ready for review

* ready for review

* Fixes

* final comments

* final commit

* removing raw keyboard changes

* removing raw keyboard changes

* removing raw keyboard changes

* actual last commit

* fixed the imports

* a few more changes

* A few more changes

* a few changes

* Final changes

* Final changes2

* final actual commit for real

* final actual commit for real2

* final actual commit for real3

* final actual commit for real4

* final

* final 2

* f

* f2

* fin

* fin 2

* fin3

* fin4
2018-08-23 17:16:44 -07:00
Jonah Williams
e56a73e42c
Add support for by word movement granularities to semantics (#19949) 2018-08-17 12:17:34 -07:00
Alexandre Ardhuin
eda03e2586
re-re-enable lint unnecessary_const (#20103) 2018-08-02 12:02:32 +02:00
Jonah Williams
ffdd6e1bf1
Toggle whether label or hint contribute to text field semantics when unfocused/focused (#19790) 2018-08-01 21:02:40 -07:00
Todd Volkert
00aac68e2d
Revert flutter/flutter#19592 (#19861)
It was causing problems rolling Flutter into Fuchsia
2018-07-27 08:44:39 -07:00
sandrasandeep
834fb7b9a8
Add cursorWidth and cursorRadius to TextField (Material) cursor (#19317)
* fixed segmented control golden test

* fixed segmented control golden test

* made the comments more explanatory

* changed comment, wrapped tests with if statements so they only run on MacOS

* changed formatting

* added width and radius fields to TextField; to do: tests and Material defaults

* weak warnings

* added tests

* added default cursor width; changed default EditableText width

* only run golden file tests on linux

* changed goldens version

* actually changed goldens.version

* style changes

* small fixes

* added default material cursor color

* changed goldens.version

* changed goldens version again

* changed goldens.version again (3)

* added todo

* deleted whitespace
2018-07-23 16:33:39 -07:00
Alexandre Ardhuin
27018359d2
re-enable lint unnecessary_const (#19592)
* re-enable lint unnecessary_const

* remove trailling whitespaces

* remove unnecessary const (after merge)
2018-07-23 08:31:48 +02:00
matthew-carroll
3ca6445c99
Added textInputAction parameter to TextFormField that forwards to TextField, added onEditingComplete parameter to TextField that forwards to EditableText, added onEditingComplete parameter to TextFormField that forwards to TextField. (#19397) (#19427) 2018-07-19 13:22:45 -07:00
Ian Hickson
f630f90d6d
Revert "enable lint unnecessary_const (#19342)" (#19423)
This reverts commit cc1cf13eec.
2018-07-16 13:30:27 -07:00
Alexandre Ardhuin
cc1cf13eec
enable lint unnecessary_const (#19342) 2018-07-16 21:43:48 +02:00
sandrasandeep
581df52a86
Make EditableText cursor configurable (#18888)
* fixed segmented control golden test

* fixed segmented control golden test

* added cursorWidth, cursorRadius

* added default value for cursorWidth based on Apple specs

* test default cursorWidth

* removed cursorHeight stuff

* added functionality to keep cursor from blinking

* cursor width and radius is configurable + tests

* changed goldens repo version in goldens.version

* working version of configurable cursor (erased debugKeepCursorOn)

* minor changes

* docs

* changed textfield test that was failing due to new default cursorwidth

* added default value of cursorwidth in RenderEditable

* only run golden file tests on Mac

* cursor tests

* the tests are actually there now

* weak warning fixed

* switching to Linux

* changed default cursorWidth: 2.0 -> 1.0

* assorted changes, including changing text field test

* re-paint -> re-layout when changing cursorWidth
2018-07-03 14:02:00 -07:00
matthew-carroll
d916806aee
Use RenderAnimatedOpacity within AnimatedOpacity widget (#15466) (#18121)
* Use RenderAnimatedOpacity within AnimatedOpacity widget (#15466)

* Fixed minor bug in RenderAnimatedOpacity

* Updated protected API for ImplicitlyAnimatedWidget
2018-06-21 19:36:14 +00:00
Tran Huy Phuc
34933f801f TextFormField/TextField - remove spaces in character counter (#18096)
* TextFormField/TextField - remove spaces in character counter(follow material design guidelines)
2018-06-04 09:41:31 -07:00
Michael Goderbauer
4c5303a204
Unfocus textfield if it is disabled (#18097) 2018-06-01 09:40:52 -07:00
Michael Goderbauer
1361071a21
Don't crash when TextField w/ explicit controller is activated via a11y (#17892)
Fixes #17801.
2018-05-25 09:56:24 -07:00
Adrian Secord
1680e55c02 Updated links to Material design guidelines to use short links. (#17077) 2018-04-30 20:29:46 -07:00
Yegor
d354096299
a11y traversal: sort locally; use new sorting algorithm (#16253)
New a11y traversal:

- sort direct sibling SemanticsNodes only
- use new sorting algorithm
- implement RTL
- test semantics in traversal order by default
- add AppBar traversal test
- breaking: remove nextNodeId/previousNodeId from the framework
- breaking: remove DebugSemanticsDumpOrder.geometricOrder
2018-04-23 14:23:49 -07:00
Victor Choueiri
68728e9f98 Better error message when TextField is not in a Material (#16147)
Added a call to debugCheckHasMaterial() at the start of TextField's build method.
2018-04-02 11:28:39 -07:00
Yegor
9c49255f3e
a11y: remove SemanticsSortOrder; sort locally only; semanticsOwner post-test check (#15537)
* a11y: remove SemanticsSortOrder; sort locally only; semanticsOwner post-test check

* update accessibility test framework

- default nextNodeId/previousNodeId to -1
- stop treating null as opt-out from value testing
- add `id`, `TestSemantics.root`, and `tags` to the suggested code in the TestSemantics failure message
- fix a small bug with raw string escaping
- update all tests accordingly

* fix sortKey doc

* prefer const over final
2018-03-18 22:18:52 -07:00
Alexandre Ardhuin
7667db6362
apply upcomming prefer_const_declarations (#15498) 2018-03-14 06:24:49 +01:00
Jason Simmons
aa04a056f3
Disable a text field test that fails on some Macs with libtxt (#14895) 2018-02-26 14:45:00 -08:00
Jason Simmons
44592238bb
Roll engine to 33b88173f3820690169348859bbdc29133179e0b (#14832)
libtxt is now the default text renderer
2018-02-26 11:39:48 -08:00
Alexandre Ardhuin
c02b6a8bcf
some whitespace cleanup (#14443) 2018-02-02 23:27:29 +01:00
Alexandre Ardhuin
841d5d7bd5
prefer_const_declarations on local variables (#14358) 2018-02-01 07:51:26 +01:00
Michael Goderbauer
3fd737c8f7
a11y on Android: copy/cut/paste (#14343)
With a little refactor and unification of how availability of copy/cut/paste is determined across platforms.

Minor remaining issue: https://github.com/flutter/flutter/issues/14331.

Fixes https://github.com/flutter/flutter/issues/13501.
2018-01-31 12:26:24 -08:00
Michael Goderbauer
671c1101a4
Change text selection (or cursor position) via a11y (#14275)
Roll engine to 7c34dfafc9acece1a9438f206bfbb0a9bedba3bf
2018-01-26 10:44:41 -08:00
Michael Goderbauer
34ff00a752
Add a11y support for selected text (#14254)
Framework side for https://github.com/flutter/engine/pull/4584 & https://github.com/flutter/engine/pull/4587.

Also rolls engine to 4c82c566edf394a5cfc237a266aea5bd37a6c172.
2018-01-25 10:12:02 -08:00
Michael Goderbauer
8059aea365
TextFields should only have one SemanticsNode (#14219)
* scrolling node eleminated

* remove second node

* fix ids
2018-01-22 18:12:39 -08:00
Ian Hickson
bed71b9a15
Make FadeTransition more efficient (#14155)
* Make FadeTransition more efficient

* Update fade_transition_test.dart

* Update proxy_box.dart
2018-01-18 20:22:22 -08:00
Michael Goderbauer
24e3f70536
Rename SemanticsFlags to SemanticsFlag (#13994)
to align with `SemanticsAction` and other enum-like types.
2018-01-09 10:31:23 -08:00
Hans Muller
d188a8ff6b
Update InputDecorator et al (#13734) 2018-01-08 10:36:52 -08:00
Hans Muller
53a2ec1bc9
Add support for baseline alignment to TextField (RenderEditable) (#13006) 2017-11-14 10:43:22 -08:00
Jason Simmons
b865b0eb2f
Use TextPainter.preferredLineHeight to estimate line height for Cupertino selection handles (#12833)
Fixes https://github.com/flutter/flutter/issues/12046
2017-11-03 09:47:46 -07:00
Greg Spencer
79862a7262
Fixing assumption that baseStyle is a complete style. (#12836)
This fixes the assumption that InputDecorator had where it expected baseStyle to be a complete style. Now it merges the baseStyle with the subhead style instead of substituting it entirely.

This fixes #12832.
2017-11-02 16:42:02 -07:00
Michael Goderbauer
1d4607ff04
Identify text fields as such to a11y (#12804)
* Identify text fields as such to a11y

* focus

* make travis happy

* review comments
2017-11-02 10:08:56 -07:00
Greg Spencer
ea679171e5 Add Material character counter to TextField. (#12648)
This adds an optional character counter and maxLength parameter to the TextField, as described in the Material Design Spec.

The counter text and style in the input decorator may be specified, but will default to the "right thing" if not specified, where the "right thing" is a counter that looks like "3 / 10" (if there are three characters entered into a field where maxLength is set to 10).

To limit the number of characters entered, I created a LengthLimitingTextFormatter that will limit the number of characters (Unicode runes) in the input, which can be used independently. The formatter is applied after the other formatters supplied (if any). Even if there is no decorator, the text field will limit the number of characters input if maxLength is set.

If maxLengthEnforced is set to false (it defaults to true), then the max length will not be enforced. In that case, if the text exceeds the length, then the counter will turn red, and it will make the divider turn red.
2017-10-24 14:49:39 -07:00
Yegor
67d16cd517 Theme.of provides all TextStyle properties (#12552)
* Theme provides all TextStyle properties

* match field declaration order in the test

* Theme.of returns text style with inherit == false

* change TextStyle.inherit logic; docs

* add TextStyle.debugLabel

* address comments

* add debug labels to Typography text styles
2017-10-20 20:17:07 -07:00
Hans Muller
796c5439f6 Language-specific LocalizationDelegates (#12645) 2017-10-20 10:45:28 -07:00
Ian Hickson
953dabc70b Fix some typos (#12233) 2017-09-24 01:40:42 -07:00
Yegor
b9e1be9ace introduce localized text geometry in MaterialLocalizations (#11829)
* introduce localized text geometry in MaterialLocalizations

* remove geometry from color text themes

* fix merge conflict

* optional Localizations

* fix fallback; test; docs
2017-09-22 13:15:01 -07:00
Chris Bracken
1a62c28b6f Correct handling for nulling TextField controller (#12190)
Correctly handle the case where the TextEditingController associated
with a TextField is set to null. Due to a typo (= vs ==), previously
this was a no-op and the existing TextEditingController was retained,
rather than copied.
2017-09-20 15:38:14 -07:00
Hans Muller
60c4ff9360 More localizations for Material (#11989) 2017-09-07 16:58:12 -07:00
Ian Hickson
ca7d2d23cf TextPainter RTL (#11888) 2017-09-07 16:57:38 -07:00
Jason Simmons
d3415137af Temporarily show the latest entered character in an obscured text field (#11830)
Fixes https://github.com/flutter/flutter/issues/11817
2017-08-29 17:31:53 -07:00
Ian Hickson
f235a2c104 RTL: Padding, Flex (#11709)
* Introduce a Directionality inherited widget which sets the ambient LTR vs RTL mode (defaulting to null, which means you cannot use directionality-influenced values).

* Make it possible to configure Padding (including Container.padding and Container.margin) using a directionality-agnostic EdgeInsets variant.

* Provide textDirection and verticalDirection controls on Row and Column to make them RTL-aware.

* Introduce a variant of FractionalOffset based on the EdgeInsets variant. Not yet actually used.

* Fix all the tests that depended on Row defaulting to LTR.
2017-08-28 12:50:24 -07:00
Jason Simmons
eb668c3f64 Keep text selection ranges within the length of the text (#11055)
Fixes https://github.com/flutter/flutter/issues/11041
2017-06-30 14:50:11 -07:00
Michael Goderbauer
fe40eed362 Provide haptic/acoustic feedback for tap & long-press on Android (#10920)
* Provide haptic/acoustic feedback for tap & long-press on Android

* review comments

* fixed example code

* review comments

* comment fix
2017-06-23 15:02:55 -07:00
Jason Simmons
856115b7e2 Clear the selection when a text widget loses focus (#10938)
Fixes https://github.com/flutter/flutter/issues/10911
2017-06-23 14:22:13 -07:00
Ian Hickson
6d32b33997 Text selection handles track scrolled text fields (#10805)
Introduce CompositedTransformTarget and CompositedTransformFollower
widgets, corresponding render objects, and corresponding layers.

Adjust the way text fields work to use this.

Various changes I needed to debug the issues that came up.
2017-06-20 09:35:15 -07:00
Hans Muller
40db1e4bc6 Added InputDecoration helperText, helperStyle (#10852) 2017-06-20 09:33:26 -07:00
Jason Simmons
f8c4a6e0d6 Defer the animation of text fields to the caret position (#10782)
Fixes https://github.com/flutter/flutter/issues/10681
2017-06-19 11:38:42 -07:00
gspencergoog
9f344b695d Adds prefix and suffix support to TextField, per Material Design spec. (#10675)
* Prefix and Suffix support for TextFields

* Adding Tests

* Removing spurious newline.

* Fixing a small problem with the test

* Review Changes
2017-06-13 19:17:04 -07:00
Ian Hickson
d74a5883d9 Allow multi-line text fields with no line limit (#10576) 2017-06-12 21:47:31 -07:00
Jason Simmons
2ab60e93ef Scroll text fields when the caret moves outside the viewport (#10323)
Fixes https://github.com/flutter/flutter/issues/9923
2017-05-31 10:33:23 -07:00
xster
f65fea8e2e Create a text validator/formatter mechanism (#9535)
* Add a text formatter interface used by EditingText. Provide some default implementations.

* self nits

* Handle -1 selection offsets

* review notes

* simplify regular expression

* Add whitelisting formatters. Use a custom phone number formatter in text demo.

* review notes

* not being able to addAll(null) is pretty annoying

* review notes

* partial tests

* Add tests

* didn’t end up needing mockito

* move to services
2017-04-28 15:33:38 -07:00
Ian Hickson
11fa80bb78 MediaQuery.of shouldn't give a default return value (#9596) 2017-04-27 15:02:59 -07:00
Alexandre Ardhuin
83fce211a3 More const immutable classes (#9544)
* more widget const constructors

* prefer const constructors

* address review comments
2017-04-23 22:37:29 +02:00
xster
76ecb0b9a1 Remove InputField (#9520) 2017-04-21 14:12:14 -07:00
Alexandre Ardhuin
9541848272 make @immutable const classes (#9532)
* make @immutable const

* fix build
2017-04-21 23:09:42 +02:00
Alexandre Ardhuin
c794221f96 enable lint prefer_adjacent_string_concatenation (#9493) 2017-04-21 08:52:07 +02:00
Hans Muller
80a8c5629e WidgetTester enterText() and showKeyboard() can specify an EditableText ancestor (#9398) 2017-04-14 15:41:30 -07:00
Chris Bracken
81fa81cd32 Add TextEditingValue update test coverage (#9381)
Tests that updates to selection base/offset editing state is updated on
controller updates.

Tests TextEditingValue.clear() clears text.
2017-04-13 12:13:30 -07:00
Ian Hickson
bf017b79b3 Move Point to Offset (#9277)
* Manually fix every use of Point.x and Point.y

Some of these were moved to dx/dy, but not all.

* Manually convert uses of the old gradient API

* Remove old reference to Point.

* Mechanical changes

I applied the following at the root of the Flutter repository:

git ls-files -z | xargs -0 sed -i 's/\bPoint[.]origin\b/Offset.zero/g'
git ls-files -z | xargs -0 sed -i 's/\bPoint[.]lerp\b/Offset.lerp/g'
git ls-files -z | xargs -0 sed -i 's/\bnew Point\b/new Offset/g'
git ls-files -z | xargs -0 sed -i 's/\bconst Point\b/const Offset/g'
git ls-files -z | xargs -0 sed -i 's/\bstatic Point /static Offset /g'
git ls-files -z | xargs -0 sed -i 's/\bfinal Point /final Offset /g'
git ls-files -z | xargs -0 sed -i 's/^\( *\)Point /\1Offset /g'
git ls-files -z | xargs -0 sed -i 's/ui[.]Point\b/ui.Offset/g'
git ls-files -z | xargs -0 sed -i 's/(Point\b/(Offset/g'
git ls-files -z | xargs -0 sed -i 's/\([[{,]\) Point\b/\1 Offset/g'
git ls-files -z | xargs -0 sed -i 's/@required Point\b/@required Offset/g'
git ls-files -z | xargs -0 sed -i 's/<Point>/<Offset>/g'
git ls-files -z | xargs -0 sed -i 's/[.]toOffset()//g'
git ls-files -z | xargs -0 sed -i 's/[.]toPoint()//g'
git ls-files -z | xargs -0 sed -i 's/\bshow Point, /show /g'
git ls-files -z | xargs -0 sed -i 's/\bshow Point;/show Offset;/g'

* Mechanical changes - dartdocs

I applied the following at the root of the Flutter repository:

git ls-files -z | xargs -0 sed -i 's/\ba \[Point\]/an [Offset]/g'
git ls-files -z | xargs -0 sed -i 's/\[Point\]/[Offset]/g'

* Further improvements and a test

* Fix minor errors from rebasing...

* Roll engine
2017-04-12 15:06:12 -07:00
Ian Hickson
2a54524337 Fix tests to use Ahem, and helpful changes around that (#9332)
* Fix tests to use Ahem, and helpful changes around that

- Fix fonts that had metric-specific behaviours.

- LiveTestWidgetsFlutterBinding.allowAllFrames has been renamed
  to LiveTestWidgetsFlutterBinding.framePolicy.

- LiveTestWidgetsFlutterBinding now defaults to using a frame policy
  that pumps slightly more frames, to animate the pointer crosshairs.

- Added "flutter run --use-test-fonts" to enable Ahem on devices.

- Changed how idle() works to be more effective in live mode.

- Display the test name in live mode (unless ahem fonts are enabled).

- Added a toString to TextSelectionPoint.

- Style nit fixes.

* Roll engine to get Ahem changes.

* Update tests for dartdoc changes.

* Fix flutter_tools tests
2017-04-12 13:33:02 -07:00
Ian Hickson
3eb87830e9 Constants! Constants everywhere! (#9286)
Aggressively apply the const lint.
2017-04-07 12:24:32 -07:00
Chris Bracken
ecc590f958 Eliminate WidgetTester.idle() after enterText() (#9290)
enterText() now includes a call to idle().
2017-04-07 11:42:22 -07:00
Chris Bracken
a7a95daa52 Update TextEditingValue.selection on selection change (#9284)
Fixes a bug where tapping in the text under edit moved the cursor but
did not push the updated selection to the engine.

Adds a test for caret position updates.
2017-04-07 11:13:10 -07:00
Adam Barth
470db7d96e TextField should update IME when controller changes (#9261)
Fixes #9246
2017-04-06 12:28:30 -07:00
Adam Barth
20015400f9 TextField centering should work in loose constraints (#9153)
We should always use the maxWidth from the incomming constraints to size the
text inside the editable because the EditableText itself always expands to fill
its width.

Also, make sure InputDecoration always expands horizontially (even when there's
no icon) for consistency.

Fixes #9149
2017-04-03 20:48:54 -07:00
Adam Barth
0b31c69963 Make it possible to center the text in a TextField (#9140)
Also, fix an issue where hint text wasn't visible when the
InputDecoration was collapsed.

Fixes #8541
2017-04-01 23:11:18 -07:00
Adam Barth
ae8994860e Rationalize text input widgets (#9119)
After this patch, there are three major text input widgets:

 * EditableText. This widget is a low-level editing control that
   interacts with the IME and displays a blinking cursor.

 * TextField. This widget is a Material Design text field, with all the
   bells and whistles. It is highly configurable and can be reduced down
   to a fairly simple control by setting its `decoration` property to
   null.

 * TextFormField. This widget is a FormField that wraps a TextField.

This patch also replaces the InputValue data model for these widgets
with a Listenable TextEditingController, which is much more flexible.

Fixes #7031
2017-04-01 17:30:21 -07:00