Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dev/tools/gen_keycodes/data/keyboard_key.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import 'package:flutter/foundation.dart';
/// * [LogicalKeyboardKey], a class with static values that describe the keys
/// that are returned from [RawKeyEvent.logicalKey].
abstract class KeyboardKey with Diagnosticable {
/// A const constructor so that subclasses may be const.
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const KeyboardKey();
}

Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/animation/curves.dart
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ abstract class Curve2D extends ParametricCurve<Offset> {
/// * [Curve2D.generateSamples], which generates samples of this type.
/// * [Curve2D], a parametric curve that maps a double parameter to a 2D location.
class Curve2DSample {
/// A const constructor for the sample so that subclasses can be const.
/// Creates an object that holds a sample; used with [Curve2D] subclasses.
///
/// All arguments must not be null.
const Curve2DSample(this.t, this.value) : assert(t != null), assert(value != null);
Expand Down
3 changes: 2 additions & 1 deletion packages/flutter/lib/src/foundation/assertions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ class PartialStackFrame {
/// A class that filters stack frames for additional filtering on
/// [FlutterError.defaultStackFilter].
abstract class StackFilter {
/// A const constructor to allow subclasses to be const.
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const StackFilter();

/// Filters the list of [StackFrame]s by updating corresponding indices in
Expand Down
3 changes: 2 additions & 1 deletion packages/flutter/lib/src/foundation/key.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ abstract class Key {
///
/// * [Widget.key], which discusses how widgets use keys.
abstract class LocalKey extends Key {
/// Default constructor, used by subclasses.
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const LocalKey() : super.empty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ part of material_animated_icons;
/// {@end-tool}
///
class AnimatedIcon extends StatelessWidget {

/// Creates an AnimatedIcon.
///
/// The [progress] and [icon] arguments must not be null.
Expand Down
3 changes: 2 additions & 1 deletion packages/flutter/lib/src/material/button_style_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import 'theme_data.dart';
/// * [ElevatedButton], a filled ButtonStyleButton whose material elevates when pressed.
/// * [OutlinedButton], similar to [TextButton], but with an outline.
abstract class ButtonStyleButton extends StatefulWidget {
/// Create a [ButtonStyleButton].
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const ButtonStyleButton({
Key? key,
required this.onPressed,
Expand Down
3 changes: 3 additions & 0 deletions packages/flutter/lib/src/material/ink_well.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ abstract class InteractiveInkFeature extends InkFeature {
/// * [InkSplash.splashFactory]
/// * [InkRipple.splashFactory]
abstract class InteractiveInkFeatureFactory {
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
///
/// Subclasses should provide a const constructor.
const InteractiveInkFeatureFactory();

Expand Down
12 changes: 8 additions & 4 deletions packages/flutter/lib/src/material/material_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ typedef MaterialPropertyResolver<T> = T Function(Set<MaterialState> states);
/// ```
/// {@end-tool}
abstract class MaterialStateColor extends Color implements MaterialStateProperty<Color> {
/// Creates a [MaterialStateColor].
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const MaterialStateColor(int defaultValue) : super(defaultValue);

/// Creates a [MaterialStateColor] from a [MaterialPropertyResolver<Color>]
Expand Down Expand Up @@ -220,7 +221,8 @@ class _MaterialStateColor extends MaterialStateColor {
/// * [SystemMouseCursors], which defines cursors that are supported by
/// native platforms.
abstract class MaterialStateMouseCursor extends MouseCursor implements MaterialStateProperty<MouseCursor> {
/// Creates a [MaterialStateMouseCursor].
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const MaterialStateMouseCursor();

@protected
Expand Down Expand Up @@ -333,7 +335,8 @@ class _EnabledAndDisabledMouseCursor extends MaterialStateMouseCursor {
/// This class should only be used for parameters which are documented to take
/// [MaterialStateBorderSide], otherwise only the default state will be used.
abstract class MaterialStateBorderSide extends BorderSide implements MaterialStateProperty<BorderSide?> {
/// Creates a [MaterialStateBorderSide].
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const MaterialStateBorderSide();

/// Returns a [BorderSide] that's to be used when a Material component is
Expand Down Expand Up @@ -393,7 +396,8 @@ abstract class MaterialStateBorderSide extends BorderSide implements MaterialSta
///
/// * [ShapeBorder] the base class for shape outlines.
abstract class MaterialStateOutlinedBorder extends OutlinedBorder implements MaterialStateProperty<OutlinedBorder?> {
/// Creates a [MaterialStateOutlinedBorder].
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const MaterialStateOutlinedBorder();

/// Returns an [OutlinedBorder] that's to be used when a Material component is
Expand Down
18 changes: 10 additions & 8 deletions packages/flutter/lib/src/material/page_transitions_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ abstract class PageTransitionsBuilder {
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// transition that matches native iOS page transitions.
class FadeUpwardsPageTransitionsBuilder extends PageTransitionsBuilder {
/// Construct a [FadeUpwardsPageTransitionsBuilder].
/// Constructs a page transition animation that slides the page up.
const FadeUpwardsPageTransitionsBuilder();

@override
Expand All @@ -461,7 +461,8 @@ class FadeUpwardsPageTransitionsBuilder extends PageTransitionsBuilder {
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// transition that matches native iOS page transitions.
class OpenUpwardsPageTransitionsBuilder extends PageTransitionsBuilder {
/// Construct a [OpenUpwardsPageTransitionsBuilder].
/// Constructs a page transition animation that matches the transition used on
/// Android P.
const OpenUpwardsPageTransitionsBuilder();

@override
Expand Down Expand Up @@ -492,7 +493,8 @@ class OpenUpwardsPageTransitionsBuilder extends PageTransitionsBuilder {
/// * [CupertinoPageTransitionsBuilder], which defines a horizontal page
/// transition that matches native iOS page transitions.
class ZoomPageTransitionsBuilder extends PageTransitionsBuilder {
/// Construct a [ZoomPageTransitionsBuilder].
/// Constructs a page transition animation that matches the transition used on
/// Android 10.
const ZoomPageTransitionsBuilder();

@override
Expand Down Expand Up @@ -522,7 +524,7 @@ class ZoomPageTransitionsBuilder extends PageTransitionsBuilder {
/// * [ZoomPageTransitionsBuilder], which defines a page transition similar
/// to the one provided in Android 10.
class CupertinoPageTransitionsBuilder extends PageTransitionsBuilder {
/// Construct a [CupertinoPageTransitionsBuilder].
/// Constructs a page transition animation that matches the iOS transition.
const CupertinoPageTransitionsBuilder();

@override
Expand Down Expand Up @@ -558,12 +560,12 @@ class CupertinoPageTransitionsBuilder extends PageTransitionsBuilder {
/// transition that matches native iOS page transitions.
@immutable
class PageTransitionsTheme with Diagnosticable {
/// Construct a PageTransitionsTheme.
/// Constructs an object that selects a transition based on the platform.
///
/// By default the list of builders is: [FadeUpwardsPageTransitionsBuilder]
/// for [TargetPlatform.android], and [CupertinoPageTransitionsBuilder] for
/// [TargetPlatform.iOS] and [TargetPlatform.macOS].
const PageTransitionsTheme({ Map<TargetPlatform, PageTransitionsBuilder>? builders }) : _builders = builders;
const PageTransitionsTheme({ Map<TargetPlatform, PageTransitionsBuilder> builders = _defaultBuilders }) : _builders = builders;

static const Map<TargetPlatform, PageTransitionsBuilder> _defaultBuilders = <TargetPlatform, PageTransitionsBuilder>{
TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(),
Expand All @@ -574,8 +576,8 @@ class PageTransitionsTheme with Diagnosticable {
};

/// The [PageTransitionsBuilder]s supported by this theme.
Map<TargetPlatform, PageTransitionsBuilder> get builders => _builders ?? _defaultBuilders;
final Map<TargetPlatform, PageTransitionsBuilder>? _builders;
Map<TargetPlatform, PageTransitionsBuilder> get builders => _builders;
final Map<TargetPlatform, PageTransitionsBuilder> _builders;

/// Delegates to the builder for the current [ThemeData.platform]
/// or [FadeUpwardsPageTransitionsBuilder].
Expand Down
3 changes: 2 additions & 1 deletion packages/flutter/lib/src/painting/gradient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ _ColorsAndStops _interpolateColorsAndStops(
/// a [GradientRotation] of `pi/4` radians (i.e. 45 degrees).
@immutable
abstract class GradientTransform {
/// A const constructor so that subclasses may be const.
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const GradientTransform();

/// When a [Gradient] creates its [Shader], it will call this method to
Expand Down
1 change: 0 additions & 1 deletion packages/flutter/lib/src/rendering/custom_paint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ abstract class CustomPainter extends Listenable {
/// * [CustomPainter], which creates instances of this class.
@immutable
class CustomPainterSemantics {

/// Creates semantics information describing a rectangle on a canvas.
///
/// Arguments `rect` and `properties` must not be null.
Expand Down
1 change: 0 additions & 1 deletion packages/flutter/lib/src/rendering/viewport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ abstract class RenderAbstractViewport extends RenderObject {
/// the [rect] position said element would have in the viewport at that
/// [offset].
class RevealedOffset {

/// Instantiates a return value for [RenderAbstractViewport.getOffsetToReveal].
const RevealedOffset({
required this.offset,
Expand Down
3 changes: 0 additions & 3 deletions packages/flutter/lib/src/semantics/semantics_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class AnnounceSemanticsEvent extends SemanticsEvent {
///
/// This is only used by Android to announce tooltip values.
class TooltipSemanticsEvent extends SemanticsEvent {

/// Constructs an event that triggers a tooltip announcement by the platform.
const TooltipSemanticsEvent(this.message) : super('tooltip');

Expand All @@ -115,7 +114,6 @@ class TooltipSemanticsEvent extends SemanticsEvent {
/// Currently only honored on Android. Triggers a long-press specific sound
/// when TalkBack is enabled.
class LongPressSemanticsEvent extends SemanticsEvent {

/// Constructs an event that triggers a long-press semantic feedback by the platform.
const LongPressSemanticsEvent() : super('longPress');

Expand All @@ -128,7 +126,6 @@ class LongPressSemanticsEvent extends SemanticsEvent {
/// Currently only honored on Android. Triggers a tap specific sound when
/// TalkBack is enabled.
class TapSemanticEvent extends SemanticsEvent {

/// Constructs an event that triggers a long-press semantic feedback by the platform.
const TapSemanticEvent() : super('tap');

Expand Down
3 changes: 2 additions & 1 deletion packages/flutter/lib/src/services/binary_messenger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ typedef MessageHandler = Future<ByteData?>? Function(ByteData? message);
///
/// This class also registers handlers for incoming messages.
abstract class BinaryMessenger {
/// A const constructor to allow subclasses to be const.
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const BinaryMessenger();

/// Calls the handler registered for the given channel.
Expand Down
3 changes: 2 additions & 1 deletion packages/flutter/lib/src/services/keyboard_key.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import 'package:flutter/foundation.dart';
/// * [LogicalKeyboardKey], a class with static values that describe the keys
/// that are returned from [RawKeyEvent.logicalKey].
abstract class KeyboardKey with Diagnosticable {
/// A const constructor so that subclasses may be const.
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const KeyboardKey();
}

Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/services/platform_views.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class PlatformViewsService {
///
/// A Dart version of Android's [MotionEvent.PointerProperties](https://developer.android.com/reference/android/view/MotionEvent.PointerProperties).
class AndroidPointerProperties {
/// Creates an AndroidPointerProperties.
/// Creates an [AndroidPointerProperties] object.
///
/// All parameters must not be null.
const AndroidPointerProperties({
Expand Down
10 changes: 4 additions & 6 deletions packages/flutter/lib/src/services/raw_keyboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,8 @@ enum ModifierKey {
/// * [RawKeyboard], which uses these interfaces to expose key data.
@immutable
abstract class RawKeyEventData {
/// Abstract const constructor.
///
/// This constructor enables subclasses to provide const constructors so that
/// they can be used in const expressions.
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const RawKeyEventData();

/// Returns true if the given [ModifierKey] was pressed at the time of this
Expand Down Expand Up @@ -255,8 +253,8 @@ abstract class RawKeyEventData {
/// * [RawKeyboardListener], a widget that listens for raw key events.
@immutable
abstract class RawKeyEvent with Diagnosticable {
/// Initializes fields for subclasses, and provides a const constructor for
/// const subclasses.
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const RawKeyEvent({
required this.data,
this.character,
Expand Down
16 changes: 10 additions & 6 deletions packages/flutter/lib/src/widgets/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ BuildContext _getParent(BuildContext context) {
/// [BuildContext].
@immutable
abstract class Intent with Diagnosticable {
/// A const constructor for an [Intent].
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const Intent();

/// An intent that is mapped to a [DoNothingAction], which, as the name
Expand Down Expand Up @@ -485,7 +486,7 @@ class CallbackAction<T extends Intent> extends Action<T> {
/// - [Actions] widget, which defines a mapping between a in [Intent] type and
/// an [Action].
class ActionDispatcher with Diagnosticable {
/// Const constructor so that subclasses can be immutable.
/// Creates an action dispatcher that invokes actions directly.
const ActionDispatcher();

/// Invokes the given `action`, passing it the given `intent`.
Expand Down Expand Up @@ -1561,7 +1562,7 @@ class DoNothingAction extends Action<Intent> {
/// * [WidgetsApp.shortcuts], which defines the shortcuts to use in an
/// application (and defaults to [WidgetsApp.defaultShortcuts]).
class ActivateIntent extends Intent {
/// Creates a const [ActivateIntent] so subclasses can be const.
/// Creates an intent that activates the currently focused control.
const ActivateIntent();
}

Expand All @@ -1578,7 +1579,7 @@ class ActivateIntent extends Intent {
/// * [WidgetsApp.shortcuts], which defines the shortcuts to use in an
/// application (and defaults to [WidgetsApp.defaultShortcuts]).
class ButtonActivateIntent extends Intent {
/// Creates a const [ButtonActivateIntent] so subclasses can be const.
/// Creates an intent that the currently focused control, if it's a button.
const ButtonActivateIntent();
}

Expand Down Expand Up @@ -1608,7 +1609,7 @@ abstract class SelectAction extends Action<SelectIntent> {}
/// - [ModalRoute] which listens for this intent to dismiss modal routes
/// (dialogs, pop-up menus, drawers, etc).
class DismissIntent extends Intent {
/// Creates a const [DismissIntent].
/// Creates an intent that dismisses the currently focused widget.
const DismissIntent();
}

Expand All @@ -1619,8 +1620,11 @@ abstract class DismissAction extends Action<DismissIntent> {}

/// An [Intent] that evaluates a series of specified [orderedIntents] for
/// execution.
///
/// The first intent that matches an enabled action is used.
class PrioritizedIntents extends Intent {
/// Creates a set of const [PrioritizedIntents].
/// Creates an intent that is used with [PrioritizedAction] to specify a list
/// of intents, the first available of which will be used.
const PrioritizedIntents({
required this.orderedIntents,
}) : assert(orderedIntents != null);
Expand Down
Loading