From d8cdaba085d8b2209bddd3d52a31768650cb6928 Mon Sep 17 00:00:00 2001 From: nt4f04uNd Date: Wed, 21 Jul 2021 02:06:03 +0300 Subject: [PATCH] init (#82348) --- .../test/material/chip_theme_test.dart | 72 +- .../test/material/range_slider_test.dart | 575 +++++++--------- .../flutter/test/material/slider_test.dart | 628 ++++++++---------- 3 files changed, 557 insertions(+), 718 deletions(-) diff --git a/packages/flutter/test/material/chip_theme_test.dart b/packages/flutter/test/material/chip_theme_test.dart index e6c026f9721..a9fa9d184f5 100644 --- a/packages/flutter/test/material/chip_theme_test.dart +++ b/packages/flutter/test/material/chip_theme_test.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' show window; - import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -90,24 +88,21 @@ void main() { locale: const Locale('en', 'us'), home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Theme( - data: theme, - child: RawChip( - showCheckmark: true, - onDeleted: () { }, - tapEnabled: true, - avatar: const Placeholder(), - deleteIcon: const Placeholder(), - isEnabled: true, - selected: false, - label: const Text('Chip'), - onSelected: (bool newValue) { }, - onPressed: null, - ), + child: Material( + child: Center( + child: Theme( + data: theme, + child: RawChip( + showCheckmark: true, + onDeleted: () { }, + tapEnabled: true, + avatar: const Placeholder(), + deleteIcon: const Placeholder(), + isEnabled: true, + selected: false, + label: const Text('Chip'), + onSelected: (bool newValue) { }, + onPressed: null, ), ), ), @@ -141,26 +136,23 @@ void main() { return MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Theme( - data: theme, - child: ChipTheme( - data: customTheme, - child: RawChip( - showCheckmark: true, - onDeleted: () { }, - tapEnabled: true, - avatar: const Placeholder(), - deleteIcon: const Placeholder(), - isEnabled: true, - selected: value, - label: const Text('$value'), - onSelected: (bool newValue) { }, - onPressed: null, - ), + child: Material( + child: Center( + child: Theme( + data: theme, + child: ChipTheme( + data: customTheme, + child: RawChip( + showCheckmark: true, + onDeleted: () { }, + tapEnabled: true, + avatar: const Placeholder(), + deleteIcon: const Placeholder(), + isEnabled: true, + selected: value, + label: const Text('$value'), + onSelected: (bool newValue) { }, + onPressed: null, ), ), ), diff --git a/packages/flutter/test/material/range_slider_test.dart b/packages/flutter/test/material/range_slider_test.dart index 61650aba980..a4727ae6643 100644 --- a/packages/flutter/test/material/range_slider_test.dart +++ b/packages/flutter/test/material/range_slider_test.dart @@ -22,18 +22,15 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -79,18 +76,15 @@ void main() { textDirection: TextDirection.rtl, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -136,21 +130,18 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - min: 0.0, - max: 100.0, - divisions: 10, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + min: 0.0, + max: 100.0, + divisions: 10, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -198,21 +189,18 @@ void main() { textDirection: TextDirection.rtl, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - min: 0, - max: 100, - divisions: 10, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + min: 0, + max: 100, + divisions: 10, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -260,18 +248,15 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -307,18 +292,15 @@ void main() { textDirection: TextDirection.rtl, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -354,21 +336,18 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - min: 0, - max: 100, - divisions: 10, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + min: 0, + max: 100, + divisions: 10, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -404,21 +383,18 @@ void main() { textDirection: TextDirection.rtl, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - min: 0, - max: 100, - divisions: 10, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + min: 0, + max: 100, + divisions: 10, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -454,18 +430,15 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -507,18 +480,15 @@ void main() { textDirection: TextDirection.rtl, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -560,21 +530,18 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - min: 0, - max: 100, - divisions: 10, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + min: 0, + max: 100, + divisions: 10, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -616,21 +583,18 @@ void main() { textDirection: TextDirection.rtl, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - min: 0, - max: 100, - divisions: 10, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + min: 0, + max: 100, + divisions: 10, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -672,18 +636,15 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -725,18 +686,15 @@ void main() { textDirection: TextDirection.rtl, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -778,21 +736,18 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - min: 0, - max: 100, - divisions: 10, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + min: 0, + max: 100, + divisions: 10, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -834,21 +789,18 @@ void main() { textDirection: TextDirection.rtl, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - min: 0, - max: 100, - divisions: 10, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + min: 0, + max: 100, + divisions: 10, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ); @@ -892,26 +844,23 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - min: 0, - max: 100, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - onChangeStart: (RangeValues newValues) { - startValues = newValues; - }, - onChangeEnd: (RangeValues newValues) { - endValues = newValues; - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + min: 0, + max: 100, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, + onChangeStart: (RangeValues newValues) { + startValues = newValues; + }, + onChangeEnd: (RangeValues newValues) { + endValues = newValues; + }, ), ), ); @@ -950,26 +899,23 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: RangeSlider( - values: values, - min: 0, - max: 100, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - onChangeStart: (RangeValues newValues) { - startValues = newValues; - }, - onChangeEnd: (RangeValues newValues) { - endValues = newValues; - }, - ), + return Material( + child: Center( + child: RangeSlider( + values: values, + min: 0, + max: 100, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, + onChangeStart: (RangeValues newValues) { + startValues = newValues; + }, + onChangeEnd: (RangeValues newValues) { + endValues = newValues; + }, ), ), ); @@ -1039,20 +985,17 @@ void main() { return MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Theme( - data: theme, - child: RangeSlider( - values: values, - labels: RangeLabels(values.start.toStringAsFixed(2), values.end.toStringAsFixed(2)), - divisions: divisions, - activeColor: activeColor, - inactiveColor: inactiveColor, - onChanged: onChanged, - ), + child: Material( + child: Center( + child: Theme( + data: theme, + child: RangeSlider( + values: values, + labels: RangeLabels(values.start.toStringAsFixed(2), values.end.toStringAsFixed(2)), + divisions: divisions, + activeColor: activeColor, + inactiveColor: inactiveColor, + onChanged: onChanged, ), ), ), @@ -1313,20 +1256,17 @@ void main() { return MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Theme( - data: theme, - child: RangeSlider( - values: values, - labels: RangeLabels(values.start.toStringAsFixed(2), values.end.toStringAsFixed(2)), - divisions: divisions, - activeColor: activeColor, - inactiveColor: inactiveColor, - onChanged: onChanged, - ), + child: Material( + child: Center( + child: Theme( + data: theme, + child: RangeSlider( + values: values, + labels: RangeLabels(values.start.toStringAsFixed(2), values.end.toStringAsFixed(2)), + divisions: divisions, + activeColor: activeColor, + inactiveColor: inactiveColor, + onChanged: onChanged, ), ), ), @@ -1477,20 +1417,17 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Theme( - data: theme, - child: RangeSlider( - values: values, - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: Theme( + data: theme, + child: RangeSlider( + values: values, + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ), @@ -1548,21 +1485,18 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Theme( - data: theme, - child: RangeSlider( - values: values, - labels: RangeLabels(values.start.toStringAsFixed(2), values.end.toStringAsFixed(2)), - onChanged: (RangeValues newValues) { - setState(() { - values = newValues; - }); - }, - ), + return Material( + child: Center( + child: Theme( + data: theme, + child: RangeSlider( + values: values, + labels: RangeLabels(values.start.toStringAsFixed(2), values.end.toStringAsFixed(2)), + onChanged: (RangeValues newValues) { + setState(() { + values = newValues; + }); + }, ), ), ), @@ -1765,15 +1699,12 @@ void main() { data: ThemeData.light(), child: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: RangeSlider( - values: const RangeValues(10.0, 12.0), - min: 0.0, - max: 100.0, - onChanged: (RangeValues v) { }, - ), + child: Material( + child: RangeSlider( + values: const RangeValues(10.0, 12.0), + min: 0.0, + max: 100.0, + onChanged: (RangeValues v) { }, ), ), ), diff --git a/packages/flutter/test/material/slider_test.dart b/packages/flutter/test/material/slider_test.dart index 26ef3d60ee3..2a65e603789 100644 --- a/packages/flutter/test/material/slider_test.dart +++ b/packages/flutter/test/material/slider_test.dart @@ -83,25 +83,22 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Slider( - key: sliderKey, - value: value, - onChanged: (double newValue) { - setState(() { - value = newValue; - }); - }, - onChangeStart: (double value) { - startValue = value; - }, - onChangeEnd: (double value) { - endValue = value; - }, - ), + return Material( + child: Center( + child: Slider( + key: sliderKey, + value: value, + onChanged: (double newValue) { + setState(() { + value = newValue; + }); + }, + onChangeStart: (double value) { + startValue = value; + }, + onChangeEnd: (double value) { + endValue = value; + }, ), ), ); @@ -143,19 +140,16 @@ void main() { textDirection: TextDirection.rtl, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Slider( - key: sliderKey, - value: value, - onChanged: (double newValue) { - setState(() { - value = newValue; - }); - }, - ), + return Material( + child: Center( + child: Slider( + key: sliderKey, + value: value, + onChanged: (double newValue) { + setState(() { + value = newValue; + }); + }, ), ), ); @@ -197,28 +191,25 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Slider( - key: sliderKey, - value: value, - onChanged: (double newValue) { - setState(() { - updates++; - value = newValue; - }); - }, - onChangeStart: (double value) { - startValueUpdates++; - startValue = value; - }, - onChangeEnd: (double value) { - endValueUpdates++; - endValue = value; - }, - ), + return Material( + child: Center( + child: Slider( + key: sliderKey, + value: value, + onChanged: (double newValue) { + setState(() { + updates++; + value = newValue; + }); + }, + onChangeStart: (double value) { + startValueUpdates++; + startValue = value; + }, + onChangeEnd: (double value) { + endValueUpdates++; + endValue = value; + }, ), ), ); @@ -252,20 +243,17 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Slider( - key: sliderKey, - value: value, - divisions: 4, - onChanged: (double newValue) { - setState(() { - value = newValue; - }); - }, - ), + return Material( + child: Center( + child: Slider( + key: sliderKey, + value: value, + divisions: 4, + onChanged: (double newValue) { + setState(() { + value = newValue; + }); + }, ), ), ); @@ -307,22 +295,19 @@ void main() { child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { final SliderThemeData sliderTheme = SliderTheme.of(context).copyWith(thumbShape: loggingThumb); - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: SliderTheme( - data: sliderTheme, - child: Slider( - key: sliderKey, - value: value, - divisions: 4, - onChanged: (double newValue) { - setState(() { - value = newValue; - }); - }, - ), + return Material( + child: Center( + child: SliderTheme( + data: sliderTheme, + child: Slider( + key: sliderKey, + value: value, + divisions: 4, + onChanged: (double newValue) { + setState(() { + value = newValue; + }); + }, ), ), ), @@ -377,20 +362,17 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Slider( - key: sliderKey, - value: value, - onChanged: (double newValue) { - setState(() { - updates++; - value = newValue; - }); - }, - ), + return Material( + child: Center( + child: Slider( + key: sliderKey, + value: value, + onChanged: (double newValue) { + setState(() { + updates++; + value = newValue; + }); + }, ), ), ); @@ -422,22 +404,19 @@ void main() { child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { final SliderThemeData sliderTheme = SliderTheme.of(context).copyWith(thumbShape: loggingThumb); - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: SliderTheme( - data: sliderTheme, - child: Slider( - key: sliderKey, - value: value, - divisions: 4, - onChanged: (double newValue) { - setState(() { - value = newValue; - }); - }, - ), + return Material( + child: Center( + child: SliderTheme( + data: sliderTheme, + child: Slider( + key: sliderKey, + value: value, + divisions: 4, + onChanged: (double newValue) { + setState(() { + value = newValue; + }); + }, ), ), ), @@ -491,24 +470,21 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: SizedBox( - width: 144.0 + 2 * 16.0, // _kPreferredTotalWidth - child: Slider( - key: sliderKey, - min: 0.0, - max: 100.0, - divisions: 10, - value: value, - onChanged: (double newValue) { - setState(() { - value = newValue; - }); - }, - ), + return Material( + child: Center( + child: SizedBox( + width: 144.0 + 2 * 16.0, // _kPreferredTotalWidth + child: Slider( + key: sliderKey, + min: 0.0, + max: 100.0, + divisions: 10, + value: value, + onChanged: (double newValue) { + setState(() { + value = newValue; + }); + }, ), ), ), @@ -543,17 +519,14 @@ void main() { MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Slider( - value: 0.0, - min: 0.0, - max: 1.0, - onChanged: (double newValue) { - log.add(newValue); - }, - ), + child: Material( + child: Slider( + value: 0.0, + min: 0.0, + max: 1.0, + onChanged: (double newValue) { + log.add(newValue); + }, ), ), ), @@ -568,17 +541,14 @@ void main() { MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Slider( - value: 0.0, - min: 0.0, - max: 0.0, - onChanged: (double newValue) { - log.add(newValue); - }, - ), + child: Material( + child: Slider( + value: 0.0, + min: 0.0, + max: 0.0, + onChanged: (double newValue) { + log.add(newValue); + }, ), ), ), @@ -627,20 +597,17 @@ void main() { return MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Theme( - data: theme, - child: Slider( - value: value, - label: '$value', - divisions: divisions, - activeColor: activeColor, - inactiveColor: inactiveColor, - onChanged: onChanged, - ), + child: Material( + child: Center( + child: Theme( + data: theme, + child: Slider( + value: value, + label: '$value', + divisions: divisions, + activeColor: activeColor, + inactiveColor: inactiveColor, + onChanged: onChanged, ), ), ), @@ -812,22 +779,19 @@ void main() { MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: ListView( - children: [ - Slider( - value: value, - onChanged: (double newValue) { - value = newValue; - }, - ), - Container( - height: 2000.0, - ), - ], - ), + child: Material( + child: ListView( + children: [ + Slider( + value: value, + onChanged: (double newValue) { + value = newValue; + }, + ), + Container( + height: 2000.0, + ), + ], ), ), ), @@ -844,16 +808,13 @@ void main() { MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Slider( - value: value, - onChanged: (double newValue) { - value = newValue; - }, - ), + child: Material( + child: Center( + child: Slider( + value: value, + onChanged: (double newValue) { + value = newValue; + }, ), ), ), @@ -879,16 +840,13 @@ void main() { MaterialApp( home: Directionality( textDirection: TextDirection.rtl, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Slider( - value: value, - onChanged: (double newValue) { - value = newValue; - }, - ), + child: Material( + child: Center( + child: Slider( + value: value, + onChanged: (double newValue) { + value = newValue; + }, ), ), ), @@ -950,13 +908,29 @@ void main() { testWidgets('Slider sizing', (WidgetTester tester) async { await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: const Material( - child: Center( + child: Material( + child: Center( + child: Slider( + value: 0.5, + onChanged: null, + ), + ), + ), + ), + ), + ); + expect(tester.renderObject(find.byType(Slider)).size, const Size(800.0, 600.0)); + + await tester.pumpWidget( + const MaterialApp( + home: Directionality( + textDirection: TextDirection.ltr, + child: Material( + child: Center( + child: IntrinsicWidth( child: Slider( value: 0.5, onChanged: null, @@ -967,45 +941,20 @@ void main() { ), ), ); - expect(tester.renderObject(find.byType(Slider)).size, const Size(800.0, 600.0)); - - await tester.pumpWidget( - MaterialApp( - home: Directionality( - textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: const Material( - child: Center( - child: IntrinsicWidth( - child: Slider( - value: 0.5, - onChanged: null, - ), - ), - ), - ), - ), - ), - ), - ); expect(tester.renderObject(find.byType(Slider)).size, const Size(144.0 + 2.0 * 24.0, 600.0)); await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: const Material( - child: Center( - child: OverflowBox( - maxWidth: double.infinity, - maxHeight: double.infinity, - child: Slider( - value: 0.5, - onChanged: null, - ), + child: Material( + child: Center( + child: OverflowBox( + maxWidth: double.infinity, + maxHeight: double.infinity, + child: Slider( + value: 0.5, + onChanged: null, ), ), ), @@ -1173,17 +1122,14 @@ void main() { return MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Slider( - min: 0.0, - max: 100.0, - divisions: divisions, - value: 0.25, - onChanged: (double newValue) { }, - ), + child: Material( + child: Center( + child: Slider( + min: 0.0, + max: 100.0, + divisions: divisions, + value: 0.25, + onChanged: (double newValue) { }, ), ), ), @@ -1245,11 +1191,8 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: createParents(parents, setState), - ), + return Material( + child: createParents(parents, setState), ); }, ), @@ -1356,13 +1299,10 @@ void main() { await tester.pumpWidget(MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Slider( - value: 0.5, - onChanged: (double v) { }, - ), + child: Material( + child: Slider( + value: 0.5, + onChanged: (double v) { }, ), ), ), @@ -1409,16 +1349,13 @@ void main() { ); // Disable slider - await tester.pumpWidget(MaterialApp( + await tester.pumpWidget(const MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: const Material( - child: Slider( - value: 0.5, - onChanged: null, - ), + child: Material( + child: Slider( + value: 0.5, + onChanged: null, ), ), ), @@ -1519,15 +1456,12 @@ void main() { data: ThemeData.light(), child: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Slider( - value: 100.0, - min: 0.0, - max: 200.0, - onChanged: (double v) { }, - ), + child: Material( + child: Slider( + value: 100.0, + min: 0.0, + max: 200.0, + onChanged: (double v) { }, ), ), ), @@ -1574,16 +1508,13 @@ void main() { ); // Disable slider - await tester.pumpWidget(MaterialApp( + await tester.pumpWidget(const MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: const Material( - child: Slider( - value: 0.5, - onChanged: null, - ), + child: Material( + child: Slider( + value: 0.5, + onChanged: null, ), ), ), @@ -1634,17 +1565,14 @@ void main() { await tester.pumpWidget(MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Slider( - value: 40.0, - min: 0.0, - max: 200.0, - divisions: 10, - semanticFormatterCallback: (double value) => value.round().toString(), - onChanged: (double v) { }, - ), + child: Material( + child: Slider( + value: 40.0, + min: 0.0, + max: 200.0, + divisions: 10, + semanticFormatterCallback: (double value) => value.round().toString(), + onChanged: (double v) { }, ), ), ), @@ -1979,20 +1907,17 @@ void main() { return MaterialApp( home: Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Theme( - data: baseTheme, - child: SliderTheme( - data: sliderTheme, - child: Slider( - value: value, - label: '$value', - divisions: divisions, - onChanged: onChanged, - ), + child: Material( + child: Center( + child: Theme( + data: baseTheme, + child: SliderTheme( + data: sliderTheme, + child: Slider( + value: value, + label: '$value', + divisions: divisions, + onChanged: onChanged, ), ), ), @@ -2063,20 +1988,17 @@ void main() { textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: Slider( - key: sliderKey, - value: value, - divisions: 4, - onChanged: (double newValue) { - setState(() { - value = newValue; - }); - }, - ), + return Material( + child: Center( + child: Slider( + key: sliderKey, + value: value, + divisions: 4, + onChanged: (double newValue) { + setState(() { + value = newValue; + }); + }, ), ), ); @@ -2259,23 +2181,20 @@ void main() { child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { final SliderThemeData sliderTheme = SliderTheme.of(context).copyWith(tickMarkShape: TallSliderTickMarkShape()); - return MediaQuery( - data: MediaQueryData.fromWindow(window), - child: Material( - child: Center( - child: IntrinsicHeight( - child: SliderTheme( - data: sliderTheme, - child: Slider( - key: sliderKey, - value: value, - divisions: 4, - onChanged: (double newValue) { - setState(() { - value = newValue; - }); - }, - ), + return Material( + child: Center( + child: IntrinsicHeight( + child: SliderTheme( + data: sliderTheme, + child: Slider( + key: sliderKey, + value: value, + divisions: 4, + onChanged: (double newValue) { + setState(() { + value = newValue; + }); + }, ), ), ), @@ -2408,16 +2327,13 @@ void main() { trackShape: RectangularSliderTrackShape(), ), ), - home: Directionality( + home: const Directionality( textDirection: TextDirection.ltr, - child: MediaQuery( - data: MediaQueryData.fromWindow(window), - child: const Material( - child: Center( - child: Slider( - value: 0.5, - onChanged: null, - ), + child: Material( + child: Center( + child: Slider( + value: 0.5, + onChanged: null, ), ), ),