add some const classes (#21954)
This commit is contained in:
parent
f1f4bda8da
commit
6c32c15f3c
@ -357,7 +357,7 @@ class _NestedScrollViewState extends State<NestedScrollView> {
|
||||
}
|
||||
|
||||
class _NestedScrollViewCustomScrollView extends CustomScrollView {
|
||||
_NestedScrollViewCustomScrollView({
|
||||
const _NestedScrollViewCustomScrollView({
|
||||
@required Axis scrollDirection,
|
||||
@required bool reverse,
|
||||
@required ScrollPhysics physics,
|
||||
|
@ -58,8 +58,7 @@ class AndroidView extends StatefulWidget {
|
||||
/// The `viewType` and `hitTestBehavior` parameters must not be null.
|
||||
/// If `creationParams` is not null then `creationParamsCodec` must not be null.
|
||||
/// {@endtemplate}
|
||||
AndroidView({ // ignore: prefer_const_constructors_in_immutables
|
||||
// TODO(aam): Remove lint ignore above once https://dartbug.com/34297 is fixed
|
||||
const AndroidView({
|
||||
Key key,
|
||||
@required this.viewType,
|
||||
this.onPlatformViewCreated,
|
||||
|
@ -50,8 +50,7 @@ abstract class ScrollView extends StatelessWidget {
|
||||
/// Creates a widget that scrolls.
|
||||
///
|
||||
/// If the [primary] argument is true, the [controller] must be null.
|
||||
ScrollView({ // ignore: prefer_const_constructors_in_immutables
|
||||
// TODO(aam): Remove lint ignore above once dartbug.com/34297 is fixed
|
||||
const ScrollView({
|
||||
Key key,
|
||||
this.scrollDirection = Axis.vertical,
|
||||
this.reverse = false,
|
||||
@ -67,8 +66,8 @@ abstract class ScrollView extends StatelessWidget {
|
||||
'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. '
|
||||
'You cannot both set primary to true and pass an explicit controller.'
|
||||
),
|
||||
primary = primary ?? controller == null && scrollDirection == Axis.vertical,
|
||||
physics = physics ?? (primary == true || (primary == null && controller == null && scrollDirection == Axis.vertical) ? const AlwaysScrollableScrollPhysics() : null),
|
||||
primary = primary ?? controller == null && identical(scrollDirection, Axis.vertical),
|
||||
physics = physics ?? (primary == true || (primary == null && controller == null && identical(scrollDirection, Axis.vertical)) ? const AlwaysScrollableScrollPhysics() : null),
|
||||
super(key: key);
|
||||
|
||||
/// The axis along which the scroll view scrolls.
|
||||
@ -386,7 +385,7 @@ class CustomScrollView extends ScrollView {
|
||||
/// Creates a [ScrollView] that creates custom scroll effects using slivers.
|
||||
///
|
||||
/// If the [primary] argument is true, the [controller] must be null.
|
||||
CustomScrollView({
|
||||
const CustomScrollView({
|
||||
Key key,
|
||||
Axis scrollDirection = Axis.vertical,
|
||||
bool reverse = false,
|
||||
@ -428,7 +427,7 @@ abstract class BoxScrollView extends ScrollView {
|
||||
/// Creates a [ScrollView] uses a single child layout model.
|
||||
///
|
||||
/// If the [primary] argument is true, the [controller] must be null.
|
||||
BoxScrollView({
|
||||
const BoxScrollView({
|
||||
Key key,
|
||||
Axis scrollDirection = Axis.vertical,
|
||||
bool reverse = false,
|
||||
@ -912,7 +911,7 @@ class ListView extends BoxScrollView {
|
||||
///
|
||||
/// For example, a custom child model can control the algorithm used to
|
||||
/// estimate the size of children that are not actually visible.
|
||||
ListView.custom({
|
||||
const ListView.custom({
|
||||
Key key,
|
||||
Axis scrollDirection = Axis.vertical,
|
||||
bool reverse = false,
|
||||
@ -1219,7 +1218,7 @@ class GridView extends BoxScrollView {
|
||||
/// a [SliverChildBuilderDelegate] or use the [GridView.builder] constructor.
|
||||
///
|
||||
/// The [gridDelegate] and [childrenDelegate] arguments must not be null.
|
||||
GridView.custom({
|
||||
const GridView.custom({
|
||||
Key key,
|
||||
Axis scrollDirection = Axis.vertical,
|
||||
bool reverse = false,
|
||||
|
@ -183,8 +183,7 @@ import 'scrollable.dart';
|
||||
/// * [Scrollable], which handles arbitrary scrolling effects.
|
||||
class SingleChildScrollView extends StatelessWidget {
|
||||
/// Creates a box in which a single widget can be scrolled.
|
||||
SingleChildScrollView({ // ignore: prefer_const_constructors_in_immutables
|
||||
// TODO(aam): Remove lint ignore above once dartbug.com/34297 is fixed
|
||||
const SingleChildScrollView({
|
||||
Key key,
|
||||
this.scrollDirection = Axis.vertical,
|
||||
this.reverse = false,
|
||||
@ -198,7 +197,7 @@ class SingleChildScrollView extends StatelessWidget {
|
||||
'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. '
|
||||
'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);
|
||||
|
||||
/// The axis along which the scroll view scrolls.
|
||||
|
@ -602,10 +602,10 @@ void main() {
|
||||
'Border is displayed by default in sliver nav bar',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
CupertinoApp(
|
||||
const CupertinoApp(
|
||||
home: CupertinoPageScaffold(
|
||||
child: CustomScrollView(
|
||||
slivers: const <Widget>[
|
||||
slivers: <Widget>[
|
||||
CupertinoSliverNavigationBar(
|
||||
largeTitle: Text('Large Title'),
|
||||
),
|
||||
@ -632,10 +632,10 @@ void main() {
|
||||
'Border is not displayed when null in sliver nav bar',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
CupertinoApp(
|
||||
const CupertinoApp(
|
||||
home: CupertinoPageScaffold(
|
||||
child: CustomScrollView(
|
||||
slivers: const <Widget>[
|
||||
slivers: <Widget>[
|
||||
CupertinoSliverNavigationBar(
|
||||
largeTitle: Text('Large Title'),
|
||||
border: null,
|
||||
@ -659,10 +659,10 @@ void main() {
|
||||
testWidgets('CupertinoSliverNavigationBar has semantics', (WidgetTester tester) async {
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
|
||||
await tester.pumpWidget(CupertinoApp(
|
||||
await tester.pumpWidget(const CupertinoApp(
|
||||
home: CupertinoPageScaffold(
|
||||
child: CustomScrollView(
|
||||
slivers: const <Widget>[
|
||||
slivers: <Widget>[
|
||||
CupertinoSliverNavigationBar(
|
||||
largeTitle: Text('Large Title'),
|
||||
border: null,
|
||||
@ -706,10 +706,10 @@ void main() {
|
||||
'Border can be overridden in sliver nav bar',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
CupertinoApp(
|
||||
const CupertinoApp(
|
||||
home: CupertinoPageScaffold(
|
||||
child: CustomScrollView(
|
||||
slivers: const <Widget>[
|
||||
slivers: <Widget>[
|
||||
CupertinoSliverNavigationBar(
|
||||
largeTitle: Text('Large Title'),
|
||||
border: Border(
|
||||
|
@ -48,9 +48,9 @@ void main() {
|
||||
CupertinoPageRoute<void>(
|
||||
title: 'An iPod',
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoPageScaffold(
|
||||
return const CupertinoPageScaffold(
|
||||
child: CustomScrollView(
|
||||
slivers: const <Widget>[
|
||||
slivers: <Widget>[
|
||||
CupertinoSliverNavigationBar(),
|
||||
],
|
||||
),
|
||||
|
@ -9,11 +9,11 @@ import '../rendering/mock_canvas.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Paints iOS spec', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(Directionality(
|
||||
await tester.pumpWidget(const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: CupertinoScrollbar(
|
||||
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';
|
||||
|
||||
void main() {
|
||||
testWidgets('Scrollbar never goes away until finger lift', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(Directionality(
|
||||
await tester.pumpWidget(const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: CupertinoScrollbar(
|
||||
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() {
|
||||
|
||||
testWidgets('Scrollbar is not smaller than minLength with large scroll views',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(Directionality(
|
||||
await tester.pumpWidget(const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: CupertinoScrollbar(
|
||||
child: SingleChildScrollView(
|
||||
child: const SizedBox(width: 800.0, height: 20000.0),
|
||||
child: SizedBox(width: 800.0, height: 20000.0),
|
||||
),
|
||||
),
|
||||
));
|
||||
|
@ -67,10 +67,10 @@ BorderRadius getBorderRadius(WidgetTester tester, int index) {
|
||||
void main() {
|
||||
testWidgets('MergeableMaterial empty', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial()
|
||||
child: MergeableMaterial()
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -82,10 +82,10 @@ void main() {
|
||||
|
||||
testWidgets('MergeableMaterial update slice', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -105,10 +105,10 @@ void main() {
|
||||
expect(box.size.height, equals(100.0));
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -130,10 +130,10 @@ void main() {
|
||||
|
||||
testWidgets('MergeableMaterial swap slices', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -162,10 +162,10 @@ void main() {
|
||||
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('B'),
|
||||
@ -200,10 +200,10 @@ void main() {
|
||||
testWidgets('MergeableMaterial paints shadows', (WidgetTester tester) async {
|
||||
debugDisableShadows = false;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -232,10 +232,10 @@ void main() {
|
||||
|
||||
testWidgets('MergeableMaterial merge gap', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -268,10 +268,10 @@ void main() {
|
||||
matches(getBorderRadius(tester, 1), RadiusType.Round, RadiusType.Round);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -309,10 +309,10 @@ void main() {
|
||||
|
||||
testWidgets('MergeableMaterial separate slices', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -341,10 +341,10 @@ void main() {
|
||||
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -385,10 +385,10 @@ void main() {
|
||||
|
||||
testWidgets('MergeableMaterial separate merge separate', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -417,10 +417,10 @@ void main() {
|
||||
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -459,10 +459,10 @@ void main() {
|
||||
matches(getBorderRadius(tester, 1), RadiusType.Round, RadiusType.Round);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -498,10 +498,10 @@ void main() {
|
||||
matches(getBorderRadius(tester, 1), RadiusType.Sharp, RadiusType.Round);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -542,10 +542,10 @@ void main() {
|
||||
|
||||
testWidgets('MergeableMaterial insert slice', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -574,10 +574,10 @@ void main() {
|
||||
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -614,10 +614,10 @@ void main() {
|
||||
|
||||
testWidgets('MergeableMaterial remove slice', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -653,10 +653,10 @@ void main() {
|
||||
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -687,10 +687,10 @@ void main() {
|
||||
|
||||
testWidgets('MergeableMaterial insert chunk', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -719,10 +719,10 @@ void main() {
|
||||
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -775,10 +775,10 @@ void main() {
|
||||
|
||||
testWidgets('MergeableMaterial remove chunk', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -822,10 +822,10 @@ void main() {
|
||||
matches(getBorderRadius(tester, 2), RadiusType.Round, RadiusType.Round);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -863,10 +863,10 @@ void main() {
|
||||
|
||||
testWidgets('MergeableMaterial replace gap with chunk', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -899,10 +899,10 @@ void main() {
|
||||
matches(getBorderRadius(tester, 1), RadiusType.Round, RadiusType.Round);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -955,10 +955,10 @@ void main() {
|
||||
|
||||
testWidgets('MergeableMaterial replace chunk with gap', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -1002,10 +1002,10 @@ void main() {
|
||||
matches(getBorderRadius(tester, 2), RadiusType.Round, RadiusType.Round);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
key: ValueKey<String>('A'),
|
||||
@ -1058,10 +1058,10 @@ void main() {
|
||||
|
||||
testWidgets('MergeableMaterial dividers', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
hasDividers: true,
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
@ -1108,10 +1108,10 @@ void main() {
|
||||
expect(isDivider(boxes[offset + 3], true, false), isTrue);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: const MergeableMaterial(
|
||||
child: MergeableMaterial(
|
||||
hasDividers: true,
|
||||
children: <MergeableMaterialItem>[
|
||||
MaterialSlice(
|
||||
|
@ -9,11 +9,11 @@ import '../rendering/mock_canvas.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Viewport basic test (LTR)', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(Directionality(
|
||||
await tester.pumpWidget(const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Scrollbar(
|
||||
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() {
|
||||
});
|
||||
|
||||
testWidgets('Viewport basic test (RTL)', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(Directionality(
|
||||
await tester.pumpWidget(const Directionality(
|
||||
textDirection: TextDirection.rtl,
|
||||
child: Scrollbar(
|
||||
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() {
|
||||
data: ThemeData(
|
||||
platform: platform
|
||||
),
|
||||
child: Scrollbar(
|
||||
child: const Scrollbar(
|
||||
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 {
|
||||
void main() {
|
||||
testWidgets('Overscroll indicator color', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: CustomScrollView(
|
||||
slivers: const <Widget>[
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: SizedBox(height: 2000.0)),
|
||||
],
|
||||
),
|
||||
@ -70,8 +70,8 @@ void main() {
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Container(
|
||||
width: 600.0,
|
||||
child: CustomScrollView(
|
||||
slivers: const <Widget>[
|
||||
child: const CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: SizedBox(height: 2000.0)),
|
||||
],
|
||||
),
|
||||
@ -91,10 +91,10 @@ void main() {
|
||||
|
||||
testWidgets('Overscroll indicator changes side when you drag on the other side', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: CustomScrollView(
|
||||
slivers: const <Widget>[
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: SizedBox(height: 2000.0)),
|
||||
],
|
||||
),
|
||||
@ -129,10 +129,10 @@ void main() {
|
||||
|
||||
testWidgets('Overscroll indicator changes side when you shift sides', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: CustomScrollView(
|
||||
slivers: const <Widget>[
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: SizedBox(height: 2000.0)),
|
||||
],
|
||||
),
|
||||
@ -165,11 +165,11 @@ void main() {
|
||||
group('Flipping direction of scrollable doesn\'t change overscroll behavior', () {
|
||||
testWidgets('down', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: CustomScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: const <Widget>[
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: SizedBox(height: 20.0)),
|
||||
],
|
||||
),
|
||||
@ -185,12 +185,12 @@ void main() {
|
||||
|
||||
testWidgets('up', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: CustomScrollView(
|
||||
reverse: true,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: const <Widget>[
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: SizedBox(height: 20.0)),
|
||||
],
|
||||
),
|
||||
@ -207,11 +207,11 @@ void main() {
|
||||
|
||||
testWidgets('Overscroll in both directions', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: CustomScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: const <Widget>[
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: SizedBox(height: 20.0)),
|
||||
],
|
||||
),
|
||||
@ -230,12 +230,12 @@ void main() {
|
||||
|
||||
testWidgets('Overscroll horizontally', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: CustomScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: const <Widget>[
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: SizedBox(height: 20.0)),
|
||||
],
|
||||
),
|
||||
@ -283,11 +283,11 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: ScrollConfiguration(
|
||||
behavior: TestScrollBehavior1(),
|
||||
child: CustomScrollView(
|
||||
child: const CustomScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
reverse: true,
|
||||
slivers: const <Widget>[
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: SizedBox(height: 20.0)),
|
||||
],
|
||||
),
|
||||
@ -305,10 +305,10 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: ScrollConfiguration(
|
||||
behavior: TestScrollBehavior2(),
|
||||
child: CustomScrollView(
|
||||
child: const CustomScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: const <Widget>[
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: SizedBox(height: 20.0)),
|
||||
],
|
||||
),
|
||||
|
@ -23,7 +23,7 @@ void main() {
|
||||
viewsController.registerViewType('webview');
|
||||
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
@ -47,7 +47,7 @@ void main() {
|
||||
viewsController.registerViewType('webview');
|
||||
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
@ -55,7 +55,7 @@ void main() {
|
||||
viewType: 'webview',
|
||||
layoutDirection: TextDirection.ltr,
|
||||
creationParams: 'creation parameters',
|
||||
creationParamsCodec: const StringCodec(),
|
||||
creationParamsCodec: StringCodec(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -85,7 +85,7 @@ void main() {
|
||||
viewsController.registerViewType('webview');
|
||||
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: SizedBox(
|
||||
width: 0.0,
|
||||
height: 0.0,
|
||||
@ -105,7 +105,7 @@ void main() {
|
||||
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
|
||||
viewsController.registerViewType('webview');
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
@ -117,7 +117,7 @@ void main() {
|
||||
viewsController.resizeCompleter = Completer<void>();
|
||||
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: SizedBox(
|
||||
width: 100.0,
|
||||
height: 50.0,
|
||||
@ -156,7 +156,7 @@ void main() {
|
||||
viewsController.registerViewType('webview');
|
||||
viewsController.registerViewType('maps');
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
@ -166,7 +166,7 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
@ -188,7 +188,7 @@ void main() {
|
||||
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
|
||||
viewsController.registerViewType('webview');
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
@ -253,7 +253,7 @@ void main() {
|
||||
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
|
||||
viewsController.registerViewType('webview');
|
||||
await tester.pumpWidget(
|
||||
Align(
|
||||
const Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
@ -294,7 +294,7 @@ void main() {
|
||||
numPointerDownsOnParent++;
|
||||
},
|
||||
),
|
||||
Positioned(
|
||||
const Positioned(
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
@ -339,7 +339,7 @@ void main() {
|
||||
numPointerDownsOnParent++;
|
||||
},
|
||||
),
|
||||
Positioned(
|
||||
const Positioned(
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
@ -387,7 +387,7 @@ void main() {
|
||||
numPointerDownsOnParent++;
|
||||
},
|
||||
),
|
||||
Positioned(
|
||||
const Positioned(
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
@ -428,7 +428,7 @@ void main() {
|
||||
alignment: Alignment.topLeft,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(10.0),
|
||||
child: SizedBox(
|
||||
child: const SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
child: AndroidView(viewType: 'webview', layoutDirection: TextDirection.ltr),
|
||||
@ -456,7 +456,7 @@ void main() {
|
||||
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
|
||||
viewsController.registerViewType('maps');
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
@ -474,7 +474,7 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
const Center(
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
@ -497,7 +497,7 @@ void main() {
|
||||
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
|
||||
viewsController.registerViewType('maps');
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
const Directionality(
|
||||
textDirection: TextDirection.rtl,
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
@ -518,7 +518,7 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
@ -553,7 +553,7 @@ void main() {
|
||||
onVerticalDragStart: (DragStartDetails d) {
|
||||
verticalDragAcceptedByParent = true;
|
||||
},
|
||||
child: SizedBox(
|
||||
child: const SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
child: AndroidView(viewType: 'webview', layoutDirection: TextDirection.ltr),
|
||||
@ -637,7 +637,7 @@ void main() {
|
||||
verticalDragAcceptedByParent = true;
|
||||
},
|
||||
onLongPress: () {},
|
||||
child: SizedBox(
|
||||
child: const SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
child: AndroidView(
|
||||
@ -669,7 +669,7 @@ void main() {
|
||||
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
|
||||
viewsController.registerViewType('webview');
|
||||
await tester.pumpWidget(
|
||||
Align(
|
||||
const Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
@ -686,7 +686,7 @@ void main() {
|
||||
await gesture.moveBy(const Offset(0.0, 100.0));
|
||||
|
||||
await tester.pumpWidget(
|
||||
Align(
|
||||
const Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SizedBox(
|
||||
width: 200.0,
|
||||
|
@ -16,8 +16,8 @@ void main() {
|
||||
notification = value;
|
||||
return false;
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
child: const SizedBox(height: 1200.0)
|
||||
child: const SingleChildScrollView(
|
||||
child: SizedBox(height: 1200.0)
|
||||
)
|
||||
));
|
||||
|
||||
@ -70,7 +70,7 @@ void main() {
|
||||
},
|
||||
child: Container(
|
||||
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() {
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
@ -200,7 +200,7 @@ void main() {
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
@ -249,7 +249,7 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: PrimaryScrollController(
|
||||
controller: primaryScrollController,
|
||||
child: CustomScrollView(primary: true),
|
||||
child: const CustomScrollView(primary: true),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -11,8 +11,8 @@ Future<void> pumpTest(WidgetTester tester, TargetPlatform platform) async {
|
||||
theme: ThemeData(
|
||||
platform: platform,
|
||||
),
|
||||
home: CustomScrollView(
|
||||
slivers: const <Widget>[
|
||||
home: const CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: SizedBox(height: 2000.0)),
|
||||
],
|
||||
),
|
||||
|
@ -131,12 +131,12 @@ void main() {
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user