From cbe650a7e67931c0208a796fc17550e5c436d340 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Wed, 27 Apr 2016 13:09:54 -0700 Subject: [PATCH] Move newton into package:flutter (#3585) Rather that importing `package:newton/newton.dart` you can `import package:flutter/physics.dart`. Fixes #2441 --- CONTRIBUTING.md | 4 ++-- packages/flutter/lib/animation.dart | 4 ++-- packages/flutter/lib/physics.dart | 19 ++++++++++++++++++ .../src/animation/animation_controller.dart | 2 +- .../flutter/lib/src/animation/forces.dart | 4 ++-- packages/flutter/lib/src/material/tabs.dart | 2 +- .../lib/src/physics}/clamped_simulation.dart | 0 .../lib/src/physics}/friction_simulation.dart | 0 .../lib/src/physics}/gravity_simulation.dart | 0 .../lib/src/physics}/scroll_simulation.dart | 0 .../lib/src/physics}/simulation.dart | 0 .../lib/src/physics}/simulation_group.dart | 0 .../lib/src/physics}/spring_simulation.dart | 0 .../lib/src/physics}/tolerance.dart | 0 .../lib/src/physics}/utils.dart | 0 .../lib/src/widgets/scroll_behavior.dart | 2 +- .../flutter/lib/src/widgets/scrollable.dart | 2 +- packages/flutter/pubspec.yaml | 2 -- .../test/physics}/near_equal_test.dart | 2 +- .../test/physics}/newton_test.dart | 2 +- packages/newton/README.md | 8 -------- packages/newton/lib/newton.dart | 20 ------------------- packages/newton/pubspec.yaml | 10 ---------- packages/newton/test/all.dart | 11 ---------- travis/test.sh | 1 - 25 files changed, 31 insertions(+), 64 deletions(-) create mode 100644 packages/flutter/lib/physics.dart rename packages/{newton/lib/src => flutter/lib/src/physics}/clamped_simulation.dart (100%) rename packages/{newton/lib/src => flutter/lib/src/physics}/friction_simulation.dart (100%) rename packages/{newton/lib/src => flutter/lib/src/physics}/gravity_simulation.dart (100%) rename packages/{newton/lib/src => flutter/lib/src/physics}/scroll_simulation.dart (100%) rename packages/{newton/lib/src => flutter/lib/src/physics}/simulation.dart (100%) rename packages/{newton/lib/src => flutter/lib/src/physics}/simulation_group.dart (100%) rename packages/{newton/lib/src => flutter/lib/src/physics}/spring_simulation.dart (100%) rename packages/{newton/lib/src => flutter/lib/src/physics}/tolerance.dart (100%) rename packages/{newton/lib/src => flutter/lib/src/physics}/utils.dart (100%) rename packages/{newton/test => flutter/test/physics}/near_equal_test.dart (91%) rename packages/{newton/test => flutter/test/physics}/newton_test.dart (99%) delete mode 100644 packages/newton/README.md delete mode 100644 packages/newton/lib/newton.dart delete mode 100644 packages/newton/pubspec.yaml delete mode 100644 packages/newton/test/all.dart diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 41442a82ff..7a64110397 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,9 +78,9 @@ Individual tests can also be run directly, e.g. `flutter test lib/my_app_test.da Flutter tests use [package:flutter_test](https://github.com/flutter/flutter/tree/master/packages/flutter_test) which provides flutter-specific extensions on top of [package:test](https://pub.dartlang.org/packages/test). -`flutter test` runs tests inside the flutter shell. Some packages inside the flutter repository can be run inside the dart command line VM as well as the flutter shell, `packages/newton` and `packages/flutter_tools` are two such examples: +`flutter test` runs tests inside the flutter shell. Some packages inside the flutter repository can be run inside the dart command line VM as well as the flutter shell, `packages/flutter_tools` is one such examples: - * `cd packages/newton` + * `cd packages/flutter_tools` * `pub run test` `flutter test --flutter-repo` is a shortcut for those working on the flutter repository itself which runs all tests inside the `flutter` package regardless of the current working directory. diff --git a/packages/flutter/lib/animation.dart b/packages/flutter/lib/animation.dart index 9c22eb8feb..5ff4ca258b 100644 --- a/packages/flutter/lib/animation.dart +++ b/packages/flutter/lib/animation.dart @@ -3,12 +3,12 @@ // found in the LICENSE file. /// The Flutter animation system. -/// +/// /// To use, import `package:flutter/animation.dart`. /// /// See [flutter.io/animations](https://flutter.io/animations/) for an overview. /// -/// This library depends only on core Dart libraries and the `newton` package. +/// This library depends only on core Dart libraries and the `physics.dart` library. library animation; export 'src/animation/animation.dart'; diff --git a/packages/flutter/lib/physics.dart b/packages/flutter/lib/physics.dart new file mode 100644 index 0000000000..78e7cd1b9a --- /dev/null +++ b/packages/flutter/lib/physics.dart @@ -0,0 +1,19 @@ +// Copyright 2016 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. + +/// Simple one-dimensional physics simulations, such as springs, friction, and +/// gravity, for use in user interface animations. +/// +/// To use, import `package:flutter/physics.dart`. +library physics; + +export 'src/physics/clamped_simulation.dart'; +export 'src/physics/friction_simulation.dart'; +export 'src/physics/gravity_simulation.dart'; +export 'src/physics/scroll_simulation.dart'; +export 'src/physics/simulation_group.dart'; +export 'src/physics/simulation.dart'; +export 'src/physics/spring_simulation.dart'; +export 'src/physics/tolerance.dart'; +export 'src/physics/utils.dart'; diff --git a/packages/flutter/lib/src/animation/animation_controller.dart b/packages/flutter/lib/src/animation/animation_controller.dart index 0d42ec2cc1..94b9810ad6 100644 --- a/packages/flutter/lib/src/animation/animation_controller.dart +++ b/packages/flutter/lib/src/animation/animation_controller.dart @@ -6,7 +6,7 @@ import 'dart:async'; import 'dart:ui' as ui show lerpDouble; import 'package:flutter/scheduler.dart'; -import 'package:newton/newton.dart'; +import 'package:flutter/physics.dart'; import 'animation.dart'; import 'curves.dart'; diff --git a/packages/flutter/lib/src/animation/forces.dart b/packages/flutter/lib/src/animation/forces.dart index 977bd40124..e53c70435e 100644 --- a/packages/flutter/lib/src/animation/forces.dart +++ b/packages/flutter/lib/src/animation/forces.dart @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:newton/newton.dart'; +import 'package:flutter/physics.dart'; -export 'package:newton/newton.dart' show SpringDescription; +export 'package:flutter/physics.dart' show SpringDescription; /// A factory for simulations. abstract class Force { diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 830c6bfb93..5137b6fed5 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -5,7 +5,7 @@ import 'dart:async'; import 'dart:math' as math; -import 'package:newton/newton.dart'; +import 'package:flutter/physics.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; diff --git a/packages/newton/lib/src/clamped_simulation.dart b/packages/flutter/lib/src/physics/clamped_simulation.dart similarity index 100% rename from packages/newton/lib/src/clamped_simulation.dart rename to packages/flutter/lib/src/physics/clamped_simulation.dart diff --git a/packages/newton/lib/src/friction_simulation.dart b/packages/flutter/lib/src/physics/friction_simulation.dart similarity index 100% rename from packages/newton/lib/src/friction_simulation.dart rename to packages/flutter/lib/src/physics/friction_simulation.dart diff --git a/packages/newton/lib/src/gravity_simulation.dart b/packages/flutter/lib/src/physics/gravity_simulation.dart similarity index 100% rename from packages/newton/lib/src/gravity_simulation.dart rename to packages/flutter/lib/src/physics/gravity_simulation.dart diff --git a/packages/newton/lib/src/scroll_simulation.dart b/packages/flutter/lib/src/physics/scroll_simulation.dart similarity index 100% rename from packages/newton/lib/src/scroll_simulation.dart rename to packages/flutter/lib/src/physics/scroll_simulation.dart diff --git a/packages/newton/lib/src/simulation.dart b/packages/flutter/lib/src/physics/simulation.dart similarity index 100% rename from packages/newton/lib/src/simulation.dart rename to packages/flutter/lib/src/physics/simulation.dart diff --git a/packages/newton/lib/src/simulation_group.dart b/packages/flutter/lib/src/physics/simulation_group.dart similarity index 100% rename from packages/newton/lib/src/simulation_group.dart rename to packages/flutter/lib/src/physics/simulation_group.dart diff --git a/packages/newton/lib/src/spring_simulation.dart b/packages/flutter/lib/src/physics/spring_simulation.dart similarity index 100% rename from packages/newton/lib/src/spring_simulation.dart rename to packages/flutter/lib/src/physics/spring_simulation.dart diff --git a/packages/newton/lib/src/tolerance.dart b/packages/flutter/lib/src/physics/tolerance.dart similarity index 100% rename from packages/newton/lib/src/tolerance.dart rename to packages/flutter/lib/src/physics/tolerance.dart diff --git a/packages/newton/lib/src/utils.dart b/packages/flutter/lib/src/physics/utils.dart similarity index 100% rename from packages/newton/lib/src/utils.dart rename to packages/flutter/lib/src/physics/utils.dart diff --git a/packages/flutter/lib/src/widgets/scroll_behavior.dart b/packages/flutter/lib/src/widgets/scroll_behavior.dart index 346648ccbe..da96072762 100644 --- a/packages/flutter/lib/src/widgets/scroll_behavior.dart +++ b/packages/flutter/lib/src/widgets/scroll_behavior.dart @@ -4,7 +4,7 @@ import 'dart:math' as math; -import 'package:newton/newton.dart'; +import 'package:flutter/physics.dart'; const double _kSecondsPerMillisecond = 1000.0; const double _kScrollDrag = 0.025; diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart index 12541c4ee4..4b136fd2ca 100644 --- a/packages/flutter/lib/src/widgets/scrollable.dart +++ b/packages/flutter/lib/src/widgets/scrollable.dart @@ -6,7 +6,7 @@ import 'dart:async'; import 'dart:math' as math; import 'dart:ui' as ui show window; -import 'package:newton/newton.dart'; +import 'package:flutter/physics.dart'; import 'package:flutter/gestures.dart'; import 'package:meta/meta.dart'; diff --git a/packages/flutter/pubspec.yaml b/packages/flutter/pubspec.yaml index ec56addfab..ffcdf467c1 100644 --- a/packages/flutter/pubspec.yaml +++ b/packages/flutter/pubspec.yaml @@ -21,8 +21,6 @@ dependencies: cassowary: path: ../cassowary - newton: - path: ../newton dev_dependencies: flutter_test: diff --git a/packages/newton/test/near_equal_test.dart b/packages/flutter/test/physics/near_equal_test.dart similarity index 91% rename from packages/newton/test/near_equal_test.dart rename to packages/flutter/test/physics/near_equal_test.dart index f584280108..4dd45f2b75 100644 --- a/packages/newton/test/near_equal_test.dart +++ b/packages/flutter/test/physics/near_equal_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; -import 'package:newton/newton.dart'; +import 'package:flutter/physics.dart'; void main() { test('test_friction', () { diff --git a/packages/newton/test/newton_test.dart b/packages/flutter/test/physics/newton_test.dart similarity index 99% rename from packages/newton/test/newton_test.dart rename to packages/flutter/test/physics/newton_test.dart index 75d3ba00a6..96aec9a66b 100644 --- a/packages/newton/test/newton_test.dart +++ b/packages/flutter/test/physics/newton_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; -import 'package:newton/newton.dart'; +import 'package:flutter/physics.dart'; void main() { test('test_friction', () { diff --git a/packages/newton/README.md b/packages/newton/README.md deleted file mode 100644 index bb114b0446..0000000000 --- a/packages/newton/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Newton - -Simple Physics Simulations for Dart. Springs, friction, gravity, etc. - -To run the tests: - -- pub get -- pub run test diff --git a/packages/newton/lib/newton.dart b/packages/newton/lib/newton.dart deleted file mode 100644 index 07899fcd8b..0000000000 --- a/packages/newton/lib/newton.dart +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 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. - -/// Simple one-dimensional physics simulations, such as springs, friction, and -/// gravity, for use in user interface animations. -/// -/// This library is not meant to be imported by developers. -/// It will soon be integrated into another Flutter library. -library newton; - -export 'src/clamped_simulation.dart'; -export 'src/friction_simulation.dart'; -export 'src/gravity_simulation.dart'; -export 'src/scroll_simulation.dart'; -export 'src/simulation_group.dart'; -export 'src/simulation.dart'; -export 'src/spring_simulation.dart'; -export 'src/tolerance.dart'; -export 'src/utils.dart'; diff --git a/packages/newton/pubspec.yaml b/packages/newton/pubspec.yaml deleted file mode 100644 index 4c27dd1520..0000000000 --- a/packages/newton/pubspec.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: newton -description: Simple Physics Simulations for Dart -version: 0.1.5 -author: Flutter Authors -homepage: https://github.com/flutter/flutter/tree/master/packages/newton -environment: - sdk: '>=1.0.0 <2.0.0' -dev_dependencies: - flutter_test: - path: ../flutter_test diff --git a/packages/newton/test/all.dart b/packages/newton/test/all.dart deleted file mode 100644 index 84523aca13..0000000000 --- a/packages/newton/test/all.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2016 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 'near_equal_test.dart' as near_equal_test; -import 'newton_test.dart' as newton_test; - -void main() { - near_equal_test.main(); - newton_test.main(); -} diff --git a/travis/test.sh b/travis/test.sh index 707a09cfda..f9cd5374f9 100755 --- a/travis/test.sh +++ b/travis/test.sh @@ -17,7 +17,6 @@ flutter analyze --flutter-repo (cd packages/flutter_test; flutter test) (cd packages/flutter_tools; dart -c test/all.dart) (cd packages/flx; dart -c test/all.dart) -(cd packages/newton; dart -c test/all.dart) (cd dev/manual_tests; flutter test) (cd examples/hello_world; flutter test)