Add ActionButtonIconsData for overriding action icons (#118229)
* Add ActionButtonIconsData for overriding action icons * Fix formatting issues * Add missing exports in material library and add copyWith method in ActionButtonIconsData * Move all action buttons, and icons to action_buttons.dart * Rename actionButtonIcons to actionIconTheme * Refactor buttons in action_buttons.dart to extend a private class for common implementation * Refactor icons in action_buttons * Fix docs in action_buttons_theme * Fix #107646 always use 'Icons.arrow_back' as a back_button icon in web * Update documentation for action buttons and add style parameter to every action button * Fix analyzer warnings * Add missing style argument in IconButton of _ActionButton * Add tests for action buttons, action icon theme, drawer buttons, and back buttons * Add example (+test) for action icon button's action icon theme in examples/api * Fix analysis errors * Add missing license header in action_icon_theme.0.dart * Fix deprecation notice in theme_data.dart * Update theme data tests for actionIconTheme * Remove iconSize parameter from ActionButtons and update docs * Fix failing tests * Update button color during backbutton tests to red * Fix analytics issues * Fix format
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/material/action_buttons/action_icon_theme.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Action Icon Buttons', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: example.MyApp(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
expect(find.byType(DrawerButton), findsOneWidget);
|
||||
final Icon drawerButtonIcon = tester.widget(
|
||||
find.descendant(
|
||||
of: find.byType(DrawerButton),
|
||||
matching: find.byType(Icon),
|
||||
),
|
||||
);
|
||||
expect(drawerButtonIcon.icon, Icons.segment);
|
||||
|
||||
// open next page
|
||||
await tester.tap(find.byType(example.NextPageButton));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(EndDrawerButton), findsOneWidget);
|
||||
final Icon endDrawerButtonIcon = tester.widget(
|
||||
find.descendant(
|
||||
of: find.byType(EndDrawerButton),
|
||||
matching: find.byType(Icon),
|
||||
),
|
||||
);
|
||||
expect(endDrawerButtonIcon.icon, Icons.more_horiz);
|
||||
|
||||
expect(find.byType(BackButton), findsOneWidget);
|
||||
final Icon backButtonIcon = tester.widget(
|
||||
find.descendant(
|
||||
of: find.byType(BackButton),
|
||||
matching: find.byType(Icon),
|
||||
),
|
||||
);
|
||||
expect(backButtonIcon.icon, Icons.arrow_back_ios_new_rounded);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user