Move newton into package:flutter (#3585)
Rather that importing `package:newton/newton.dart` you can `import package:flutter/physics.dart`. Fixes #2441
This commit is contained in:
parent
7ef1df4d5b
commit
cbe650a7e6
@ -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.
|
||||
|
@ -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';
|
||||
|
19
packages/flutter/lib/physics.dart
Normal file
19
packages/flutter/lib/physics.dart
Normal file
@ -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';
|
@ -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';
|
||||
|
@ -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 {
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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';
|
||||
|
||||
|
@ -21,8 +21,6 @@ dependencies:
|
||||
|
||||
cassowary:
|
||||
path: ../cassowary
|
||||
newton:
|
||||
path: ../newton
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'package:newton/newton.dart';
|
||||
import 'package:flutter/physics.dart';
|
||||
|
||||
void main() {
|
||||
test('test_friction', () {
|
@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'package:newton/newton.dart';
|
||||
import 'package:flutter/physics.dart';
|
||||
|
||||
void main() {
|
||||
test('test_friction', () {
|
@ -1,8 +0,0 @@
|
||||
# Newton
|
||||
|
||||
Simple Physics Simulations for Dart. Springs, friction, gravity, etc.
|
||||
|
||||
To run the tests:
|
||||
|
||||
- pub get
|
||||
- pub run test
|
@ -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';
|
@ -1,10 +0,0 @@
|
||||
name: newton
|
||||
description: Simple Physics Simulations for Dart
|
||||
version: 0.1.5
|
||||
author: Flutter Authors <flutter-dev@googlegroups.com>
|
||||
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
|
@ -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();
|
||||
}
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user