[material_ui] Fixes typo in code and tests (#12503)
## Pre-Review Checklist
**Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.
[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
diff --git a/packages/material_ui/README.md b/packages/material_ui/README.md
index 2d558ae..044e0a8 100644
--- a/packages/material_ui/README.md
+++ b/packages/material_ui/README.md
@@ -106,7 +106,7 @@
## Features
-The `material_ui` packcage contains everything you need to create a
+The `material_ui` package contains everything you need to create a
fully-featured Material app, such as:
* **App Structure & Navigation**: `MaterialApp`, `Scaffold`, `AppBar`,
diff --git a/packages/material_ui/example/test/navigation_rail/navigation_rail.0_test.dart b/packages/material_ui/example/test/navigation_rail/navigation_rail.0_test.dart
index ea7d666..9800254 100644
--- a/packages/material_ui/example/test/navigation_rail/navigation_rail.0_test.dart
+++ b/packages/material_ui/example/test/navigation_rail/navigation_rail.0_test.dart
@@ -57,7 +57,7 @@
) async {
await tester.pumpWidget(const example.NavigationRailExampleApp());
- // initial group alignment set top top.
+ // initial group alignment set to top.
expect(find.text('Group alignment: -1.0'), findsOneWidget);
// switch to center alignment
diff --git a/packages/material_ui/lib/src/date_picker_theme.dart b/packages/material_ui/lib/src/date_picker_theme.dart
index b12203b..32e447f 100644
--- a/packages/material_ui/lib/src/date_picker_theme.dart
+++ b/packages/material_ui/lib/src/date_picker_theme.dart
@@ -1004,7 +1004,7 @@
/// given an explicit non-null value.
class DatePickerTheme extends InheritedTheme {
/// Creates a [DatePickerTheme] that controls visual parameters for
- /// descendent [DatePickerDialog]s.
+ /// descendant [DatePickerDialog]s.
const DatePickerTheme({super.key, required this.data, required super.child});
/// Specifies the visual properties used by descendant [DatePickerDialog]
diff --git a/packages/material_ui/lib/src/dialog.dart b/packages/material_ui/lib/src/dialog.dart
index 4d68231..63f1445 100644
--- a/packages/material_ui/lib/src/dialog.dart
+++ b/packages/material_ui/lib/src/dialog.dart
@@ -50,7 +50,7 @@
///
/// </callout-box>
///
-/// ## Contraints
+/// ## Constraints
/// The Material 3 guideline recommends that a dialog should have a maximal width of 560dp.
/// For historical reasons, Flutter's [Dialog] widget does not come with this constraint by default.
/// For applications targeting large screens such as desktop or Web, it is recommended to
diff --git a/packages/material_ui/lib/src/dropdown.dart b/packages/material_ui/lib/src/dropdown.dart
index 59f7846..748167b 100644
--- a/packages/material_ui/lib/src/dropdown.dart
+++ b/packages/material_ui/lib/src/dropdown.dart
@@ -1718,12 +1718,12 @@
if (widget._inputDecoration != null) {
final bool filled =
widget._inputDecoration?.filled ?? InputDecorationTheme.of(context).filled;
- final bool oulined =
+ final bool outlined =
widget._inputDecoration?.border?.isOutline ??
InputDecorationTheme.of(context).border?.isOutline ??
false;
- final suffixIconEndMargin = (filled || oulined) ? 12.0 : 0.0;
+ final suffixIconEndMargin = (filled || outlined) ? 12.0 : 0.0;
InputDecoration effectiveDecoration = widget._inputDecoration!.copyWith(
// Override the suffix icon constraints to allow the
// icon alignment to match the regular dropdown button.
diff --git a/packages/material_ui/lib/src/dropdown_menu.dart b/packages/material_ui/lib/src/dropdown_menu.dart
index 21798bc..bb1ad62 100644
--- a/packages/material_ui/lib/src/dropdown_menu.dart
+++ b/packages/material_ui/lib/src/dropdown_menu.dart
@@ -1287,7 +1287,7 @@
final MaterialLocalizations localizations = MaterialLocalizations.of(context);
final Widget textField = Semantics(
button: isButton,
- // This is set specificly for iOS because iOS does not have any native
+ // This is set specifically for iOS because iOS does not have any native
// APIs to show whether the menu is expanded or collapsed.
hint: Theme.of(context).platform == TargetPlatform.iOS
? _controller.isOpen
diff --git a/packages/material_ui/lib/src/menu_anchor.dart b/packages/material_ui/lib/src/menu_anchor.dart
index 14fa9e6..bcc1a17 100644
--- a/packages/material_ui/lib/src/menu_anchor.dart
+++ b/packages/material_ui/lib/src/menu_anchor.dart
@@ -1064,7 +1064,7 @@
/// The direction in which the menu item expands.
///
- /// If the menu item button is a descendent of [MenuAnchor] or [MenuBar], then
+ /// If the menu item button is a descendant of [MenuAnchor] or [MenuBar], then
/// this property is ignored.
///
/// If [overflowAxis] is [Axis.vertical], the menu will be expanded vertically.
diff --git a/packages/material_ui/lib/src/search.dart b/packages/material_ui/lib/src/search.dart
index 1c6721d..6ab7507 100644
--- a/packages/material_ui/lib/src/search.dart
+++ b/packages/material_ui/lib/src/search.dart
@@ -351,7 +351,7 @@
..pop(result);
}
- /// Closes the search page and returns to the underlying route whitout result.
+ /// Closes the search page and returns to the underlying route without result.
void _pop(BuildContext context) {
_currentBody = null;
_focusNode?.unfocus();
diff --git a/packages/material_ui/lib/src/segmented_button_theme.dart b/packages/material_ui/lib/src/segmented_button_theme.dart
index e5e1a18..08dccba 100644
--- a/packages/material_ui/lib/src/segmented_button_theme.dart
+++ b/packages/material_ui/lib/src/segmented_button_theme.dart
@@ -110,7 +110,7 @@
/// given an explicit non-null value.
class SegmentedButtonTheme extends InheritedTheme {
/// Creates a [SegmentedButtonTheme] that controls visual parameters for
- /// descendent [SegmentedButton]s.
+ /// descendant [SegmentedButton]s.
const SegmentedButtonTheme({super.key, required this.data, required super.child});
/// Specifies the visual properties used by descendant [SegmentedButton]
diff --git a/packages/material_ui/lib/src/stepper.dart b/packages/material_ui/lib/src/stepper.dart
index ff82c20..136f4e5 100644
--- a/packages/material_ui/lib/src/stepper.dart
+++ b/packages/material_ui/lib/src/stepper.dart
@@ -403,7 +403,7 @@
/// The padding around the header row in both [StepperType.vertical] and
/// [StepperType.horizontal] steppers.
///
- /// Defaults to to `EdgeInsets.symmetric(horizontal: 24.0)`.
+ /// Defaults to `EdgeInsets.symmetric(horizontal: 24.0)`.
final EdgeInsetsGeometry? headerPadding;
/// The padding around the content area in both [StepperType.vertical] and
diff --git a/packages/material_ui/lib/src/theme_data.dart b/packages/material_ui/lib/src/theme_data.dart
index 9835f20..3f21a84 100644
--- a/packages/material_ui/lib/src/theme_data.dart
+++ b/packages/material_ui/lib/src/theme_data.dart
@@ -272,7 +272,7 @@
/// When [useSystemColors] is true and the platform supports system colors, then the system colors
/// will be used to override certain theme colors. The [colorScheme], [textTheme],
/// [elevatedButtonTheme], [outlinedButtonTheme], [textButtonTheme], [filledButtonTheme], and
- /// [floatingActionButtonTheme] are overriden by the system colors.
+ /// [floatingActionButtonTheme] are overridden by the system colors.
///
/// See also:
///
diff --git a/packages/material_ui/pending_changelogs/change_2026_08_18_1787089293872.yaml b/packages/material_ui/pending_changelogs/change_2026_08_18_1787089293872.yaml
new file mode 100644
index 0000000..bb10d9c
--- /dev/null
+++ b/packages/material_ui/pending_changelogs/change_2026_08_18_1787089293872.yaml
@@ -0,0 +1,3 @@
+changelog: |
+ - Fixes typos in library code and tests.
+version: patch
diff --git a/packages/material_ui/pubspec.yaml b/packages/material_ui/pubspec.yaml
index 74627a0..262ee10 100644
--- a/packages/material_ui/pubspec.yaml
+++ b/packages/material_ui/pubspec.yaml
@@ -2,7 +2,7 @@
description: The official Flutter Material UI Library, implementing Google's Material Design design system.
version: 1.0.0
repository: https://github.com/flutter/packages/tree/main/packages/material_ui
-issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A%20material%20design%22
+issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A%20material%20design%22
environment:
sdk: ^3.12.0
diff --git a/packages/material_ui/test/carousel_test.dart b/packages/material_ui/test/carousel_test.dart
index 4218b2f..5838b87 100644
--- a/packages/material_ui/test/carousel_test.dart
+++ b/packages/material_ui/test/carousel_test.dart
@@ -1638,7 +1638,7 @@
});
// Regression test for https://github.com/flutter/flutter/issues/167621.
- testWidgets('CarouselView.weigted weigths are applied when viewport dimension is updated', (
+ testWidgets('CarouselView.weighted weights are applied when viewport dimension is updated', (
WidgetTester tester,
) async {
addTearDown(() => tester.binding.setSurfaceSize(null));
diff --git a/packages/material_ui/test/checkbox_test.dart b/packages/material_ui/test/checkbox_test.dart
index 3e19060..ba1dd78 100644
--- a/packages/material_ui/test/checkbox_test.dart
+++ b/packages/material_ui/test/checkbox_test.dart
@@ -1065,10 +1065,10 @@
});
testWidgets(
- 'Material3 - Checkbox visual density cannot be overriden by ThemeData.visualDensity',
+ 'Material3 - Checkbox visual density cannot be overridden by ThemeData.visualDensity',
(WidgetTester tester) async {
const key = Key('test');
- Widget buldCheckbox() {
+ Widget buildCheckbox() {
return MaterialApp(
theme: theme.copyWith(visualDensity: VisualDensity.compact),
home: Material(
@@ -1079,7 +1079,7 @@
);
}
- await tester.pumpWidget(buldCheckbox());
+ await tester.pumpWidget(buildCheckbox());
await tester.pumpAndSettle();
final RenderBox box = tester.renderObject(find.byKey(key));
expect(box.size, equals(const Size(48, 48)));
diff --git a/packages/material_ui/test/date_picker_test.dart b/packages/material_ui/test/date_picker_test.dart
index 57d0e0c..cf2329d 100644
--- a/packages/material_ui/test/date_picker_test.dart
+++ b/packages/material_ui/test/date_picker_test.dart
@@ -1675,7 +1675,7 @@
expect(find.text('Select date'), findsOne);
});
- // Simulate the portait mode on a device with a small display when the virtual
+ // Simulate the portrait mode on a device with a small display when the virtual
// keyboard is visible.
tester.view.viewInsets = const FakeViewPadding(bottom: 1000);
await tester.pumpAndSettle();
diff --git a/packages/material_ui/test/date_range_picker_test.dart b/packages/material_ui/test/date_range_picker_test.dart
index baecbf8..f4bf3e2 100644
--- a/packages/material_ui/test/date_range_picker_test.dart
+++ b/packages/material_ui/test/date_range_picker_test.dart
@@ -1263,7 +1263,7 @@
expect(find.text('Select range'), findsOne);
});
- // Simulate the portait mode on a device with a small display when the virtual
+ // Simulate the portrait mode on a device with a small display when the virtual
// keyboard is visible.
tester.view.viewInsets = const FakeViewPadding(bottom: 1000);
await tester.pumpAndSettle();
diff --git a/packages/material_ui/test/dropdown_menu_test.dart b/packages/material_ui/test/dropdown_menu_test.dart
index 32350b2..e0e253e 100644
--- a/packages/material_ui/test/dropdown_menu_test.dart
+++ b/packages/material_ui/test/dropdown_menu_test.dart
@@ -4260,7 +4260,7 @@
},
);
- testWidgets('items can be constrainted to be smaller than the text field with menuStyle', (
+ testWidgets('items can be constrained to be smaller than the text field with menuStyle', (
WidgetTester tester,
) async {
const longLabel = 'This is a long text that it can overflow.';
diff --git a/packages/material_ui/test/filled_button_theme_test.dart b/packages/material_ui/test/filled_button_theme_test.dart
index b99eb89..b5c7fc1 100644
--- a/packages/material_ui/test/filled_button_theme_test.dart
+++ b/packages/material_ui/test/filled_button_theme_test.dart
@@ -230,7 +230,7 @@
);
});
- testWidgets('FilledButton repsects Theme shadowColor', (WidgetTester tester) async {
+ testWidgets('FilledButton respects Theme shadowColor', (WidgetTester tester) async {
const colorScheme = ColorScheme.light();
const shadowColor = Color(0xff000001);
const overriddenColor = Color(0xff000002);
diff --git a/packages/material_ui/test/outlined_button_theme_test.dart b/packages/material_ui/test/outlined_button_theme_test.dart
index 393b985..ef9cdef 100644
--- a/packages/material_ui/test/outlined_button_theme_test.dart
+++ b/packages/material_ui/test/outlined_button_theme_test.dart
@@ -276,7 +276,7 @@
);
});
- testWidgets('Material3 - OutlinedButton repsects Theme shadowColor', (WidgetTester tester) async {
+ testWidgets('Material3 - OutlinedButton respects Theme shadowColor', (WidgetTester tester) async {
const colorScheme = ColorScheme.light();
const shadowColor = Color(0xff000001);
const overriddenColor = Color(0xff000002);
@@ -344,7 +344,7 @@
expect(material.shadowColor, shadowColor);
});
- testWidgets('Material2 - OutlinedButton repsects Theme shadowColor', (WidgetTester tester) async {
+ testWidgets('Material2 - OutlinedButton respects Theme shadowColor', (WidgetTester tester) async {
const colorScheme = ColorScheme.light();
const shadowColor = Color(0xff000001);
const overriddenColor = Color(0xff000002);
diff --git a/packages/material_ui/test/page_transitions_theme_test.dart b/packages/material_ui/test/page_transitions_theme_test.dart
index 5b729e1..952ba5c 100644
--- a/packages/material_ui/test/page_transitions_theme_test.dart
+++ b/packages/material_ui/test/page_transitions_theme_test.dart
@@ -959,7 +959,7 @@
switch (defaultTargetPlatform) {
case TargetPlatform.android:
- // Shows both pages while doing the "peek" predicitve back transition.
+ // Shows both pages while doing the "peek" predictive back transition.
expect(find.text('push'), findsOneWidget);
case TargetPlatform.iOS:
case TargetPlatform.macOS:
diff --git a/packages/material_ui/test/popup_menu_theme_test.dart b/packages/material_ui/test/popup_menu_theme_test.dart
index e7d4df5..aa46762 100644
--- a/packages/material_ui/test/popup_menu_theme_test.dart
+++ b/packages/material_ui/test/popup_menu_theme_test.dart
@@ -182,7 +182,7 @@
await tester.pumpAndSettle();
/// The last Material widget under popupButtonApp is the [PopupMenuButton]
- /// specified above, so by finding the last descendent of popupButtonApp
+ /// specified above, so by finding the last descendant of popupButtonApp
/// that is of type Material, this code retrieves the built
/// [PopupMenuButton].
final Material button = tester.widget<Material>(
@@ -198,7 +198,7 @@
expect(button.elevation, 3.0);
/// The last DefaultTextStyle widget under popupItemKey is the
- /// [PopupMenuItem] specified above, so by finding the last descendent of
+ /// [PopupMenuItem] specified above, so by finding the last descendant of
/// popupItemKey that is of type DefaultTextStyle, this code retrieves the
/// built [PopupMenuItem].
DefaultTextStyle popupMenuItemLabel = tester.widget<DefaultTextStyle>(
@@ -306,7 +306,7 @@
await tester.pumpAndSettle();
/// The last Material widget under popupButtonApp is the [PopupMenuButton]
- /// specified above, so by finding the last descendent of popupButtonApp
+ /// specified above, so by finding the last descendant of popupButtonApp
/// that is of type Material, this code retrieves the built
/// [PopupMenuButton].
final Material button = tester.widget<Material>(
@@ -432,7 +432,7 @@
await tester.pumpAndSettle();
/// The last Material widget under popupButtonApp is the [PopupMenuButton]
- /// specified above, so by finding the last descendent of popupButtonApp
+ /// specified above, so by finding the last descendant of popupButtonApp
/// that is of type Material, this code retrieves the built
/// [PopupMenuButton].
final Material button = tester.widget<Material>(
@@ -445,7 +445,7 @@
expect(button.surfaceTintColor, surfaceTintColor);
/// The last DefaultTextStyle widget under popupItemKey is the
- /// [PopupMenuItem] specified above, so by finding the last descendent of
+ /// [PopupMenuItem] specified above, so by finding the last descendant of
/// popupItemKey that is of type DefaultTextStyle, this code retrieves the
/// built [PopupMenuItem].
final DefaultTextStyle text = tester.widget<DefaultTextStyle>(
@@ -522,7 +522,7 @@
await tester.pumpAndSettle();
/// The last Material widget under popupButtonApp is the [PopupMenuButton]
- /// specified above, so by finding the last descendent of popupButtonApp
+ /// specified above, so by finding the last descendant of popupButtonApp
/// that is of type Material, this code retrieves the built
/// [PopupMenuButton].
final Material button = tester.widget<Material>(
@@ -533,7 +533,7 @@
expect(button.elevation, 8.0);
/// The last DefaultTextStyle widget under popupItemKey is the
- /// [PopupMenuItem] specified above, so by finding the last descendent of
+ /// [PopupMenuItem] specified above, so by finding the last descendant of
/// popupItemKey that is of type DefaultTextStyle, this code retrieves the
/// built [PopupMenuItem].
final DefaultTextStyle enabledText = tester.widget<DefaultTextStyle>(
@@ -631,7 +631,7 @@
await tester.pumpAndSettle();
/// The last Material widget under popupButtonApp is the [PopupMenuButton]
- /// specified above, so by finding the last descendent of popupButtonApp
+ /// specified above, so by finding the last descendant of popupButtonApp
/// that is of type Material, this code retrieves the built
/// [PopupMenuButton].
final Material button = tester.widget<Material>(
@@ -642,7 +642,7 @@
expect(button.elevation, popupMenuTheme.elevation);
/// The last DefaultTextStyle widget under popupItemKey is the
- /// [PopupMenuItem] specified above, so by finding the last descendent of
+ /// [PopupMenuItem] specified above, so by finding the last descendant of
/// popupItemKey that is of type DefaultTextStyle, this code retrieves the
/// built [PopupMenuItem].
final DefaultTextStyle text = tester.widget<DefaultTextStyle>(
@@ -725,7 +725,7 @@
await tester.pumpAndSettle();
/// The last Material widget under popupButtonApp is the [PopupMenuButton]
- /// specified above, so by finding the last descendent of popupButtonApp
+ /// specified above, so by finding the last descendant of popupButtonApp
/// that is of type Material, this code retrieves the built
/// [PopupMenuButton].
final Material button = tester.widget<Material>(
@@ -738,7 +738,7 @@
expect(button.surfaceTintColor, surfaceTintColor);
/// The last DefaultTextStyle widget under popupItemKey is the
- /// [PopupMenuItem] specified above, so by finding the last descendent of
+ /// [PopupMenuItem] specified above, so by finding the last descendant of
/// popupItemKey that is of type DefaultTextStyle, this code retrieves the
/// built [PopupMenuItem].
final DefaultTextStyle text = tester.widget<DefaultTextStyle>(
diff --git a/packages/material_ui/test/range_slider_test.dart b/packages/material_ui/test/range_slider_test.dart
index bce8581..026c518 100644
--- a/packages/material_ui/test/range_slider_test.dart
+++ b/packages/material_ui/test/range_slider_test.dart
@@ -1629,7 +1629,7 @@
expect(
valueIndicatorBox,
paints
- // Represents the raised button wth next text.
+ // Represents the raised button with next text.
..path(color: Colors.black)
..paragraph()
// Represents the range slider.
@@ -3537,7 +3537,7 @@
);
});
- // Regression test for hhttps://github.com/flutter/flutter/issues/161805
+ // Regression test for https://github.com/flutter/flutter/issues/161805
testWidgets('Discrete RangeSlider does not apply thumb padding in a non-rounded track shape', (
WidgetTester tester,
) async {
diff --git a/packages/material_ui/test/slider_test.dart b/packages/material_ui/test/slider_test.dart
index 44f5d6c..59c8572 100644
--- a/packages/material_ui/test/slider_test.dart
+++ b/packages/material_ui/test/slider_test.dart
@@ -3999,7 +3999,7 @@
),
),
);
- // Initially, the slider does not have focus whe enabled and not tapped.
+ // Initially, the slider does not have focus when enabled and not tapped.
await tester.pumpAndSettle();
expect(value, equals(0.5));
// Get FocusNode from the state of the slider to include auto-generated FocusNode.
@@ -5619,7 +5619,7 @@
expect(log.last, const Offset(400.0, 300.0));
});
- // Regression test for hhttps://github.com/flutter/flutter/issues/161805
+ // Regression test for https://github.com/flutter/flutter/issues/161805
testWidgets('Discrete Slider does not apply thumb padding in a non-rounded track shape', (
WidgetTester tester,
) async {
diff --git a/packages/material_ui/test/text_button_theme_test.dart b/packages/material_ui/test/text_button_theme_test.dart
index 83be109..993e778 100644
--- a/packages/material_ui/test/text_button_theme_test.dart
+++ b/packages/material_ui/test/text_button_theme_test.dart
@@ -287,7 +287,7 @@
);
});
- testWidgets('Material3 - TextButton repsects Theme shadowColor', (WidgetTester tester) async {
+ testWidgets('Material3 - TextButton respects Theme shadowColor', (WidgetTester tester) async {
const colorScheme = ColorScheme.light();
const shadowColor = Color(0xff000001);
const overriddenColor = Color(0xff000002);
@@ -353,7 +353,7 @@
expect(material.shadowColor, shadowColor);
});
- testWidgets('Material2 - TextButton repsects Theme shadowColor', (WidgetTester tester) async {
+ testWidgets('Material2 - TextButton respects Theme shadowColor', (WidgetTester tester) async {
const colorScheme = ColorScheme.light();
const shadowColor = Color(0xff000001);
const overriddenColor = Color(0xff000002);
diff --git a/packages/material_ui/test/text_field_test.dart b/packages/material_ui/test/text_field_test.dart
index b180e0b..4e1996a 100644
--- a/packages/material_ui/test/text_field_test.dart
+++ b/packages/material_ui/test/text_field_test.dart
@@ -17749,7 +17749,7 @@
expect(magnifierController, isNotNull);
expect(magnifierController!.shown, false);
- // Keep draging to select 'one two three four five' while the position continues to
+ // Keep dragging to select 'one two three four five' while the position continues to
// exceed the `hideBelowThreshold` keeping the magnifier hidden.
await gesture.moveTo(textOffsetToPosition(tester, 20) + const Offset(0.0, 50.0));
await tester.pumpAndSettle();