Commit Graph

125 Commits

Author SHA1 Message Date
Tong Mu
60f1aa25d3
Add mouse cursor API to widgets (phase 1) (#57628)
* Adds default cursor and/or mouseCursor property to a number of widgets.
* Adds `MaterialStateMouseCurrsor`.
2020-05-28 13:16:31 -07:00
Jose Alba
bd06749edc
Slider value indicator gets disposed if it is activated (#57535) 2020-05-27 15:27:01 -07:00
Jose Alba
0423809c2f
Value Indicator uses Global position (#57327)
* Value Indicator uses Global position when calculating horizontal position

* fixed test

* fixed analyzer

* Made globalCenter variable and added comments
2020-05-18 13:22:31 -04:00
Jose Alba
0549ab2390
Removed useV2 Slider flag (#55857) 2020-04-30 15:19:01 -07:00
Jose Alba
7eb3df4a11
Default to use V2 Slider (#55599)
* Instead of changing test I just flipped flag so the test uses the proper slider

* Use Depracated annotation

* Updated depracation notice

* Updated depracation notice again

* Ignore analyze issues

* flutter analyze .

* ignore analyzer

* // ignore: deprecated_member_use

* Ignoring notice

* indentation
2020-04-27 17:57:42 -04:00
Kate Lovett
5d5175b0b3
Skip Audit - Material Library (#54322) 2020-04-21 19:13:02 -07:00
Anthony
b00b4e8342
[Material] Add focus, highlight, and keyboard shortcuts to Slider (#53945) 2020-04-16 08:50:01 -07:00
Jose Alba
3441d6cbe7
Slider rebase work (#53916)
* [Slider] Rebase.

* disabled thumb color with alphaBlend of colorScheme surface

* test remove alphablend

* Change rectangular track to how it used to be

* Chaned to adaptive slider

* blank lines

Co-authored-by: Will Larche <larche@google.com>
2020-04-07 17:10:18 -04:00
Jose Alba
d14a301e41
Revert "[Slider] Rebase. (#52663)" (#53698)
This reverts commit e71cf1cdbe.
2020-03-31 16:14:22 -07:00
Jose Alba
e71cf1cdbe
[Slider] Rebase. (#52663) 2020-03-31 10:56:01 -07:00
Greg Spencer
1ba4f1f509
Add Linux and Windows target platforms (#51519)
This PR adds the linux and windows target platform enum values, along with automatically setting the defaultTargetPlatform to the appropriate value on those platforms.

Fixes #31366
2020-03-03 04:38:04 -08:00
Dan Field
8b2993337a
revert #48985 (#49572) 2020-01-27 14:36:02 -08:00
Anthony
b67d5ec6e9 [a11y] Make sure RenderFractionalTranslation updates its semantics after the translation field is set (#48985) 2020-01-17 15:13:01 -08:00
Greg Spencer
3dbe90e1fd
Add TargetPlatform.macOS tests to the material library (#48996)
This contains the test changes for adding TargetPlatform.macOS, which was done in #43457.

The main goal of this PR is to enable tests in the material library that are currently running only on iOS to also run on macOS, but only for the tests where that makes sense. For instance, we don't run any of the haptic feedback tests on macOS.
2020-01-17 10:51:11 -08:00
Ian Hickson
449f4a6673
License update (#45373)
* Update project.pbxproj files to say Flutter rather than Chromium

Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright.

* Update the copyright notice checker to require a standard notice on all files

* Update copyrights on Dart files. (This was a mechanical commit.)

* Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine.

Some were already marked "The Flutter Authors", not clear why. Their
dates have been normalized. Some were missing the blank line after the
license. Some were randomly different in trivial ways for no apparent
reason (e.g. missing the trailing period).

* Clean up the copyrights in non-Dart files. (Manual edits.)

Also, make sure templates don't have copyrights.

* Fix some more ORGANIZATIONNAMEs
2019-11-27 15:04:02 -08:00
Todd Volkert
ce8e2bb7cf
Revert "[Material] Update the Slider and RangeSlider to the latest Material spec (#44351)" (#45268)
This reverts commit 421bf64703.

Was causing severe breakages in Google.
2019-11-20 10:42:23 -08:00
Anthony
421bf64703
[Material] Update the Slider and RangeSlider to the latest Material spec (#44351)
Update the Slider and RangeSlider to the latest Material spec. This introduces an updated track, updated thumbs, updated tick marks, and a new value indicator shape. The old paddle value indicator shape is also updated so that text scaling works consistently.
2019-11-20 18:18:40 +01:00
Alexandre Ardhuin
890b939401
indent formal parameters correctly (#41644) 2019-10-04 11:00:18 +02:00
Alexandre Ardhuin
b873162194
fix some bad indentations (#41172) 2019-09-24 21:03:37 +02:00
Alexandre Ardhuin
e9965f5636
add missing trailing commas in packages/flutter (#41076) 2019-09-24 08:05:41 +02:00
Slade Capasso
4c254e5e8a Updates to debugFillProperties to test all properties in slider.dart and slider_test.dart (#39632) 2019-09-09 18:31:40 -07:00
brettfingo
38fdf56c16 Fix slider preferred height (#36028)
[Material] Fix slider preferred height
2019-07-26 13:42:15 -04:00
Dan Field
3eb40925e5
Always test semantics (#35110)
Default `semanticsEnabled` to true for `testWidgets` and fix associated bugs
2019-06-28 12:40:23 -07:00
Jonah Williams
3ae6abd9e8
Compatibility pass on flutter/material tests for JavaScript compilation. (9) (#33378) 2019-06-12 17:06:01 -07:00
Anthony
0572f158fb
[Material] Adaptive Slider constructor (#30572)
Adds an adaptive constructor for the Material Slider. An adaptive widget is one that renders itself as Material on Android, and Cupertino on iOS. This work is based off of a similar feature on Switches: bbb080b#diff-fe2bb980c6207699cbf45538fe927afa.

The motivation for this change is that we should provide adaptive constructors for as many widgets as necessary in the Material library. In Material, it is suggested that the slider is an iOS-style slider.
2019-04-24 16:26:22 -04:00
Anthony
96f15c74ad
[Material] Update slider and slider theme with new sizes, shapes, and color mappings (2nd attempt) (#31564)
#30390 was rolled back. This PR will re-roll it forward.

This PR makes a number of changes to the visual appearance of material sliders:

Sizes/Shapes
** enabled thumb radius from 6 to 10
** disabled thumb radius from 4 to 10 with no gap
** default track shape is a rounded rect rather than a rect
**
Colors
** all of the colors now use the new color scheme
** overlay opacity has been reduce from 16% to 12%
** value indicator text color now respects the indicator it is on by using onPrimary
** disabledThumb color no respects the surface it is on by using onSurface
The slider theme is also now constructed consistently with other theme objects within the ThemeData. By default, all values are null, and have default values that are resolved in the slider itself, rather than in the slider theme.
2019-04-24 14:23:44 -04:00
MH Johnson
0545c63b9b
Revert "[Material] Update slider and slider theme with new sizes, shapes, and color mappings (#30390)" (#31339)
This reverts commit b1039f0f1b.

(This is a temporary revert while some of our customers deal with the breaking changes involved.)
2019-04-19 20:41:32 -04:00
Anthony
b1039f0f1b
[Material] Update slider and slider theme with new sizes, shapes, and color mappings (#30390)
This PR makes a number of changes to the visual appearance of material sliders:

Sizes/Shapes
** enabled thumb radius from 6 to 10
** disabled thumb radius from 4 to 10 with no gap
** default track shape is a rounded rect rather than a rect
**
Colors
** all of the colors now use the new color scheme
** overlay opacity has been reduce from 16% to 12%
** value indicator text color now respects the indicator it is on by using onPrimary
** disabledThumb color no respects the surface it is on by using onSurface
The slider theme is also now constructed consistently with other theme objects within the ThemeData. By default, all values are null, and have default values that are resolved in the slider itself, rather than in the slider theme.
2019-04-18 17:02:17 -04:00
Alexandre Ardhuin
a0d1f93b07
fix block formatting (#29051) 2019-03-09 09:03:11 +01: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
Alexandre Ardhuin
4c1f4d14e1
fix some formatting issues (#28809)
* fix some formatting issues

* address review comments

* fix indent
2019-03-06 09:37:32 +01:00
Anthony
70c8b63e15
[Material] Unit test for skipping Slider tick mark due to overdensity (#28013)
Added a unit test to check that the tick marks are skipped over when the divisions are set to a number that makes them less than 6dp away from each other.
2019-02-26 17:39:48 -05:00
Alexandre Ardhuin
5169ab5974
format parameter list (#27261) 2019-02-21 09:27:07 +01:00
Anthony
cfe992d087
[Material] Custom track, tick mark, and overlay shape painters for Slider (#25008)
Create a slider shape for custom track, tick mark, and overlay painting, for the material slider.
2019-01-31 16:40:22 -08: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
Alexandre Ardhuin
d927c93310
Unnecessary new (#20138)
* enable lint unnecessary_new

* fix tests

* fix tests

* fix tests
2018-09-12 08:29:29 +02:00
Alexandre Ardhuin
eda03e2586
re-re-enable lint unnecessary_const (#20103) 2018-08-02 12:02:32 +02: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
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
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
Jonah Williams
0891a1136b
update a11y for material slider (#18005) 2018-06-07 15:41:35 -07:00
Alexandre Ardhuin
09276bea25
enable lint prefer_equal_for_default_values (#18156) 2018-06-05 08:50:40 +02:00
Greg Spencer
c2c64a5a4c
Add onChangeStart and onChangeEnd to slider. (#17298)
This fixes #17169 by adding onChangeStart and onChangeEnd to the slider. These will be called when the user starts a change, and when they end a change, regardless of whether that change is a tap or a drag.

These differ from onChanged, in that they only report when the user starts and ends an interaction, not at every slight change.
2018-05-10 17:29:43 -07:00
Greg Spencer
7a78741920
Revert "Changing the slider thumb size." (#16541)
This reverts commit 6494ab23f6.
2018-04-12 16:11:43 -07:00
Greg Spencer
5129d8ffa6
Rename Rail to Track, per UX guideline (#16519) 2018-04-12 12:32:30 -07:00
Greg Spencer
c31706f996
Changing the slider thumb size. (#16515)
The spec changed the size of the slider thumb, so this just effects that change.
2018-04-12 10:22:41 -07:00
Greg Spencer
2171fcb882
Address post-submit comments for sliders (#15836)
* Address post-submit comments

* Added dispose protection for the animation controllers.
2018-03-25 00:04:24 -07:00
Greg Spencer
10fe2056f3
Add a slider demo, and a text theme for SliderThemeData (#15620)
This adds a slider demo with a custom theme to the gallery.

In the process of adding this, I decided to add a text theme to the SliderThemeData, since it's a pain to change the text style on the value indicator otherwise.
2018-03-19 14:50:29 -07:00
Greg Spencer
d28e9aa5c9
Add slider minimum interaction time (#15358)
This change makes the discrete slider show the value indicator for a minimum amount of time for any interaction (tap, drag).
2018-03-13 09:41:49 -07:00
Jason Simmons
466d15433f
Use Dart 2 camel case constants (#15360) 2018-03-12 11:06:32 -07:00
Greg Spencer
7fab7f6d02
Adding edge avoidance, painting tests, general cleanup (#15078)
Fixed the real repaint problem the Slider had (missing addListener), and added tests for it.

Added GlobalKey reparenting test.

Added the ability for the value indicator to slide left and right to avoid falling off the edge of the screen.
It only shifts as much as it can without deforming, but even at large text scales, that is enough to keep the text on the screen.

Updated the formatting on theme_data.dart and others to use longer line length.

Also, removed a color tween that faded the value indicator in as it scaled, since that wasn't to spec.
2018-03-09 14:04:58 -08:00
Greg Spencer
701eff4ac5
Slider Visual Update (#14901)
This implements an update to the look of the Slider widget.

Specifically, it does the following:

* Adds the ability to customize the colors of all components of the slider
* Adds the ability to customize the shape of the slider thumb and value indicator
* Adds the ability to show the value indicator on continuous sliders
* Updates the default value indicator to be a "paddle" shape with new animations.
* Changes the tick marks to be visible all the time on discrete sliders
* Fixes a memory leak of an animation controller.
* Removes "thumbOpenAtMin" flag, which is no longer needed, and can be emulated by the
custom thumb shape support. It was not widely used.
* Adds tests for all of the new features.
2018-03-01 13:03:20 -08:00
Alexandre Ardhuin
841d5d7bd5
prefer_const_declarations on local variables (#14358) 2018-02-01 07:51:26 +01:00
gspencergoog
ba0618d35d Make material slider respect textScaleFactor (#12511)
Make material slider respect textScaleFactor

Fixes #5938
2017-10-12 16:43:28 -07:00
Alexandre Ardhuin
bb4f4070f9 Prefer const constructors (#11853)
* upgrade to linter-0.1.35

* re-enable lint prefer_const_constructors

* address review comments
2017-08-31 08:55:21 +02:00
Adam Barth
7b549def56 Add RTL support to Slider and CupertinoSlider (#11822)
Fixes #11358
2017-08-29 20:34:17 -07:00
Michael Goderbauer
c9cefbf0be Properly update semantics when Material/Cupertino Sliders are disabled (#11776)
* Properly update semantics when Material/Cupertino Slider are disabled

* whitespace fix

* fix style
2017-08-24 12:54:34 -07:00
Mary
bb15e346bb Add slider customizations (#11185)
* adds inactiveColor and showThumb to Slider

* add customizable color and showThumb tests

* remove showThumb, add negative tests
2017-07-20 11:15:22 -07:00
Ian Hickson
61c56ba15f Make Slider take up whatever space it has. (#10132)
Previously it was (arbitrarily?) set to 144.0 pixels wide.
2017-05-17 14:31:55 -07:00
Ian Hickson
940473e5d6 Don't crash if Slider is given an empty range. (#10133)
Instead just disable the slider.

Fixes https://github.com/flutter/flutter/issues/10055
2017-05-16 19:35:01 -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
8eac6cd0da Test API improvements: pumpAndSettle, autogenerate pointer IDs (#8751) 2017-03-13 16:27:15 -07:00
Chris Bracken
46291903e0 Declare locals final where not reassigned (tests) (#8566) 2017-03-03 17:43:22 -08:00
Alexandre Ardhuin
d1d1c50cbe prefer const constructors (#8024) 2017-02-09 00:57:38 -08:00
Ian Hickson
332a23030b Rename and refactor ScrollView hierarchy (#7865)
This prepares us for a CustomScrollView that takes slivers.
2017-02-03 16:05:43 -08:00
Adam Barth
5ecf8786b4 Add ScrollView.padding (#7690)
Uses SliverPadding to implementing paddding in ScrollView. Also, deploy
ScrollView in more places now that it implements padding.

Finally, remove loader_app.dart because it is not referenced.
2017-01-26 23:14:37 -08:00
Ian Hickson
c5fcaf6dea Introduce a paints matcher, and convert the previous customers of (#7567)
MockCanvas to use it instead.

Currently it only supports a very limited set of drawing features, but
adding new ones is easy.

Once the feature set is more complete, and we've used this a bunch, if
it feels right, this API will get promoted to flutter_test.
2017-01-20 15:28:00 -08:00
Adam Barth
0139c69c84 Add GestureArenaTeam (#7481)
Previously, the Slider used a drag gesture recognizer to move the head
of the slider, but when the slider was in a vertical scroller, the
recognizer would wait until the user moved the pointer by enough pixels
to disambiguate between sliding the slider and scrolling the scroller.

That worked fine for actual drags, but the slider should also move when
the user taps the track. This patch introduces a tap recognizer to
handle that behavior.

To avoid the slider's drag and tap recognizers from competing with each
other in the arena, this patch introduces the notion of a
GestureArenaTeam, which lets several recognizers combine to form one
entry in the arena.  If that entry wins, the team picks the first of its
recognizers as the winner, avoiding latency.

Fixes #7454
2017-01-13 14:44:59 -08:00
Adam Barth
0c6dc598f7 Slider shouldn't be open at min (#7342)
This patch changes the default appearance of Slider to not have the
thumb be an open circle at its minimum position. The `thumbOpenAtMin`
property can enable drawing an open thumb at the min position, which was
the previous behavior.

Fixes #6941
2017-01-05 11:29:55 -08:00
Ian Hickson
3252701753 Make it possible to run tests live on a device (#3936)
This makes it possible to substitute 'flutter run' for 'flutter test'
and actually watch a test run on a device.

For any test that depends on flutter_test:

1. Remove any import of 'package:test/test.dart'.

2. Replace `testWidgets('...', (WidgetTester tester) {`
      with `testWidgets('...', (WidgetTester tester) async {`

3. Add an "await" in front of calls to any of the following:
    * tap()
    * tapAt()
    * fling()
    * flingFrom()
    * scroll()
    * scrollAt()
    * pump()
    * pumpWidget()

4. Replace any calls to `tester.flushMicrotasks()` with calls to
   `await tester.idle()`.

There's a guarding API that you can use, if you have particularly
complicated tests, to get better error messages. Search for
TestAsyncUtils.
2016-05-16 12:53:13 -07:00
Ian Hickson
91dd969966 Refactor the test framework (#3622)
* Refactor widget test framework

Instead of:

```dart
  test("Card Collection smoke test", () {
    testWidgets((WidgetTester tester) {
```

...you now say:

```dart
  testWidgets("Card Collection smoke test", (WidgetTester tester) {
```

Instead of:

```dart
  expect(tester, hasWidget(find.text('hello')));
```

...you now say:

```dart
  expect(find.text('hello'), findsOneWidget);
```

Instead of the previous API (exists, widgets, widget, stateOf,
elementOf, etc), you now have the following comprehensive API. All these
are functions that take a Finder, except the all* properties.

* `any()` - true if anything matches, c.f. `Iterable.any`
* `allWidgets` - all the widgets in the tree
* `widget()` - the one and only widget that matches the finder
* `firstWidget()` - the first widget that matches the finder
* `allElements` - all the elements in the tree
* `element()` - the one and only element that matches the finder
* `firstElement()` - the first element that matches the finder
* `allStates` - all the `State`s in the tree
* `state()` - the one and only state that matches the finder
* `firstState()` - the first state that matches the finder
* `allRenderObjects` - all the render objects in the tree
* `renderObject()` - the one and only render object that matches the finder
* `firstRenderObject()` - the first render object that matches the finder

There's also `layers' which returns the list of current layers.

`tap`, `fling`, getCenter, getSize, etc, take Finders, like the APIs
above, and expect there to only be one matching widget.

The finders are:

 * `find.text(String text)`
 * `find.widgetWithText(Type widgetType, String text)`
 * `find.byKey(Key key)`
 * `find.byType(Type type)`
 * `find.byElementType(Type type)`
 * `find.byConfig(Widget config)`
 * `find.byWidgetPredicate(WidgetPredicate predicate)`
 * `find.byElementPredicate(ElementPredicate predicate)`

The matchers (for `expect`) are:

 * `findsNothing`
 * `findsWidgets`
 * `findsOneWidget`
 * `findsNWidgets(n)`
 * `isOnStage`
 * `isOffStage`
 * `isInCard`
 * `isNotInCard`

Benchmarks now use benchmarkWidgets instead of testWidgets.

Also, for those of you using mockers, `serviceMocker` now automatically
handles the binding initialization.

This patch also:

* changes how tests are run so that we can more easily swap the logic
  out for a "real" mode instead of FakeAsync.

* introduces CachingIterable.

* changes how flutter_driver interacts with the widget tree to use the
  aforementioned new API rather than ElementTreeTester, which is gone.

* removes ElementTreeTester.

* changes the semantics of a test for scrollables because we couldn't
  convince ourselves that the old semantics made sense; it only worked
  before because flushing the microtasks after every event was broken.

* fixes the flushing of microtasks after every event.

* Reindent the tests

* Fix review comments
2016-04-29 13:23:27 -07:00
Ian Hickson
e968d91ca4 Rename binding abstract classes (#3482)
The old names were getting silly and started stepping on valuable namespace.

The new names are consistent and clear.
2016-04-21 17:18:46 -07:00
Yegor
f3a4f722c4 [flutter_test] new WidgetTester API based on finder objects (#3288) 2016-04-13 23:40:15 -07:00
Adam Barth
767ce82646 Add support for discrete material sliders
Fixes #1541
2016-04-04 11:14:12 -07:00