Skip to content

Commit 43bd948

Browse files
Fix WidgetStateProperty documentation (#154298)
Changes: - Remove 2<sup>nd</sup> person language from docs ([relevant style guideline](https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#use-the-passive-voice-recommend-do-not-require-never-say-things-are-simple)) - Update a bunch of spots to be more explicit about `WidgetStateMouseCursor`. - `WidgetStateFoo` constructors now accurately describe what happens when used incorrectly. - Gave `WidgetStateProperty` a little section about equality checks.
1 parent 97a4db9 commit 43bd948

File tree

15 files changed

+74
-109
lines changed

15 files changed

+74
-109
lines changed

packages/flutter/lib/src/material/bottom_navigation_bar.dart

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -377,18 +377,12 @@ class BottomNavigationBar extends StatefulWidget {
377377
/// The cursor for a mouse pointer when it enters or is hovering over the
378378
/// items.
379379
///
380-
/// If [mouseCursor] is a [WidgetStateProperty<MouseCursor>],
381-
/// [WidgetStateProperty.resolve] is used for the following [WidgetState]s:
382-
///
383-
/// * [WidgetState.selected].
380+
/// If [mouseCursor] is a [WidgetStateMouseCursor], its `resolve` method
381+
/// can define the appearance of the cursor depending on whether
382+
/// [WidgetState.selected] is active.
384383
///
385384
/// If null, then the value of [BottomNavigationBarThemeData.mouseCursor] is used. If
386385
/// that is also null, then [WidgetStateMouseCursor.clickable] is used.
387-
///
388-
/// See also:
389-
///
390-
/// * [WidgetStateMouseCursor], which can be used to create a [MouseCursor]
391-
/// that is also a [WidgetStateProperty<MouseCursor>].
392386
final MouseCursor? mouseCursor;
393387

394388
/// Whether detected gestures should provide acoustic and/or haptic feedback.

packages/flutter/lib/src/material/button.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class RawMaterialButton extends StatefulWidget {
115115
/// The cursor for a mouse pointer when it enters or is hovering over the
116116
/// button.
117117
///
118-
/// If [mouseCursor] is a [WidgetStateProperty<MouseCursor>],
118+
/// If [mouseCursor] is a [WidgetStateMouseCursor],
119119
/// [WidgetStateProperty.resolve] is used for the following [WidgetState]s:
120120
///
121121
/// * [WidgetState.pressed].

packages/flutter/lib/src/material/checkbox.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,6 @@ class Checkbox extends StatefulWidget {
197197
///
198198
/// If null, then the value of [CheckboxThemeData.mouseCursor] is used. If
199199
/// that is also null, then [WidgetStateMouseCursor.clickable] is used.
200-
///
201-
/// See also:
202-
///
203-
/// * [WidgetStateMouseCursor], a [MouseCursor] that implements
204-
/// [WidgetStateProperty] which is used in APIs that need to accept
205-
/// either a [MouseCursor] or a [WidgetStateProperty].
206200
final MouseCursor? mouseCursor;
207201

208202
/// The color to use when this checkbox is checked.

packages/flutter/lib/src/material/checkbox_list_tile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class CheckboxListTile extends StatelessWidget {
291291
/// The cursor for a mouse pointer when it enters or is hovering over the
292292
/// widget.
293293
///
294-
/// If [mouseCursor] is a [WidgetStateProperty<MouseCursor>],
294+
/// If [mouseCursor] is a [WidgetStateMouseCursor],
295295
/// [WidgetStateProperty.resolve] is used for the following [WidgetState]s:
296296
///
297297
/// * [WidgetState.selected].

packages/flutter/lib/src/material/ink_well.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ class InkResponse extends StatelessWidget {
403403
/// The cursor for a mouse pointer when it enters or is hovering over the
404404
/// widget.
405405
///
406-
/// If [mouseCursor] is a [WidgetStateProperty<MouseCursor>],
406+
/// If [mouseCursor] is a [WidgetStateMouseCursor],
407407
/// [WidgetStateProperty.resolve] is used for the following [WidgetState]s:
408408
///
409409
/// * [WidgetState.hovered].

packages/flutter/lib/src/material/list_tile.dart

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ class ListTile extends StatelessWidget {
621621
/// The cursor for a mouse pointer when it enters or is hovering over the
622622
/// widget.
623623
///
624-
/// If [mouseCursor] is a [WidgetStateProperty<MouseCursor>],
624+
/// If [mouseCursor] is a [WidgetStateMouseCursor],
625625
/// [WidgetStateProperty.resolve] is used for the following [WidgetState]s:
626626
///
627627
/// * [WidgetState.selected].
@@ -630,11 +630,6 @@ class ListTile extends StatelessWidget {
630630
///
631631
/// If null, then the value of [ListTileThemeData.mouseCursor] is used. If
632632
/// that is also null, then [WidgetStateMouseCursor.clickable] is used.
633-
///
634-
/// See also:
635-
///
636-
/// * [WidgetStateMouseCursor], which can be used to create a [MouseCursor]
637-
/// that is also a [WidgetStateProperty<MouseCursor>].
638633
final MouseCursor? mouseCursor;
639634

640635
/// If this tile is also [enabled] then icons and text are rendered with the same color.

packages/flutter/lib/src/material/popup_menu.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ class PopupMenuItem<T> extends PopupMenuEntry<T> {
289289
/// The cursor for a mouse pointer when it enters or is hovering over the
290290
/// widget.
291291
///
292-
/// If [mouseCursor] is a [WidgetStateProperty<MouseCursor>],
292+
/// If [mouseCursor] is a [WidgetStateMouseCursor],
293293
/// [WidgetStateProperty.resolve] is used for the following [WidgetState]s:
294294
///
295295
/// * [WidgetState.hovered].

packages/flutter/lib/src/material/radio.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class Radio<T> extends StatefulWidget {
183183
/// The cursor for a mouse pointer when it enters or is hovering over the
184184
/// widget.
185185
///
186-
/// If [mouseCursor] is a [WidgetStateProperty<MouseCursor>],
186+
/// If [mouseCursor] is a [WidgetStateMouseCursor],
187187
/// [WidgetStateProperty.resolve] is used for the following [WidgetState]s:
188188
///
189189
/// * [WidgetState.selected].
@@ -194,12 +194,6 @@ class Radio<T> extends StatefulWidget {
194194
///
195195
/// If null, then the value of [RadioThemeData.mouseCursor] is used.
196196
/// If that is also null, then [WidgetStateMouseCursor.clickable] is used.
197-
///
198-
/// See also:
199-
///
200-
/// * [WidgetStateMouseCursor], a [MouseCursor] that implements
201-
/// `WidgetStateProperty` which is used in APIs that need to accept
202-
/// either a [MouseCursor] or a [WidgetStateProperty<MouseCursor>].
203197
final MouseCursor? mouseCursor;
204198

205199
/// Set to true if this radio button is allowed to be returned to an

packages/flutter/lib/src/material/radio_list_tile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ class RadioListTile<T> extends StatelessWidget {
288288
/// The cursor for a mouse pointer when it enters or is hovering over the
289289
/// widget.
290290
///
291-
/// If [mouseCursor] is a [WidgetStateProperty<MouseCursor>],
291+
/// If [mouseCursor] is a [WidgetStateMouseCursor],
292292
/// [WidgetStateProperty.resolve] is used for the following [WidgetState]s:
293293
///
294294
/// * [WidgetState.selected].

packages/flutter/lib/src/material/slider.dart

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ class Slider extends StatefulWidget {
486486
/// The cursor for a mouse pointer when it enters or is hovering over the
487487
/// widget.
488488
///
489-
/// If [mouseCursor] is a [WidgetStateProperty<MouseCursor>],
489+
/// If [mouseCursor] is a [WidgetStateMouseCursor],
490490
/// [WidgetStateProperty.resolve] is used for the following [WidgetState]s:
491491
///
492492
/// * [WidgetState.dragged].
@@ -497,11 +497,6 @@ class Slider extends StatefulWidget {
497497
///
498498
/// If null, then the value of [SliderThemeData.mouseCursor] is used. If that
499499
/// is also null, then [WidgetStateMouseCursor.clickable] is used.
500-
///
501-
/// See also:
502-
///
503-
/// * [WidgetStateMouseCursor], which can be used to create a [MouseCursor]
504-
/// that is also a [WidgetStateProperty<MouseCursor>].
505500
final MouseCursor? mouseCursor;
506501

507502
/// The callback used to create a semantic value from a slider value.

0 commit comments

Comments
 (0)