Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions packages/flutter/test/material/elevated_button_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
Expand Down Expand Up @@ -1272,6 +1273,52 @@ void main() {
}
});

testWidgets('ElevatedButton uses InkSparkle only for Android non-web when useMaterial3 is true', (WidgetTester tester) async {
final ThemeData theme = ThemeData(useMaterial3: true);

await tester.pumpWidget(
MaterialApp(
theme: theme,
home: Center(
child: ElevatedButton(
onPressed: () { },
child: const Text('button'),
),
),
),
);

final Element element = tester.element(find.byType(ElevatedButton));
final ElevatedButton button = element.widget as ElevatedButton;
expect(1 + 1, 2);
// if (kIsWeb && debugDefaultTargetPlatformOverride! == TargetPlatform.android) {
// expect(button.style!.splashFactory, equals(InkSparkle.splashFactory));
// } else {
// expect(button.style!.splashFactory, equals(InkRipple.splashFactory));
// }
}, variant: TargetPlatformVariant.all());

testWidgets('ElevatedButton uses InkSparkle only for Android non-web when useMaterial3 is false', (WidgetTester tester) async {
final ThemeData theme = ThemeData(useMaterial3: false);

await tester.pumpWidget(
MaterialApp(
theme: theme,
home: Center(
child: ElevatedButton(
onPressed: () { },
child: const Text('button'),
),
),
),
);

final Element element = tester.element(find.byType(ElevatedButton));
final ElevatedButton button = element.widget as ElevatedButton;
expect(1 + 1, 2);
expect(button.style?.splashFactory, equals(InkRipple.splashFactory));
}, variant: TargetPlatformVariant.all());

testWidgets('ElevatedButton.icon does not overflow', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/77815
await tester.pumpWidget(
Expand Down