Reverts "Update framework_test.dart
to remove ButtonBar
usage and remove references from other clases" (#137731)
Reverts flutter/flutter#137550 Initiated by: Piinks This change reverts the following previous change: Original Description: This PR removes `ButtonBar` usage from `framework_test.dart` class and update other references in preparation for `ButtonBar` deprecation related to https://github.com/flutter/flutter/issues/127955
This commit is contained in:
parent
43dc3fcfcc
commit
b47e4c4acb
@ -318,7 +318,7 @@ class _MaterialBannerState extends State<MaterialBanner> {
|
|||||||
?? bannerTheme.leadingPadding
|
?? bannerTheme.leadingPadding
|
||||||
?? const EdgeInsetsDirectional.only(end: 16.0);
|
?? const EdgeInsetsDirectional.only(end: 16.0);
|
||||||
|
|
||||||
final Widget actionsBar = Container(
|
final Widget buttonBar = Container(
|
||||||
alignment: AlignmentDirectional.centerEnd,
|
alignment: AlignmentDirectional.centerEnd,
|
||||||
constraints: const BoxConstraints(minHeight: 52.0),
|
constraints: const BoxConstraints(minHeight: 52.0),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
@ -372,12 +372,12 @@ class _MaterialBannerState extends State<MaterialBanner> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (isSingleRow)
|
if (isSingleRow)
|
||||||
actionsBar,
|
buttonBar,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!isSingleRow)
|
if (!isSingleRow)
|
||||||
actionsBar,
|
buttonBar,
|
||||||
if (elevation == 0)
|
if (elevation == 0)
|
||||||
Divider(height: 0, color: dividerColor),
|
Divider(height: 0, color: dividerColor),
|
||||||
],
|
],
|
||||||
|
@ -57,7 +57,7 @@ RenderParagraph _getTextRenderObjectFromDialog(WidgetTester tester, String text)
|
|||||||
// What was the AlertDialog's ButtonBar when many of these tests were written,
|
// What was the AlertDialog's ButtonBar when many of these tests were written,
|
||||||
// is now a Padding widget with an OverflowBar child. The Padding widget's size
|
// is now a Padding widget with an OverflowBar child. The Padding widget's size
|
||||||
// and location match the original ButtonBar's size and location.
|
// and location match the original ButtonBar's size and location.
|
||||||
Finder _findOverflowBar() {
|
Finder _findButtonBar() {
|
||||||
return find.ancestor(of: find.byType(OverflowBar), matching: find.byType(Padding)).first;
|
return find.ancestor(of: find.byType(OverflowBar), matching: find.byType(Padding)).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,7 +610,7 @@ void main() {
|
|||||||
matching: find.byType(Material),
|
matching: find.byType(Material),
|
||||||
).first,
|
).first,
|
||||||
);
|
);
|
||||||
final Size actionsSize = tester.getSize(_findOverflowBar());
|
final Size actionsSize = tester.getSize(_findButtonBar());
|
||||||
|
|
||||||
expect(actionsSize.width, dialogSize.width);
|
expect(actionsSize.width, dialogSize.width);
|
||||||
});
|
});
|
||||||
@ -687,25 +687,25 @@ void main() {
|
|||||||
// First button
|
// First button
|
||||||
expect(
|
expect(
|
||||||
tester.getTopRight(find.byKey(key1)).dy,
|
tester.getTopRight(find.byKey(key1)).dy,
|
||||||
tester.getTopRight(_findOverflowBar()).dy + 8.0,
|
tester.getTopRight(_findButtonBar()).dy + 8.0,
|
||||||
); // top
|
); // top
|
||||||
expect(
|
expect(
|
||||||
tester.getBottomRight(find.byKey(key1)).dy,
|
tester.getBottomRight(find.byKey(key1)).dy,
|
||||||
tester.getBottomRight(_findOverflowBar()).dy - 8.0,
|
tester.getBottomRight(_findButtonBar()).dy - 8.0,
|
||||||
); // bottom
|
); // bottom
|
||||||
|
|
||||||
// Second button
|
// Second button
|
||||||
expect(
|
expect(
|
||||||
tester.getTopRight(find.byKey(key2)).dy,
|
tester.getTopRight(find.byKey(key2)).dy,
|
||||||
tester.getTopRight(_findOverflowBar()).dy + 8.0,
|
tester.getTopRight(_findButtonBar()).dy + 8.0,
|
||||||
); // top
|
); // top
|
||||||
expect(
|
expect(
|
||||||
tester.getBottomRight(find.byKey(key2)).dy,
|
tester.getBottomRight(find.byKey(key2)).dy,
|
||||||
tester.getBottomRight(_findOverflowBar()).dy - 8.0,
|
tester.getBottomRight(_findButtonBar()).dy - 8.0,
|
||||||
); // bottom
|
); // bottom
|
||||||
expect(
|
expect(
|
||||||
tester.getBottomRight(find.byKey(key2)).dx,
|
tester.getBottomRight(find.byKey(key2)).dx,
|
||||||
tester.getBottomRight(_findOverflowBar()).dx - 8.0,
|
tester.getBottomRight(_findButtonBar()).dx - 8.0,
|
||||||
); // right
|
); // right
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -745,25 +745,25 @@ void main() {
|
|||||||
// First button
|
// First button
|
||||||
expect(
|
expect(
|
||||||
tester.getTopRight(find.byKey(key1)).dy,
|
tester.getTopRight(find.byKey(key1)).dy,
|
||||||
tester.getTopRight(_findOverflowBar()).dy,
|
tester.getTopRight(_findButtonBar()).dy,
|
||||||
); // top
|
); // top
|
||||||
expect(
|
expect(
|
||||||
tester.getBottomRight(find.byKey(key1)).dy,
|
tester.getBottomRight(find.byKey(key1)).dy,
|
||||||
tester.getBottomRight(_findOverflowBar()).dy - 24.0,
|
tester.getBottomRight(_findButtonBar()).dy - 24.0,
|
||||||
); // bottom
|
); // bottom
|
||||||
|
|
||||||
// // Second button
|
// // Second button
|
||||||
expect(
|
expect(
|
||||||
tester.getTopRight(find.byKey(key2)).dy,
|
tester.getTopRight(find.byKey(key2)).dy,
|
||||||
tester.getTopRight(_findOverflowBar()).dy,
|
tester.getTopRight(_findButtonBar()).dy,
|
||||||
); // top
|
); // top
|
||||||
expect(
|
expect(
|
||||||
tester.getBottomRight(find.byKey(key2)).dy,
|
tester.getBottomRight(find.byKey(key2)).dy,
|
||||||
tester.getBottomRight(_findOverflowBar()).dy - 24.0,
|
tester.getBottomRight(_findButtonBar()).dy - 24.0,
|
||||||
); // bottom
|
); // bottom
|
||||||
expect(
|
expect(
|
||||||
tester.getBottomRight(find.byKey(key2)).dx,
|
tester.getBottomRight(find.byKey(key2)).dx,
|
||||||
tester.getBottomRight(_findOverflowBar()).dx - 24.0,
|
tester.getBottomRight(_findButtonBar()).dx - 24.0,
|
||||||
); // right
|
); // right
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -809,25 +809,25 @@ void main() {
|
|||||||
// First button
|
// First button
|
||||||
expect(
|
expect(
|
||||||
tester.getTopRight(find.byKey(key1)).dy,
|
tester.getTopRight(find.byKey(key1)).dy,
|
||||||
tester.getTopRight(_findOverflowBar()).dy + ((10.0 + 20.0) / 2),
|
tester.getTopRight(_findButtonBar()).dy + ((10.0 + 20.0) / 2),
|
||||||
); // top
|
); // top
|
||||||
expect(
|
expect(
|
||||||
tester.getBottomRight(find.byKey(key1)).dy,
|
tester.getBottomRight(find.byKey(key1)).dy,
|
||||||
tester.getBottomRight(_findOverflowBar()).dy - ((10.0 + 20.0) / 2),
|
tester.getBottomRight(_findButtonBar()).dy - ((10.0 + 20.0) / 2),
|
||||||
); // bottom
|
); // bottom
|
||||||
|
|
||||||
// Second button
|
// Second button
|
||||||
expect(
|
expect(
|
||||||
tester.getTopRight(find.byKey(key2)).dy,
|
tester.getTopRight(find.byKey(key2)).dy,
|
||||||
tester.getTopRight(_findOverflowBar()).dy + ((10.0 + 20.0) / 2),
|
tester.getTopRight(_findButtonBar()).dy + ((10.0 + 20.0) / 2),
|
||||||
); // top
|
); // top
|
||||||
expect(
|
expect(
|
||||||
tester.getBottomRight(find.byKey(key2)).dy,
|
tester.getBottomRight(find.byKey(key2)).dy,
|
||||||
tester.getBottomRight(_findOverflowBar()).dy - ((10.0 + 20.0) / 2),
|
tester.getBottomRight(_findButtonBar()).dy - ((10.0 + 20.0) / 2),
|
||||||
); // bottom
|
); // bottom
|
||||||
expect(
|
expect(
|
||||||
tester.getBottomRight(find.byKey(key2)).dx,
|
tester.getBottomRight(find.byKey(key2)).dx,
|
||||||
tester.getBottomRight(_findOverflowBar()).dx - ((10.0 + 20.0) / 2),
|
tester.getBottomRight(_findButtonBar()).dx - ((10.0 + 20.0) / 2),
|
||||||
); // right
|
); // right
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -850,7 +850,7 @@ void main() {
|
|||||||
final Finder iconFinder = find.byKey(iconKey);
|
final Finder iconFinder = find.byKey(iconKey);
|
||||||
final Finder titleFinder = find.byKey(titleKey);
|
final Finder titleFinder = find.byKey(titleKey);
|
||||||
final Finder contentFinder = find.byKey(contentKey);
|
final Finder contentFinder = find.byKey(contentKey);
|
||||||
final Finder actionsFinder = _findOverflowBar();
|
final Finder actionsFinder = _findButtonBar();
|
||||||
final Finder childrenFinder = find.byKey(childrenKey);
|
final Finder childrenFinder = find.byKey(childrenKey);
|
||||||
|
|
||||||
Future<void> openDialog(WidgetTester tester, Widget dialog, double textScaleFactor, {bool isM3 = false}) async {
|
Future<void> openDialog(WidgetTester tester, Widget dialog, double textScaleFactor, {bool isM3 = false}) async {
|
||||||
|
@ -1580,10 +1580,10 @@ void main() {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: Placeholder(),
|
child: Placeholder(),
|
||||||
));
|
));
|
||||||
final _TestInheritedElement navigationBarTheme =
|
final _TestInheritedElement buttonBarTheme =
|
||||||
_TestInheritedElement(const NavigationBarTheme(
|
_TestInheritedElement(const ButtonBarTheme(
|
||||||
data: NavigationBarThemeData(
|
data: ButtonBarThemeData(
|
||||||
indicatorColor: Color(0xff00ff00),
|
alignment: MainAxisAlignment.center,
|
||||||
),
|
),
|
||||||
child: Placeholder(),
|
child: Placeholder(),
|
||||||
));
|
));
|
||||||
@ -1592,7 +1592,7 @@ void main() {
|
|||||||
element
|
element
|
||||||
..dependOnInheritedElement(focusTraversalOrder)
|
..dependOnInheritedElement(focusTraversalOrder)
|
||||||
..dependOnInheritedElement(directionality)
|
..dependOnInheritedElement(directionality)
|
||||||
..dependOnInheritedElement(navigationBarTheme);
|
..dependOnInheritedElement(buttonBarTheme);
|
||||||
|
|
||||||
// Dependencies will be sorted by [debugFillProperties].
|
// Dependencies will be sorted by [debugFillProperties].
|
||||||
element.debugFillProperties(builder);
|
element.debugFillProperties(builder);
|
||||||
@ -1607,7 +1607,7 @@ void main() {
|
|||||||
|
|
||||||
final Set<InheritedElement> dependencies = dependenciesProperty.value!;
|
final Set<InheritedElement> dependencies = dependenciesProperty.value!;
|
||||||
expect(dependencies.length, equals(3));
|
expect(dependencies.length, equals(3));
|
||||||
expect(dependenciesProperty.toDescription(), '[Directionality, FocusTraversalOrder, NavigationBarTheme]');
|
expect(dependenciesProperty.toDescription(), '[ButtonBarTheme, Directionality, FocusTraversalOrder]');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgetsWithLeakTracking('BuildOwner.globalKeyCount keeps track of in-use global keys', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('BuildOwner.globalKeyCount keeps track of in-use global keys', (WidgetTester tester) async {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user