mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Apply @required according to the rules, for all of material/* (#7732)
This commit is contained in:
parent
0400107cdf
commit
d7b523e004
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'colors.dart';
|
||||
@ -42,8 +43,8 @@ class Chip extends StatelessWidget {
|
||||
const Chip({
|
||||
Key key,
|
||||
this.avatar,
|
||||
this.label,
|
||||
this.onDeleted
|
||||
@required this.label,
|
||||
this.onDeleted,
|
||||
}) : super(key: key);
|
||||
|
||||
/// A widget to display prior to the chip's label.
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
@ -34,7 +35,7 @@ class DataColumn {
|
||||
///
|
||||
/// The [label] argument must not be null.
|
||||
const DataColumn({
|
||||
this.label,
|
||||
@required this.label,
|
||||
this.tooltip,
|
||||
this.numeric: false,
|
||||
this.onSort
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'debug.dart';
|
||||
@ -35,7 +36,7 @@ class DrawerHeader extends StatelessWidget {
|
||||
this.padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 8.0),
|
||||
this.duration: const Duration(milliseconds: 250),
|
||||
this.curve: Curves.fastOutSlowIn,
|
||||
this.child
|
||||
@required this.child,
|
||||
}) : super(key: key);
|
||||
|
||||
/// Decoration for the main drawer header [Container]; useful for applying
|
||||
@ -61,6 +62,9 @@ class DrawerHeader extends StatelessWidget {
|
||||
final Curve curve;
|
||||
|
||||
/// A widget to be placed inside the drawer header, inset by the [padding].
|
||||
///
|
||||
/// This widget will be sized to the size of the header. To position the child
|
||||
/// precisely, consider using an [Align] or [Center] widget.
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'colors.dart';
|
||||
@ -33,7 +34,7 @@ class DrawerItem extends StatelessWidget {
|
||||
const DrawerItem({
|
||||
Key key,
|
||||
this.icon: const Icon(null),
|
||||
this.child,
|
||||
@required this.child,
|
||||
this.onPressed,
|
||||
this.selected: false
|
||||
}) : super(key: key);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
/// A tile in a material design grid list.
|
||||
@ -19,7 +20,7 @@ class GridTile extends StatelessWidget {
|
||||
/// Creates a grid tile.
|
||||
///
|
||||
/// Must have a child. Does not typically have both a header and a footer.
|
||||
GridTile({ Key key, this.header, this.footer, this.child }) : super(key: key) {
|
||||
GridTile({ Key key, this.header, this.footer, @required this.child }) : super(key: key) {
|
||||
assert(child != null);
|
||||
}
|
||||
|
||||
|
||||
@ -237,6 +237,7 @@ class InputContainer extends StatefulWidget {
|
||||
/// Defaults to true.
|
||||
final bool showDivider;
|
||||
|
||||
/// The widget below this widget in the tree.
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
|
||||
@ -35,7 +35,7 @@ class MaterialSlice extends MergeableMaterialItem {
|
||||
/// [MergeableMaterial].
|
||||
MaterialSlice({
|
||||
@required LocalKey key,
|
||||
this.child
|
||||
@required this.child,
|
||||
}) : super(key) {
|
||||
assert(key != null);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
import 'dart:async' show Timer;
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'theme.dart';
|
||||
@ -100,7 +101,7 @@ class OverscrollIndicator extends StatefulWidget {
|
||||
Key key,
|
||||
this.scrollableKey,
|
||||
this.edge: ScrollableEdge.both,
|
||||
this.child
|
||||
@required this.child,
|
||||
}) : super(key: key) {
|
||||
assert(child != null);
|
||||
assert(edge != null);
|
||||
|
||||
@ -20,7 +20,7 @@ class _MountainViewPageTransition extends AnimatedWidget {
|
||||
_MountainViewPageTransition({
|
||||
Key key,
|
||||
Animation<double> animation,
|
||||
this.child
|
||||
this.child,
|
||||
}) : super(
|
||||
key: key,
|
||||
animation: _kTween.animate(new CurvedAnimation(
|
||||
|
||||
@ -115,7 +115,7 @@ class PopupMenuItem<T> extends PopupMenuEntry<T> {
|
||||
Key key,
|
||||
this.value,
|
||||
this.enabled: true,
|
||||
this.child
|
||||
@required this.child,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
||||
@ -132,7 +132,7 @@ class RaisedButton extends StatelessWidget {
|
||||
elevation: enabled ? elevation : disabledElevation,
|
||||
highlightElevation: enabled ? highlightElevation : disabledElevation,
|
||||
colorBrightness: colorBrightness,
|
||||
child: child
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
|
||||
class _FloatingActionButtonTransition extends StatefulWidget {
|
||||
_FloatingActionButtonTransition({
|
||||
Key key,
|
||||
this.child
|
||||
this.child,
|
||||
}) : super(key: key);
|
||||
|
||||
final Widget child;
|
||||
@ -266,7 +266,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
|
||||
if (_previousAnimation.status != AnimationStatus.dismissed) {
|
||||
children.add(new ScaleTransition(
|
||||
scale: _previousAnimation,
|
||||
child: _previousChild
|
||||
child: _previousChild,
|
||||
));
|
||||
}
|
||||
if (_currentAnimation.status != AnimationStatus.dismissed) {
|
||||
@ -274,7 +274,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
|
||||
scale: _currentAnimation,
|
||||
child: new RotationTransition(
|
||||
turns: _kFloatingActionButtonTurnTween.animate(_currentAnimation),
|
||||
child: config.child
|
||||
child: config.child,
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
@ -147,11 +147,11 @@ class SnackBar extends StatelessWidget {
|
||||
/// The [content] argument must be non-null.
|
||||
SnackBar({
|
||||
Key key,
|
||||
this.content,
|
||||
@required this.content,
|
||||
this.backgroundColor,
|
||||
this.action,
|
||||
this.duration: _kSnackBarDisplayDuration,
|
||||
this.animation
|
||||
this.animation,
|
||||
}) : super(key: key) {
|
||||
assert(content != null);
|
||||
}
|
||||
@ -203,7 +203,7 @@ class SnackBar extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(vertical: _kSingleLineVerticalPadding),
|
||||
child: new DefaultTextStyle(
|
||||
style: darkTheme.textTheme.subhead,
|
||||
child: content
|
||||
child: content,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@ -144,7 +144,7 @@ class DefaultTabController extends StatefulWidget {
|
||||
Key key,
|
||||
@required this.length,
|
||||
this.initialIndex: 0,
|
||||
this.child
|
||||
@required this.child,
|
||||
}) : super(key: key);
|
||||
|
||||
/// The total number of tabs. Must be greater than one.
|
||||
|
||||
@ -109,7 +109,7 @@ class _TabStyle extends AnimatedWidget {
|
||||
this.selected,
|
||||
this.labelColor,
|
||||
this.unselectedLabelColor,
|
||||
this.child
|
||||
@required this.child,
|
||||
}) : super(key: key, animation: animation);
|
||||
|
||||
final bool selected;
|
||||
|
||||
@ -160,7 +160,7 @@ class AnimatedTheme extends ImplicitlyAnimatedWidget {
|
||||
this.isMaterialAppTheme: false,
|
||||
Curve curve: Curves.linear,
|
||||
Duration duration: kThemeAnimationDuration,
|
||||
this.child
|
||||
@required this.child,
|
||||
}) : super(key: key, curve: curve, duration: duration) {
|
||||
assert(child != null);
|
||||
assert(data != null);
|
||||
|
||||
@ -47,7 +47,7 @@ class Tooltip extends StatefulWidget {
|
||||
this.padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
this.verticalOffset: 24.0,
|
||||
this.preferBelow: true,
|
||||
this.child
|
||||
this.child,
|
||||
}) : super(key: key) {
|
||||
assert(message != null);
|
||||
assert(height != null);
|
||||
@ -181,7 +181,7 @@ class _TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
|
||||
excludeFromSemantics: true,
|
||||
child: new Semantics(
|
||||
label: config.message,
|
||||
child: config.child
|
||||
child: config.child,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'debug.dart';
|
||||
@ -50,8 +51,8 @@ class _AccountPictures extends StatelessWidget {
|
||||
class _AccountDetails extends StatelessWidget {
|
||||
_AccountDetails({
|
||||
Key key,
|
||||
this.accountName,
|
||||
this.accountEmail,
|
||||
@required this.accountName,
|
||||
@required this.accountEmail,
|
||||
this.onTap,
|
||||
this.isOpen,
|
||||
}) : super(key: key);
|
||||
@ -136,8 +137,8 @@ class UserAccountsDrawerHeader extends StatefulWidget {
|
||||
this.decoration,
|
||||
this.currentAccountPicture,
|
||||
this.otherAccountsPictures,
|
||||
this.accountName,
|
||||
this.accountEmail,
|
||||
@required this.accountName,
|
||||
@required this.accountEmail,
|
||||
this.onDetailsPressed
|
||||
}) : super(key: key);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user