1. 16 Jun, 2016 2 commits
    • Hans Muller's avatar
      6ba5674d
    • Ian Hickson's avatar
      Refactor everything to do with images (#4583) · 2dfdc840
      Ian Hickson authored
      Overview
      ========
      
      This patch refactors images to achieve the following goals:
      
      * it allows references to unresolved assets to be passed
        around (previously, almost every layer of the system had to know about
        whether an image came from an asset bundle or the network or
        elsewhere, and had to manually interact with the image cache).
      
      * it allows decorations to use the same API for declaring images as the
        widget tree.
      
      It requires some minor changes to call sites that use images, as
      discussed below.
      
      Widgets
      -------
      
      Change this:
      
      ```dart
            child: new AssetImage(
              name: 'my_asset.png',
              ...
            )
      ```
      
      ...to this:
      
      ```dart
            child: new Image(
              image: new AssetImage('my_asset.png'),
              ...
            )
      ```
      
      Decorations
      -----------
      
      Change this:
      
      ```dart
            child: new DecoratedBox(
              decoration: new BoxDecoration(
                backgroundImage: new BackgroundImage(
                  image: DefaultAssetBundle.of(context).loadImage('my_asset.png'),
                  ...
                ),
                ...
              ),
              child: ...
            )
      ```
      
      ...to this:
      
      ```dart
            child: new DecoratedBox(
              decoration: new BoxDecoration(
                backgroundImage: new BackgroundImage(
                  image: new AssetImage('my_asset.png'),
                  ...
                ),
                ...
              ),
              child: ...
            )
      ```
      
      DETAILED CHANGE LOG
      ===================
      
      The following APIs have been replaced in this patch:
      
      * The `AssetImage` and `NetworkImage` widgets have been split in two,
        with identically-named `ImageProvider` subclasses providing the
        image-loading logic, and a single `Image` widget providing all the
        widget tree logic.
      
      * `ImageResource` is now `ImageStream`. Rather than configuring it with
        a `Future<ImageInfo>`, you complete it with an `ImageStreamCompleter`.
      
      * `ImageCache.load` and `ImageCache.loadProvider` are replaced by
        `ImageCache.putIfAbsent`.
      
      The following APIs have changed in this patch:
      
      * `ImageCache` works in terms of arbitrary keys and caches
        `ImageStreamCompleter` objects using those keys. With the new model,
        you should never need to interact with the cache directly.
      
      * `Decoration` can now be `const`. The state has moved to the
        `BoxPainter` class. Instead of a list of listeners, there's now just a
        single callback and a `dispose()` method on the painter. The callback
        is passed in to the `createBoxPainter()` method. When invoked, you
        should repaint the painter.
      
      The following new APIs are introduced:
      
      * `AssetBundle.loadStructuredData`.
      
      * `SynchronousFuture`, a variant of `Future` that calls the `then`
        callback synchronously. This enables the asynchronous and
        synchronous (in-the-cache) code paths to look identical yet for the
        latter to avoid returning to the event loop mid-paint.
      
      * `ExactAssetImage`, a variant of `AssetImage` that doesn't do anything clever.
      
      * `ImageConfiguration`, a class that describes parameters that configure
        the `AssetImage` resolver.
      
      The following APIs are entirely removed by this patch:
      
      * `AssetBundle.loadImage` is gone. Use an `AssetImage` instead.
      
      * `AssetVendor` is gone. `AssetImage` handles everything `AssetVendor`
        used to handle.
      
      * `RawImageResource` and `AsyncImage` are gone.
      
      The following code-level changes are performed:
      
      * `Image`, which replaces `AsyncImage`, `NetworkImage`, `AssetImage`,
        and `RawResourceImage`, lives in `image.dart`.
      
      * `DecoratedBox` and `Container` live in their own file now,
        `container.dart` (they reference `image.dart`).
      
      DIRECTIONS FOR FUTURE RESEARCH
      ==============================
      
      * The `ImageConfiguration` fields are mostly aspirational. Right now
        only `devicePixelRatio` and `bundle` are implemented. `locale` isn't
        even plumbed through, it will require work on the localisation logic.
      
      * We should go through and make `BoxDecoration`, `AssetImage`, and
        `NetworkImage` objects `const` where possible.
      
      * This patch makes supporting animated GIFs much easier.
      
      * This patch makes it possible to create an abstract concept of an
        "Icon" that could be either an image or a font-based glyph (using
        `IconData` or similar). (see
        https://github.com/flutter/flutter/issues/4494)
      
      RELATED ISSUES
      ==============
      
      Fixes https://github.com/flutter/flutter/issues/4500
      Fixes https://github.com/flutter/flutter/issues/4495
      Obsoletes https://github.com/flutter/flutter/issues/4496
      2dfdc840
  2. 15 Jun, 2016 1 commit
  3. 14 Jun, 2016 2 commits
    • pq's avatar
      Added asserts. · f5a4e632
      pq authored
      f5a4e632
    • pq's avatar
      Add missing returns. · 7a955487
      pq authored
      As of `1.18.0-dev-0`, these cases will get flagged.  In the meantime, the
      7a955487
  4. 13 Jun, 2016 1 commit
  5. 12 Jun, 2016 1 commit
  6. 09 Jun, 2016 1 commit
    • Adam Barth's avatar
      Remove clients of getTotalMatrix (#4487) · afe3158d
      Adam Barth authored
      Instead of using getTotalMatrix and setMatrix, we can just use
      save/restore, which is more idiomatic.
      
      The getTotalMatrix/setMatrix pattern was introduced to improve
      performance, but the original code was calling getTotalMatrix/setMatrix
      at every node in the sprite tree, which is much slower than the normal
      save/transform/restore pattern.
      
      Related to #4254
      afe3158d
  7. 08 Jun, 2016 1 commit
  8. 07 Jun, 2016 1 commit
  9. 06 Jun, 2016 1 commit
  10. 03 Jun, 2016 3 commits
    • Adam Barth's avatar
      Convert drag gestures to use details objects (#4343) · 2d4acb80
      Adam Barth authored
      Previously we supplied individual parameters to the various drag and pan
      callbacks. However, that approach isn't extensible because each new
      parameter is a breaking change to the API.
      
      This patch makes a one-time breaking change to the API to provide a
      "details" object that we can extend over time as we need to expose more
      information. The first planned extension is adding enough information to
      accurately produce an overscroll glow on Android.
      2d4acb80
    • Ian Hickson's avatar
      Clean up the way RenderIntrinsicWidth works (#4340) · 5245d388
      Ian Hickson authored
      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.
      5245d388
    • Ian Hickson's avatar
      RenderPadding's intrinsic should clamp child dims (#4329) · d8283d1c
      Ian Hickson authored
      We used to rely on BoxConstraints.deflate's clamping, but now we have to
      roll our own.
      d8283d1c
  11. 02 Jun, 2016 1 commit
  12. 01 Jun, 2016 1 commit
    • Ian Hickson's avatar
      PaginatedDataTable (part 1) (#4306) · 0618da7c
      Ian Hickson authored
      This introduces the key parts of a paginated data table, not including
      the built-in pagination features.
      
      * Provide more data for the data table demo, so there's data to page.
      
      * Introduce a ChangeNotifier class which abstracts out
        addListener/removeListener/notifyListeners. We might be able to use
        this to simplify existing classes as well, though this patch doesn't
        do that.
      
      * Introduce DataTableSource, a delegate for getting data for data
        tables. This will also be used by ScrollingDataTable in due course.
      
      * Introduce PaginatedDataTable, a widget that wraps DataTable and only
        shows N rows at a time, fed by a DataTableSource.
      0618da7c
  13. 31 May, 2016 2 commits
  14. 29 May, 2016 2 commits
  15. 27 May, 2016 1 commit
  16. 26 May, 2016 3 commits
  17. 23 May, 2016 1 commit
  18. 20 May, 2016 2 commits
  19. 19 May, 2016 1 commit
  20. 18 May, 2016 1 commit
    • Ian Hickson's avatar
      Some cleanup of the test framework (#4001) · d2c8c82f
      Ian Hickson authored
      * Add a "build" phase to EnginePhase for completeness.
      * Ignore events from the device during test execution.
      * More dartdocs
      * Slightly more helpful messages about Timers in verifyInvariants.
      * Add widgetList, elementList, stateList, renderObjectList.
      * Send test events asynchronously for consistency with other APIs.
      * Fix a test that was depending on test events being synchronous (or
        rather, scheduled in a microtask that came before the microtask for
        the completer of the future that the tap() function returned).
      d2c8c82f
  21. 17 May, 2016 3 commits
  22. 16 May, 2016 3 commits
    • Ian Hickson's avatar
      Make it possible to run tests live on a device (#3936) · 32527017
      Ian Hickson authored
      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.
      32527017
    • Ian Hickson's avatar
      Revert "Rename DefaultTextStyle constructor to explicit (#3920)" (#3930) · c5ff156f
      Ian Hickson authored
      This reverts commit 55f9145e.
      
      Turns out that this commit breaks apps that use the material library,
      because of the _errorTextStyle DefaultTextStyle which has inherit:true.
      Just setting it to false doesn't work, unfortunately, because then you
      hit some sort of issue with merging that text style with others that
      have inherit:true.
      c5ff156f
    • Adam Barth's avatar
      Rename DefaultTextStyle constructor to explicit (#3920) · 55f9145e
      Adam Barth authored
      To make it clear that this constructor requires an explicit style. Also
      throw a descriptive error recommending the inherit constructor for
      styles with the inherit bit set.
      
      Fixes #3842
      55f9145e
  23. 13 May, 2016 1 commit
  24. 12 May, 2016 1 commit
  25. 10 May, 2016 1 commit
  26. 05 May, 2016 2 commits
    • Adam Barth's avatar
      DropDownMenu should use ScrollableList (#3745) · 2592f8f4
      Adam Barth authored
      Previously it used Block, which is less efficient for large numbers of items.
      Also move the top margin out of the menu item to fix the baseline alignment of
      the text.
      
      Fixes #1615
      2592f8f4
    • Adam Barth's avatar
      Ensure that DropDownMenus are always onscreen (#3742) · 6a46bf2e
      Adam Barth authored
      This patch sizes the menu such that it is always on screen, but doesn't scroll
      the menu to ensure that the currently selected item is always visible and on
      top of the button. That will need to wait for a later patch.
      
      Also, teach CustomPaint how to repaint animations more efficiently.
      
      Fixes #3720
      6a46bf2e