1. 16 Jun, 2016 1 commit
    • 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. 10 Jun, 2016 1 commit
  3. 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
  4. 29 May, 2016 1 commit
  5. 26 May, 2016 1 commit
  6. 19 May, 2016 2 commits
  7. 16 May, 2016 2 commits
    • Viktor Lidholt's avatar
      e1e773af
    • 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
  8. 12 May, 2016 1 commit
  9. 07 May, 2016 1 commit
    • Adam Barth's avatar
      Move TextAlign out of TextStyle (#3789) · ee903af0
      Adam Barth authored
      TextAlign applies to a whole paragraph instead of applying to an individual
      text span. This patch moves the property out of TextStyle and into a separate
      property on Text and RichText.
      ee903af0
  10. 06 May, 2016 1 commit
  11. 04 May, 2016 2 commits
    • pq's avatar
      Literals get type annotations. · bcede8df
      pq authored
      As per the recent fix to the `always_specify_types` lint (https://github.com/dart-lang/linter/issues/199), literal maps and lists are now expected to be explicitly typed.
      
      Running that lint on the repo identifies quite a few spots to update.  This focuses on `flutter_driver` and `flutter_sprites` (somewhat arbitrarily) but the changes are fairly representative.
      
      Note there are a number of places where I made a quick judgement on how specific to make the types.  Feedback on those is welcome.  (Especially as we move forward with more.)
      bcede8df
    • Viktor Lidholt's avatar
      Refactor sprite physics, part 1 (#3711) · 76b04cdd
      Viktor Lidholt authored
      76b04cdd
  12. 29 Apr, 2016 2 commits
  13. 23 Apr, 2016 1 commit
  14. 22 Apr, 2016 2 commits
  15. 08 Apr, 2016 1 commit
  16. 06 Apr, 2016 1 commit
    • Adam Barth's avatar
      LazyBlock docs and physics · 6fd68597
      Adam Barth authored
      This patch adds dartdoc to LazyBlock. Also, this patch fixes the scrolling
      physics of LazyBlock. Previously, we updated a running simulation only when the
      change in scroll behavior changed the current scroll offset. Now we update
      running simulations every time the behavior changes because the simulation
      might depend on quantities other than the current scroll offset.
      6fd68597
  17. 30 Mar, 2016 1 commit
  18. 25 Mar, 2016 1 commit
  19. 24 Mar, 2016 1 commit
  20. 18 Mar, 2016 1 commit
  21. 14 Mar, 2016 1 commit
  22. 12 Mar, 2016 4 commits
  23. 11 Mar, 2016 2 commits
    • Adam Barth's avatar
      Provide the BuildContext to createRenderObject and updateRenderObject · 0277b075
      Adam Barth authored
      We'll need this for RTL support because the RTL state will live in the widget
      tree. Also, remove the `oldWidget` argument to updateRenderObject because there
      aren't any clients for it.
      0277b075
    • Ian Hickson's avatar
      Enable ALL THE LINTS · 1b9cd520
      Ian Hickson authored
      Well, all the easy ones, anyway.
      
      For some reason `// ignore:` isn't working for me so I've disabled
      lints that need that. Also disabled those that require a ton of work
      (which I'm doing, but not in this PR, to keep it reviewable).
      
      This adds:
      - avoid_init_to_null
      - library_names
      - package_api_docs
      - package_names
      - package_prefixed_library_names
      - prefer_is_not_empty
      - sort_constructors_first
      - sort_unnamed_constructors_first
      - unnecessary_getters_setters
      1b9cd520
  24. 10 Mar, 2016 1 commit
  25. 01 Mar, 2016 1 commit
  26. 24 Feb, 2016 1 commit
    • Adam Barth's avatar
      Improve TextSpan · fb4dbf45
      Adam Barth authored
      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.
      fb4dbf45
  27. 17 Feb, 2016 1 commit
  28. 11 Feb, 2016 1 commit
    • Ian Hickson's avatar
      Clean up imports and exports. · a94999ba
      Ian Hickson authored
      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.
      a94999ba
  29. 08 Feb, 2016 1 commit
  30. 03 Feb, 2016 1 commit
  31. 29 Jan, 2016 1 commit