1. 09 Aug, 2017 1 commit
  2. 21 Jun, 2017 3 commits
  3. 17 Mar, 2017 1 commit
  4. 04 Mar, 2017 1 commit
  5. 21 Feb, 2017 1 commit
  6. 16 Feb, 2017 1 commit
  7. 23 Jan, 2017 1 commit
  8. 22 Jan, 2017 1 commit
  9. 19 Nov, 2016 1 commit
  10. 07 Nov, 2016 1 commit
  11. 20 Oct, 2016 1 commit
  12. 07 Oct, 2016 1 commit
    • Adam Barth's avatar
      Deploy `@checked` (#6244) · 2c21d795
      Adam Barth authored
      This patch adds `@checked` everywhere is needed to remove the
      `strong_mode_invalid_method_override` strong mode error.
      2c21d795
  13. 08 Sep, 2016 1 commit
    • Ian Hickson's avatar
      Make tests more realistic (#5762) · 5bc8888e
      Ian Hickson authored
      Previously, pumpWidget() would do a partial pump (it didn't trigger
      Ticker callbacks or post-frame callbacks), and pump() would do a full
      pump. This patch brings them closer together. It also makes runApp run a
      full actual frame, rather than skipping the transient callback part of
      the frame logic. Having "half-frames" in the system was confusing and
      could lead to bugs where code expecting to run before the next layout
      pass didn't because a "half-frame" ran first.
      
      Also, make Tickers start ticking in the frame that they were started in,
      if they were started during a frame. This means we no longer spin a
      frame for t=0, we jump straight to the first actual frame.
      
      Other changes in this patch:
      
      * rename WidgetsBinding._runApp to WidgetsBinding.attachRootWidget, so
        that tests can use it to more accurately mock out runApp.
      
      * allow loadStructuredData to return synchronously.
      
      * make handleBeginFrame handle not being given a time stamp.
      
      * make DataPipeImageProvider.loadAsync protected (rather than private),
        and document it. There wasn't really a reason for it to be private.
      
      * fix ImageConfiguration.toString.
      
      * introduce debugPrintBuildScope and debugPrintScheduleBuildForStacks,
        which can help debug problems with widgets getting marked as dirty but
        not cleaned.
      
      * make debugPrintRebuildDirtyWidgets say "Building" the first time and
        "Rebuilding" the second, to make it clearer when a widget is first
        created. This makes debugging widget lifecycle issues much easier.
      
      * make debugDumpApp more resilient.
      
      * debugPrintStack now takes a label that is printed before the stack.
      
      * improve the banner shown for debugPrintBeginFrameBanner.
      
      * various and sundry documentation fixes
      5bc8888e
  14. 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
  15. 16 May, 2016 1 commit
    • 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
  16. 29 Apr, 2016 1 commit
    • Ian Hickson's avatar
      Refactor the test framework (#3622) · 91dd9699
      Ian Hickson authored
      * 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
      91dd9699
  17. 14 Apr, 2016 1 commit
  18. 13 Apr, 2016 1 commit
  19. 14 Mar, 2016 1 commit
  20. 12 Mar, 2016 4 commits
  21. 11 Mar, 2016 1 commit
    • 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
  22. 09 Mar, 2016 1 commit
  23. 04 Mar, 2016 1 commit