@@ -42,7 +42,7 @@ class _ContactCategory extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _ContactItem extends StatelessWidget {
|
||||
_ContactItem({ Key key, this.icon, this.lines, this.tooltip, this.onPressed })
|
||||
const _ContactItem({ Key key, this.icon, this.lines, this.tooltip, this.onPressed })
|
||||
: assert(lines.length > 1),
|
||||
super(key: key);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ const Color _kDefaultTabBarBorderColor = Color(0x4C000000);
|
||||
/// * [BottomNavigationBarItem], an item in a [CupertinoTabBar].
|
||||
class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
/// Creates a tab bar in the iOS style.
|
||||
CupertinoTabBar({
|
||||
const CupertinoTabBar({
|
||||
Key key,
|
||||
@required this.items,
|
||||
this.onTap,
|
||||
|
||||
@@ -132,7 +132,7 @@ class Stepper extends StatefulWidget {
|
||||
/// new one.
|
||||
///
|
||||
/// The [steps], [type], and [currentStep] arguments must not be null.
|
||||
Stepper({
|
||||
const Stepper({
|
||||
Key key,
|
||||
@required this.steps,
|
||||
this.physics,
|
||||
|
||||
@@ -41,7 +41,7 @@ class ValueClipper<T> extends CustomClipper<T> {
|
||||
}
|
||||
|
||||
class _UpdateCountedClipRect extends ClipRect {
|
||||
_UpdateCountedClipRect({Clip clipBehavior = Clip.antiAlias})
|
||||
const _UpdateCountedClipRect({Clip clipBehavior = Clip.antiAlias})
|
||||
: super(clipBehavior: clipBehavior);
|
||||
}
|
||||
|
||||
@@ -51,24 +51,24 @@ class _UpdateCountedClipRRect extends ClipRRect {
|
||||
}
|
||||
|
||||
class _UpdateCountedClipOval extends ClipOval {
|
||||
_UpdateCountedClipOval({Clip clipBehavior = Clip.antiAlias})
|
||||
const _UpdateCountedClipOval({Clip clipBehavior = Clip.antiAlias})
|
||||
: super(clipBehavior: clipBehavior);
|
||||
}
|
||||
|
||||
class _UpdateCountedClipPath extends ClipPath {
|
||||
_UpdateCountedClipPath({Clip clipBehavior = Clip.antiAlias})
|
||||
const _UpdateCountedClipPath({Clip clipBehavior = Clip.antiAlias})
|
||||
: super(clipBehavior: clipBehavior);
|
||||
}
|
||||
|
||||
void main() {
|
||||
testWidgets('ClipRect updates clipBehavior in updateRenderObject', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(_UpdateCountedClipRect());
|
||||
await tester.pumpWidget(const _UpdateCountedClipRect());
|
||||
|
||||
final RenderClipRect renderClip = tester.allRenderObjects.whereType<RenderClipRect>().first;
|
||||
|
||||
expect(renderClip.clipBehavior, equals(Clip.antiAlias));
|
||||
|
||||
await tester.pumpWidget(_UpdateCountedClipRect(clipBehavior: Clip.hardEdge));
|
||||
await tester.pumpWidget(const _UpdateCountedClipRect(clipBehavior: Clip.hardEdge));
|
||||
|
||||
expect(renderClip.clipBehavior, equals(Clip.hardEdge));
|
||||
});
|
||||
@@ -86,25 +86,25 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('ClipOval updates clipBehavior in updateRenderObject', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(_UpdateCountedClipOval());
|
||||
await tester.pumpWidget(const _UpdateCountedClipOval());
|
||||
|
||||
final RenderClipOval renderClip = tester.allRenderObjects.whereType<RenderClipOval>().first;
|
||||
|
||||
expect(renderClip.clipBehavior, equals(Clip.antiAlias));
|
||||
|
||||
await tester.pumpWidget(_UpdateCountedClipOval(clipBehavior: Clip.hardEdge));
|
||||
await tester.pumpWidget(const _UpdateCountedClipOval(clipBehavior: Clip.hardEdge));
|
||||
|
||||
expect(renderClip.clipBehavior, equals(Clip.hardEdge));
|
||||
});
|
||||
|
||||
testWidgets('ClipPath updates clipBehavior in updateRenderObject', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(_UpdateCountedClipPath());
|
||||
await tester.pumpWidget(const _UpdateCountedClipPath());
|
||||
|
||||
final RenderClipPath renderClip = tester.allRenderObjects.whereType<RenderClipPath>().first;
|
||||
|
||||
expect(renderClip.clipBehavior, equals(Clip.antiAlias));
|
||||
|
||||
await tester.pumpWidget(_UpdateCountedClipPath(clipBehavior: Clip.hardEdge));
|
||||
await tester.pumpWidget(const _UpdateCountedClipPath(clipBehavior: Clip.hardEdge));
|
||||
|
||||
expect(renderClip.clipBehavior, equals(Clip.hardEdge));
|
||||
});
|
||||
|
||||
@@ -11,19 +11,19 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
class _UpdateCountedPhysicalModel extends PhysicalModel {
|
||||
_UpdateCountedPhysicalModel({Clip clipBehavior = Clip.none})
|
||||
const _UpdateCountedPhysicalModel({Clip clipBehavior = Clip.none})
|
||||
: super(clipBehavior: clipBehavior, color: Colors.red);
|
||||
}
|
||||
|
||||
class _UpdateCountedPhysicalShape extends PhysicalShape {
|
||||
_UpdateCountedPhysicalShape({Clip clipBehavior = Clip.none})
|
||||
const _UpdateCountedPhysicalShape({Clip clipBehavior = Clip.none})
|
||||
: super(clipBehavior: clipBehavior, color: Colors.red, clipper: const ShapeBorderClipper(shape: CircleBorder()));
|
||||
}
|
||||
|
||||
void main() {
|
||||
testWidgets('PhysicalModel updates clipBehavior in updateRenderObject', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(home: _UpdateCountedPhysicalModel()),
|
||||
const MaterialApp(home: _UpdateCountedPhysicalModel()),
|
||||
);
|
||||
|
||||
final RenderPhysicalModel renderPhysicalModel = tester.allRenderObjects.whereType<RenderPhysicalModel>().first;
|
||||
@@ -31,7 +31,7 @@ void main() {
|
||||
expect(renderPhysicalModel.clipBehavior, equals(Clip.none));
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(home: _UpdateCountedPhysicalModel(clipBehavior: Clip.antiAlias)),
|
||||
const MaterialApp(home: _UpdateCountedPhysicalModel(clipBehavior: Clip.antiAlias)),
|
||||
);
|
||||
|
||||
expect(renderPhysicalModel.clipBehavior, equals(Clip.antiAlias));
|
||||
@@ -39,7 +39,7 @@ void main() {
|
||||
|
||||
testWidgets('PhysicalShape updates clipBehavior in updateRenderObject', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(home: _UpdateCountedPhysicalShape()),
|
||||
const MaterialApp(home: _UpdateCountedPhysicalShape()),
|
||||
);
|
||||
|
||||
final RenderPhysicalShape renderPhysicalShape = tester.allRenderObjects.whereType<RenderPhysicalShape>().first;
|
||||
@@ -47,7 +47,7 @@ void main() {
|
||||
expect(renderPhysicalShape.clipBehavior, equals(Clip.none));
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(home: _UpdateCountedPhysicalShape(clipBehavior: Clip.antiAlias)),
|
||||
const MaterialApp(home: _UpdateCountedPhysicalShape(clipBehavior: Clip.antiAlias)),
|
||||
);
|
||||
|
||||
expect(renderPhysicalShape.clipBehavior, equals(Clip.antiAlias));
|
||||
|
||||
@@ -9,9 +9,9 @@ import 'package:flutter/rendering.dart';
|
||||
void main() {
|
||||
testWidgets('Sliver with keep alive without key - should dispose after reodering', (WidgetTester tester) async {
|
||||
List<Widget> childList= <Widget>[
|
||||
WidgetTest0(text: 'child 0', keepAlive: true),
|
||||
WidgetTest1(text: 'child 1', keepAlive: true),
|
||||
WidgetTest2(text: 'child 2', keepAlive: true),
|
||||
const WidgetTest0(text: 'child 0', keepAlive: true),
|
||||
const WidgetTest1(text: 'child 1', keepAlive: true),
|
||||
const WidgetTest2(text: 'child 2', keepAlive: true),
|
||||
];
|
||||
await tester.pumpWidget(SwitchingChildListTest(children: childList));
|
||||
final _WidgetTest0State state0 = tester.state(find.byType(WidgetTest0));
|
||||
@@ -32,9 +32,9 @@ void main() {
|
||||
|
||||
testWidgets('Sliver without keep alive without key - should dispose after reodering', (WidgetTester tester) async {
|
||||
List<Widget> childList= <Widget>[
|
||||
WidgetTest0(text: 'child 0'),
|
||||
WidgetTest1(text: 'child 1'),
|
||||
WidgetTest2(text: 'child 2'),
|
||||
const WidgetTest0(text: 'child 0'),
|
||||
const WidgetTest1(text: 'child 1'),
|
||||
const WidgetTest2(text: 'child 2'),
|
||||
];
|
||||
await tester.pumpWidget(SwitchingChildListTest(children: childList));
|
||||
final _WidgetTest0State state0 = tester.state(find.byType(WidgetTest0));
|
||||
@@ -122,9 +122,9 @@ void main() {
|
||||
|
||||
testWidgets('Sliver with keep alive with Value key - should not dispose after reodering', (WidgetTester tester) async {
|
||||
List<Widget> childList= <Widget>[
|
||||
WidgetTest0(text: 'child 0', key: const ValueKey<int>(0), keepAlive: true),
|
||||
WidgetTest1(text: 'child 1', key: const ValueKey<int>(1), keepAlive: true),
|
||||
WidgetTest2(text: 'child 2', key: const ValueKey<int>(2), keepAlive: true),
|
||||
const WidgetTest0(text: 'child 0', key: ValueKey<int>(0), keepAlive: true),
|
||||
const WidgetTest1(text: 'child 1', key: ValueKey<int>(1), keepAlive: true),
|
||||
const WidgetTest2(text: 'child 2', key: ValueKey<int>(2), keepAlive: true),
|
||||
];
|
||||
await tester.pumpWidget(SwitchingChildListTest(children: childList));
|
||||
final _WidgetTest0State state0 = tester.state(find.byType(WidgetTest0));
|
||||
@@ -146,7 +146,7 @@ void main() {
|
||||
List<Widget> childList= <Widget>[
|
||||
WidgetTest0(text: 'child 0', key: GlobalKey(), keepAlive: true),
|
||||
WidgetTest1(text: 'child 1', key: GlobalKey(), keepAlive: true),
|
||||
WidgetTest2(text: 'child 2', keepAlive: true),
|
||||
const WidgetTest2(text: 'child 2', keepAlive: true),
|
||||
];
|
||||
await tester.pumpWidget(SwitchingChildListTest(children: childList));
|
||||
final _WidgetTest0State state0 = tester.state(find.byType(WidgetTest0));
|
||||
@@ -190,7 +190,7 @@ void main() {
|
||||
List<Widget> childList= <Widget>[
|
||||
WidgetTest0(text: 'child 0', key: GlobalKey(), keepAlive: true),
|
||||
WidgetTest1(text: 'child 1', key: UniqueKey()),
|
||||
WidgetTest2(text: 'child 2', keepAlive: true),
|
||||
const WidgetTest2(text: 'child 2', keepAlive: true),
|
||||
];
|
||||
await tester.pumpWidget(SwitchingChildListTest(children: childList));
|
||||
final _WidgetTest0State state0 = tester.state(find.byType(WidgetTest0));
|
||||
@@ -233,7 +233,7 @@ void main() {
|
||||
List<Widget> childList= <Widget>[
|
||||
WidgetTest0(text: 'child 0', key: UniqueKey(), keepAlive: true),
|
||||
WidgetTest1(text: 'child 1', key: GlobalKey()),
|
||||
WidgetTest2(text: 'child 2', keepAlive: true),
|
||||
const WidgetTest2(text: 'child 2', keepAlive: true),
|
||||
];
|
||||
await tester.pumpWidget(SwitchingChildBuilderTest(children: childList));
|
||||
final _WidgetTest0State state0 = tester.state(find.byType(WidgetTest0));
|
||||
@@ -276,7 +276,7 @@ void main() {
|
||||
List<Widget> childList= <Widget>[
|
||||
WidgetTest0(text: 'child 0', key: UniqueKey(), keepAlive: true),
|
||||
WidgetTest1(text: 'child 1', key: UniqueKey()),
|
||||
WidgetTest2(text: 'child 2', keepAlive: true),
|
||||
const WidgetTest2(text: 'child 2', keepAlive: true),
|
||||
];
|
||||
await tester.pumpWidget(
|
||||
SwitchingChildListTest(children: childList, viewportFraction: 0.1)
|
||||
@@ -316,7 +316,7 @@ void main() {
|
||||
testWidgets('SliverList should not dispose widget with key during in screen reordering', (WidgetTester tester) async {
|
||||
List<Widget> childList= <Widget>[
|
||||
WidgetTest0(text: 'child 0', key: UniqueKey(), keepAlive: true),
|
||||
WidgetTest1(text: 'child 1', keepAlive: true),
|
||||
const WidgetTest1(text: 'child 1', keepAlive: true),
|
||||
WidgetTest2(text: 'child 2', key: UniqueKey()),
|
||||
];
|
||||
await tester.pumpWidget(
|
||||
@@ -366,7 +366,7 @@ void main() {
|
||||
testWidgets('SliverList remove child from child list', (WidgetTester tester) async {
|
||||
List<Widget> childList= <Widget>[
|
||||
WidgetTest0(text: 'child 0', key: UniqueKey(), keepAlive: true),
|
||||
WidgetTest1(text: 'child 1', keepAlive: true),
|
||||
const WidgetTest1(text: 'child 1', keepAlive: true),
|
||||
WidgetTest2(text: 'child 2', key: UniqueKey()),
|
||||
];
|
||||
await tester.pumpWidget(
|
||||
@@ -401,7 +401,7 @@ List<Widget> createSwitchedChildList(List<Widget> childList, int i, int j) {
|
||||
}
|
||||
|
||||
class SwitchingChildBuilderTest extends StatefulWidget {
|
||||
SwitchingChildBuilderTest({
|
||||
const SwitchingChildBuilderTest({
|
||||
this.children,
|
||||
Key key
|
||||
}) : super(key: key);
|
||||
@@ -474,7 +474,7 @@ class _SwitchingChildBuilderTest extends State<SwitchingChildBuilderTest> {
|
||||
}
|
||||
|
||||
class SwitchingChildListTest extends StatefulWidget {
|
||||
SwitchingChildListTest({
|
||||
const SwitchingChildListTest({
|
||||
this.children,
|
||||
this.viewportFraction = 1.0,
|
||||
Key key
|
||||
@@ -511,7 +511,7 @@ class _SwitchingChildListTest extends State<SwitchingChildListTest> {
|
||||
}
|
||||
|
||||
class SwitchingSliverListTest extends StatefulWidget {
|
||||
SwitchingSliverListTest({
|
||||
const SwitchingSliverListTest({
|
||||
this.children,
|
||||
this.viewportFraction = 1.0,
|
||||
Key key
|
||||
@@ -547,7 +547,7 @@ class _SwitchingSliverListTest extends State<SwitchingSliverListTest> {
|
||||
}
|
||||
|
||||
class WidgetTest0 extends StatefulWidget {
|
||||
WidgetTest0({
|
||||
const WidgetTest0({
|
||||
this.text,
|
||||
this.keepAlive = false,
|
||||
Key key
|
||||
@@ -580,7 +580,7 @@ class _WidgetTest0State extends State<WidgetTest0> with AutomaticKeepAliveClient
|
||||
}
|
||||
|
||||
class WidgetTest1 extends StatefulWidget {
|
||||
WidgetTest1({
|
||||
const WidgetTest1({
|
||||
this.text,
|
||||
this.keepAlive = false,
|
||||
Key key
|
||||
@@ -613,7 +613,7 @@ class _WidgetTest1State extends State<WidgetTest1> with AutomaticKeepAliveClient
|
||||
}
|
||||
|
||||
class WidgetTest2 extends StatefulWidget {
|
||||
WidgetTest2({
|
||||
const WidgetTest2({
|
||||
this.text,
|
||||
this.keepAlive = false,
|
||||
Key key
|
||||
|
||||
Reference in New Issue
Block a user