Commit graph

122 commits

Author SHA1 Message Date
Seth Ladd 2666628b12 use async / await 2015-12-08 14:16:14 -08:00
Collin Jackson d05c564cef Fix hero transition when using dynamic routes 2015-12-08 13:08:16 -08:00
Jason Simmons 9693cd5537 Add a LocaleQuery widget that can be used to fetch locale-specific data
Users of MaterialApp can provide an onLocaleChanged handler that will be
called to asynchronously fetch locale-specific data.  MaterialApp will
then instantiate a LocaleQuery that supplies the locale data to its
descendants.
2015-12-07 17:38:50 -08:00
Adam Barth abf0359569 Remove PaintingCanvas
We can just use Canvas now.  The two are the same thing.
2015-12-04 20:26:08 -08:00
Jason Simmons e08d446ebf Example of using the Dart internationalization package in Flutter 2015-12-04 09:48:32 -08:00
Ian Hickson c5a26615d8 Introduce some basic utility classes.
One might argue, the most basic utility classes.
2015-12-03 20:03:31 -08:00
Adam Barth e17c3eccf6 Automatically fill in the menu button when there's a drawer
Also, fill in a back arrow when we can go back.

Fixes #699
2015-12-03 16:30:06 -08:00
Ian Hickson ab74b1783c Merge pull request #705 from Hixie/yak3-material-app-route-classes
Let MaterialApp.onGenerateRoute return a Route
2015-12-03 14:40:36 -08:00
Hixie e249c0ab49 Add menu items to stocks to control timeDilation 2015-12-03 14:28:27 -08:00
Hixie df07a69b12 Let MaterialApp.onGenerateRoute return a Route
Also:
 - minor code reindents in places.
 - reset the widget tree between tests.
 - once you generate a route, don't let its builder change
   (previously it would keep changing as the routes table changed).
 - revert the stocks app toolbar-fading-on-forward-transition thing.
2015-12-03 14:21:38 -08:00
Adam Barth 1d195cb995 Fix a large number of Drawer bugs
This patch restructures how we handle drawer. The drawer is now a child of the
Scaffold, which wraps the Drawer in a DrawerController. The DrawerController
manages the interaction with the navigator as well as the edge swiping. The
DrawerController's state machine is driven almost entirely off its Performance,
which it now owns completely.

Fixes #90
Fixes #187
Fixes #192
Fixes #194
Fixes #604
2015-12-03 10:12:56 -08:00
Hixie bc5307f5af buildForwardTransition()
For those times when you want to do something as you move away from a
route into the next one, as well as when you move into it from the
previous one.
2015-12-02 17:16:43 -08:00
Ian Hickson d5e072c35b Fix crash when going back in stocks app.
Heroes with the same tag have to have keys that are unique across the
entire subtree. Since we can now show both stock lists, this means we
have to include the tab in the heroes' keys.

Fixes #668.
2015-12-01 22:54:11 -08:00
Hixie f9ea1ce815 NavigatorTransaction
To make it easier to avoid pushing twice in one frame, provide a
transaction mechanism for the navigator.
2015-11-30 15:24:36 -08:00
Hans Muller 9de4df1e8b TabNavigator animates selected TabView
The TabBar's selection is now represented by a TabBarSelection object which encapsulates both the previous and currently selected indices and the Performance used to animate the selection indicator.

Added a TabBarView class which displays a tab's contents. It uses a shared TabBarSelection to stay in sync with a TabBar. The TabBarView scrolls in sync with the TabBar when the selection changes. Eventually it will allow one to fling the selection forward or backwards.

Added a tabBar property to ToolBar. Typically the corresponding TabBarView will be the body of the toolbar's Scaffold.

Removed TabNavigatorView and TabNavigator.

Added a widget gallery tabs demo page. Removed the old tabs demo.
2015-11-30 12:13:17 -08:00
Hixie 8218a13aa4 Remove StateRoutes 2015-11-24 10:31:01 -08:00
Hixie 03e094aa1b Convert Persistent Bottom Sheets to a Scaffold API
- `Scaffold.of(context).showBottomSheet(widget);`
- Returns an object with .closed Future and .close() method.
- Uses a StateRoute to handle back button.
- Take the Navigator logic out of the BottomSheet widget.
- Support showing a sheet while an old one is going away.
- Add Navigator.remove().
2015-11-20 10:49:10 -08:00
Adam Barth 49fb492332 Fix crash in stocks app painting 2015-11-20 09:36:12 -08:00
Adam Barth 72329cf422 Callback identity is too fragile for CustomPaint
Many of the widgets that use CustomPaint were spamming repaints because
CustomPaint repaints when the identity of the onPaint callback changes, which
it does every build for StatelessComponents.

This patch changes CustomPaint to use a CustomPainter, similar to the new
custom layout widgets. The CustomPainter has a `shouldRepaint` function along
with its `paint` function. This function gives clients explicit control over
when the custom paint object repaints.
2015-11-20 08:20:59 -08:00
Adam Barth dfbd8c6a8a Add debugDumpLayerTree to dump the layer tree
To help debugging issues with the layer tree.
2015-11-19 14:45:40 -08:00
Hixie 954713ab23 Snackbar Refactor
"showSnackBar()" is now a feature of a Scaffold. To get to a Scaffold
you either use a global key (`scaffoldKey.currentState.showSnackBar(...)`),
or you use `Scaffold.of(context)`.

Snack bars no longer have a route. They are entirely managed by the
Scaffold. Fixes #432.

Snack bars now queue up when you have several of them. Fixes #374.

Snack bars now auto-size themselves around their contents. This is step
one towards implementing multiline snack bars.

Snack bars now self-dismiss after some per-snackbar configurable period.

The self-dismissing pauses while a dialog is up above the snackbar (or
anything that uses ModalRoute). To enable this, there's now a
`ModalRoute.of(context)` API that returns the current ModalRoute, and
you will be rebuilt if you asked for this and the route's "current"
status changes. To implement this, the Navigator now rebuilds
unconditionally any time it pushes or pops a route.

Snack bars now use the curves that Android uses for snack bars.

Snack bar contents now fade in.
2015-11-18 17:01:21 -08:00
Hans Muller d9153a13c6 Update shadow rendering
Shadows now render as three seprate MaskFilter.blur components per the most recent Material spec.

The shadows Map was replaced by a similar Map called elevationToShadow with entries that match the 10 elevations specifed by http://www.google.com/design/spec/what-is-material/elevation-shadows.html.

The "level" property (many classes) is now called "elevation", to match the Material spec.

BoxShadow now includes a spreadRadius parameter - as in CSS box-shadow. Renamed the BoxShadow blur property to blurRadius to further align BoxShadow with CSS box-shadow.
2015-11-18 07:58:28 -08:00
Collin Jackson b07d55d1b3 Remove redundant fetch functions and avoid crashing when no headers are set 2015-11-16 18:31:57 -08:00
Hans Muller f7b36f07f8 Give the StockSymbolView's Hero a Key 2015-11-16 11:35:42 -08:00
Adam Barth 0259ad81db ItemBuilder should also get the index of the item
This seems useful for numbering the entries in the list, for example.

Fixes #328
2015-11-12 12:05:42 -08:00
Hans Muller 4b03a9eec8 Merge pull request #318 from HansMuller/stocks_demo
Add a persistent bottom sheet to the stocks demo
2015-11-11 15:54:33 -08:00
Hans Muller 5755b15bf5 Add a persistent bottom sheet to the stocks demo 2015-11-11 15:38:13 -08:00
Eric Seidel d8d5156a45 Move data out of Github and into Firebase
@abarth @collinjackson
2015-11-11 15:30:10 -08:00
Hans Muller 5e08b98e0d Refactor bottom sheet support, add a bottom sheet to the stocks demo
Factored OverlayRoute out of the modal and persistent bottom sheet clases, since the bottom sheet classes need to drive the performance.

Added a bottom sheet to the stocks demo: long-press on a stock shows a modal bottom sheet.

Made AnimatedModalBarrier public.
2015-11-10 11:27:17 -08:00
Hixie 1f5844ea70 Teach Block about padding.
It's common to want a scrolling viewport but with padding around the
contents. Teaching Block about this makes the places that do this
substantially simpler and further buries ScrollableViewport and
BlockBody (they're now only used in scrollable.dart).
2015-11-05 17:14:27 -08:00
Adam Barth 828775e97e Routes shouldn't be interactive when animating out
This patch introduces the notion of a ModalRoute that puts up a modal barrier
and makes the route invisible to hit testing when its animating out. This patch
also uses this mechanism in a number of places (including PageRoute). There are
still a few more cases to convert, but that's work for a future patch.

Fixes #1684
2015-11-02 12:48:11 -08:00
Adam Barth 74d6f33f5a Rename Icon's type paramter to icon
The name of the parameter wasn't consistent with IconButton or DrawerItem, etc.

Fixes #1871
2015-11-01 11:25:17 -08:00
Adam Barth 50a177b7aa Switch to Navigator2 2015-10-29 23:18:56 -07:00
Adam Barth af790303c2 Merge pull request #1848 from abarth/icon_size
Icon should use an enum rather than an int for size
2015-10-28 09:13:23 -07:00
Adam Barth eeea4ab7c7 Icon should use an enum rather than an int for size
Material design icons are defined to work at specific sizes: 18, 24, 36, 48.
The current API doesn't reflect that and just takes a size int. If an invalid
size is chosen an error is printed to the console and no icon shows up.

Fixes #1816
2015-10-28 08:55:49 -07:00
Adam Barth 3373d0ba01 Switch clients from ui.view to ui.window 2015-10-28 07:16:56 -07:00
Ian Hickson 8a900f9042 Track scroll position
- Change RouteArguments to pass the route's BuildContext rather than
  the Navigator. This caused the bulk of the examples/ and .../test/
  changes (those are mostly mechanical changes). It also meant I could
  simplify Navigator.of().

- Make initState() actually get called when the State's Element is in
  the tree, so you can use Foo.of() functions there. Added a test for
  this also.

- Provide a RouteWidget so that routes have a position in the Widget
  tree. The bulk of the route logic is still in a longer-lived Route
  object for now.

- Make Route.setState() only rebuild the actual route, not the whole
  navigator.

- Provided a Route.of().

- Provided a Route.writeState / Route.readState API that tries to
  identify the clients by their runtimeType, their key, and their
  ancestors keys, up to the nearest ancestor with a GlobalKey.

- Made scrollables hook into this API to track state. Added a test to
  make sure this works.

- Fix the debug output of GestureDetector and the hashCode of
  MixedViewport.

- Fixed ScrollableWidgetListState<T> to handle infinite lists.
2015-10-27 13:46:07 -07:00
Hixie d11acc41eb Use the presence of handler to determine 'enabled'
Instread of an explicit 'enabled' bool, this uses the presence of the
event handler to determine if a widget is enabled or not. This means
that if you've not passed a handler, your widget will be disabled, which
makes sense, since it wouldn't work anyway.

Adds this feature to checkbox, and ports raised button, flat button, and
radio buttons to this new model.

Adds a checkbox to card_collection that can be disabled.

Hide a (basically bogus) hint from the (soon to be disabled) strong hint
mode in the analyzer that this reveals.
2015-10-26 17:35:41 -07:00
Jason Simmons 310ce31891 Merge pull request #1791 from jason-simmons/stocks_example_fetch
In the stock list, filter out any symbols that have not yet been fetched
2015-10-26 12:37:03 -07:00
Ian Hickson 7822bd03ae Merge pull request #1776 from Hixie/stocks-back
Fix Stocks search mode back button.
2015-10-26 12:02:33 -07:00
Jason Simmons 194f0f22e3 In the stock list, filter out any symbols that have not yet been fetched
If you load the example and immediately switch to the Portfolio tab, you may
see exceptions due to symbols that are in the portfolio list but whose
data is not yet present in the stocks map
2015-10-26 11:12:08 -07:00
Hixie b1dbf4528c Radio<T> and ValueChanged<T>
Make Radio widgets take a type that describes the type of their value,
so that you can catch when you use the wrong value.

Standardise on ValueChanged<Foo> instead of having a FooValueChanged
for every value of Foo.
2015-10-26 11:03:24 -07:00
Ian Hickson a66e55a89c Fix Stocks search mode back button.
Back button wasn't reliably working in checked mode.
2015-10-25 18:31:03 -07:00
Hixie a6c473ea95 Strong modeify the examples
This makes skyanalyzer also check the examples, and fixes everything it
found there.
2015-10-23 18:13:25 -07:00
Adam Barth de395582d5 Add Navigator.of
Now you don't need to pass the navigator around everywhere.
2015-10-22 12:32:42 -07:00
Hixie fa8c45151f Heroes 2015-10-21 16:58:36 -07:00
Hixie bc6d17db3b Use a card for the stock symbol viewer page. 2015-10-21 12:02:28 -07:00
Adam Barth 529fa95f87 Give the CustomPaint and SizeObserver callbacks better names
The style we use for callbacks in widgets is "onFoo". These classes were using
an order naming convention and just called their callbacks "callback".
2015-10-19 17:27:40 -07:00
Adam Barth 4094223378 Show ColorFilter
Instead of requiring clients to use ui.ColorFilter, we show show the
ColorFilter class, similar to what we do for Color.
2015-10-19 13:33:39 -07:00
Adam Barth 47c854b8fc Merge pull request #1673 from abarth/rm_old_paint_setters
Remove old setFoo functions on Paint
2015-10-19 12:28:09 -07:00