This reverts commit 3070baf175.
This commit is contained in:
@@ -19,6 +19,10 @@ class IconButtonToggleApp extends StatelessWidget {
|
||||
theme: ThemeData(
|
||||
colorSchemeSeed: const Color(0xff6750a4),
|
||||
useMaterial3: true,
|
||||
// Desktop and web platforms have a compact visual density by default.
|
||||
// To see buttons with circular background on desktop/web, the "visualDensity"
|
||||
// needs to be set to "VisualDensity.standard".
|
||||
visualDensity: VisualDensity.standard,
|
||||
),
|
||||
title: 'Icon Button Types',
|
||||
home: const Scaffold(
|
||||
|
||||
@@ -13,32 +13,32 @@ void main() {
|
||||
);
|
||||
|
||||
expect(find.text('Hero Sample'), findsOneWidget);
|
||||
await tester.tap(find.byType(example.BoxWidget));
|
||||
await tester.tap(find.byType(Container));
|
||||
await tester.pump();
|
||||
|
||||
Size heroSize = tester.getSize(find.byType(example.BoxWidget));
|
||||
Size heroSize = tester.getSize(find.byType(Container));
|
||||
|
||||
// Jump 25% into the transition (total length = 300ms)
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget));
|
||||
heroSize = tester.getSize(find.byType(Container));
|
||||
expect(heroSize.width.roundToDouble(), 103.0);
|
||||
expect(heroSize.height.roundToDouble(), 60.0);
|
||||
|
||||
// Jump to 50% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget));
|
||||
heroSize = tester.getSize(find.byType(Container));
|
||||
expect(heroSize.width.roundToDouble(), 189.0);
|
||||
expect(heroSize.height.roundToDouble(), 146.0);
|
||||
|
||||
// Jump to 75% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget));
|
||||
heroSize = tester.getSize(find.byType(Container));
|
||||
expect(heroSize.width.roundToDouble(), 199.0);
|
||||
expect(heroSize.height.roundToDouble(), 190.0);
|
||||
|
||||
// Jump to 100% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget));
|
||||
heroSize = tester.getSize(find.byType(Container));
|
||||
expect(heroSize, const Size(200.0, 200.0));
|
||||
|
||||
expect(find.byIcon(Icons.arrow_back), findsOneWidget);
|
||||
@@ -47,25 +47,25 @@ void main() {
|
||||
|
||||
// Jump 25% into the transition (total length = 300ms)
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget));
|
||||
heroSize = tester.getSize(find.byType(Container));
|
||||
expect(heroSize.width.roundToDouble(), 199.0);
|
||||
expect(heroSize.height.roundToDouble(), 190.0);
|
||||
|
||||
// Jump to 50% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget));
|
||||
heroSize = tester.getSize(find.byType(Container));
|
||||
expect(heroSize.width.roundToDouble(), 189.0);
|
||||
expect(heroSize.height.roundToDouble(), 146.0);
|
||||
|
||||
// Jump to 75% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget));
|
||||
heroSize = tester.getSize(find.byType(Container));
|
||||
expect(heroSize.width.roundToDouble(), 103.0);
|
||||
expect(heroSize.height.roundToDouble(), 60.0);
|
||||
|
||||
// Jump to 100% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget));
|
||||
heroSize = tester.getSize(find.byType(Container));
|
||||
expect(heroSize, const Size(50.0, 50.0));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,30 +16,30 @@ void main() {
|
||||
await tester.tap(find.byType(ElevatedButton));
|
||||
await tester.pump();
|
||||
|
||||
Size heroSize = tester.getSize(find.byType(example.BoxWidget).first);
|
||||
Size heroSize = tester.getSize(find.byType(Container).first);
|
||||
expect(heroSize, const Size(50.0, 50.0));
|
||||
|
||||
// Jump 25% into the transition (total length = 300ms)
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).first);
|
||||
heroSize = tester.getSize(find.byType(Container).first);
|
||||
expect(heroSize.width.roundToDouble(), 171.0);
|
||||
expect(heroSize.height.roundToDouble(), 73.0);
|
||||
|
||||
// Jump to 50% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).first);
|
||||
heroSize = tester.getSize(find.byType(Container).first);
|
||||
expect(heroSize.width.roundToDouble(), 371.0);
|
||||
expect(heroSize.height.roundToDouble(), 273.0);
|
||||
|
||||
// Jump to 75% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).first);
|
||||
heroSize = tester.getSize(find.byType(Container).first);
|
||||
expect(heroSize.width.roundToDouble(), 398.0);
|
||||
expect(heroSize.height.roundToDouble(), 376.0);
|
||||
|
||||
// Jump to 100% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).first);
|
||||
heroSize = tester.getSize(find.byType(Container).first);
|
||||
expect(heroSize, const Size(400.0, 400.0));
|
||||
|
||||
expect(find.byIcon(Icons.arrow_back), findsOneWidget);
|
||||
@@ -48,25 +48,25 @@ void main() {
|
||||
|
||||
// Jump 25% into the transition (total length = 300ms)
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).first);
|
||||
heroSize = tester.getSize(find.byType(Container).first);
|
||||
expect(heroSize.width.roundToDouble(), 398.0);
|
||||
expect(heroSize.height.roundToDouble(), 376.0);
|
||||
|
||||
// Jump to 50% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).first);
|
||||
heroSize = tester.getSize(find.byType(Container).first);
|
||||
expect(heroSize.width.roundToDouble(), 371.0);
|
||||
expect(heroSize.height.roundToDouble(), 273.0);
|
||||
|
||||
// Jump to 75% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).first);
|
||||
heroSize = tester.getSize(find.byType(Container).first);
|
||||
expect(heroSize.width.roundToDouble(), 171.0);
|
||||
expect(heroSize.height.roundToDouble(), 73.0);
|
||||
|
||||
// Jump to 100% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).first);
|
||||
heroSize = tester.getSize(find.byType(Container).first);
|
||||
expect(heroSize, const Size(50.0, 50.0));
|
||||
});
|
||||
|
||||
@@ -79,30 +79,30 @@ void main() {
|
||||
await tester.tap(find.byType(ElevatedButton));
|
||||
await tester.pump();
|
||||
|
||||
Size heroSize = tester.getSize(find.byType(example.BoxWidget).last);
|
||||
Size heroSize = tester.getSize(find.byType(Container).last);
|
||||
expect(heroSize, const Size(50.0, 50.0));
|
||||
|
||||
// Jump 25% into the transition (total length = 300ms)
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).last);
|
||||
heroSize = tester.getSize(find.byType(Container).last);
|
||||
expect(heroSize.width.roundToDouble(), 133.0);
|
||||
expect(heroSize.height.roundToDouble(), 133.0);
|
||||
|
||||
// Jump to 50% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).last);
|
||||
heroSize = tester.getSize(find.byType(Container).last);
|
||||
expect(heroSize.width.roundToDouble(), 321.0);
|
||||
expect(heroSize.height.roundToDouble(), 321.0);
|
||||
|
||||
// Jump to 75% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).first);
|
||||
heroSize = tester.getSize(find.byType(Container).first);
|
||||
expect(heroSize.width.roundToDouble(), 398.0);
|
||||
expect(heroSize.height.roundToDouble(), 376.0);
|
||||
|
||||
// Jump to 100% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).last);
|
||||
heroSize = tester.getSize(find.byType(Container).last);
|
||||
expect(heroSize, const Size(400.0, 400.0));
|
||||
|
||||
expect(find.byIcon(Icons.arrow_back), findsOneWidget);
|
||||
@@ -111,25 +111,25 @@ void main() {
|
||||
|
||||
// Jump 25% into the transition (total length = 300ms)
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).last);
|
||||
heroSize = tester.getSize(find.byType(Container).last);
|
||||
expect(heroSize.width.roundToDouble(), 386.0);
|
||||
expect(heroSize.height.roundToDouble(), 386.0);
|
||||
|
||||
// Jump to 50% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).last);
|
||||
heroSize = tester.getSize(find.byType(Container).last);
|
||||
expect(heroSize.width.roundToDouble(), 321.0);
|
||||
expect(heroSize.height.roundToDouble(), 321.0);
|
||||
|
||||
// Jump to 75% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).last);
|
||||
heroSize = tester.getSize(find.byType(Container).last);
|
||||
expect(heroSize.width.roundToDouble(), 133.0);
|
||||
expect(heroSize.height.roundToDouble(), 133.0);
|
||||
|
||||
// Jump to 100% into the transition.
|
||||
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
|
||||
heroSize = tester.getSize(find.byType(example.BoxWidget).last);
|
||||
heroSize = tester.getSize(find.byType(Container).last);
|
||||
expect(heroSize, const Size(50.0, 50.0));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user