// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:sky' as sky;

import 'package:sky/gestures.dart';
import 'package:sky/widgets.dart';

import 'icon.dart';

class IconButton extends StatelessComponent {
  const IconButton({ Key key, this.icon, this.onPressed, this.color }) : super(key: key);

  final String icon;
  final Color color;
  final GestureTapCallback onPressed;

  Widget build(BuildContext context) {
    Widget child = new Icon(type: icon, size: 24);
    if (color != null) {
      child = new ColorFilter(
        color: color,
        transferMode: sky.TransferMode.srcATop,
        child: child
      );
    }
    return new GestureDetector(
      onTap: onPressed,
      child: new Padding(
        child: child,
        padding: const EdgeDims.all(8.0))
    );
  }
}

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:sky' as sky;

import 'package:sky/gestures.dart';
import 'package:sky/widgets.dart';

import 'icon.dart';

class IconButton extends StatelessComponent {
  const IconButton({
    Key key,
    this.icon,
    this.color,
    this.colorFilter,
    this.onPressed
  }) : super(key: key);

  final String icon;
  final IconThemeColor color;
  final sky.ColorFilter colorFilter;
  final GestureTapCallback onPressed;

  Widget build(BuildContext context) {
    return new GestureDetector(
      onTap: onPressed,
      child: new Padding(
        padding: const EdgeDims.all(8.0),
        child: new Icon(
          type: icon,
          size: 24,
          color: color,
          colorFilter: colorFilter
        )
      )
    );
  }
}

Make it fast to draw color icons

Make it fast to draw color icons

Instead of using a ColorFilter, plumb the information down to Icon and thereby
to Image.


import 'package:flutter/material.dart';
import 'package:flutter_inner_drawer/inner_drawer.dart';

import 'app_drawer.dart';
import 'app_drawer_icon.dart';
import 'double_tap_exit.dart';

class InnerDrawerScaffold extends StatelessWidget {
  final Widget title;
  final Widget body;
  final List<Widget> actions;

  const InnerDrawerScaffold({
    Key key,
    @required this.title,
    @required this.body,
    this.actions,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final GlobalKey<InnerDrawerState> _innerDrawerKey =
        GlobalKey<InnerDrawerState>();

    return InnerDrawer(
      key: _innerDrawerKey,
      onTapClose: true,
      offset: const IDOffset.horizontal(0.5),
      leftChild: const AppDrawer(),
      scaffold: Scaffold(
        backgroundColor: Theme.of(context).backgroundColor,
        appBar: AppBar(
          leading: AppDrawerIcon(innerDrawerKey: _innerDrawerKey),
          title: title,
          actions: actions ?? [],
        ),
        body: DoubleTapExit(
          child: body,
        ),
      ),
    );
  }
}

import 'package:flutter/material.dart';
import 'package:flutter_inner_drawer/inner_drawer.dart';

import 'app_drawer.dart';
import 'app_drawer_icon.dart';
import 'double_tap_exit.dart';

class InnerDrawerScaffold extends StatelessWidget {
  final Widget title;
  final Widget body;
  final List<Widget> actions;

  const InnerDrawerScaffold({
    Key key,
    @required this.title,
    @required this.body,
    this.actions,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final GlobalKey<InnerDrawerState> _innerDrawerKey =
        GlobalKey<InnerDrawerState>();

    return InnerDrawer(
      key: _innerDrawerKey,
      onTapClose: true,
      swipeChild: true,
      offset: const IDOffset.horizontal(0.5),
      leftChild: const AppDrawer(),
      scaffold: Scaffold(
        backgroundColor: Theme.of(context).backgroundColor,
        appBar: AppBar(
          leading: AppDrawerIcon(innerDrawerKey: _innerDrawerKey),
          title: title,
          actions: actions ?? [],
        ),
        body: DoubleTapExit(
          child: body,
        ),
      ),
    );
  }
}

Enable swipe over app drawer to close.

Enable swipe over app drawer to close.


// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// or details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/**
 * Test date formatting and parsing using locale data read via an http request
 * to a server.
 */

library date_time_format_http_request_test;

import 'dart:html';
import 'package:unittest/html_config.dart';
import 'package:unittest/unittest.dart';
import 'package:intl/date_symbol_data_http_request.dart';
import 'date_time_format_test_stub.dart';

main() {
  useHtmlConfiguration();
  var url = "http://localhost:${window.location.port}"
    "/root_dart/pkg/intl/lib/src/data/dates/";

   test("Initializing a locale that needs fallback", () {
     initializeDateFormatting("de_DE", url).then(expectAsync((_) => true));
   });

  runWith(smallSetOfLocales, url, initializeDateFormatting);
}

// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// or details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/**
 * Test date formatting and parsing using locale data read via an http request
 * to a server.
 */

library date_time_format_http_request_test;

import 'dart:html';
import 'package:unittest/html_config.dart';
import 'package:unittest/unittest.dart';
import 'package:intl/date_symbol_data_http_request.dart';
import 'date_time_format_test_stub.dart';

main() {
  useHtmlConfiguration();
  var url = "http://localhost:${window.location.port}"
    "/packages/intl/src/data/dates/";

   test("Initializing a locale that needs fallback", () {
     initializeDateFormatting("de_DE", url).then(expectAsync((_) => true));
   });

  runWith(smallSetOfLocales, url, initializeDateFormatting);
}

Fix url location for http test

Fix url location for http test


// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:sky' as sky;

/// Helper class to build a Paint DrawLooper that adds shadows to the Paint's
/// operation.
class ShadowDrawLooperBuilder {
  var builder_ = new sky.LayerDrawLooperBuilder();

  void addShadow(sky.Size offset, sky.Color color, double blur) {
    builder_.addLayerOnTop(
          new sky.DrawLooperLayerInfo()
            ..setPaintBits(PaintBits.all)
            ..setOffset(offset.toPoint())
            ..setColorMode(sky.TransferMode.srcMode),
          (sky.Paint layerPaint) {
        layerPaint.color = color;
        layerPaint.setMaskFilter(
          new sky.MaskFilter.blur(sky.BlurStyle.normal,
                                  blur,
                                  highQuality: true));
      });
  }

  sky.DrawLooper build() {
    builder_.addLayerOnTop(new sky.DrawLooperLayerInfo(), (_) {});
    return builder_.build();
  }
}

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:sky' as sky;

/// Helper class to build a Paint DrawLooper that adds shadows to the Paint's
/// operation.
class ShadowDrawLooperBuilder {
  var builder_ = new sky.LayerDrawLooperBuilder();

  void addShadow(sky.Size offset, sky.Color color, double blur) {
    builder_.addLayerOnTop(
          new sky.DrawLooperLayerInfo()
            ..setPaintBits(sky.PaintBits.all)
            ..setOffset(offset.toPoint())
            ..setColorMode(sky.TransferMode.srcMode),
          (sky.Paint layerPaint) {
        layerPaint.color = color;
        layerPaint.setMaskFilter(
          new sky.MaskFilter.blur(sky.BlurStyle.normal,
                                  blur,
                                  highQuality: true));
      });
  }

  sky.DrawLooper build() {
    builder_.addLayerOnTop(new sky.DrawLooperLayerInfo(), (_) {});
    return builder_.build();
  }
}

Fix crash in stocks2 app caused by unspecified PaintBits.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1182613002.


library hello_world.index;

import "package:angular2/bootstrap.dart" show AngularEntrypoint, bootstrap;
import "package:angular2/angular2.dart"
    show Component, Directive, ElementRef, Injectable, Renderer;

@AngularEntrypoint("Hello World Entrypoint")
main() {
  bootstrap(HelloCmp);
}

@Injectable()
class GreetingService {
  String greeting = "hello";
}

@Directive(selector: "[red]")
class RedDec {
  RedDec(ElementRef el, Renderer renderer) {
    renderer.setElementStyle(el, "color", "red");
  }
}

@Component(
    selector: "hello-app",
    viewProviders: const [GreetingService],
    template:
        '''
{{greeting}} world!

           <button class="changeButton" (click)="changeGreeting()">change greeting</button>''',
    directives: const [RedDec])
class HelloCmp {
  String greeting;
  HelloCmp(GreetingService service) {
    this.greeting = service.greeting;
  }
  void changeGreeting() {
    this.greeting = "howdy";
  }
}

library hello_world.index;

import "package:angular2/bootstrap.dart" show AngularEntrypoint, bootstrap;
import "package:angular2/angular2.dart"
    show Component, Directive, ElementRef, Injectable, Renderer;

@AngularEntrypoint("Hello World Entrypoint")
main() {
  bootstrap(HelloCmp);
}

@Injectable()
class GreetingService {
  String greeting = "hello";
}

@Directive(selector: "[red]")
class RedDec {
  RedDec(ElementRef el, Renderer renderer) {
    renderer.setElementStyle(el.nativeElement, "color", "red");
  }
}

@Component(
    selector: "hello-app",
    viewProviders: const [GreetingService],
    template:
        '''
{{greeting}} world!

           <button class="changeButton" (click)="changeGreeting()">change greeting</button>''',
    directives: const [RedDec])
class HelloCmp {
  String greeting;
  HelloCmp(GreetingService service) {
    this.greeting = service.greeting;
  }
  void changeGreeting() {
    this.greeting = "howdy";
  }
}

fix(dart/payload): Fix runtime error in hello_world payload app

The hello_world app used to measure Dart payload size was broken by a
change in
https://github.com/angular/angular/commit/7ae23adaff2990cf6022af9792c449730d451d1d.

This breakage does not materially affect the size of the generated code,
(before fix: 298819, after fix: 298825), and since it was a runtime
error it was not noticed & not a problem.

Update the app to work again.

Closes #7358


library keys;

import 'package:ctrl_alt_foo/shortcut.dart';
import 'package:ctrl_alt_foo/key_event_x.dart';

class Keys {
  static List subscriptions = [];

  static void shortcuts(Map shortcuts) {
    shortcuts.forEach((key, callback) {
      key.
        split(new RegExp(r'\s*,\s*')).
        forEach((k)=> new ShortCut.fromString(k, callback));
    });
  }

  static onEnter(el, callback) {
    var s = KeyboardEventStreamX.onKeyDown(el).listen((e) {
      if (!e.isEnter) return;
      e.preventDefault();
      callback();
    });
    subscriptions.add(s);
  }

  static bool isEnter(event) => new KeyEventX(event).isEnter;

  static onDown(el, callback) {
    var s = KeyboardEventStreamX.onKeyDown(el).listen((e) {
      if (!e.isDown) return;
      e.preventDefault();
      callback();
    });
    subscriptions.add(s);
  }

  static onUp(el, callback) {
    var s = KeyboardEventStreamX.onKeyDown(el).listen((e) {
      if (!e.isUp) return;
      e.preventDefault();
      callback();
    });
    subscriptions.add(s);
  }

  static cancel() {
    ShortCut.removeAll();
    Keys.removeAll();
  }

  static removeAll() {
    while (Keys.subscriptions.length > 0) {
      Keys.subscriptions.removeLast().cancel();
    }
  }
}

library keys;

import 'package:ctrl_alt_foo/shortcut.dart';
import 'package:ctrl_alt_foo/key_event_x.dart';

class Keys {
  static int _lastKeyCode;
  static set lastKeyCode(v) { _lastKeyCode = v; }
  static get lastKeyCode {
    print('Horrible hack. FIXME ASAP!!!!');
    return _lastKeyCode;
  }

  static List subscriptions = [];

  static void shortcuts(Map shortcuts) {
    shortcuts.forEach((key, callback) {
      key.
        split(new RegExp(r'\s*,\s*')).
        forEach((k)=> new ShortCut.fromString(k, callback));
    });
  }

  static onEnter(el, callback) {
    var s = KeyboardEventStreamX.onKeyDown(el).listen((e) {
      if (!e.isEnter) return;
      e.preventDefault();
      callback();
    });
    subscriptions.add(s);
  }

  static bool isEnter(event) => new KeyEventX(event).isEnter;

  static onDown(el, callback) {
    var s = KeyboardEventStreamX.onKeyDown(el).listen((e) {
      if (!e.isDown) return;
      e.preventDefault();
      callback();
    });
    subscriptions.add(s);
  }

  static onUp(el, callback) {
    var s = KeyboardEventStreamX.onKeyDown(el).listen((e) {
      if (!e.isUp) return;
      e.preventDefault();
      callback();
    });
    subscriptions.add(s);
  }

  static cancel() {
    ShortCut.removeAll();
    Keys.removeAll();
  }

  static removeAll() {
    while (Keys.subscriptions.length > 0) {
      Keys.subscriptions.removeLast().cancel();
    }
  }
}

Support a giant hack to store last keyCode

Until KeyEvent is fixed in Dart


// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import "dart:isolate";
import "package:unittest/unittest.dart";

Uri toDartDataUri(String source) {
  return Uri.parse("data:application/dart;charset=utf-8,"
      "${Uri.encodeComponent(source)}");
}

main() {
  test('Simple response', () {
    String source = """
import "dart:isolate";
main(List args, SendPort replyPort) {
  replyPort.send(42);
}
""";

    RawReceivePort receivePort;
    receivePort = new RawReceivePort(expectAsync((message) {
      expect(message, equals(42));
      receivePort.close();
    }));
    Isolate.spawnUri(toDartDataUri(source), [], receivePort.sendPort);
  });
}

// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import "dart:isolate";

import "package:async_helper/async_helper.dart";
import "package:expect/expect.dart";

Uri toDartDataUri(String source) {
  return Uri.parse("data:application/dart;charset=utf-8,"
      "${Uri.encodeComponent(source)}");
}

main() {
  String source = """
import "dart:isolate";
main(List args, SendPort replyPort) {
replyPort.send(42);
}
""";

  RawReceivePort receivePort;
  asyncStart();
  receivePort = new RawReceivePort((message) {
    Expect.equals(message, 42);
    receivePort.close();
    asyncEnd();
  });
  Isolate.spawnUri(toDartDataUri(source), [], receivePort.sendPort);
}

Migrate a VM test off the ancient deprecated unittest package.

Change-Id: Id2d408b87bc40af75899fbe0922ba523cbde148c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136022
Auto-Submit: Bob Nystrom <afede3a9ebedb865bee78398feff6fbe97068f17@google.com>
Reviewed-by: Leaf Petersen <9bef692239b5f624cec8e2cd5249ab1939a377aa@google.com>
Commit-Queue: Bob Nystrom <afede3a9ebedb865bee78398feff6fbe97068f17@google.com>


@TestOn('browser')
library angular2.test.symbol_inspector.symbol_inspector_test;

import 'dart:mirrors';

import 'symbol_inspector.dart';
import 'simple_library.dart';

import 'package:test/test.dart';

main() {
  group('getSymbolsFromLibrary', () {
    test('should extract symbols', () {
      var simpleLib = reflectClass(A).owner as LibraryMirror;
      var symbols = getSymbolsFromLibrary(simpleLib);
      expect(symbols, [
        'A',
        'ClosureParam',
        'ClosureReturn',
        'ConsParamType',
        'FieldType',
        'Generic',
        'GetterType',
        'MethodReturnType',
        'ParamType',
        'SomeInterface',
        'StaticFieldType',
        'TypedefParam',
        'TypedefReturnType'
      ]);
    });
  });
  group('ng2libs', () {
    test('should be available via mirrors', () {
      expect(commonLib.uri.toString(), 'package:angular2/common.dart');
      expect(compilerLib.uri.toString(), 'package:angular2/compiler.dart');
      expect(coreLib.uri.toString(), 'package:angular2/core.dart');
      expect(instrumentationLib.uri.toString(),
          'package:angular2/instrumentation.dart');
      expect(platformBrowserLib.uri.toString(),
          'package:angular2/platform/browser.dart');
      expect(platformCommonLib.uri.toString(),
          'package:angular2/platform/common.dart');
    });
  });
}

@TestOn('browser && !js')
library angular2.test.symbol_inspector.symbol_inspector_test;

import 'dart:mirrors';

import 'symbol_inspector.dart';
import 'simple_library.dart';

import 'package:test/test.dart';

main() {
  group('getSymbolsFromLibrary', () {
    test('should extract symbols', () {
      var simpleLib = reflectClass(A).owner as LibraryMirror;
      var symbols = getSymbolsFromLibrary(simpleLib);
      expect(symbols, [
        'A',
        'ClosureParam',
        'ClosureReturn',
        'ConsParamType',
        'FieldType',
        'Generic',
        'GetterType',
        'MethodReturnType',
        'ParamType',
        'SomeInterface',
        'StaticFieldType',
        'TypedefParam',
        'TypedefReturnType'
      ]);
    });
  });
  group('ng2libs', () {
    test('should be available via mirrors', () {
      expect(commonLib.uri.toString(), 'package:angular2/common.dart');
      expect(compilerLib.uri.toString(), 'package:angular2/compiler.dart');
      expect(coreLib.uri.toString(), 'package:angular2/core.dart');
      expect(instrumentationLib.uri.toString(),
          'package:angular2/instrumentation.dart');
      expect(platformBrowserLib.uri.toString(),
          'package:angular2/platform/browser.dart');
      expect(platformCommonLib.uri.toString(),
          'package:angular2/platform/common.dart');
    });
  });
}

Mark another test as not working with dart2js

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132199028


// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Test that different representations of the same string are all equal.

import "dart:convert";

import "package:expect/expect.dart";

main() {
  var base = "\u{10412}";
  var strings = [
    "\u{10412}",
    "𐐒",
    new String.fromCharCodes([0xd801, 0xdc12]),
    base[0] + base[1],
    "$base",
    "${base[0]}${base[1]}",
    "${base[0]}${base.substring(1)}",
    new String.fromCharCodes([0x10412]),
    ("a" + base).substring(1),
    (new StringBuffer()..writeCharCode(0xd801)
                       ..writeCharCode(0xdc12)).toString(),
    (new StringBuffer()..writeCharCode(0x10412)).toString(),
    JSON.decode('"\u{10412}"'),
    JSON.decode('{"\u{10412}":[]}').keys.first
  ];
  for (String string in strings) {
    Expect.equals(base.length, string.length);
    Expect.equals(base, string);
    Expect.equals(base.hashCode, string.hashCode);
    Expect.listEquals(base.codeUnits.toList(), string.codeUnits.toList());
  }
}

// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Test that different representations of the same string are all equal.

import "dart:convert";

import "package:expect/expect.dart";

main() {
  var base = "\u{10412}";
  var strings = [
    "\u{10412}",
    "𐐒",
    new String.fromCharCodes([0xd801, 0xdc12]),
    base[0] + base[1],
    "$base",
    "${base[0]}${base[1]}",
    "${base[0]}${base.substring(1)}",
    new String.fromCharCodes([0x10412]),
    ("a" + base).substring(1),
    (new StringBuffer()..writeCharCode(0xd801)
                       ..writeCharCode(0xdc12)).toString(),
    (new StringBuffer()..writeCharCode(0x10412)).toString(),
    JSON.decode('"\u{10412}"'),
    (JSON.decode('{"\u{10412}":[]}') as Map).keys.first
  ];
  for (String string in strings) {
    Expect.equals(base.length, string.length);
    Expect.equals(base, string);
    Expect.equals(base.hashCode, string.hashCode);
    Expect.listEquals(base.codeUnits.toList(), string.codeUnits.toList());
  }
}

Fix test to not assume that JSON.decode returns dynamic.

It currently returns Object.
I have CL to make it do that again, but it's open for discussion.

Review URL: https://codereview.chromium.org//52353002

git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@29527 260f80e4-7a28-3924-810f-c04153c831b5


part of angular.mock;

@proxy
class MockWindow extends Mock implements Window {
  final history = new MockHistory();
  final location = new MockLocation();
  final document = new MockDocument();

  final onPopStateController = new dart_async.StreamController<PopStateEvent>();
  final onHashChangeController = new dart_async.StreamController<Event>();
  final onClickController = new dart_async.StreamController<MouseEvent>();

  dart_async.Stream<PopStateEvent> get onPopState => onPopStateController.stream;
  dart_async.Stream<Event> get onHashChange => onHashChangeController.stream;
  dart_async.Stream<Event> get onClick => onClickController.stream;
  dart_async.Future<num> get animationFrame => animationFrameCompleter.future;

  executeAnimationFrame([num time=0.0]) {
    var last = animationFrameCompleter;
    animationFrameCompleter = new dart_async.Completer<num>();
    last.complete(time);
  }

  noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

@proxy
class MockHistory extends Mock implements History {
  noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

@proxy
class MockLocation extends Mock implements Location {
  noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

@proxy
class MockDocument extends Mock implements HtmlDocument {
  noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

part of angular.mock;

@proxy
class MockWindow extends Mock implements Window {
  final history = new MockHistory();
  final location = new MockLocation();
  final document = new MockDocument();

  final onPopStateController = new dart_async.StreamController<PopStateEvent>();
  final onHashChangeController = new dart_async.StreamController<Event>();
  final onClickController = new dart_async.StreamController<MouseEvent>();

  var animationFrameCompleter = new dart_async.Completer<num>();

  dart_async.Stream<PopStateEvent> get onPopState => onPopStateController.stream;
  dart_async.Stream<Event> get onHashChange => onHashChangeController.stream;
  dart_async.Stream<Event> get onClick => onClickController.stream;
  dart_async.Future<num> get animationFrame => animationFrameCompleter.future;

  executeAnimationFrame([num time=0.0]) {
    var last = animationFrameCompleter;
    animationFrameCompleter = new dart_async.Completer<num>();
    last.complete(time);
  }

  noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

@proxy
class MockHistory extends Mock implements History {
  noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

@proxy
class MockLocation extends Mock implements Location {
  noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

@proxy
class MockDocument extends Mock implements HtmlDocument {
  noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

Fix unitialized variable in MockWindow.

fix(mock): Fix unitialized variable in MockWindow.


// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'basic.dart';
import 'button_base.dart';
import 'ink_well.dart';
import 'material.dart';
import 'theme.dart';

// TODO(eseidel): This needs to change based on device size?
// http://www.google.com/design/spec/layout/metrics-keylines.html#metrics-keylines-keylines-spacing
const double _kSize = 56.0;

class FloatingActionButton extends ButtonBase {

  FloatingActionButton({
    String key,
    this.child,
    Function onPressed
  }) : super(key: key);

  Widget child;
  Function onPressed;

  void syncFields(FloatingActionButton source) {
    super.syncFields(source);
    child = source.child;
    onPressed = source.onPressed;
  }

  Widget buildContent() {
    return new Material(
      color: Theme.of(this).accent[200],
      edge: MaterialEdge.circle,
      level: highlight ? 3 : 2,
      child: new ClipOval(
        child: new Listener(
          onGestureTap: (_) {
            if (onPressed != null)
              onPressed();
          },
          child: new Container(
            width: _kSize,
            height: _kSize,
            child: new InkWell(child: new Center(child: child))
          )
        )
      )
    );
  }

}

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'basic.dart';
import 'button_base.dart';
import 'ink_well.dart';
import 'material.dart';
import 'theme.dart';

// TODO(eseidel): This needs to change based on device size?
// http://www.google.com/design/spec/layout/metrics-keylines.html#metrics-keylines-keylines-spacing
const double _kSize = 56.0;

class FloatingActionButton extends ButtonBase {

  FloatingActionButton({
    String key,
    this.child,
    this.onPressed
  }) : super(key: key);

  Widget child;
  Function onPressed;

  void syncFields(FloatingActionButton source) {
    super.syncFields(source);
    child = source.child;
    onPressed = source.onPressed;
  }

  Widget buildContent() {
    return new Material(
      color: Theme.of(this).accent[200],
      edge: MaterialEdge.circle,
      level: highlight ? 3 : 2,
      child: new ClipOval(
        child: new Listener(
          onGestureTap: (_) {
            if (onPressed != null)
              onPressed();
          },
          child: new Container(
            width: _kSize,
            height: _kSize,
            child: new InkWell(child: new Center(child: child))
          )
        )
      )
    );
  }

}

Make FloatingActionButton respect the onPressed ctor arg.

BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1210923003.


Make it fast to draw color icons


import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

import '../../features/activity/presentation/bloc/activity_bloc.dart';
import '../helpers/color_palette_helper.dart';

class ServerHeader extends StatelessWidget {
  final String serverName;
  final ActivityLoadingState state;

  const ServerHeader({
    Key key,
    @required this.serverName,
    this.state,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(
        left: 8,
        top: 8,
        bottom: 8,
      ),
      child: Row(
        children: <Widget>[
          Text(
            serverName,
            style: TextStyle(
              fontSize: 18,
              fontWeight: FontWeight.w600,
              color: Theme.of(context).accentColor,
            ),
          ),
          if (state == ActivityLoadingState.inProgress)
            Padding(
              padding: const EdgeInsets.only(left: 4),
              child: SizedBox(
                height: 15,
                width: 15,
                child: CircularProgressIndicator(
                  strokeWidth: 2,
                ),
              ),
            ),
          if (state == ActivityLoadingState.failure)
            Padding(
              padding: const EdgeInsets.only(left: 4),
              child: FaIcon(
                FontAwesomeIcons.exclamationCircle,
                size: 15,
                color: TautulliColorPalette.not_white,
              ),
            ),
        ],
      ),
    );
  }
}

import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

import '../../features/activity/presentation/bloc/activity_bloc.dart';
import '../helpers/color_palette_helper.dart';

class ServerHeader extends StatelessWidget {
  final String serverName;
  final ActivityLoadingState state;

  const ServerHeader({
    Key key,
    @required this.serverName,
    this.state,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(
        left: 8,
        top: 8.2,
        bottom: 12.5,
      ),
      child: Row(
        children: <Widget>[
          Text(
            serverName,
            style: TextStyle(
              fontSize: 18,
              fontWeight: FontWeight.w600,
              color: Theme.of(context).accentColor,
            ),
          ),
          if (state == ActivityLoadingState.inProgress)
            Padding(
              padding: const EdgeInsets.only(left: 4),
              child: SizedBox(
                height: 15,
                width: 15,
                child: CircularProgressIndicator(
                  strokeWidth: 2,
                ),
              ),
            ),
          if (state == ActivityLoadingState.failure)
            Padding(
              padding: const EdgeInsets.only(left: 4),
              child: FaIcon(
                FontAwesomeIcons.exclamationCircle,
                size: 15,
                color: TautulliColorPalette.not_white,
              ),
            ),
        ],
      ),
    );
  }
}

Adjust server header padding to match dropdowns.

Implements #45


part of irc.bot;

class DumbBot extends Bot {
  Client _client;
  List<String> channels = [];

  DumbBot(BotConfig config) {
    _client = new Client(config);
    _registerHandlers();
  }

  void _registerHandlers() {
    whenReady((ReadyEvent event) => channels.forEach((chan) => event.join(chan)));

    onMessage((MessageEvent event) => print("<${event.target}><${event.from}> ${event.message}"));
  }

  @override
  Client client() => _client;
}

part of irc.bot;

class DumbBot extends Bot {
  Client _client;
  List<String> channels = [];

  DumbBot(BotConfig config) {
    _client = new Client(config);
    _registerHandlers();
  }

  void _registerHandlers() {
    register((ReadyEvent event) => channels.forEach((chan) => event.join(chan)));

    register((MessageEvent event) => print("<${event.target}><${event.from}> ${event.message}"));
  }

  @override
  Client client() => _client;
}

Fix Dumb Bot for the new Event System (it was left out)


import 'package:unittest/unittest.dart';
import 'package:workmantrainer/textmarker.dart';

void main() {
  test('check initialisation of TextMarker Class works.', () {
    var tm = new TextMarker('some text',0,2,"CORRECT");
    expect(tm.targettext, 'some text');
    expect(tm.startposition,0);
    expect(tm.endposition,2);
    expect(tm.textState, 'CORRECT');
  });
  test('typedCorrectly returns correct span element.', () {
    var tm = new TextMarker('some text', 0, 2, "CORRECT");
    var span = tm.typedCorrectly();
    expect(span.text, 'so');
    expect(span.className, 'typedcorrect');
  });
}

import 'package:unittest/unittest.dart';
import 'package:workmantrainer/textmarker.dart';

void main() {
  test('check initialisation of TextMarker Class works.', () {
    var tm = new TextMarker('some text',0,2,"CORRECT");
    expect(tm.targettext, 'some text');
    expect(tm.startposition,0);
    expect(tm.endposition,2);
    expect(tm.textState, 'CORRECT');
  });
  test('typedCorrectly returns correct span element.', () {
    var tm = new TextMarker('some text', 0, 2, "CORRECT");
    var span = tm.typedCorrectly();
    expect(span.text, 'so');
    expect(span.className, 'typedcorrect');
  });
  test('typedIncorrectly returns correct span element.', () {
    var tm = new TextMarker('some text', 0, 9, "INCORRECT");
    var span = tm.typedIncorrectly();
    expect(span.text, 'some text');
    expect(span.className, 'typedincorrect');
  });
  test('yetToBeTyped returns correct span element.', () {
    var tm = new TextMarker('some text', 0,1,'NOTTYPED');
    var span = tm.yetToBeTyped();
    expect(span.text, 's');
    expect(span.className, 'nottyped');
  });
}

Add tests for remaining span elements.

Add tests for remaining span elements.


// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import "package:expect/expect.dart";
import "dart:async";
import "dart:io";
import "dart:isolate";

void testPauseList() {
  var keepAlive = new ReceivePort();
  new Directory("").createTemp().then((d) {
    // Linux reads 2K at a time, so be sure to be >>.
    int total = 4 * 1024 + 1;
    for (int i = 0; i < total; i++) {
      new File("${d.path}/$i").createSync();
    }
    bool first = true;
    var subscription;
    int count = 0;
    subscription = d.list().listen((file) {
      if (first) {
        first = false;
        subscription.pause();
        Timer.run(() {
          for (int i = 0; i < total; i++) {
            new File("${d.path}/$i").deleteSync();
          }
          subscription.resume();
        });
      }
      count++;
    }, onDone: () {
      Expect.notEquals(total, count);
      keepAlive.close();
      d.delete().then((ignore) => keepAlive.close());
    });
  });
}

void main() {
  testPauseList();
}

// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import "package:expect/expect.dart";
import "dart:async";
import "dart:io";
import "dart:isolate";

void testPauseList() {
  var keepAlive = new ReceivePort();
  // TOTAL should be bigger the our directory listing buffer.
  const int TOTAL = 128;
  new Directory("").createTemp().then((d) {
    for (int i = 0; i < TOTAL; i++) {
      new Directory("${d.path}/$i").createSync();
      new File("${d.path}/$i/file").createSync();
    }
    bool first = true;
    var subscription;
    int count = 0;
    subscription = d.list(recursive: true).listen((file) {
      if (file is File) {
        if (first) {
          first = false;
          subscription.pause();
          Timer.run(() {
            for (int i = 0; i < TOTAL; i++) {
              new File("${d.path}/$i/file").deleteSync();
            }
            subscription.resume();
          });
        }
        count++;
      }
    }, onDone: () {
      Expect.notEquals(TOTAL, count);
      Expect.isTrue(count > 0);
      keepAlive.close();
      d.delete(recursive: true).then((ignore) => keepAlive.close());
    });
  });
}

void main() {
  testPauseList();
}

Use directories with content, to avoid very large folder and flakyness.

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//16825003

git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@24124 260f80e4-7a28-3924-810f-c04153c831b5


/*
 * Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
 * for details. All rights reserved. Use of this source code is governed by a
 * BSD-style license that can be found in the LICENSE file.
 */
/**
 * @assertion Uint32x4 toUint32x4()
 * Returns a bit-wise copy of this as a Uint32x4.
 * @description Checks special cases.
 * @author msyabro
 */

import "dart:typed_data";
import "../../../Utils/expect.dart";

main() {
  var obj = new Float32x4(double.INFINITY, double.NEGATIVE_INFINITY, double.NAN, -double.NAN);
  var res = obj.toUint32x4();

  Expect.equals(0x7f800000, res.x);
  Expect.equals(0xff800000, res.y);
  Expect.equals(0xffc00000, res.z);
  Expect.equals(0xffc00000, res.w);
}

/*
 * Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
 * for details. All rights reserved. Use of this source code is governed by a
 * BSD-style license that can be found in the LICENSE file.
 */
/**
 * @assertion Uint32x4 toUint32x4()
 * Returns a bit-wise copy of this as a Uint32x4.
 * @description Checks special cases.
 * @author msyabro
 */

import "dart:typed_data";
import "../../../Utils/expect.dart";

main() {
  var obj = new Float32x4(double.INFINITY, double.NEGATIVE_INFINITY, double.NAN, -double.NAN);
  var res = obj.toUint32x4();

  Expect.equals(0x7f800000, res.x);
  Expect.equals(0xff800000, res.y);

  var nanMask = 0x7f800000;
  var fraction = 0x7fffff;
  Expect.equals(nanMask, res.z & nanMask);
  Expect.isTrue((res.z & fraction) != 0);
  Expect.equals(nanMask, res.w & nanMask);
  Expect.isTrue((res.w & fraction) != 0);
}

Fix the NaN check (issue 551)

Fix the NaN check (issue 551)

git-svn-id: 38feb1729fd842af57e1a6ea8a5dccce4272ed9b@569 2ecb45c1-dfb3-dc95-330a-13f216d23a04


// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#library('XHRCrossOriginTest');
#import('../../lib/unittest/unittest.dart');
#import('../../lib/unittest/html_config.dart');
#import('dart:html');
#import('dart:json');

main() {
  useHtmlConfiguration();

  test('XHR Cross-domain', () {
    var xhr = new XMLHttpRequest();
    var url = "https://code.google.com/feeds/issues/p/dart/issues/full?alt=json";
    xhr.open('GET', url, true);
    var validate = expectAsync1((data) {
      expect(data, contains('feed'));
      expect(data['feed'], contains('entry'));
      expect(data is Map, isTrue);
    });
    xhr.on.readyStateChange.add((e) {
      guardAsync(() {
        if (xhr.readyState == XMLHttpRequest.DONE) {
          validate(JSON.parse(xhr.response));
        }
      });
    });
    xhr.send();
  });

  test('XHR.get Cross-domain', () {
    var url = "https://code.google.com/feeds/issues/p/dart/issues/full?alt=json";
    new XMLHttpRequest.get(url, expectAsync1((xhr) {
      var data = JSON.parse(xhr.response);
      expect(data, contains('feed'));
      expect(data['feed'], contains('entry'));
      expect(data is Map, isTrue);
    }));
  });
}

// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#library('XHRCrossOriginTest');
#import('../../pkg/unittest/unittest.dart');
#import('../../pkg/unittest/html_config.dart');
#import('dart:html');
#import('dart:json');

main() {
  useHtmlConfiguration();

  test('XHR Cross-domain', () {
    var xhr = new XMLHttpRequest();
    var url = "https://code.google.com/feeds/issues/p/dart/issues/full?alt=json";
    xhr.open('GET', url, true);
    var validate = expectAsync1((data) {
      expect(data, contains('feed'));
      expect(data['feed'], contains('entry'));
      expect(data is Map, isTrue);
    });
    xhr.on.readyStateChange.add((e) {
      guardAsync(() {
        if (xhr.readyState == XMLHttpRequest.DONE) {
          validate(JSON.parse(xhr.response));
        }
      });
    });
    xhr.send();
  });

  test('XHR.get Cross-domain', () {
    var url = "https://code.google.com/feeds/issues/p/dart/issues/full?alt=json";
    new XMLHttpRequest.get(url, expectAsync1((xhr) {
      var data = JSON.parse(xhr.response);
      expect(data, contains('feed'));
      expect(data['feed'], contains('entry'));
      expect(data is Map, isTrue);
    }));
  });
}

Fix missed spot for move of unittest from lib to pkg.
TBR=rnystrom

git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@10689 260f80e4-7a28-3924-810f-c04153c831b5


/* Bot Abstraction */
library irc.bot;

import 'package:irc/irc.dart';
import 'dart:async';
import 'dart:io';

part 'src/bot/dumbbot.dart';
part "src/bot/commandbot.dart";
part 'src/bot/base.dart';
part 'src/bot/logbot.dart';

/* Bot Abstraction */
library irc.bot;

import 'package:irc/irc.dart';
import 'dart:async';
import 'dart:io';

part 'src/bot/dumbbot.dart';
part 'src/bot/commandbot.dart';
part 'src/bot/base.dart';
part 'src/bot/logbot.dart';

Use single quote for part/import statements


import 'package:codemod/codemod.dart';

/// The latest version of riverpod that migrated code should be updated to
// TODO add a test that this version is up-to-date
const latestVersion = '1.0.0-dev.10';

/// Migrates the pubspec to the [latestVersion]
Stream<Patch> versionMigrationSuggestor(FileContext context) async* {
  final matches = RegExp(
          r'riverpod:\s+\^?([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?')
      .allMatches(context.sourceText);
  for (final m in matches) {
    yield Patch('riverpod: ^$latestVersion', m.start, m.end);
  }
}

import 'package:codemod/codemod.dart';

/// The latest version of riverpod that migrated code should be updated to
// TODO add a test that this version is up-to-date
const latestVersion = '1.0.0';

/// Migrates the pubspec to the [latestVersion]
Stream<Patch> versionMigrationSuggestor(FileContext context) async* {
  final matches = RegExp(
          r'riverpod:\s+\^?([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?')
      .allMatches(context.sourceText);
  for (final m in matches) {
    yield Patch('riverpod: ^$latestVersion', m.start, m.end);
  }
}

Make migration update to 1.0.0

Make migration update to 1.0.0


import 'package:jael_web/jael_web.dart';
import 'package:jael_web/elements.dart';
part 'main.g.dart';

@Dsx(template: '''

Hello, Jael!

  Current time: {now}

''')
class Hello extends Component with _HelloJaelTemplate {
  DateTime get now => DateTime.now();
}

// Could also have been:
class Hello2 extends Component {
  DateTime get now => DateTime.now();

  @override
  DomNode render() {
    return div(c: [
      h1(c: [
        text('Hello, Jael!'),
      ]),
      i(c: [
        text('Current time: $now'),
      ]),
    ]);
  }
}

import 'package:jael_web/jael_web.dart';
import 'package:jael_web/elements.dart';
part 'main.g.dart';

@Jael(template: '''

Hello, Jael!

  Current time: {{now}}

''')
class Hello extends Component with _HelloJaelTemplate {
  DateTime get now => DateTime.now();
}

// Could also have been:
class Hello2 extends Component {
  DateTime get now => DateTime.now();

  @override
  DomNode render() {
    return div(c: [
      h1(c: [
        text('Hello, Jael!'),
      ]),
      i(c: [
        text('Current time: $now'),
      ]),
    ]);
  }
}

Use Jael in example 1

Use Jael in example 1


part of image;

/**
 * Apply a smoothing convolution filter to the [src] image.
 *
 * [w] is the weight of the current pixel being filtered.  If it's greater than
 * 1.0, it will make the image sharper.
 */
Image smooth(Image src, num w) {
  List<double> filter = [
    1.0, 1.0, 1.0,
    1.0, w,   1.0,
    1.0, 1.0, 1.0];

  return convolution(src, filter, w + 8, 0);
}

part of image;

/**
 * Apply a smoothing convolution filter to the [src] image.
 *
 * [w] is the weight of the current pixel being filtered.  If it's greater than
 * 1.0, it will make the image sharper.
 */
Image smooth(Image src, num w) {
  List<double> filter = [
    1.0, 1.0, 1.0,
    1.0, w.toDouble(),   1.0,
    1.0, 1.0, 1.0];

  return convolution(src, filter, w + 8, 0);
}

Fix a Dart 2 runtime failure

Fix a Dart 2 runtime failure


// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library 4740_library;

class Foo {
  Foo._internal();
}

// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library _4740_library;

class Foo {
  Foo._internal();
}

TBR: Fix library name cauisng build break.
Review URL: https://codereview.chromium.org//11358185

git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@14753 260f80e4-7a28-3924-810f-c04153c831b5


// Before blank line

// After blank line

/// This is my class.
class MyClass {
  /// This is my num field.
  num myNumField;

  /// This is my num getter.
  num get myNumGetter => 1;

  /// This is my num setter.
  set myNumSetter(num value) {}

  /// This is my class constructor.
  MyClass();

  /// This is my class named constructor.
  MyClass.myNamed();

  /// This is my void returning method.
  void myVoidReturningMethod() {}

  /// This is my string returning method.
  String myStringReturningMethod() {
    return "";
  }

  /// This is my method taking a string.
  void methodTakingString(String a) {}

  /// This is my method taking a function.
  void methodTakingFunction(int Function(String) myFunc) {}
}

void doSomeStuff() {
  var a = new MyClass();
  var b = new MyClass.myNamed();
  print(a.myNumField);
  print(a.myNumGetter);
  a.myNumSetter = 1;
  print(b.myStringReturningMethod());
  b.myVoidReturningMethod();
  b.methodTakingString("Hello");
  b.methodTakingFunction((s) => print(s));
}

// Before blank line

// After blank line

/// This is my class.
class MyClass {
  /// This is my num field.
  num myNumField;

  /// This is my num getter.
  num get myNumGetter => 1;

  /// This is my num setter.
  set myNumSetter(num value) {}

  /// This is my class constructor.
  MyClass();

  /// This is my class named constructor.
  MyClass.myNamed();

  /// This is my void returning method.
  void myVoidReturningMethod() {}

  /// This is my string returning method.
  String myStringReturningMethod() {
    return "";
  }

  /// This is my method taking a string.
  void methodTakingString(String a) {}

  /// This is my method taking a function.
  void methodTakingFunction(void Function(String) myFunc) {}
}

void doSomeStuff() {
  var a = new MyClass();
  var b = new MyClass.myNamed();
  print(a.myNumField);
  print(a.myNumGetter);
  a.myNumSetter = 1;
  print(b.myStringReturningMethod());
  b.myVoidReturningMethod();
  b.methodTakingString("Hello");
  b.methodTakingFunction((s) => print(s));
}

Fix static error - Dart 2 symantics

Fix static error - Dart 2 symantics


// Copyright (c) 2016, <your name>. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library markov.example;

import 'dart:convert';
import 'dart:io';

import 'package:markov/markov.dart';

main() async {
  print("Provide source text by stdin. For best result, provide a large number "
      "of tweets, one per line.\n\n"
      "  \$ dart stdin_example.dart < tweets.txt\n"
      "  Here's your generated tweet.");

  // List<String> lines = await stdin
  //     .transform(new Utf8Decoder())
  //     .transform(new LineSplitter())
  //     .fold([], (List prev, next) {
  //   prev.add(next);
  //   return prev;
  // });
  //
  // // Chunked conversion is currently unimplemented, otherwise we could just
  // // use another `transform()` above.
  // MarkovChain chain = new MarkovConverter(2).convert(lines);

  // Take POSIX standard input stream (or any other byte
  // stream) and use it as source text.
  var chain = await stdin
      .transform(new Utf8Decoder())
      .transform(new LineSplitter())
      .pipe(new MarkovChainGenerator(2));

  // Take just one tweet worth of generated content (terminated by a newline).
  List<Token> tokens =
      chain.generate().takeWhile((token) => token.string != "\n").toList();

  print(format(tokens));
}

// Copyright (c) 2016, <your name>. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library markov.example;

import 'dart:convert';
import 'dart:io';

import 'package:markov/markov.dart';

main() async {
  print("Provide source text by stdin. For best result, provide a large number "
      "of tweets, one per line.\n\n"
      "  \$ dart stdin_example.dart < tweets.txt\n"
      "  Here's your generated tweet.");

  // Take POSIX standard input stream (or any other byte
  // stream) and use it as source text.
  var chain = await stdin
      .transform(new Utf8Decoder())
      .transform(new LineSplitter())
      .pipe(new MarkovChainGenerator(2));

  // Take just one tweet worth of generated content (terminated by a newline).
  List<Token> tokens =
      chain.generate().takeWhile((token) => token.string != "\n").toList();

  print(format(tokens));
}

Remove dead commented out code.

Remove dead commented out code.


// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';

// This library contains a member loadLibrary.
// Check that we shadow this member.
import "deferred_closurize_load_library_lib.dart" deferred as lib;

void main() {
  var x = lib.loadLibrary;
  asyncStart();
  x().then((_) {
    Expect.isTrue(lib.trueVar);
    asyncEnd();
  });
}

// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';

import "deferred_closurize_load_library_lib.dart" deferred as lib;

void main() {
  var x = lib.loadLibrary;
  asyncStart();
  x().then((_) {
    Expect.isTrue(lib.trueVar);
    asyncEnd();
  });
}

Remove spurious comment in test.

dart2js: Remove spurious comment in test.

R=sigurdm@google.com

Review URL: https://codereview.chromium.org//632633002

git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@40925 260f80e4-7a28-3924-810f-c04153c831b5


import 'package:flutter/material.dart';

void main() => runApp(MyBrokenApp());

class MyBrokenApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: MyBrokenHomePage(),
    );
  }
}

class MyBrokenHomePage extends StatelessWidget {
  MyBrokenHomePage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    _throwAnException();
    return Text("test");
  }

  void _throwAnException() {
    throw Exception("Oops");
  }
}

import 'dart:async';

import 'package:flutter/material.dart';

void main() => runApp(MyBrokenApp());

class MyBrokenApp extends StatefulWidget {
  @override
  _MyBrokenAppState createState() => _MyBrokenAppState();
}

class _MyBrokenAppState extends State<MyBrokenApp> {
  bool shouldBeBroken = false;

  @override
  void initState() {
    super.initState();

    // Enabling structured errors has a race - we can't enable it until the app
    // is running, but if we throw an exception immediately, it may occur before
    // structured errors was enabled. So, this app waits 2 seconds before switching
    // to a widget that throws, to allow any startup things like this to occur first.
    new Timer(
      const Duration(seconds: 2),
      () => setState(() => shouldBeBroken = true),
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: shouldBeBroken ? MyBrokenHomePage() : MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Text("test");
  }
}

class MyBrokenHomePage extends StatelessWidget {
  MyBrokenHomePage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    _throwAnException();
    return Text("test");
  }

  void _throwAnException() {
    throw Exception("Oops");
  }
}

Fix a race in structured errors tests

Fix a race in structured errors tests


enum HeadPhoneStrategy { none, pauseOnUnplug, pauseOnUnplugPlayOnPlug }

String describeHeadPhoneStrategy(HeadPhoneStrategy strategy) {
  switch (strategy) {
    case HeadPhoneStrategy.none:
      return "none";
    case HeadPhoneStrategy.pauseOnUnplug:
      return "pauseOnUnplug";
    case HeadPhoneStrategy.pauseOnUnplugPlayOnPlug:
      return "pauseOnUnplugPlayOnPlug";
  }
  return null;
}

class AudioFocusStrategy {
  final bool request;
  final bool resumeAfterInterruption;
  final bool resumeOthersPlayersAfterDone;

  /***
   * Don't request focus
   */
  AudioFocusStrategy.none()
      : this.request = false,
        this.resumeAfterInterruption = false,
        this.resumeOthersPlayersAfterDone = false;

  /***
   * Request focus
   *
   * resumeAfterInterruption : When other app request focus (phone call, other player like spotify play), pause the AssetMediaPlayer
   * resumeOthersPlayersAfterDone : When this player finish to play, tell others native players (like spotify), to resume
   */
  const AudioFocusStrategy.request(
      {this.resumeAfterInterruption = false,
      this.resumeOthersPlayersAfterDone = false})
      : this.request = true;
}

Map<String, dynamic> describeAudioFocusStrategy(AudioFocusStrategy strategy) {
  return {
    "request": strategy.request,
    "resumeAfterInterruption": strategy.resumeAfterInterruption,
    "resumeOthersPlayersAfterDone": strategy.resumeOthersPlayersAfterDone,
  };
}

enum HeadPhoneStrategy { none, pauseOnUnplug, pauseOnUnplugPlayOnPlug }

String describeHeadPhoneStrategy(HeadPhoneStrategy strategy) {
  switch (strategy) {
    case HeadPhoneStrategy.none:
      return "none";
    case HeadPhoneStrategy.pauseOnUnplug:
      return "pauseOnUnplug";
    case HeadPhoneStrategy.pauseOnUnplugPlayOnPlug:
      return "pauseOnUnplugPlayOnPlug";
  }
  return null;
}

class AudioFocusStrategy {
  final bool request;
  final bool resumeAfterInterruption;
  final bool resumeOthersPlayersAfterDone;

  /// Don't request focus
  AudioFocusStrategy.none()
      : this.request = false,
        this.resumeAfterInterruption = false,
        this.resumeOthersPlayersAfterDone = false;

  /// Request focus
  ///
  /// resumeAfterInterruption : When other app request focus (phone call, other player like spotify play), pause the AssetMediaPlayer
  ///
  /// resumeOthersPlayersAfterDone : When this player finish to play, tell others native players (like spotify), to resume
  const AudioFocusStrategy.request(
      {this.resumeAfterInterruption = false,
      this.resumeOthersPlayersAfterDone = false})
      : this.request = true;
}

Map<String, dynamic> describeAudioFocusStrategy(AudioFocusStrategy strategy) {
  return {
    "request": strategy.request,
    "resumeAfterInterruption": strategy.resumeAfterInterruption,
    "resumeOthersPlayersAfterDone": strategy.resumeOthersPlayersAfterDone,
  };
}

Correct pub.dev static analysis issues

Correct pub.dev static analysis issues


library ddrive.src.commands.init;

import 'package:unscripted/unscripted.dart';
import 'package:googleapis/drive/v2.dart' as drive;
import 'package:path/path.dart' as path;

import '../context.dart' as context;

class InitCommand {

  @SubCommand(help: 'Gets the quota information about the current user')
  init({ @Option(help: 'The root directory for Google Drive. Defaults to your current directory') String driveHome }) async {
    String p = driveHome == null || driveHome.isEmpty ? path.current : driveHome; //path ? path : path.current;
    bool firstTime = ! await context.credentialsExist(p);
    context.askForAuthorization(p);
  }
}

library ddrive.src.commands.init;

import 'package:unscripted/unscripted.dart';
import 'package:googleapis/drive/v2.dart' as drive;
import 'package:path/path.dart' as path;

import '../context.dart' as context;

class InitCommand {

  @SubCommand(help: 'Initialize a Google Drive home directory')
  init({ @Option(help: 'The root directory for Google Drive. Defaults to your current directory') String driveHome }) async {
    String p = driveHome == null || driveHome.isEmpty ? path.current : driveHome; //path ? path : path.current;
    bool firstTime = ! await context.credentialsExist(p);
    context.askForAuthorization(p);
  }
}

Refactor and clean up code

Refactor and clean up code


// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:analyzer/src/error/codes.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

import '../dart/resolution/driver_resolution.dart';

main() {
  defineReflectiveSuite(() {
    defineReflectiveTests(RecursiveCompileTimeConstantTest);
  });
}

@reflectiveTest
class RecursiveCompileTimeConstantTest extends DriverResolutionTest {
  test_private() async {
    await assertErrorsInCode('''
f({var _p}) {}
''', [
      error(CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER, 3, 6),
    ]);
  }

  test_fieldFormal() async {
    await assertErrorsInCode(r'''
class A {
  var _p;
  A({this._p: 0});
}
''', [
      error(HintCode.UNUSED_FIELD, 16, 2),
      error(CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER, 25, 7),
    ]);
  }

  test_withDefaultValue() async {
    await assertErrorsInCode('''
f({_p : 0}) {}
''', [
      error(CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER, 3, 2),
    ]);
  }
}

// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:analyzer/src/error/codes.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

import '../dart/resolution/driver_resolution.dart';

main() {
  defineReflectiveSuite(() {
    defineReflectiveTests(PrivateOptionalParameterTest);
  });
}

@reflectiveTest
class PrivateOptionalParameterTest extends DriverResolutionTest {
  test_private() async {
    await assertErrorsInCode('''
f({var _p}) {}
''', [
      error(CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER, 3, 6),
    ]);
  }

  test_fieldFormal() async {
    await assertErrorsInCode(r'''
class A {
  var _p;
  A({this._p: 0});
}
''', [
      error(HintCode.UNUSED_FIELD, 16, 2),
      error(CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER, 25, 7),
    ]);
  }

  test_withDefaultValue() async {
    await assertErrorsInCode('''
f({_p : 0}) {}
''', [
      error(CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER, 3, 2),
    ]);
  }
}

Rename an incorrectly named test class

Rename an incorrectly named test class

Change-Id: I40cdb290cea7beaffa68d5f21f1e340e7086a857
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138603
Reviewed-by: Konstantin Shcheglov <09e4d7516628963212bf4aace2f97603d2b706e4@google.com>
Commit-Queue: Brian Wilkerson <1f7641b6b14c52b9163524ab8d9aabff80176f21@google.com>


import 'dart:io';
import 'dart:convert';

/// This script reads the JSON object from the file at args[0] and
/// adds data to it from the environment.  Args[1] should be the timestamp
/// (as epoch seconds) of the current Git commit being tested.
void main(List<String> args) {
  Map<String, dynamic> map = jsonDecode(File(args[0]).readAsStringSync());
  final env = Platform.environment;
  map['commit_hash'] = env['BUILDBOT_REVISION'];
  map['commit_time'] = args[1];
  map['builder_name'] = env['SWARMING_BOT_ID'];
  map['bot_name'] = env['BUILDBOT_BUILDERNAME'];
  File(args[0]).writeAsStringSync(jsonEncode(map));
}

import 'dart:io';
import 'dart:convert';

/// This script reads the JSON object from the file at args[0] and
/// adds data to it from the environment.  Args[1] should be the timestamp
/// (as epoch seconds) of the current Git commit being tested.
/// Args[2] should be the hash of the current Git commit under test.
void main(List<String> args) {
  Map<String, dynamic> map = jsonDecode(File(args[0]).readAsStringSync());
  final env = Platform.environment;
  map['commit_time'] = args[1];
  map['commit_hash'] = args[2];
  map['builder_name'] = env['SWARMING_BOT_ID'];
  map['bot_name'] = env['BUILDBOT_BUILDERNAME'];
  File(args[0]).writeAsStringSync(jsonEncode(map));
}

Add commit hash to results upload on builders

Change-Id: I395ea68d7c6f7f45d665279e3dbc0b4f60d3ac1c
Reviewed-on: https://dart-review.googlesource.com/74624
Reviewed-by: Martin Kustermann <a35dd5b79fac84b2bb3b026a16b8becc55af5961@google.com>
Reviewed-by: Jonas Termansen <092ec58085ae5e368bc39d18752740ff81a2d09c@google.com>


// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/**
 * This contains a reader that accesses data from local files, so it can't
 * be run in the browser.
 */

library file_data_reader;

import 'dart:io';
import 'intl_helpers.dart';

class FileDataReader implements LocaleDataReader {

  /// The base path from which we will read data.
  String path;

  FileDataReader(this.path);

  /// Read the locale data found for [locale] on our [path].
  Future read(String locale) {
    var file = new File('$path$locale.json');
    return file.readAsText();
  }
}

// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/**
 * This contains a reader that accesses data from local files, so it can't
 * be run in the browser.
 */

library file_data_reader;

import 'dart:io';
import 'intl_helpers.dart';

class FileDataReader implements LocaleDataReader {

  /// The base path from which we will read data.
  String path;

  FileDataReader(this.path);

  /// Read the locale data found for [locale] on our [path].
  Future read(String locale) {
    var file = new File('$path$locale.json');
    return file.readAsString();
  }
}

Rename File.readAsText to File.readAsString. There is no Text type in Dart
and the methods return Strings.

R=sgjesse@google.com
BUG=

Review URL: https://codereview.chromium.org//11412033

git-svn-id: a8f079e7cfc3a289d8496d7b88aabbd5c45a3053@15011 260f80e4-7a28-3924-810f-c04153c831b5


// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#library("co19_test_config");

#import('dart:io');
#import('../../tools/testing/dart/test_suite.dart');

class Co19TestSuite extends StandardTestSuite {
  RegExp _testRegExp = new RegExp(r"t[0-9]{2}.dart$");

  Co19TestSuite(Map configuration)
      : super(configuration,
              "co19",
              new Path("tests/co19/src"),
              [],
              ["tests/co19/co19-compiler.status",
               "tests/co19/co19-runtime.status",
               "tests/co19/co19-dart2dart.status",
               "tests/co19/co19-dart2js.status"]);

  bool isTestFile(String filename) => _testRegExp.hasMatch(filename);
  bool get listRecursively => true;
}

// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#library("co19_test_config");

#import('dart:io');
#import('../../tools/testing/dart/test_suite.dart');

class Co19TestSuite extends StandardTestSuite {
  RegExp _testRegExp = new RegExp(r"t[0-9]{2}.dart$");

  Co19TestSuite(Map configuration)
      : super(configuration,
              "co19",
              new Path("tests/co19/src"),
              ["tests/co19/co19-compiler.status",
               "tests/co19/co19-runtime.status",
               "tests/co19/co19-dart2dart.status",
               "tests/co19/co19-dart2js.status"],
              []);

  bool isTestFile(String filename) => _testRegExp.hasMatch(filename);
  bool get listRecursively => true;
}

Correct location of new optional server list.
Review URL: https://codereview.chromium.org//11772008

git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@16673 260f80e4-7a28-3924-810f-c04153c831b5


import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import '../../features/settings/presentation/bloc/settings_bloc.dart';
import 'settings_not_loaded.dart';

class PageBody extends StatelessWidget {
  final Widget child;

  const PageBody({
    Key? key,
    required this.child,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: BlocBuilder<SettingsBloc, SettingsState>(
        builder: (context, state) {
          if (state is SettingsSuccess) return child;

          return const SettingsNotLoaded();
        },
      ),
    );
  }
}

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import '../../features/settings/presentation/bloc/settings_bloc.dart';
import 'settings_not_loaded.dart';

class PageBody extends StatelessWidget {
  final Widget child;
  final bool loading;

  const PageBody({
    Key? key,
    required this.child,
    this.loading = false,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: BlocBuilder<SettingsBloc, SettingsState>(
        builder: (context, state) {
          if (state is SettingsSuccess) {
            return Stack(
              children: [
                if (loading) const LinearProgressIndicator(),
                child,
              ],
            );
          }

          return const SettingsNotLoaded();
        },
      ),
    );
  }
}

Add optional loading indicator to PageBody.


library test.event_emitter;

import 'src/event_emitter_test.dart' as event_emitter_test;
import 'package:test/test.dart';

void main () {
    group('[Event emitter]', event_emitter_test.main);
}

library test.event_emitter;

import 'src/event_emitter_test.dart' as event_emitter_test;
import 'src/event_emitter_with_event_objects_test.dart' as event_objects_test;
import 'package:test/test.dart';

void main () {
    group('[Event emitter]', event_emitter_test.main);
    group('[Event emitter with objects]', event_objects_test.main);
}

Add event objects' tests to travis builds


library dartrocket;

import "dart:math";
import "dart:async";
import "dart:html" show Element,querySelector;
import "package:stagexl/stagexl.dart" as StageXL;

part "src/core/game.dart";
part "src/core/statemanager.dart";
part "src/core/state.dart";
part "src/core/background.dart";
part "src/core/text.dart";

part "src/animation/transition_function.dart";

part "src/gameobject/sprite.dart";
part "src/gameobject/animated_sprite.dart";
part "src/gameobject/group.dart";

library dartrocket;

import "dart:math";
import "dart:async";
import "dart:html" show Element,querySelector;
import "package:stagexl/stagexl.dart" as StageXL;

part "src/core/game.dart";
part "src/core/statemanager.dart";
part "src/core/state.dart";
part "src/core/background.dart";
part "src/core/text.dart";

part "src/animation/transition_function.dart";

part "src/gameobject/sprite.dart";
part "src/gameobject/animated_sprite.dart";
part "src/gameobject/interactive_sprite.dart";
part "src/gameobject/full_sprite.dart";
part "src/gameobject/group.dart";

Add new kind of sprites

Add new kind of sprites


// Copyright 2016 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'value/boolean.dart';
import 'value/identifier.dart';
import 'visitor/interface/value.dart';
import 'visitor/serialize.dart';

export 'value/boolean.dart';
export 'value/color.dart';
export 'value/identifier.dart';
export 'value/list.dart';
export 'value/map.dart';
export 'value/number.dart';
export 'value/string.dart';

abstract class Value {
  /// Whether the value will be represented in CSS as the empty string.
  bool get isBlank => false;

  const Value();

  /*=T*/ accept/*<T>*/(ValueVisitor/*<T>*/ visitor);

  // TODO: call the proper stringifying method
  Value unaryPlus() => new SassIdentifier("+${valueToCss(this)}");

  Value unaryMinus() => new SassIdentifier("-${valueToCss(this)}");

  Value unaryDivide() => new SassIdentifier("/${valueToCss(this)}");

  Value unaryNot() => sassFalse;

  String toString() => valueToCss(this);
}

// Copyright 2016 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'value/boolean.dart';
import 'value/identifier.dart';
import 'visitor/interface/value.dart';
import 'visitor/serialize.dart';

export 'value/boolean.dart';
export 'value/color.dart';
export 'value/identifier.dart';
export 'value/list.dart';
export 'value/map.dart';
export 'value/number.dart';
export 'value/string.dart';

abstract class Value {
  /// Whether the value will be represented in CSS as the empty string.
  bool get isBlank => false;

  const Value();

  /*=T*/ accept/*<T>*/(ValueVisitor/*<T>*/ visitor);

  Value unaryPlus() => new SassIdentifier("+${valueToCss(this)}");

  Value unaryMinus() => new SassIdentifier("-${valueToCss(this)}");

  Value unaryDivide() => new SassIdentifier("/${valueToCss(this)}");

  Value unaryNot() => sassFalse;

  String toString() => valueToCss(this);
}

Remove a TODO that's already been done.

Remove a TODO that's already been done.


library sprites;

import 'dart:sky';
import 'dart:math' as Math;
import 'package:vector_math/vector_math_64.dart';
import 'package:sky/framework/app.dart';
import 'package:sky/framework/rendering/box.dart';
import 'package:sky/framework/rendering/node.dart';
import 'package:sky/framework/scheduler.dart' as scheduler;
import 'package:sky/framework/net/image_cache.dart' as image_cache;

part 'sprite_box.dart';
part 'transform_node.dart';
part 'sprite_node.dart';
part 'image_map.dart';

library sprites;

import 'dart:sky';
import 'dart:math' as Math;
import 'package:vector_math/vector_math_64.dart';
import 'package:sky/framework/app.dart';
import 'package:sky/framework/rendering/box.dart';
import 'package:sky/framework/rendering/object.dart';
import 'package:sky/framework/scheduler.dart' as scheduler;
import 'package:sky/framework/net/image_cache.dart' as image_cache;

part 'sprite_box.dart';
part 'transform_node.dart';
part 'sprite_node.dart';
part 'image_map.dart';

Fix examples/game to work after Hixie's grand rename.

TBR=viktorl@google.com

Review URL: https://codereview.chromium.org/1158273009


//This will be the style guide used for this project
//https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  final ucsdBackgrounndColor = const Color(0xFF182B49);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
    );
  }
}

//This will be the style guide used for this project
//https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  final ucsdBackgroundColor = const Color(0xFF182B49);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'UCSD',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Home(),

    );
  }
}

class HomeState extends State<Home> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("UCSD"),
      ),
      body: Container(),
    );
  }
}

class Home extends StatefulWidget {
  @override
  HomeState createState() => new HomeState();
}

Add appBar and blue theme

Add appBar and blue theme


// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library pub_tests;

import 'package:scheduled_test/scheduled_test.dart';

import '../descriptor.dart' as d;
import '../test_pub.dart';
import 'utils.dart';

main() {
  initConfig();
  setUp(() {
    d.dir(appPath, [
      d.appPubspec()
    ]).create();
  });

  integration("the 404 page describes the missing asset", () {
    pubServe();

    scheduleRequest("packages/foo/missing.txt").then((response) {
      expect(response.statusCode, equals(404));

      // Should mention the asset that can't be found.
      expect(response.body, contains("foo"));
      expect(response.body, contains("missing.txt"));
    });

    endPubServe();
  });

  integration("the 404 page describes the error", () {
    pubServe();

    scheduleRequest("packages").then((response) {
      expect(response.statusCode, equals(404));

      // Should mention the asset that can't be found.
      expect(response.body, contains('"/packages"'));
    });

    endPubServe();
  });
}

Fix pub test that broke with changes in dart:convert
(dart:convert no longer escapes '/' since https://code.google.com/p/dart/source/detail?r=45003)

R=kevmoo@google.com

Review URL: https://codereview.chromium.org//1069413003

git-svn-id: a962b240025cf0577aa172e20f49ccb159ba6be1@45017 260f80e4-7a28-3924-810f-c04153c831b5


// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Test to ensure that dart2js is free of warnings.

// Test annotation to let the test framework know that this file
// should analyze without any warnings.
// @static-clean

#import('../../sdk/lib/_internal/compiler/implementation/dart2js.dart',
    prefix: 'dart2js');

void main() {
  // Do nothing.
}

// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Test to ensure that dart2js is free of warnings.

// Test annotation to let the test framework know that this file
// should analyze without any warnings.
// @static-clean

import '../../sdk/lib/_internal/compiler/implementation/dart2js.dart'
    as dart2js;

void main() {
  // Do nothing.
}

Revert "Use old import syntax."

Revert "Use old import syntax."

TBR=ahe@google.com

Review URL: https://codereview.chromium.org//11537007

git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@15974 260f80e4-7a28-3924-810f-c04153c831b5


import 'package:flutter/material.dart';

import 'heading.dart';

class ListTileGroup extends StatelessWidget {
  final String? heading;
  final List<Widget> listTiles;

  const ListTileGroup({
    Key? key,
    this.heading,
    required this.listTiles,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisSize: MainAxisSize.min,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        heading != null
            ? Padding(
                padding: const EdgeInsets.symmetric(horizontal: 8),
                child: Heading(
                  text: heading!,
                ),
              )
            : const SizedBox(height: 0, width: 0),
        Padding(
          padding: EdgeInsets.only(top: heading != null ? 8 : 0),
          child: ClipRRect(
            borderRadius: BorderRadius.circular(4),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: listTiles,
            ),
          ),
        ),
      ],
    );
  }
}

import 'package:flutter/material.dart';

import 'heading.dart';

class ListTileGroup extends StatelessWidget {
  final String? heading;
  final List<Widget> listTiles;

  const ListTileGroup({
    Key? key,
    this.heading,
    required this.listTiles,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisSize: MainAxisSize.min,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        if (heading != null)
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 8),
            child: Heading(
              text: heading!,
            ),
          ),
        Padding(
          padding: EdgeInsets.only(top: heading != null ? 8 : 0),
          child: ClipRRect(
            borderRadius: BorderRadius.circular(4),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: listTiles,
            ),
          ),
        ),
      ],
    );
  }
}

Use 'if' to determine if Heading should display.


#!/usr/bin/env dart
// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library reserved_names_test;

import 'dart:mirrors' as mirrors;

import 'package:unittest/unittest.dart';

import '../lib/protoc.dart' show MessageGenerator;

import 'test_util.dart';

void main() {
  test('testReservedNamesList', () {
    Set<String> names = new Set<String>();
    fillConflictingNames(mirrors.ClassMirror cls) {
      String className = mirrors.MirrorSystem.getName(cls.simpleName);
      names.addAll(
          cls
          .declarations
          .values
          .where((decl) => !decl.isPrivate && decl is !mirrors.VariableMirror)
          .map((m) => mirrors.MirrorSystem.getName(m.simpleName))
          .map((n) => n.startsWith(className + '.')
                      ? n.substring(className.length + 1) : n)
          .toList());
    }

    var cls = mirrors.currentMirrorSystem()
        .libraries[Uri.parse('package:protobuf/protobuf.dart')]
        .classes[#GeneratedMessage];
    do {
      fillConflictingNames(cls);
      cls = cls.superclass;
    } while (cls != null);

    var x = new Set<String>()..addAll(MessageGenerator.reservedNames);
    expect(names.toList()..sort(), equals(x.toList()..sort()));
  });
}

#!/usr/bin/env dart
// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library reserved_names_test;

import 'dart:mirrors' as mirrors;

import 'package:unittest/unittest.dart';

import '../lib/protoc.dart' show MessageGenerator;

import 'test_util.dart';

void main() {
  test('testReservedNamesList', () {
    Set<String> names = new Set<String>();
    fillConflictingNames(mirrors.ClassMirror cls) {
      String className = mirrors.MirrorSystem.getName(cls.simpleName);
      names.addAll(
          cls
          .declarations
          .values
          .where((decl) => !decl.isPrivate && decl is !mirrors.VariableMirror)
          .map((m) => mirrors.MirrorSystem.getName(m.simpleName))
          .map((n) => n.startsWith(className + '.')
                      ? n.substring(className.length + 1) : n)
          .toList());
    }

    var cls = mirrors.currentMirrorSystem()
        .libraries[Uri.parse('package:protobuf/protobuf.dart')]
        .declarations[#GeneratedMessage];
    do {
      fillConflictingNames(cls);
      cls = cls.superclass;
    } while (cls != null);

    var x = new Set<String>()..addAll(MessageGenerator.reservedNames);
    expect(names.toList()..sort(), equals(x.toList()..sort()));
  });
}

Update test to work with mirrors for Dart 1.1

TBR=sigmund@google.com

Review URL: https://chromiumcodereview.appspot.com//123153002


// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library polymer.test.nested_binding_test;

import 'dart:async';
import 'dart:html';
import 'package:polymer/polymer.dart';
import 'package:unittest/unittest.dart';
import 'package:unittest/html_config.dart';

@CustomTag('my-test')
class MyTest extends PolymerElement {
  final List fruits = toObservable(['apples', 'oranges', 'pears']);

  final _testDone = new Completer();

  MyTest.created() : super.created();

  _runTest(_) {
    expect($['fruit'].text.trim(), 'Short name: [pears]');
    _testDone.complete();
  }

  ready() {
    onMutation($['fruit']).then(_runTest);
  }
}

main() => initPolymer().run(() {
  useHtmlConfiguration();

  setUp(() => Polymer.onReady);

  test('ready called',
      () => (querySelector('my-test') as MyTest)._testDone.future);
});

// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library polymer.test.nested_binding_test;

import 'dart:async';
import 'dart:html';
import 'package:polymer/polymer.dart';
import 'package:unittest/unittest.dart';
import 'package:unittest/html_config.dart';

@CustomTag('my-test')
class MyTest extends PolymerElement {
  final List fruits = toObservable(['apples', 'oranges', 'pears']);

  final _testDone = new Completer();

  MyTest.created() : super.created();

  ready() {
    expect($['fruit'].text.trim(), 'Short name: [pears]');
    _testDone.complete();
  }
}

main() => initPolymer().run(() {
  useHtmlConfiguration();

  setUp(() => Polymer.onReady);

  test('ready called',
      () => (querySelector('my-test') as MyTest)._testDone.future);
});

Remove comprehension object, but return the list of scopes directly instead.

This is to fix https://code.google.com/p/dart/issues/detail?id=18792:
creating a new list of scopes on every invocation to _convertValue was causing us to issue extra notifications, which in turn caused the bug with <select> in that bug.

R=jmesserly@google.com, justinfagnani@google.com

Review URL: https://codereview.chromium.org//304223004

git-svn-id: 0aa7e0b98478d6ef7145d04e8154f8ab2209deba@36848 260f80e4-7a28-3924-810f-c04153c831b5


library aquatics;

import 'dart:html' as html;
import 'dart:math';
import 'dart:async';
import 'package:stagexl/stagexl.dart';

part 'RandomPath.dart';
part 'Aquatic.dart';

void main() {
  var canvas = html.query('#stage');
  var stage = new Stage('myStage', canvas);
  var renderLoop = new RenderLoop();
  renderLoop.addStage(stage);

  var padding = 150;
  var speed = 0.009;
  var scale = 0.05;
  var random = new Random();
  for (int i = 0; i < 22; i++) {
    var x0 = padding + random.nextDouble() * (stage.stageWidth - padding);
    var y0 = padding + random.nextDouble() * (stage.stageHeight - padding);
    scale += 0.025;
    speed += 0.0013;
    var path = new RandomPath(x: x0, y: y0,
        top:50, bottom:stage.stageHeight - 50, left:50, right:stage.stageWidth - 50,
        scale: scale, speed: speed);
    stage.addChild(path);
    path.startLoop();
  }
}

library aquatics;

import 'dart:html' as html;
import 'dart:math';
import 'dart:async';
import 'package:stagexl/stagexl.dart';

part 'RandomPath.dart';
part 'Aquatic.dart';

void main() {
  var canvas = html.query('#stage');
  var stage = new Stage('myStage', canvas);
  var renderLoop = new RenderLoop();
  renderLoop.addStage(stage);

  var padding = 200;
  var speed = 0.008;
  var scale = 0.05;
  var random = new Random();
  for (int i = 0; i < 25; i++) {
    var a0 = 360 * random.nextDouble();
    var x0 = padding + random.nextDouble() * (stage.stageWidth - 2 * padding);
    var y0 = padding + random.nextDouble() * (stage.stageHeight - 2 * padding);
    scale += 0.022;
    speed += 0.0013;
    var path = new RandomPath(x: x0, y: y0, a0: a0,
        top:50, bottom:stage.stageHeight - 50, left:50, right:stage.stageWidth - 50,
        scale: scale, speed: speed);
    stage.addChild(path);
    path.startLoop();
  }
}

Improve init parameters to center initial vectors


/// Calculator from the tutorial.
library petitparser.example.calc;

import 'package:petitparser/petitparser.dart';

void main(List<String> arguments) {
  final number = digit().plus().flatten().trim().map(int.parse);
  final term = undefined();
  final prod = undefined();
  final prim = undefined();
  final start = term.end();

  term.set(prod
      .seq(char('+').trim())
      .seq(term)
      .map((values) => values[0] + values[2])
      .or(prod));
  prod.set(prim
      .seq(char('*').trim())
      .seq(prod)
      .map((values) => values[0] * values[2])
      .or(prim));
  prim.set(char('(')
      .trim()
      .seq(term)
      .seq(char(')'.trim()))
      .map((values) => values[1])
      .or(number));

  print(start.parse(arguments.join(' ')).value);
}

/// Calculator from the tutorial.
library petitparser.example.calc;

import 'package:petitparser/petitparser.dart';

void main(List<String> arguments) {
  final number = digit().plus().flatten().trim().map(int.parse);
  final term = undefined();
  final prod = undefined();
  final prim = undefined();
  final start = term.end();

  term.set(prod
      .seq(char('+').trim())
      .seq(term)
      .map((values) => values[0] + values[2])
      .or(prod));
  prod.set(prim
      .seq(char('*').trim())
      .seq(prod)
      .map((values) => values[0] * values[2])
      .or(prim));
  prim.set(char('(')
      .trim()
      .seq(term)
      .seq(char(')').trim())
      .map((values) => values[1])
      .or(number));

  print(start.parse(arguments.join(' ')).value);
}

Fix typo also in example

Fix typo also in example


part of irc.parser;

/**
 * Represents a Hostmask that has been parsed
 */
class Hostmask {
  static final HOSTMASK_REGEX = new RegExp("[!@]");

  /**
   * Nickname is Hostmask
   */
  String nickname;

  /**
   * User's Identity
   */
  String identity;

  /**
   * User's Hostname
   */
  String hostname;

  /**
   * Creates a Hostmask instance
   */
  Hostmask({this.nickname, this.identity, this.hostname});

  Hostmask.parse(String input) {
    var parts = input.split(HOSTMASK_REGEX);

    this.nickname = parts[0];
    this.identity = parts[1];
    this.hostname = parts[2];
  }
}

/**
 * A Hostmask Pattern
 *
 * This is generally used for Ban Lists
 */
class GlobHostmask {
  /**
   * Hostmask Pattern
   */
  String pattern;

  /**
   * Creates a new Hostmask Pattern
   *
   * [pattern] is the glob pattern
   */
  GlobHostmask(this.pattern);

  /**
   * Checks if [hostmask] matches [pattern]
   */
  bool matches(String hostmask) => new Glob(pattern).hasMatch(hostmask);

  /**
   * Gives a String Representation of this hostmask pattern
   */
  @override
  String toString() => pattern;
}

part of irc.parser;

/**
 * Represents a Hostmask that has been parsed
 */
class Hostmask {
  static final HOSTMASK_REGEX = new RegExp("[!@]");

  /**
   * User's Nickname
   */
  String nickname;

  /**
   * User's Identity
   */
  String identity;

  /**
   * User's Hostname
   */
  String hostname;

  /**
   * Creates a Hostmask instance
   */
  Hostmask({this.nickname, this.identity, this.hostname});

  Hostmask.parse(String input) {
    var parts = input.split(HOSTMASK_REGEX);

    this.nickname = parts[0];
    this.identity = parts[1];
    this.hostname = parts[2];
  }
}

/**
 * A Hostmask Pattern
 *
 * This is generally used for Ban Lists
 */
class GlobHostmask {
  /**
   * Hostmask Pattern
   */
  String pattern;

  /**
   * Creates a new Hostmask Pattern
   *
   * [pattern] is the glob pattern
   */
  GlobHostmask(this.pattern);

  /**
   * Checks if [hostmask] matches [pattern]
   */
  bool matches(String hostmask) => new Glob(pattern).hasMatch(hostmask);

  /**
   * Gives a String Representation of this hostmask pattern
   */
  @override
  String toString() => pattern;
}

Fix Typo in [Hostmask] documentation

Fix Typo in [Hostmask] documentation


// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:sky';
import 'package:sky/framework/app.dart';
import 'package:sky/framework/rendering/box.dart';
import 'package:sky/framework/rendering/flex.dart';

AppView app;

void main() {
  var coloredBox = new RenderDecoratedBox(
    decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFF00))
  );
  var shadow = const BoxShadow(
      color: const Color(0xFFEEEEEE), offset: const Size(5.0, 5.0), blur: 5.0);
  var shadowBox = new RenderShadowedBox(shadow: shadow, child: coloredBox);
  var paddedBox = new RenderPadding(padding: const EdgeDims.all(30.0),
      child: shadowBox);
  app = new AppView(paddedBox);
}

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:sky';
import 'package:sky/framework/app.dart';
import 'package:sky/framework/rendering/box.dart';
import 'package:sky/framework/rendering/flex.dart';
import 'package:sky/framework/theme2/shadows.dart';

AppView app;

void main() {
  var coloredBox = new RenderDecoratedBox(
    decoration: new BoxDecoration(
      backgroundColor: const Color(0xFFFAFAFA),
      boxShadow: Shadow[3])
  );
  var paddedBox = new RenderPadding(
    padding: const EdgeDims.all(50.0),
    child: coloredBox);
  app = new AppView(new RenderDecoratedBox(
    decoration: const BoxDecoration(
      backgroundColor: const Color(0xFFFFFFFF)
    ),
    child: paddedBox
  ));
}

Add a proper material shadow the popup menu

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1172723002.


import 'package:flutter/material.dart';
import 'package:quiver/strings.dart';

class StatusPage extends StatelessWidget {
  final String message;
  final String? suggestion;
  final Widget? action;
  final bool scrollable;

  const StatusPage({
    Key? key,
    required this.message,
    this.suggestion,
    this.action,
    this.scrollable = false,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (context, constraints) {
        return SingleChildScrollView(
          physics: scrollable
              ? const AlwaysScrollableScrollPhysics()
              : const NeverScrollableScrollPhysics(),
          child: ConstrainedBox(
            constraints: BoxConstraints(
              minHeight: constraints.maxHeight,
              minWidth: constraints.maxWidth,
            ),
            child: IntrinsicHeight(
              child: Column(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    message,
                    style: const TextStyle(
                      fontSize: 18,
                    ),
                  ),
                  if (isNotBlank(suggestion)) const SizedBox(height: 8),
                  if (isNotBlank(suggestion))
                    Text(
                      suggestion!,
                      style: const TextStyle(
                        fontSize: 16,
                      ),
                    ),
                  if (action != null) const SizedBox(height: 4),
                  if (action != null) action!,
                ],
              ),
            ),
          ),
        );
      },
    );
  }
}

import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:quiver/strings.dart';

class StatusPage extends StatelessWidget {
  final String message;
  final String? suggestion;
  final Widget? action;
  final bool scrollable;

  const StatusPage({
    Key? key,
    required this.message,
    this.suggestion,
    this.action,
    this.scrollable = false,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (context, constraints) {
        return SingleChildScrollView(
          physics: scrollable
              ? const AlwaysScrollableScrollPhysics()
              : const NeverScrollableScrollPhysics(),
          child: ConstrainedBox(
            constraints: BoxConstraints(
              minHeight: constraints.maxHeight,
              minWidth: constraints.maxWidth,
            ),
            child: IntrinsicHeight(
              child: Column(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    message,
                    style: const TextStyle(
                      fontSize: 18,
                    ),
                  ),
                  if (isNotBlank(suggestion)) const Gap(8),
                  if (isNotBlank(suggestion))
                    Text(
                      suggestion!,
                      style: const TextStyle(
                        fontSize: 16,
                      ),
                    ),
                  if (action != null) const Gap(4),
                  if (action != null) action!,
                ],
              ),
            ),
          ),
        );
      },
    );
  }
}

Update StatusPage to use Gap instead of SizedBox.


import 'package:endpoints/endpoints.dart';
import 'package:cloud_datastore/cloud_datastore.dart';

@ModelMetadata(const ScoreDesc())
class Score extends Model {
  @ApiProperty(description: 'Datastore ID of the Score', variant: 'uint64')
  int id;

  @ApiProperty(description: 'Result of the game.')
  String outcome;

  @ApiProperty(description: 'Time stamp, will be added automatically when the score is recorded.')
  DateTime played;

  @ApiProperty(description: 'Google ID of the player')
  String player;

  Score() {
    // Automatically set current date for new messages
    played = new DateTime.now();
  }
}

class ScoreDesc extends ModelDescription {
  final id = const IntProperty();
  final outcome = const StringProperty();
  final played = const DateTimeProperty();
  final player = const StringProperty();

  const ScoreDesc() : super ('Message');
}

class ScoreList {
  List<Score> items;

  ScoreList([this.items = const []]);
}

class ScoreListRequest {
  @ApiProperty(description: 'Number of scores to return in one request')
  int limit;

  @ApiProperty(description: 'Sort order of scores in response')
  String order;
}

class ScoreRequest {
  @ApiProperty(description: 'Score to be inserted')
  String outcome;
}

class Board {
  @ApiProperty(description: 'Current state of the game')
  String state;
}

import 'package:endpoints/endpoints.dart';
import 'package:cloud_datastore/cloud_datastore.dart';

@ModelMetadata(const ScoreDesc())
class Score extends Model {
  @ApiProperty(description: 'Datastore ID of the Score', variant: 'uint64')
  int id;

  @ApiProperty(description: 'Result of the game.')
  String outcome;

  @ApiProperty(description: 'Time stamp, will be added automatically when the score is recorded.')
  DateTime played;

  @ApiProperty(description: 'Google ID of the player')
  String player;

  Score() {
    // Automatically set current date for new messages
    played = new DateTime.now();
  }
}

class ScoreDesc extends ModelDescription {
  final id = const IntProperty();
  final outcome = const StringProperty();
  final played = const DateTimeProperty();
  final player = const StringProperty();

  const ScoreDesc() : super ('Message');
}

class ScoreList {
  List<Score> items;

  ScoreList([this.items = const []]);
}

class ScoreListRequest {
  @ApiProperty(description: 'Number of scores to return in one request')
  int limit;

  @ApiProperty(
    values: const {
      'WHEN': 'Return most recent scores first',
      'TEXT': 'Return scores sorted by outcome value'
    },
    description: 'Sort order of scores in response'
  )
  String order;
}

class ScoreRequest {
  @ApiProperty(description: 'Score to be inserted')
  String outcome;
}

class Board {
  @ApiProperty(description: 'Current state of the game')
  String state;
}

Add enum property for order

Add enum property for order


import 'package:angular/angular.dart';
import 'package:angular/application_factory.dart';
import 'trips_history.dart';

@Controller(
    selector: '[trips-history]',
    publishAs: 'ctrl')
class TripsHistoryController {
  List<Person> people = new List();
  String personName;
  String personColour;

  void addPerson() {
    var person = new Person(personName, personColour);
    people.add(person);
    personName = '';
    personColour = '';
  }
}

class TripsHistoryModule extends Module {

  TripsHistoryModule() {
    type(TripsHistoryController);
  }
}

main() {
  applicationFactory()
      .addModule(new TripsHistoryModule())
      .run();
}

import 'package:angular/angular.dart';
import 'package:angular/application_factory.dart';
import 'trips_history.dart';

@Controller(
    selector: '[trips-history]',
    publishAs: 'ctrl')
class TripsHistoryController {
  List<Person> people = new List();
  String personName;
  String personColour;

  TripsHistoryController() {
    // TODO: remove example people.
    var a = new Person('Andrea', '#EEEE00');
    var b = new Person('Brett', '#0000EE');
    var ab = new Person('Andrea & Brett', '#00EE00');
    people.add(a);
    people.add(b);
    people.add(ab);
  }

  void addPerson() {
    var person = new Person(personName, personColour);
    people.add(person);
    personName = '';
    personColour = '';
  }
}

class TripsHistoryModule extends Module {

  TripsHistoryModule() {
    type(TripsHistoryController);
  }
}

main() {
  applicationFactory()
      .addModule(new TripsHistoryModule())
      .run();
}

Add some temporary example people

Add some temporary example people


import 'package:flutter/material.dart';
import './book-list.dart';

void main() => runApp(BuddyBible());

class BuddyBible extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Buddy Bible',
      home: Home()
    );
  }
}

class Home extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text(
          'Buddy Bible',
          style: TextStyle(color: Colors.black),
        ),
        bottom: PreferredSize(
          child: Padding(
            padding: EdgeInsets.only(bottom: 6),
            child: Text(
              'Your daily bible assistant',
              style: TextStyle(color: Colors.grey.shade600, fontSize: 16, fontWeight: FontWeight.w300),
            ),
          ),
          preferredSize: null,
        ),
        elevation: 0.4,
        backgroundColor: Colors.white
      ),
      backgroundColor: Colors.white,
      body: BookList()
    );
  }
}

import 'package:flutter/material.dart';
import './book-list.dart';

void main() => runApp(BuddyBible());

class BuddyBible extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Buddy Bible',
      home: Home()
    );
  }
}

class Home extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return BookList();
  }
}

Remove app bar and wrapper on book list page