Unverified Commit 6c32c15f authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

add some const classes (#21954)

parent f1f4bda8
...@@ -357,7 +357,7 @@ class _NestedScrollViewState extends State<NestedScrollView> { ...@@ -357,7 +357,7 @@ class _NestedScrollViewState extends State<NestedScrollView> {
} }
class _NestedScrollViewCustomScrollView extends CustomScrollView { class _NestedScrollViewCustomScrollView extends CustomScrollView {
_NestedScrollViewCustomScrollView({ const _NestedScrollViewCustomScrollView({
@required Axis scrollDirection, @required Axis scrollDirection,
@required bool reverse, @required bool reverse,
@required ScrollPhysics physics, @required ScrollPhysics physics,
......
...@@ -58,8 +58,7 @@ class AndroidView extends StatefulWidget { ...@@ -58,8 +58,7 @@ class AndroidView extends StatefulWidget {
/// The `viewType` and `hitTestBehavior` parameters must not be null. /// The `viewType` and `hitTestBehavior` parameters must not be null.
/// If `creationParams` is not null then `creationParamsCodec` must not be null. /// If `creationParams` is not null then `creationParamsCodec` must not be null.
/// {@endtemplate} /// {@endtemplate}
AndroidView({ // ignore: prefer_const_constructors_in_immutables const AndroidView({
// TODO(aam): Remove lint ignore above once https://dartbug.com/34297 is fixed
Key key, Key key,
@required this.viewType, @required this.viewType,
this.onPlatformViewCreated, this.onPlatformViewCreated,
......
...@@ -50,8 +50,7 @@ abstract class ScrollView extends StatelessWidget { ...@@ -50,8 +50,7 @@ abstract class ScrollView extends StatelessWidget {
/// Creates a widget that scrolls. /// Creates a widget that scrolls.
/// ///
/// If the [primary] argument is true, the [controller] must be null. /// If the [primary] argument is true, the [controller] must be null.
ScrollView({ // ignore: prefer_const_constructors_in_immutables const ScrollView({
// TODO(aam): Remove lint ignore above once dartbug.com/34297 is fixed
Key key, Key key,
this.scrollDirection = Axis.vertical, this.scrollDirection = Axis.vertical,
this.reverse = false, this.reverse = false,
...@@ -67,8 +66,8 @@ abstract class ScrollView extends StatelessWidget { ...@@ -67,8 +66,8 @@ abstract class ScrollView extends StatelessWidget {
'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. ' 'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. '
'You cannot both set primary to true and pass an explicit controller.' 'You cannot both set primary to true and pass an explicit controller.'
), ),
primary = primary ?? controller == null && scrollDirection == Axis.vertical, primary = primary ?? controller == null && identical(scrollDirection, Axis.vertical),
physics = physics ?? (primary == true || (primary == null && controller == null && scrollDirection == Axis.vertical) ? const AlwaysScrollableScrollPhysics() : null), physics = physics ?? (primary == true || (primary == null && controller == null && identical(scrollDirection, Axis.vertical)) ? const AlwaysScrollableScrollPhysics() : null),
super(key: key); super(key: key);
/// The axis along which the scroll view scrolls. /// The axis along which the scroll view scrolls.
...@@ -386,7 +385,7 @@ class CustomScrollView extends ScrollView { ...@@ -386,7 +385,7 @@ class CustomScrollView extends ScrollView {
/// Creates a [ScrollView] that creates custom scroll effects using slivers. /// Creates a [ScrollView] that creates custom scroll effects using slivers.
/// ///
/// If the [primary] argument is true, the [controller] must be null. /// If the [primary] argument is true, the [controller] must be null.
CustomScrollView({ const CustomScrollView({
Key key, Key key,
Axis scrollDirection = Axis.vertical, Axis scrollDirection = Axis.vertical,
bool reverse = false, bool reverse = false,
...@@ -428,7 +427,7 @@ abstract class BoxScrollView extends ScrollView { ...@@ -428,7 +427,7 @@ abstract class BoxScrollView extends ScrollView {
/// Creates a [ScrollView] uses a single child layout model. /// Creates a [ScrollView] uses a single child layout model.
/// ///
/// If the [primary] argument is true, the [controller] must be null. /// If the [primary] argument is true, the [controller] must be null.
BoxScrollView({ const BoxScrollView({
Key key, Key key,
Axis scrollDirection = Axis.vertical, Axis scrollDirection = Axis.vertical,
bool reverse = false, bool reverse = false,
...@@ -912,7 +911,7 @@ class ListView extends BoxScrollView { ...@@ -912,7 +911,7 @@ class ListView extends BoxScrollView {
/// ///
/// For example, a custom child model can control the algorithm used to /// For example, a custom child model can control the algorithm used to
/// estimate the size of children that are not actually visible. /// estimate the size of children that are not actually visible.
ListView.custom({ const ListView.custom({
Key key, Key key,
Axis scrollDirection = Axis.vertical, Axis scrollDirection = Axis.vertical,
bool reverse = false, bool reverse = false,
...@@ -1219,7 +1218,7 @@ class GridView extends BoxScrollView { ...@@ -1219,7 +1218,7 @@ class GridView extends BoxScrollView {
/// a [SliverChildBuilderDelegate] or use the [GridView.builder] constructor. /// a [SliverChildBuilderDelegate] or use the [GridView.builder] constructor.
/// ///
/// The [gridDelegate] and [childrenDelegate] arguments must not be null. /// The [gridDelegate] and [childrenDelegate] arguments must not be null.
GridView.custom({ const GridView.custom({
Key key, Key key,
Axis scrollDirection = Axis.vertical, Axis scrollDirection = Axis.vertical,
bool reverse = false, bool reverse = false,
......
...@@ -183,8 +183,7 @@ import 'scrollable.dart'; ...@@ -183,8 +183,7 @@ import 'scrollable.dart';
/// * [Scrollable], which handles arbitrary scrolling effects. /// * [Scrollable], which handles arbitrary scrolling effects.
class SingleChildScrollView extends StatelessWidget { class SingleChildScrollView extends StatelessWidget {
/// Creates a box in which a single widget can be scrolled. /// Creates a box in which a single widget can be scrolled.
SingleChildScrollView({ // ignore: prefer_const_constructors_in_immutables const SingleChildScrollView({
// TODO(aam): Remove lint ignore above once dartbug.com/34297 is fixed
Key key, Key key,
this.scrollDirection = Axis.vertical, this.scrollDirection = Axis.vertical,
this.reverse = false, this.reverse = false,
...@@ -198,7 +197,7 @@ class SingleChildScrollView extends StatelessWidget { ...@@ -198,7 +197,7 @@ class SingleChildScrollView extends StatelessWidget {
'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. ' 'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. '
'You cannot both set primary to true and pass an explicit controller.' 'You cannot both set primary to true and pass an explicit controller.'
), ),
primary = primary ?? controller == null && scrollDirection == Axis.vertical, primary = primary ?? controller == null && identical(scrollDirection, Axis.vertical),
super(key: key); super(key: key);
/// The axis along which the scroll view scrolls. /// The axis along which the scroll view scrolls.
......
...@@ -602,10 +602,10 @@ void main() { ...@@ -602,10 +602,10 @@ void main() {
'Border is displayed by default in sliver nav bar', 'Border is displayed by default in sliver nav bar',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( const CupertinoApp(
home: CupertinoPageScaffold( home: CupertinoPageScaffold(
child: CustomScrollView( child: CustomScrollView(
slivers: const <Widget>[ slivers: <Widget>[
CupertinoSliverNavigationBar( CupertinoSliverNavigationBar(
largeTitle: Text('Large Title'), largeTitle: Text('Large Title'),
), ),
...@@ -632,10 +632,10 @@ void main() { ...@@ -632,10 +632,10 @@ void main() {
'Border is not displayed when null in sliver nav bar', 'Border is not displayed when null in sliver nav bar',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( const CupertinoApp(
home: CupertinoPageScaffold( home: CupertinoPageScaffold(
child: CustomScrollView( child: CustomScrollView(
slivers: const <Widget>[ slivers: <Widget>[
CupertinoSliverNavigationBar( CupertinoSliverNavigationBar(
largeTitle: Text('Large Title'), largeTitle: Text('Large Title'),
border: null, border: null,
...@@ -659,10 +659,10 @@ void main() { ...@@ -659,10 +659,10 @@ void main() {
testWidgets('CupertinoSliverNavigationBar has semantics', (WidgetTester tester) async { testWidgets('CupertinoSliverNavigationBar has semantics', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(CupertinoApp( await tester.pumpWidget(const CupertinoApp(
home: CupertinoPageScaffold( home: CupertinoPageScaffold(
child: CustomScrollView( child: CustomScrollView(
slivers: const <Widget>[ slivers: <Widget>[
CupertinoSliverNavigationBar( CupertinoSliverNavigationBar(
largeTitle: Text('Large Title'), largeTitle: Text('Large Title'),
border: null, border: null,
...@@ -706,10 +706,10 @@ void main() { ...@@ -706,10 +706,10 @@ void main() {
'Border can be overridden in sliver nav bar', 'Border can be overridden in sliver nav bar',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( const CupertinoApp(
home: CupertinoPageScaffold( home: CupertinoPageScaffold(
child: CustomScrollView( child: CustomScrollView(
slivers: const <Widget>[ slivers: <Widget>[
CupertinoSliverNavigationBar( CupertinoSliverNavigationBar(
largeTitle: Text('Large Title'), largeTitle: Text('Large Title'),
border: Border( border: Border(
......
...@@ -48,9 +48,9 @@ void main() { ...@@ -48,9 +48,9 @@ void main() {
CupertinoPageRoute<void>( CupertinoPageRoute<void>(
title: 'An iPod', title: 'An iPod',
builder: (BuildContext context) { builder: (BuildContext context) {
return CupertinoPageScaffold( return const CupertinoPageScaffold(
child: CustomScrollView( child: CustomScrollView(
slivers: const <Widget>[ slivers: <Widget>[
CupertinoSliverNavigationBar(), CupertinoSliverNavigationBar(),
], ],
), ),
......
...@@ -9,11 +9,11 @@ import '../rendering/mock_canvas.dart'; ...@@ -9,11 +9,11 @@ import '../rendering/mock_canvas.dart';
void main() { void main() {
testWidgets('Paints iOS spec', (WidgetTester tester) async { testWidgets('Paints iOS spec', (WidgetTester tester) async {
await tester.pumpWidget(Directionality( await tester.pumpWidget(const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: CupertinoScrollbar( child: CupertinoScrollbar(
child: SingleChildScrollView( child: SingleChildScrollView(
child: const SizedBox(width: 4000.0, height: 4000.0), child: SizedBox(width: 4000.0, height: 4000.0),
), ),
), ),
)); ));
......
...@@ -9,11 +9,11 @@ import '../rendering/mock_canvas.dart'; ...@@ -9,11 +9,11 @@ import '../rendering/mock_canvas.dart';
void main() { void main() {
testWidgets('Scrollbar never goes away until finger lift', (WidgetTester tester) async { testWidgets('Scrollbar never goes away until finger lift', (WidgetTester tester) async {
await tester.pumpWidget(Directionality( await tester.pumpWidget(const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: CupertinoScrollbar( child: CupertinoScrollbar(
child: SingleChildScrollView( child: SingleChildScrollView(
child: const SizedBox(width: 4000.0, height: 4000.0), child: SizedBox(width: 4000.0, height: 4000.0),
), ),
), ),
)); ));
...@@ -45,11 +45,11 @@ void main() { ...@@ -45,11 +45,11 @@ void main() {
testWidgets('Scrollbar is not smaller than minLength with large scroll views', testWidgets('Scrollbar is not smaller than minLength with large scroll views',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget(Directionality( await tester.pumpWidget(const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: CupertinoScrollbar( child: CupertinoScrollbar(
child: SingleChildScrollView( child: SingleChildScrollView(
child: const SizedBox(width: 800.0, height: 20000.0), child: SizedBox(width: 800.0, height: 20000.0),
), ),
), ),
)); ));
......
...@@ -9,11 +9,11 @@ import '../rendering/mock_canvas.dart'; ...@@ -9,11 +9,11 @@ import '../rendering/mock_canvas.dart';
void main() { void main() {
testWidgets('Viewport basic test (LTR)', (WidgetTester tester) async { testWidgets('Viewport basic test (LTR)', (WidgetTester tester) async {
await tester.pumpWidget(Directionality( await tester.pumpWidget(const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Scrollbar( child: Scrollbar(
child: SingleChildScrollView( child: SingleChildScrollView(
child: const SizedBox(width: 4000.0, height: 4000.0), child: SizedBox(width: 4000.0, height: 4000.0),
), ),
), ),
)); ));
...@@ -23,11 +23,11 @@ void main() { ...@@ -23,11 +23,11 @@ void main() {
}); });
testWidgets('Viewport basic test (RTL)', (WidgetTester tester) async { testWidgets('Viewport basic test (RTL)', (WidgetTester tester) async {
await tester.pumpWidget(Directionality( await tester.pumpWidget(const Directionality(
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: Scrollbar( child: Scrollbar(
child: SingleChildScrollView( child: SingleChildScrollView(
child: const SizedBox(width: 4000.0, height: 4000.0), child: SizedBox(width: 4000.0, height: 4000.0),
), ),
), ),
)); ));
......
...@@ -113,9 +113,9 @@ void main() { ...@@ -113,9 +113,9 @@ void main() {
data: ThemeData( data: ThemeData(
platform: platform platform: platform
), ),
child: Scrollbar( child: const Scrollbar(
child: SingleChildScrollView( child: SingleChildScrollView(
child: const SizedBox(width: 4000.0, height: 4000.0), child: SizedBox(width: 4000.0, height: 4000.0),
), ),
), ),
), ),
......
...@@ -24,10 +24,10 @@ Future<void> slowDrag(WidgetTester tester, Offset start, Offset offset) async { ...@@ -24,10 +24,10 @@ Future<void> slowDrag(WidgetTester tester, Offset start, Offset offset) async {
void main() { void main() {
testWidgets('Overscroll indicator color', (WidgetTester tester) async { testWidgets('Overscroll indicator color', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
Directionality( const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: CustomScrollView( child: CustomScrollView(
slivers: const <Widget>[ slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 2000.0)), SliverToBoxAdapter(child: SizedBox(height: 2000.0)),
], ],
), ),
...@@ -70,8 +70,8 @@ void main() { ...@@ -70,8 +70,8 @@ void main() {
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Container( child: Container(
width: 600.0, width: 600.0,
child: CustomScrollView( child: const CustomScrollView(
slivers: const <Widget>[ slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 2000.0)), SliverToBoxAdapter(child: SizedBox(height: 2000.0)),
], ],
), ),
...@@ -91,10 +91,10 @@ void main() { ...@@ -91,10 +91,10 @@ void main() {
testWidgets('Overscroll indicator changes side when you drag on the other side', (WidgetTester tester) async { testWidgets('Overscroll indicator changes side when you drag on the other side', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
Directionality( const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: CustomScrollView( child: CustomScrollView(
slivers: const <Widget>[ slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 2000.0)), SliverToBoxAdapter(child: SizedBox(height: 2000.0)),
], ],
), ),
...@@ -129,10 +129,10 @@ void main() { ...@@ -129,10 +129,10 @@ void main() {
testWidgets('Overscroll indicator changes side when you shift sides', (WidgetTester tester) async { testWidgets('Overscroll indicator changes side when you shift sides', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
Directionality( const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: CustomScrollView( child: CustomScrollView(
slivers: const <Widget>[ slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 2000.0)), SliverToBoxAdapter(child: SizedBox(height: 2000.0)),
], ],
), ),
...@@ -165,11 +165,11 @@ void main() { ...@@ -165,11 +165,11 @@ void main() {
group('Flipping direction of scrollable doesn\'t change overscroll behavior', () { group('Flipping direction of scrollable doesn\'t change overscroll behavior', () {
testWidgets('down', (WidgetTester tester) async { testWidgets('down', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
Directionality( const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: CustomScrollView( child: CustomScrollView(
physics: const AlwaysScrollableScrollPhysics(), physics: AlwaysScrollableScrollPhysics(),
slivers: const <Widget>[ slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 20.0)), SliverToBoxAdapter(child: SizedBox(height: 20.0)),
], ],
), ),
...@@ -185,12 +185,12 @@ void main() { ...@@ -185,12 +185,12 @@ void main() {
testWidgets('up', (WidgetTester tester) async { testWidgets('up', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
Directionality( const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: CustomScrollView( child: CustomScrollView(
reverse: true, reverse: true,
physics: const AlwaysScrollableScrollPhysics(), physics: AlwaysScrollableScrollPhysics(),
slivers: const <Widget>[ slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 20.0)), SliverToBoxAdapter(child: SizedBox(height: 20.0)),
], ],
), ),
...@@ -207,11 +207,11 @@ void main() { ...@@ -207,11 +207,11 @@ void main() {
testWidgets('Overscroll in both directions', (WidgetTester tester) async { testWidgets('Overscroll in both directions', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
Directionality( const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: CustomScrollView( child: CustomScrollView(
physics: const AlwaysScrollableScrollPhysics(), physics: AlwaysScrollableScrollPhysics(),
slivers: const <Widget>[ slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 20.0)), SliverToBoxAdapter(child: SizedBox(height: 20.0)),
], ],
), ),
...@@ -230,12 +230,12 @@ void main() { ...@@ -230,12 +230,12 @@ void main() {
testWidgets('Overscroll horizontally', (WidgetTester tester) async { testWidgets('Overscroll horizontally', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
Directionality( const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: CustomScrollView( child: CustomScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
physics: const AlwaysScrollableScrollPhysics(), physics: AlwaysScrollableScrollPhysics(),
slivers: const <Widget>[ slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 20.0)), SliverToBoxAdapter(child: SizedBox(height: 20.0)),
], ],
), ),
...@@ -283,11 +283,11 @@ void main() { ...@@ -283,11 +283,11 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: ScrollConfiguration( child: ScrollConfiguration(
behavior: TestScrollBehavior1(), behavior: TestScrollBehavior1(),
child: CustomScrollView( child: const CustomScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
physics: const AlwaysScrollableScrollPhysics(), physics: AlwaysScrollableScrollPhysics(),
reverse: true, reverse: true,
slivers: const <Widget>[ slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 20.0)), SliverToBoxAdapter(child: SizedBox(height: 20.0)),
], ],
), ),
...@@ -305,10 +305,10 @@ void main() { ...@@ -305,10 +305,10 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: ScrollConfiguration( child: ScrollConfiguration(
behavior: TestScrollBehavior2(), behavior: TestScrollBehavior2(),
child: CustomScrollView( child: const CustomScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
physics: const AlwaysScrollableScrollPhysics(), physics: AlwaysScrollableScrollPhysics(),
slivers: const <Widget>[ slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 20.0)), SliverToBoxAdapter(child: SizedBox(height: 20.0)),
], ],
), ),
......
...@@ -23,7 +23,7 @@ void main() { ...@@ -23,7 +23,7 @@ void main() {
viewsController.registerViewType('webview'); viewsController.registerViewType('webview');
await tester.pumpWidget( await tester.pumpWidget(
Center( const Center(
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
...@@ -47,7 +47,7 @@ void main() { ...@@ -47,7 +47,7 @@ void main() {
viewsController.registerViewType('webview'); viewsController.registerViewType('webview');
await tester.pumpWidget( await tester.pumpWidget(
Center( const Center(
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
...@@ -55,7 +55,7 @@ void main() { ...@@ -55,7 +55,7 @@ void main() {
viewType: 'webview', viewType: 'webview',
layoutDirection: TextDirection.ltr, layoutDirection: TextDirection.ltr,
creationParams: 'creation parameters', creationParams: 'creation parameters',
creationParamsCodec: const StringCodec(), creationParamsCodec: StringCodec(),
), ),
), ),
), ),
...@@ -85,7 +85,7 @@ void main() { ...@@ -85,7 +85,7 @@ void main() {
viewsController.registerViewType('webview'); viewsController.registerViewType('webview');
await tester.pumpWidget( await tester.pumpWidget(
Center( const Center(
child: SizedBox( child: SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
...@@ -105,7 +105,7 @@ void main() { ...@@ -105,7 +105,7 @@ void main() {
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController(); final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
viewsController.registerViewType('webview'); viewsController.registerViewType('webview');
await tester.pumpWidget( await tester.pumpWidget(
Center( const Center(
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
...@@ -117,7 +117,7 @@ void main() { ...@@ -117,7 +117,7 @@ void main() {
viewsController.resizeCompleter = Completer<void>(); viewsController.resizeCompleter = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
Center( const Center(
child: SizedBox( child: SizedBox(
width: 100.0, width: 100.0,
height: 50.0, height: 50.0,
...@@ -156,7 +156,7 @@ void main() { ...@@ -156,7 +156,7 @@ void main() {
viewsController.registerViewType('webview'); viewsController.registerViewType('webview');
viewsController.registerViewType('maps'); viewsController.registerViewType('maps');
await tester.pumpWidget( await tester.pumpWidget(
Center( const Center(
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
...@@ -166,7 +166,7 @@ void main() { ...@@ -166,7 +166,7 @@ void main() {
); );
await tester.pumpWidget( await tester.pumpWidget(
Center( const Center(
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
...@@ -188,7 +188,7 @@ void main() { ...@@ -188,7 +188,7 @@ void main() {
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController(); final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
viewsController.registerViewType('webview'); viewsController.registerViewType('webview');
await tester.pumpWidget( await tester.pumpWidget(
Center( const Center(
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
...@@ -253,7 +253,7 @@ void main() { ...@@ -253,7 +253,7 @@ void main() {
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController(); final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
viewsController.registerViewType('webview'); viewsController.registerViewType('webview');
await tester.pumpWidget( await tester.pumpWidget(
Align( const Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
...@@ -294,7 +294,7 @@ void main() { ...@@ -294,7 +294,7 @@ void main() {
numPointerDownsOnParent++; numPointerDownsOnParent++;
}, },
), ),
Positioned( const Positioned(
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
...@@ -339,7 +339,7 @@ void main() { ...@@ -339,7 +339,7 @@ void main() {
numPointerDownsOnParent++; numPointerDownsOnParent++;
}, },
), ),
Positioned( const Positioned(
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
...@@ -387,7 +387,7 @@ void main() { ...@@ -387,7 +387,7 @@ void main() {
numPointerDownsOnParent++; numPointerDownsOnParent++;
}, },
), ),
Positioned( const Positioned(
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
...@@ -428,7 +428,7 @@ void main() { ...@@ -428,7 +428,7 @@ void main() {
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Container( child: Container(
margin: const EdgeInsets.all(10.0), margin: const EdgeInsets.all(10.0),
child: SizedBox( child: const SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
child: AndroidView(viewType: 'webview', layoutDirection: TextDirection.ltr), child: AndroidView(viewType: 'webview', layoutDirection: TextDirection.ltr),
...@@ -456,7 +456,7 @@ void main() { ...@@ -456,7 +456,7 @@ void main() {
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController(); final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
viewsController.registerViewType('maps'); viewsController.registerViewType('maps');
await tester.pumpWidget( await tester.pumpWidget(
Center( const Center(
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
...@@ -474,7 +474,7 @@ void main() { ...@@ -474,7 +474,7 @@ void main() {
); );
await tester.pumpWidget( await tester.pumpWidget(
Center( const Center(
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
...@@ -497,7 +497,7 @@ void main() { ...@@ -497,7 +497,7 @@ void main() {
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController(); final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
viewsController.registerViewType('maps'); viewsController.registerViewType('maps');
await tester.pumpWidget( await tester.pumpWidget(
Directionality( const Directionality(
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: Center( child: Center(
child: SizedBox( child: SizedBox(
...@@ -518,7 +518,7 @@ void main() { ...@@ -518,7 +518,7 @@ void main() {
); );
await tester.pumpWidget( await tester.pumpWidget(
Directionality( const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Center( child: Center(
child: SizedBox( child: SizedBox(
...@@ -553,7 +553,7 @@ void main() { ...@@ -553,7 +553,7 @@ void main() {
onVerticalDragStart: (DragStartDetails d) { onVerticalDragStart: (DragStartDetails d) {
verticalDragAcceptedByParent = true; verticalDragAcceptedByParent = true;
}, },
child: SizedBox( child: const SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
child: AndroidView(viewType: 'webview', layoutDirection: TextDirection.ltr), child: AndroidView(viewType: 'webview', layoutDirection: TextDirection.ltr),
...@@ -637,7 +637,7 @@ void main() { ...@@ -637,7 +637,7 @@ void main() {
verticalDragAcceptedByParent = true; verticalDragAcceptedByParent = true;
}, },
onLongPress: () {}, onLongPress: () {},
child: SizedBox( child: const SizedBox(
width: 200.0, width: 200.0,
height: 100.0, height: 100.0,
child: AndroidView( child: AndroidView(
...@@ -669,7 +669,7 @@ void main() { ...@@ -669,7 +669,7 @@ void main() {
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController(); final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
viewsController.registerViewType('webview'); viewsController.registerViewType('webview');
await tester.pumpWidget( await tester.pumpWidget(
Align( const Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
...@@ -686,7 +686,7 @@ void main() { ...@@ -686,7 +686,7 @@ void main() {
await gesture.moveBy(const Offset(0.0, 100.0)); await gesture.moveBy(const Offset(0.0, 100.0));
await tester.pumpWidget( await tester.pumpWidget(
Align( const Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: SizedBox( child: SizedBox(
width: 200.0, width: 200.0,
......
...@@ -16,8 +16,8 @@ void main() { ...@@ -16,8 +16,8 @@ void main() {
notification = value; notification = value;
return false; return false;
}, },
child: SingleChildScrollView( child: const SingleChildScrollView(
child: const SizedBox(height: 1200.0) child: SizedBox(height: 1200.0)
) )
)); ));
...@@ -70,7 +70,7 @@ void main() { ...@@ -70,7 +70,7 @@ void main() {
}, },
child: Container( child: Container(
padding: const EdgeInsets.all(50.0), padding: const EdgeInsets.all(50.0),
child: SingleChildScrollView(child: const SizedBox(height: 1200.0)) child: const SingleChildScrollView(child: SizedBox(height: 1200.0))
) )
) )
) )
......
...@@ -182,7 +182,7 @@ void main() { ...@@ -182,7 +182,7 @@ void main() {
}); });
testWidgets('Vertical CustomScrollViews are primary by default', (WidgetTester tester) async { testWidgets('Vertical CustomScrollViews are primary by default', (WidgetTester tester) async {
final CustomScrollView view = CustomScrollView(scrollDirection: Axis.vertical); const CustomScrollView view = CustomScrollView(scrollDirection: Axis.vertical);
expect(view.primary, isTrue); expect(view.primary, isTrue);
}); });
...@@ -200,7 +200,7 @@ void main() { ...@@ -200,7 +200,7 @@ void main() {
}); });
testWidgets('Horizontal CustomScrollViews are non-primary by default', (WidgetTester tester) async { testWidgets('Horizontal CustomScrollViews are non-primary by default', (WidgetTester tester) async {
final CustomScrollView view = CustomScrollView(scrollDirection: Axis.horizontal); const CustomScrollView view = CustomScrollView(scrollDirection: Axis.horizontal);
expect(view.primary, isFalse); expect(view.primary, isFalse);
}); });
...@@ -249,7 +249,7 @@ void main() { ...@@ -249,7 +249,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: PrimaryScrollController( child: PrimaryScrollController(
controller: primaryScrollController, controller: primaryScrollController,
child: CustomScrollView(primary: true), child: const CustomScrollView(primary: true),
), ),
), ),
); );
......
...@@ -11,8 +11,8 @@ Future<void> pumpTest(WidgetTester tester, TargetPlatform platform) async { ...@@ -11,8 +11,8 @@ Future<void> pumpTest(WidgetTester tester, TargetPlatform platform) async {
theme: ThemeData( theme: ThemeData(
platform: platform, platform: platform,
), ),
home: CustomScrollView( home: const CustomScrollView(
slivers: const <Widget>[ slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 2000.0)), SliverToBoxAdapter(child: SizedBox(height: 2000.0)),
], ],
), ),
......
...@@ -131,12 +131,12 @@ void main() { ...@@ -131,12 +131,12 @@ void main() {
}); });
testWidgets('Vertical SingleChildScrollViews are primary by default', (WidgetTester tester) async { testWidgets('Vertical SingleChildScrollViews are primary by default', (WidgetTester tester) async {
final SingleChildScrollView view = SingleChildScrollView(scrollDirection: Axis.vertical); const SingleChildScrollView view = SingleChildScrollView(scrollDirection: Axis.vertical);
expect(view.primary, isTrue); expect(view.primary, isTrue);
}); });
testWidgets('Horizontal SingleChildScrollViews are non-primary by default', (WidgetTester tester) async { testWidgets('Horizontal SingleChildScrollViews are non-primary by default', (WidgetTester tester) async {
final SingleChildScrollView view = SingleChildScrollView(scrollDirection: Axis.horizontal); const SingleChildScrollView view = SingleChildScrollView(scrollDirection: Axis.horizontal);
expect(view.primary, isFalse); expect(view.primary, isFalse);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment