From bf6ae3ee763faa10aca0a7450725445c95645a93 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Wed, 1 Jun 2016 15:34:48 -0700 Subject: [PATCH] Reenable the gallery smoke test (#4303) ...and fix some grid and table intrinsic issues it uncovered. --- examples/flutter_gallery/test/smoke_test.dart | 3 +-- packages/flutter/lib/src/rendering/grid.dart | 16 +++++++++++++++- packages/flutter/lib/src/rendering/table.dart | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/examples/flutter_gallery/test/smoke_test.dart b/examples/flutter_gallery/test/smoke_test.dart index 27935235e7..8be5022b6d 100644 --- a/examples/flutter_gallery/test/smoke_test.dart +++ b/examples/flutter_gallery/test/smoke_test.dart @@ -109,6 +109,5 @@ void main() { await tester.tap(find.text('Light')); await tester.pump(); await tester.pump(const Duration(seconds: 1)); // Wait until it's changed. - }, - skip: true); + }); } diff --git a/packages/flutter/lib/src/rendering/grid.dart b/packages/flutter/lib/src/rendering/grid.dart index 1e8811539e..d87fe15bbd 100644 --- a/packages/flutter/lib/src/rendering/grid.dart +++ b/packages/flutter/lib/src/rendering/grid.dart @@ -292,6 +292,10 @@ abstract class GridDelegateWithInOrderChildPlacement extends GridDelegate { /// A [GridDelegate] that divides the grid's width evenly for a fixed number of columns. +/// +/// Grids using this delegate cannot validly be placed inside an unconstrained +/// horizontal space, since they attempt to divide the incoming horizontal +/// maximum width constraint. class FixedColumnCountGridDelegate extends GridDelegateWithInOrderChildPlacement { /// Creates a grid delegate that uses a fixed column count. /// @@ -349,7 +353,17 @@ class FixedColumnCountGridDelegate extends GridDelegateWithInOrderChildPlacement return 0.0; } - // TODO(ianh): Provide efficient intrinsic height functions. + @override + double getMinIntrinsicHeight(double width, int childCount) { + // TODO(ianh): Strictly, this should examine the children. + return 0.0; + } + + @override + double getMaxIntrinsicHeight(double width, int childCount) { + // TODO(ianh): Strictly, this should examine the children. + return 0.0; + } } /// A [GridDelegate] that fills the width with a variable number of tiles. diff --git a/packages/flutter/lib/src/rendering/table.dart b/packages/flutter/lib/src/rendering/table.dart index 7e0b43d144..f4174c5421 100644 --- a/packages/flutter/lib/src/rendering/table.dart +++ b/packages/flutter/lib/src/rendering/table.dart @@ -892,7 +892,6 @@ class RenderTable extends RenderBox { if (flexes[x] != null) { final double newWidth = widths[x] - deficit * flexes[x] / totalFlex; assert(newWidth.isFinite); - assert(newWidth >= 0.0); if (newWidth <= minWidths[x]) { // shrank to minimum deficit -= widths[x] - minWidths[x]; @@ -904,6 +903,7 @@ class RenderTable extends RenderBox { widths[x] = newWidth; newTotalFlex += flexes[x]; } + assert(widths[x] >= 0.0); } } totalFlex = newTotalFlex;