60 Commits

Author SHA1 Message Date
Adam Barth
a60fefc131 Improve test coverage (#5473)
These tests should hit some previously untested lines.
2016-08-17 18:18:07 -07:00
Adam Barth
839def55ba Teach the system to shutdown semantics (#4811)
We now stop updating semantics when there are no remaining clients.
2016-07-01 17:57:10 -07:00
Adam Barth
5ed8f1a1fd Add semantics for Sliders (#4808)
Also, make SemanticsOwner into a real class and use it instead of a static in
several places.
2016-07-01 13:38:24 -07:00
Adam Barth
14f42a6a48 Improve test coverage in rendering.dart (#4775) 2016-06-27 17:38:53 -07:00
Ian Hickson
007d0a2f39 Cache intrinsic dimensions (#4446)
Also, make sure that the parent is notified when they change.

Fixes #2298
2016-06-07 22:07:12 -07:00
Ian Hickson
5245d3889d Clean up the way RenderIntrinsicWidth works (#4340)
The old code had gotten crufty with all the refactors. This simplifies
it down to what it really means.

Also, add a bunch of tests.
2016-06-02 19:09:29 -07:00
Ian Hickson
d8283d1c62 RenderPadding's intrinsic should clamp child dims (#4329)
We used to rely on BoxConstraints.deflate's clamping, but now we have to
roll our own.
2016-06-02 17:29:28 -07:00
Ian Hickson
787fb3be7d Simplify intrinsic dimension APIs (#4283) 2016-05-31 14:59:48 -07:00
Adam Barth
76772608e2 Remove OverlayPainter mechanism (#4264)
We used to use this mechanism to paint scrollbars, but it's awkward. The
new approach to scrollbars is much cleaner. This mechanism has no other
clients, so we should remove it.
2016-05-29 16:37:29 -07: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
Adam Barth
6072552868 AspectRatio has incorrect intrinsic sizing (#3666)
If there's a max height or width, we should factor that into the intrinsic
sizing for the other dimension.
2016-05-02 15:51:45 -07:00
Ian Hickson
055c919fda Allow children to overflow above a Baseline widget (#3573)
Turns out a common use for Baseline is making sure that the child's
baseline is higher than it otherwise would be, e.g. with the Material
font or other symbols.
2016-04-28 21:35:49 -07:00
Adam Barth
c6942c9945 Implement MainAxisAlignment.spaceEvenly (#3550)
Fixes #3289
2016-04-25 23:10:14 -07:00
Adam Barth
0d7b61f51e Improve elevation docs (#3502)
Fixes #3501
2016-04-22 12:58:03 -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
Hans Muller
25164e1089 Make IconButton gesture targets as big as possible (#3423)
* Make IconButtons as big as possible
2016-04-20 10:00:14 -07:00
Ian Hickson
a91bc0ba9c Material Data Tables (#3337)
+ Add new demo to gallery to show data tables. (This currently doesn't
use a Card; I'll create a Card version in a subsequent patch.)

+ Fix checkbox alignment. It now centers in its box regardless.

+ Add Colors.black54.

+ Some minor fixes to dartdocs.

+ DataTable, DataColumn, DataRow, DataCell

+ RowInkWell

+ Augment dartdocs of materia/debug.dart.

+ DropDownButtonHideUnderline to hide the underline in a drop-down when
  used in a DataTable.

+ Add new capabilities to InkResponse to support RowInkWell.

+ Augment dartdocs of materia/material.dart.

+ Add an assert to catch nested Blocks.

+ Fix a crash in RenderBox when you remove an object and an ancestor
  used its baseline. (https://github.com/flutter/flutter/issues/2874)

+ Fix (and redocument) RenderBaseline/Baseline.

+ Add flex support to IntrinsicColumnWidth.

+ Document more stuff on the RenderTable side.

+ Fix a bug with parentData handling on RenderTable children.

+ Completely rewrite the column width computations. The old logic made
  no sense at all.

+ Add dartdocs to widgets/debug.dart.

+ Add a toString for TableRow.
2016-04-15 16:51:03 -07:00
Ian Hickson
d348f28df7 Use the same logic in flushPaint as flushLayout (#3353)
If two repaint boundaries mark themselves dirty, but the second one is a
child of the first, then the second one will get repainted by the first
and then when we come to paint it directly, we get confused because it
isn't dirty any more.

We ran into this in layout before. Apply the same fix. Also, apply the
same fix to composition while we're at it.
2016-04-15 14:55:18 -07:00
Ian Hickson
e1aaf39f82 Fix Block intrinsic functions (#3286)
* Fix Block intrinsic functions

* Update block_test.dart

Fix the test per travis
2016-04-13 09:35:10 -07:00
Ian Hickson
ecf1cce82c Provide details when reporting invalid constraints (#3281)
This also shrinks the width of the error messages a bit because now that
we use 'package:' URLs the stacks are a bit narrower.
2016-04-12 15:42:00 -07:00
Ian Hickson
47f5c6f2e0 Add even more careful checks around BoxConstraints (#3243)
I ran into a case where I was setting minHeight=∞ and then calling
layout() with that constraint, which is all kinds of bad. To try to
catch this earlier, this patch now provides a way to catch constraints
that are requiring infinite values.

We don't _always_ check this because there are valid uses for
BoxConstraints.biggest, e.g. as an additionalConstraint.
2016-04-11 11:10:11 -07:00
krisgiesing
504610791f Update wording on viewport test (#3228) 2016-04-08 23:52:52 -07:00
Adam Barth
1e207c0150 Remove RenderBlockViewport
Previously this was used by MixedViewport, but now we don't need it because

LazyBlockViewport has replaced MixedViewport.



I've also taken this opportunity to modernize RenderBlock.
2016-04-06 19:39:10 -07:00
krisgiesing
0213b67e76 Handle dirty bits correctly when render objects are re-attached
Fixes #2855
2016-04-06 12:39:22 -07:00
Hixie
bdfeaaa47a More table fixes 2016-03-29 14:10:17 -07:00
Hixie
baf06515e5 Table widget
- Add x and y to the parent data, in case it's useful. In point of fact,
  I ended up not needing it.

- Make columnWidths settable rather than having a setter so that the
  code in the widgets layer is more idiomatic.

- Teach setFlatChildren about avoiding unnecessary drop/adopt loops.

- Assert that the child list length is correct more aggressively so that
  we catch the dumb bug I had more quickly next time.

- Improve the toString() to handle empty tables better.

- Resort the imports in framework.dart.

- Introduce a LocalKey for cases where you don't want to allow use of
  GlobalKey.

- Make inflateWidget and deactivateChild public for subclass use.

- Table widget.

- Cell widget.

- TableRow fake widget.
2016-03-29 12:43:19 -07:00
Adam Barth
1ba539a661 Add constants for FractionalOffsets
Adds some names for common FractionalOffset values.
2016-03-28 22:51:06 -07:00
Hixie
6af9e6c96b RenderTable 2016-03-25 18:40:18 -07:00
krisgiesing
cef24293b7 Merge pull request #2839 from krisgiesing/offscreen_layout
Allow independent rendering pipelines
2016-03-24 16:26:36 -07:00
Kris Giesing
bb5a82a726 Allow independent rendering pipelines
Fixes #2723
2016-03-24 14:59:21 -07:00
Ian Hickson
9356c19dce Handle NaNs in constraints, just in case. 2016-03-22 22:53:40 -07:00
Hixie
34cc0c4728 Rationalise the overflow render boxes
New RenderAligningShiftedBox abstract class for render boxes with
"alignment", which as of now is:

 - RenderPositionedBox
 - RenderConstrainedOverflowBox (ex RenderOverflowBox)
 - RenderSizedOverflowBox
 - RenderFractionallySizedOverflowBox (ex RenderFractionallySizedBox)

(The respective widgets are Align, OverflowBox, SizedOverflowBox, and
FractionallySizedBox. They haven't been renamed.)

Also I added some toString details.
2016-03-22 14:06:49 -07:00
Hixie
71976b306b Fix RenderFractionallySizedBox's constraints logic
Fixes https://github.com/flutter/flutter/issues/2735
2016-03-22 10:29:43 -07:00
Adam Barth
502a4ae078 Use FractionalOffset for gradients
These were using Offsets, but they're really FractionalOffsets.

Fixes #2318
2016-03-15 19:30:41 -07:00
Hixie
797e27edd3 Add @override annotations to flutter framework 2016-03-14 14:02:26 -07:00
Adam Barth
d5b2e2a01c [rename fixit] Flex alignments
* justifyContent -> mainAxisAlignment
* alignItems -> crossAxisAlignment
* FlexJustifyContent -> MainAxisAlignment
* FlexAlignItems -> CrossAxisAlignment

Fixes #231
2016-03-12 18:33:47 -08:00
Adam Barth
e71bd77e4f [rename fixit] EdgeDims -> EdgeInsets
Fixes #1382
2016-03-12 12:33:38 -08:00
Adam Barth
b5923f9282 [rename fixit] Painter -> RenderObjectPainter
Fixes #774
2016-03-12 11:37:39 -08:00
Hixie
6795efacab Enable always_specify_types lint
And fix the zillion issues that uncovered.
2016-03-12 00:37:31 -08:00
Ian Hickson
43b0104114 Revert "Merge pull request #2639 from Hixie/always_specify_types"
This reverts commit f41b3411da35929b09009e47cb52474389e42874, reversing
changes made to e33d8d96212f3e337a6660f1eb1118bffc945bf5.

This was a bad check-in due to my mangling uploading a new version of the branch from a different machine.

This reverts https://github.com/flutter/flutter/pull/2639 and will be replaced by https://github.com/flutter/flutter/pull/2640
2016-03-12 00:34:37 -08:00
Hixie
d162d98c79 Enable always_specify_types lint
And fix the zillion issues that uncovered.
2016-03-11 18:27:32 -08:00
Hixie
5810cd80bd Avoid 'as' keyword
It has performance implications in release mode.

We'll enable the lint once https://github.com/dart-lang/linter/issues/195 is fixed.
2016-03-09 15:00:55 -08:00
Adam Barth
fbc0950da4 Factor MojoShell into shell.dart
Putting this code in a separate library let's services that depend only on the
shell be clearer about their dependencies.
2016-03-04 13:48:28 -08:00
Hixie
cb5017d17d Convert LinearGradient and RadialGradient to fractional units
Makes it easier to use without a SizeObserver
2016-03-02 09:56:37 -08:00
Hixie
512b2e1972 Fix move() to call markNeedsLayout().
Otherwise, changing the order of your children (e.g. shuffling a list of
children) will have no visible effect.
2016-02-24 17:10:59 -08:00
Eric Seidel
fbe4cdf5c6 Merge pull request #2129 from eseidelGoogle/space_per_flex
Don't give children negative sizes when overconstrained
2016-02-24 15:30:16 -08:00
Eric Seidel
4e7a9de578 Fix two bugs in Flex exposed by the Game in landscape mode
One bug was masking the other, hence they both needed to be fixed
and tested separately.

@Hixie
2016-02-24 15:30:05 -08:00
Adam Barth
fb4dbf4584 Improve TextSpan
Now we just have one TextSpan class that handles both simple strings, trees of
children, and styling both. This approach simplifies the interface for most
clients.

This patch also removes StyledText, which was weakly typed and tricky to use
correctly. The replacement is RichText, which is strongly typed and uses
TextSpan.
2016-02-24 14:07:10 -08:00
Ian Hickson
a94999ba50 Clean up imports and exports.
Each layer is supposed to reexport the parts of the previous layer
that are part of its API.

- In painting.dart, export from dart:ui all the Canvas-related APIs
  that make sense to be used at higher levels, e.g. PaintingStyle.

- Delete painting/shadows.dart. It was dead code.

- In rendering/object.dart, export all of painting.dart.

- In widgets/basic.dart, export all of painting.dart and
  animation.dart. Some classes in animation/ are renamed to make this
  less disruptive and confusing to the namespace.

- Split out Stocks back into an import model rather than a part model,
  so that it's easier to manage its dependencies on a per-file basis.

- Move Ticker to scheduler library.

- Remove as many redundant imports as possible now.

- Some minor nit picking cleanup in various files.
2016-02-11 00:06:23 -08:00
Adam Barth
3c8cbef973 Rationalize RenderViewport and RenderVirtualViewport
These classes now share more code and have feature parity.
2016-02-09 10:30:52 -08:00