Auto-format Framework (#160545)
This auto-formats all *.dart files in the repository outside of the `engine` subdirectory and enforces that these files stay formatted with a presubmit check. **Reviewers:** Please carefully review all the commits except for the one titled "formatted". The "formatted" commit was auto-generated by running `dev/tools/format.sh -a -f`. The other commits were hand-crafted to prepare the repo for the formatting change. I recommend reviewing the commits one-by-one via the "Commits" tab and avoiding Github's "Files changed" tab as it will likely slow down your browser because of the size of this PR. --------- Co-authored-by: Kate Lovett <katelovett@google.com> Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8e0993eda8
commit
5491c8c146
@@ -9,9 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('FloatingActionButton', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.FloatingActionButtonExampleApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.FloatingActionButtonExampleApp());
|
||||
|
||||
expect(find.byType(FloatingActionButton), findsOneWidget);
|
||||
expect(find.byIcon(Icons.navigation), findsOneWidget);
|
||||
|
||||
@@ -13,9 +13,7 @@ void main() {
|
||||
return tester.widget<RawMaterialButton>(finder);
|
||||
}
|
||||
|
||||
await tester.pumpWidget(
|
||||
const example.FloatingActionButtonExampleApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.FloatingActionButtonExampleApp());
|
||||
|
||||
final ThemeData theme = ThemeData(useMaterial3: true);
|
||||
|
||||
@@ -25,25 +23,49 @@ void main() {
|
||||
final Finder smallFabMaterialButton = find.byType(RawMaterialButton).at(0);
|
||||
final RenderBox smallFabRenderBox = tester.renderObject(smallFabMaterialButton);
|
||||
expect(smallFabRenderBox.size, const Size(48.0, 48.0));
|
||||
expect(getRawMaterialButtonWidget(smallFabMaterialButton).fillColor, theme.colorScheme.primaryContainer);
|
||||
expect(getRawMaterialButtonWidget(smallFabMaterialButton).shape, RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)));
|
||||
expect(
|
||||
getRawMaterialButtonWidget(smallFabMaterialButton).fillColor,
|
||||
theme.colorScheme.primaryContainer,
|
||||
);
|
||||
expect(
|
||||
getRawMaterialButtonWidget(smallFabMaterialButton).shape,
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
|
||||
);
|
||||
|
||||
final Finder regularFABMaterialButton = find.byType(RawMaterialButton).at(1);
|
||||
final RenderBox regularFABRenderBox = tester.renderObject(regularFABMaterialButton);
|
||||
expect(regularFABRenderBox.size, const Size(56.0, 56.0));
|
||||
expect(getRawMaterialButtonWidget(regularFABMaterialButton).fillColor, theme.colorScheme.primaryContainer);
|
||||
expect(getRawMaterialButtonWidget(regularFABMaterialButton).shape, RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)));
|
||||
expect(
|
||||
getRawMaterialButtonWidget(regularFABMaterialButton).fillColor,
|
||||
theme.colorScheme.primaryContainer,
|
||||
);
|
||||
expect(
|
||||
getRawMaterialButtonWidget(regularFABMaterialButton).shape,
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
|
||||
);
|
||||
|
||||
final Finder largeFABMaterialButton = find.byType(RawMaterialButton).at(2);
|
||||
final RenderBox largeFABRenderBox = tester.renderObject(largeFABMaterialButton);
|
||||
expect(largeFABRenderBox.size, const Size(96.0, 96.0));
|
||||
expect(getRawMaterialButtonWidget(largeFABMaterialButton).fillColor, theme.colorScheme.primaryContainer);
|
||||
expect(getRawMaterialButtonWidget(largeFABMaterialButton).shape, RoundedRectangleBorder(borderRadius: BorderRadius.circular(28.0)));
|
||||
expect(
|
||||
getRawMaterialButtonWidget(largeFABMaterialButton).fillColor,
|
||||
theme.colorScheme.primaryContainer,
|
||||
);
|
||||
expect(
|
||||
getRawMaterialButtonWidget(largeFABMaterialButton).shape,
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(28.0)),
|
||||
);
|
||||
|
||||
final Finder extendedFABMaterialButton = find.byType(RawMaterialButton).at(3);
|
||||
final RenderBox extendedFABRenderBox = tester.renderObject(extendedFABMaterialButton);
|
||||
expect(extendedFABRenderBox.size, within(distance: 0.01, from: const Size(110.3, 56.0)));
|
||||
expect(getRawMaterialButtonWidget(extendedFABMaterialButton).fillColor, theme.colorScheme.primaryContainer);
|
||||
expect(getRawMaterialButtonWidget(extendedFABMaterialButton).shape, RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)));
|
||||
expect(
|
||||
getRawMaterialButtonWidget(extendedFABMaterialButton).fillColor,
|
||||
theme.colorScheme.primaryContainer,
|
||||
);
|
||||
expect(
|
||||
getRawMaterialButtonWidget(extendedFABMaterialButton).shape,
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,9 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('FloatingActionButton variants', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.FloatingActionButtonExampleApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.FloatingActionButtonExampleApp());
|
||||
|
||||
FloatingActionButton getFAB(Finder finder) {
|
||||
return tester.widget<FloatingActionButton>(finder);
|
||||
|
||||
Reference in New Issue
Block a user