Merge pull request #1958 from devoncarew/more_validation

More work on validation
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 04461d0..90481e6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -48,17 +48,17 @@
 
 To run an example with a prebuilt binary from the cloud, switch to that
 example's directory, run `pub get` to make sure its dependencies have been
-downloaded, and use `flutter start`. Make sure you have a device connected over
+downloaded, and use `flutter run`. Make sure you have a device connected over
 USB and debugging enabled on that device.
 
- * `cd examples/hello_world; flutter start`
+ * `cd examples/hello_world; flutter run`
 
 You can also specify a particular Dart file to run if you want to run an example
 that doesn't have a `lib/main.dart` file using the `-t` command-line option. For
 example, to run the `tabs.dart` example in the [examples/widgets](examples/widgets)
 directory on a connected Android device, from that directory you would run:
 
- * `flutter start -t tabs.dart`
+ * `flutter run -t tabs.dart`
 
 When running code from the examples directory, any changes you make to the
 example code, as well as any changes to Dart code in the
@@ -169,7 +169,7 @@
 examples on your device using your locally built engine, use the
 `--debug` option to the `flutter` tool:
 
- * `flutter start --debug`
+ * `flutter run --debug`
 
 If you want to test the release version instead of the debug version,
 use `--release` instead of `--debug`.
diff --git a/dev/profile_startup.dart b/dev/profile_startup.dart
index b5a01a8..f905795 100755
--- a/dev/profile_startup.dart
+++ b/dev/profile_startup.dart
@@ -45,7 +45,7 @@
   String tracePath = "${tracesDir}/trace_$runNumber.json";
   runWithLoggingSync([
     'flutter',
-    'start',
+    'run',
     '--no-checked',
     '--trace-startup'
   ], workingDirectory: projectPath);
@@ -84,7 +84,7 @@
   String traces_dir = '/tmp';
 
   List<double> times = [];
-  print("Profiling startup using flutter start --trace-startup.");
+  print("Profiling startup using flutter run --trace-startup.");
   print("Measuring from first trace event to completion of first frame upload.");
   print("aka NativeViewGLSurfaceEGL:RealSwapBuffers.\n");
   print("NOTE: If device is not on/unlocked tracing may fail.\n");
diff --git a/examples/README.md b/examples/README.md
index e7bcc3b..35048c6 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -1,23 +1,23 @@
 Flutter Examples
 ================
 
-This directory contains several examples of using Flutter.  Each of these is an
+This directory contains several examples of using Flutter. Each of these is an
 individual Dart application package.
 
 To run a sample with the `flutter` tool, run `pub get` inside its directory,
-then run `flutter start`. (See the
+then run `flutter run`. (See the
 [getting started guide](https://flutter.io/getting-started/) to install
 the `flutter` tool.)
 
 Available examples include:
 
-- *Hello, world.* The [hello world app](hello_world) is a basic app that shows
+- **Hello, world** The [hello world app](hello_world) is a basic app that shows
    the text "hello, world."
 
-- *Stocks.* The [stocks app](stocks) is an example of a typical mobile app
+- **Stocks** The [stocks app](stocks) is an example of a typical mobile app
    built using Flutter. The app shows a list of all the stocks in the NASDAQ.
 
-- *Widgets.* The [widget apps](widgets) demonstrate a number of Flutter widgets
+- **Widgets** The [widget apps](widgets) demonstrate a number of Flutter widgets
    so you can experiment with them in a simple container. There is no main.dart
    in this directory because each file is a standalone sample. To run a
-   particular file, use `flutter start -t filename.dart`.
+   particular file, use `flutter run -t filename.dart`.
diff --git a/examples/layers/README.md b/examples/layers/README.md
index d4916ca..cedc466 100644
--- a/examples/layers/README.md
+++ b/examples/layers/README.md
@@ -18,5 +18,5 @@
 To run each example, use the `-t` argument to the `flutter` tool:
 
 ```
-flutter start -t widgets/spinning_square.dart
+flutter run -t widgets/spinning_square.dart
 ```
diff --git a/examples/widgets/README.md b/examples/widgets/README.md
index 9ad8964..11addfc 100644
--- a/examples/widgets/README.md
+++ b/examples/widgets/README.md
@@ -4,7 +4,7 @@
 To run these, open a terminal in this directory and use the following command:
 
 ```bash
-flutter start --checked -t foo.dart
+flutter run -t foo.dart
 ```
 
 ...where `foo.dart` is the file you want to run.
diff --git a/packages/flutter/lib/src/rendering/grid.dart b/packages/flutter/lib/src/rendering/grid.dart
index 69bdf4d..7367d80 100644
--- a/packages/flutter/lib/src/rendering/grid.dart
+++ b/packages/flutter/lib/src/rendering/grid.dart
@@ -50,6 +50,10 @@
   }
 
   /// Creates a grid specification containing a certain number of equally sized tiles.
+  /// The tileWidth is the sum of the width of the child it will contain and
+  /// columnSpacing (even if columnCount is 1). Similarly tileHeight is child's height
+  /// plus rowSpacing. If the tiles are to completely fill the grid, then their size
+  /// should be based on the grid's padded interior.
   GridSpecification.fromRegularTiles({
     double tileWidth,
     double tileHeight,
@@ -62,6 +66,8 @@
        rowOffsets = _generateRegularOffsets(rowCount, tileHeight) {
     assert(_debugIsMonotonic(columnOffsets));
     assert(_debugIsMonotonic(rowOffsets));
+    assert(columnSpacing != null && columnSpacing >= 0.0);
+    assert(rowSpacing != null && rowSpacing >= 0.0);
     assert(padding != null && padding.isNonNegative);
   }
 
@@ -209,8 +215,8 @@
 
   bool shouldRelayout(GridDelegateWithInOrderChildPlacement oldDelegate) {
     return columnSpacing != oldDelegate.columnSpacing
-      || rowSpacing != oldDelegate.rowSpacing
-      || padding != oldDelegate.padding;
+        || rowSpacing != oldDelegate.rowSpacing
+        || padding != oldDelegate.padding;
   }
 }
 
@@ -468,10 +474,10 @@
       assert(placement.column + placement.columnSpan < _specification.columnOffsets.length);
       assert(placement.row + placement.rowSpan < _specification.rowOffsets.length);
 
-      double tileLeft = _specification.columnOffsets[placement.column] + gridLeftPadding;
-      double tileRight = _specification.columnOffsets[placement.column + placement.columnSpan] + gridLeftPadding;
-      double tileTop = _specification.rowOffsets[placement.row] + gridTopPadding;
-      double tileBottom = _specification.rowOffsets[placement.row + placement.rowSpan] + gridTopPadding;
+      double tileLeft = gridLeftPadding + _specification.columnOffsets[placement.column];
+      double tileRight = gridLeftPadding + _specification.columnOffsets[placement.column + placement.columnSpan];
+      double tileTop = gridTopPadding + _specification.rowOffsets[placement.row];
+      double tileBottom =  gridTopPadding + _specification.rowOffsets[placement.row + placement.rowSpan];
 
       double childWidth = math.max(0.0, tileRight - tileLeft - _specification.columnSpacing);
       double childHeight = math.max(0.0, tileBottom - tileTop - _specification.rowSpacing);