Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
9ac16680
Commit
9ac16680
authored
Jun 12, 2017
by
Ian Hickson
Committed by
GitHub
Jun 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Analyze sample code (#10619)
parent
123e9e01
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
612 additions
and
227 deletions
+612
-227
analyze-sample-code.dart
dev/bots/analyze-sample-code.dart
+266
-0
test.dart
dev/bots/test.dart
+9
-0
cupertino_buttons_demo.dart
...er_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart
+9
-9
cupertino_dialog_demo.dart
...ter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart
+2
-4
foundation.dart
packages/flutter/lib/foundation.dart
+9
-0
animation_controller.dart
packages/flutter/lib/src/animation/animation_controller.dart
+16
-10
tween.dart
packages/flutter/lib/src/animation/tween.dart
+1
-1
colors.dart
packages/flutter/lib/src/cupertino/colors.dart
+11
-1
switch.dart
packages/flutter/lib/src/cupertino/switch.dart
+20
-0
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+5
-0
circle_avatar.dart
packages/flutter/lib/src/material/circle_avatar.dart
+3
-0
colors.dart
packages/flutter/lib/src/material/colors.dart
+141
-141
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+7
-1
box_fit.dart
packages/flutter/lib/src/painting/box_fit.dart
+9
-8
box_painter.dart
packages/flutter/lib/src/painting/box_painter.dart
+23
-17
edge_insets.dart
packages/flutter/lib/src/painting/edge_insets.dart
+16
-6
gravity_simulation.dart
packages/flutter/lib/src/physics/gravity_simulation.dart
+24
-0
animated_cross_fade.dart
packages/flutter/lib/src/widgets/animated_cross_fade.dart
+1
-1
async.dart
packages/flutter/lib/src/widgets/async.dart
+3
-0
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+1
-1
binding.dart
packages/flutter/lib/src/widgets/binding.dart
+8
-8
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+24
-15
gesture_detector.dart
packages/flutter/lib/src/widgets/gesture_detector.dart
+4
-4
No files found.
dev/bots/analyze-sample-code.dart
0 → 100644
View file @
9ac16680
This diff is collapsed.
Click to expand it.
dev/bots/test.dart
View file @
9ac16680
// Copyright 2017 The Chromium 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
'dart:async'
;
import
'dart:convert'
;
import
'dart:io'
;
...
...
@@ -37,6 +41,11 @@ Future<Null> main() async {
options:
<
String
>[
'--flutter-repo'
],
);
// Analyze all the sample code in the repo
await
_runCommand
(
dart
,
<
String
>[
path
.
join
(
flutterRoot
,
'dev'
,
'bots'
,
'analyze-sample-code.dart'
)],
workingDirectory:
flutterRoot
,
);
// Try with the --watch analyzer, to make sure it returns success also.
// The --benchmark argument exits after one run.
await
_runFlutterAnalyze
(
flutterRoot
,
...
...
examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart
View file @
9ac16680
...
...
@@ -5,8 +5,6 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
const
Color
_kBlue
=
const
Color
(
0xFF007AFF
);
class
CupertinoButtonsDemo
extends
StatefulWidget
{
static
const
String
routeName
=
'/cupertino/buttons'
;
...
...
@@ -27,15 +25,17 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
children:
<
Widget
>
[
const
Padding
(
padding:
const
EdgeInsets
.
all
(
16.0
),
child:
const
Text
(
'iOS themed buttons are flat. They can have borders or backgrounds but '
'only when necessary.'
),
child:
const
Text
(
'iOS themed buttons are flat. They can have borders or backgrounds but '
'only when necessary.'
),
),
new
Expanded
(
child:
new
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>
[
new
Text
(
_pressedCount
>
0
?
'Button pressed
$_pressedCount
time
${_pressedCount == 1 ?
'' : 's'
}
'
?
'Button pressed
$_pressedCount
time
${_pressedCount == 1 ?
"" : "s"
}
'
:
' '
),
const
Padding
(
padding:
const
EdgeInsets
.
all
(
12.0
)),
new
Align
(
...
...
@@ -46,7 +46,7 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
new
CupertinoButton
(
child:
const
Text
(
'Cupertino Button'
),
onPressed:
()
{
setState
(()
{
_pressedCount
++;
});
setState
(()
{
_pressedCount
+=
1
;
});
}
),
const
CupertinoButton
(
...
...
@@ -59,15 +59,15 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
const
Padding
(
padding:
const
EdgeInsets
.
all
(
12.0
)),
new
CupertinoButton
(
child:
const
Text
(
'With Background'
),
color:
_k
Blue
,
color:
CupertinoColors
.
active
Blue
,
onPressed:
()
{
setState
(()
{
_pressedCount
++;
});
setState
(()
{
_pressedCount
+=
1
;
});
}
),
const
Padding
(
padding:
const
EdgeInsets
.
all
(
12.0
)),
const
CupertinoButton
(
child:
const
Text
(
'Disabled'
),
color:
_k
Blue
,
color:
CupertinoColors
.
active
Blue
,
onPressed:
null
,
),
],
...
...
examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart
View file @
9ac16680
...
...
@@ -5,8 +5,6 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
const
Color
_kBlue
=
const
Color
(
0xFF007AFF
);
class
CupertinoDialogDemo
extends
StatefulWidget
{
static
const
String
routeName
=
'/cupertino/dialog'
;
...
...
@@ -44,7 +42,7 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> {
children:
<
Widget
>
[
new
CupertinoButton
(
child:
const
Text
(
'Alert'
),
color:
_k
Blue
,
color:
CupertinoColors
.
active
Blue
,
onPressed:
()
{
showDemoDialog
<
String
>(
context:
context
,
...
...
@@ -69,7 +67,7 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> {
const
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
)),
new
CupertinoButton
(
child:
const
Text
(
'Alert with Title'
),
color:
_k
Blue
,
color:
CupertinoColors
.
active
Blue
,
padding:
const
EdgeInsets
.
symmetric
(
vertical:
16.0
,
horizontal:
36.0
),
onPressed:
()
{
showDemoDialog
<
String
>(
...
...
packages/flutter/lib/foundation.dart
View file @
9ac16680
...
...
@@ -16,6 +16,15 @@ export 'package:meta/meta.dart' show
protected
,
required
;
// Examples can assume:
// bool _first;
// bool _lights;
// bool _visible;
// double _volume;
// dynamic _selection;
// dynamic _last;
// dynamic _calculation;
export
'src/foundation/assertions.dart'
;
export
'src/foundation/basic_types.dart'
;
export
'src/foundation/binding.dart'
;
...
...
packages/flutter/lib/src/animation/animation_controller.dart
View file @
9ac16680
...
...
@@ -15,6 +15,9 @@ import 'listener_helpers.dart';
export
'package:flutter/scheduler.dart'
show
TickerFuture
,
TickerCanceled
;
// Examples can assume:
// AnimationController _controller;
/// The direction in which an animation is running.
enum
_AnimationDirection
{
/// The animation is running from beginning to end.
...
...
@@ -44,17 +47,20 @@ const Tolerance _kFlingTolerance = const Tolerance(
/// * Define the [upperBound] and [lowerBound] values of an animation.
/// * Create a [fling] animation effect using a physics simulation.
///
/// By default, an [AnimationController] linearly produces values that range from 0.0 to 1.0, during
/// a given duration. The animation controller generates a new value whenever the device running
/// your app is ready to display a new frame (typically, this rate is around 60 values per second).
/// By default, an [AnimationController] linearly produces values that range
/// from 0.0 to 1.0, during a given duration. The animation controller generates
/// a new value whenever the device running your app is ready to display a new
/// frame (typically, this rate is around 60 values per second).
///
/// An AnimationController needs a [TickerProvider], which is configured using the `vsync` argument
/// on the constructor. If you are creating an AnimationController from a [State], then you can use
/// the [TickerProviderStateMixin] and [SingleTickerProviderStateMixin] classes to obtain a suitable
/// [TickerProvider]. The widget test framework [WidgetTester] object can be used as a ticker provider
/// in the context of tests. In other contexts, you will have to either pass a [TickerProvider] from
/// a higher level (e.g. indirectly from a [State] that mixes in [TickerProviderStateMixin]), or
/// create a custom [TickerProvider] subclass.
/// An AnimationController needs a [TickerProvider], which is configured using
/// the `vsync` argument on the constructor. If you are creating an
/// AnimationController from a [State], then you can use the
/// [TickerProviderStateMixin] and [SingleTickerProviderStateMixin] classes to
/// obtain a suitable [TickerProvider]. The widget test framework [WidgetTester]
/// object can be used as a ticker provider in the context of tests. In other
/// contexts, you will have to either pass a [TickerProvider] from a higher
/// level (e.g. indirectly from a [State] that mixes in
/// [TickerProviderStateMixin]), or create a custom [TickerProvider] subclass.
///
/// The methods that start animations return a [TickerFuture] object which
/// completes when the animation completes successfully, and never throws an
...
...
packages/flutter/lib/src/animation/tween.dart
View file @
9ac16680
...
...
@@ -97,7 +97,7 @@ class _ChainedEvaluation<T> extends Animatable<T> {
/// `_animation`:
///
/// ```dart
/// _animation = new Tween<Offset>(
///
Animation<Offset>
_animation = new Tween<Offset>(
/// begin: const Offset(100.0, 50.0),
/// end: const Offset(200.0, 300.0),
/// ).animate(_controller);
...
...
packages/flutter/lib/src/cupertino/colors.dart
View file @
9ac16680
...
...
@@ -4,7 +4,8 @@
import
'dart:ui'
show
Color
;
/// [Color] constants that describe colors commonly used in iOS applications.
/// A palette of [Color] constants that describe colors commonly used when
/// matching the iOS platform aesthetics.
class
CupertinoColors
{
CupertinoColors
.
_
();
...
...
@@ -18,9 +19,18 @@ class CupertinoColors {
static
const
Color
activeGreen
=
const
Color
(
0xFF4CD964
);
/// Opaque white color. Used for backgrounds and fonts against dark backgrounds.
///
/// See also:
///
/// * [Colors.white], the same color, in the material design palette.
/// * [black], opaque black in the [CupertinoColors] palette.
static
const
Color
white
=
const
Color
(
0xFFFFFFFF
);
/// Opaque black color. Used for texts against light backgrounds.
///
/// See also:
///
/// * [Colors.black], the same color, in the material design palette.
static
const
Color
black
=
const
Color
(
0xFF000000
);
/// Used in iOS 10 for light background fills such as the chat bubble background.
...
...
packages/flutter/lib/src/cupertino/switch.dart
View file @
9ac16680
...
...
@@ -22,8 +22,28 @@ import 'thumb_painter.dart';
/// that use a switch will listen for the [onChanged] callback and rebuild the
/// switch with a new [value] to update the visual appearance of the switch.
///
/// ## Sample code
///
/// This sample shows how to use a [CupertinoSwitch] in a [ListTile]. The
/// [MergeSemantics] is used to turn the entire [ListTile] into a single item
/// for accessibility tools.
///
/// ```dart
/// new MergeSemantics(
/// child: new ListTile(
/// title: new Text('Lights'),
/// trailing: new CupertinoSwitch(
/// value: _lights,
/// onChanged: (bool value) { setState(() { _lights = value; }); },
/// ),
/// onTap: () { setState(() { _lights = !_lights; }); },
/// ),
/// )
/// ```
///
/// See also:
///
/// * [Switch], the material design equivalent.
/// * <https://developer.apple.com/ios/human-interface-guidelines/ui-controls/switches/>
class
CupertinoSwitch
extends
StatefulWidget
{
/// Creates an iOS-style switch.
...
...
packages/flutter/lib/src/material/app_bar.dart
View file @
9ac16680
...
...
@@ -21,6 +21,11 @@ import 'tabs.dart';
import
'theme.dart'
;
import
'typography.dart'
;
// Examples can assume:
// void _airDress() { }
// void _restitchDress() { }
// void _repairDress() { }
const
double
_kLeadingWidth
=
kToolbarHeight
;
// So the leading button is square.
// Bottom justify the kToolbarHeight child which may overflow the top.
...
...
packages/flutter/lib/src/material/circle_avatar.dart
View file @
9ac16680
...
...
@@ -9,6 +9,9 @@ import 'constants.dart';
import
'theme.dart'
;
import
'typography.dart'
;
// Examples can assume:
// String userAvatarUrl;
/// A circle that represents a user.
///
/// Typically used with a user's profile image, or, in the absence of
...
...
packages/flutter/lib/src/material/colors.dart
View file @
9ac16680
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/material/popup_menu.dart
View file @
9ac16680
...
...
@@ -16,6 +16,10 @@ import 'list_tile.dart';
import
'material.dart'
;
import
'theme.dart'
;
// Examples can assume:
// enum Commands { heroAndScholar, hurricaneCame }
// dynamic _heroAndScholar;
const
Duration
_kMenuDuration
=
const
Duration
(
milliseconds:
300
);
const
double
_kBaselineOffsetFromBottom
=
20.0
;
const
double
_kMenuCloseIntervalEnd
=
2.0
/
3.0
;
...
...
@@ -133,7 +137,7 @@ class _PopupMenuDividerState extends State<PopupMenuDivider> {
/// const PopupMenuItem<WhyFarther>(
/// value: WhyFarther.harder,
/// child: const Text('Working a lot harder'),
/// )
,
/// )
/// ```
///
/// See the example at [PopupMenuButton] for how this example could be used in a
...
...
@@ -616,6 +620,8 @@ typedef List<PopupMenuEntry<T>> PopupMenuItemBuilder<T>(BuildContext context);
/// the selected menu item. If child is null then a standard 'navigation/more_vert'
/// icon is created.
///
/// ## Sample code
///
/// This example shows a menu with four items, selecting between an enum's
/// values and setting a `_selection` field based on the selection.
///
...
...
packages/flutter/lib/src/painting/box_fit.dart
View file @
9ac16680
...
...
@@ -3,7 +3,6 @@
// found in the LICENSE file.
import
'dart:math'
as
math
;
import
'dart:ui'
show
Image
;
// to disambiguate mentions of Image in the dartdocs
import
'package:flutter/foundation.dart'
;
...
...
@@ -105,16 +104,18 @@ class FittedSizes {
///
/// ## Sample code
///
/// This
example paints an [
Image] `image` onto the [Rect] `outputRect` on a
/// [Canvas] `canvas`, using a [Paint]
paint
, applying the [BoxFit] algorithm
/// This
function paints a [dart:ui.
Image] `image` onto the [Rect] `outputRect` on a
/// [Canvas] `canvas`, using a [Paint]
`paint`
, applying the [BoxFit] algorithm
/// `fit`:
///
/// ```dart
/// final Size imageSize = new Size(image.width.toDouble(), image.height.toDouble());
/// final FittedSizes sizes = applyBoxFit(fit, imageSize, outputRect.size);
/// final Rect inputSubrect = FractionalOffset.center.inscribe(sizes.source, Offset.zero & imageSize);
/// final Rect outputSubrect = FractionalOffset.center.inscribe(sizes.destination, outputRect);
/// canvas.drawImageRect(image, inputSubrect, outputSubrect, paint);
/// void paintImage(ui.Image image, Rect outputRect, Canvas canvas, Paint paint, BoxFit fit) {
/// final Size imageSize = new Size(image.width.toDouble(), image.height.toDouble());
/// final FittedSizes sizes = applyBoxFit(fit, imageSize, outputRect.size);
/// final Rect inputSubrect = FractionalOffset.center.inscribe(sizes.source, Offset.zero & imageSize);
/// final Rect outputSubrect = FractionalOffset.center.inscribe(sizes.destination, outputRect);
/// canvas.drawImageRect(image, inputSubrect, outputSubrect, paint);
/// }
/// ```
///
/// See also:
...
...
packages/flutter/lib/src/painting/box_painter.dart
View file @
9ac16680
...
...
@@ -328,18 +328,21 @@ class BorderSide {
///
/// ## Sample code
///
/// All four borders the same, two-pixel wide solid white:
///
/// ```dart
/// // All four borders the same, two-pixel wide solid white:
/// new Border.all(width: 2.0, color: const Color(0xFFFFFFFF))
/// ```
///
/// The border for a material design divider:
///
/// ```dart
/// // The border for a material design divider:
/// new Border(bottom: new BorderSide(color: Theme.of(context).dividerColor))
/// ```
///
/// A 1990s-era "OK" button:
///
/// ```dart
/// // A 1990s-era "OK" button:
/// new Container(
/// decoration: const BoxDecoration(
/// border: const Border(
...
...
@@ -1013,21 +1016,24 @@ class LinearGradient extends Gradient {
///
/// ## Sample code
///
/// This function draws a gradient that looks like a sun in a blue sky.
///
/// ```dart
/// // This gradient looks like a sun in a blue sky.
/// var gradient = new RadialGradient(
/// center: const FractionalOffset(0.7, 0.2), // near the top right
/// radius: 0.2,
/// colors: [
/// const Color(0xFFFFFF00), // yellow sun
/// const Color(0xFF0099FF), // blue sky
/// ],
/// stops: [0.4, 1.0],
/// );
/// // rect is the area we are painting over
/// var paint = new Paint()
/// ..shader = gradient.createShader(rect);
/// canvas.drawRect(rect, paint);
/// void paintSky(Canvas canvas, Rect rect) {
/// var gradient = new RadialGradient(
/// center: const FractionalOffset(0.7, 0.2), // near the top right
/// radius: 0.2,
/// colors: [
/// const Color(0xFFFFFF00), // yellow sun
/// const Color(0xFF0099FF), // blue sky
/// ],
/// stops: [0.4, 1.0],
/// );
/// // rect is the area we are painting over
/// var paint = new Paint()
/// ..shader = gradient.createShader(rect);
/// canvas.drawRect(rect, paint);
/// }
/// ```
///
/// See also:
...
...
packages/flutter/lib/src/painting/edge_insets.dart
View file @
9ac16680
...
...
@@ -26,14 +26,21 @@ enum Axis {
///
/// Here are some examples of how to create [EdgeInsets] instances:
///
/// Typical eight-pixel margin on all sides:
///
/// ```dart
/// // typical 8-pixel margin on all sides
/// const EdgeInsets.all(8.0)
/// ```
///
/// Eight pixel margin above and below, no horizontal margins:
///
///
// 8-pixel margin above and below, no horizontal margins
///
```dart
/// const EdgeInsets.symmetric(vertical: 8.0)
/// ```
///
/// // left-margin indent of 40 pixels
/// Left margin indent of 40 pixels:
///
/// ```dart
/// const EdgeInsets.only(left: 40.0)
/// ```
///
...
...
@@ -49,8 +56,9 @@ class EdgeInsets {
///
/// ## Sample code
///
/// Typical eight-pixel margin on all sides:
///
/// ```dart
/// // typical 8-pixel margin on all sides
/// const EdgeInsets.all(8.0)
/// ```
const
EdgeInsets
.
all
(
double
value
)
...
...
@@ -60,8 +68,9 @@ class EdgeInsets {
///
/// ## Sample code
///
/// Left margin indent of 40 pixels:
///
/// ```dart
/// // left-margin indent of 40 pixels
/// const EdgeInsets.only(left: 40.0)
/// ```
const
EdgeInsets
.
only
({
...
...
@@ -75,8 +84,9 @@ class EdgeInsets {
///
/// ## Sample code
///
/// Eight pixel margin above and below, no horizontal margins:
///
/// ```dart
/// // 8-pixel margin above and below, no horizontal margins
/// const EdgeInsets.symmetric(vertical: 8.0)
/// ```
const
EdgeInsets
.
symmetric
({
double
vertical:
0.0
,
...
...
packages/flutter/lib/src/physics/gravity_simulation.dart
View file @
9ac16680
...
...
@@ -8,6 +8,30 @@ import 'simulation.dart';
///
/// Models a particle that follows Newton's second law of motion. The simulation
/// ends when the position reaches a defined point.
///
/// ## Sample code
///
/// This method triggers an [AnimationController] (a previously constructed
/// `_controller` field) to simulate a fall of 300 pixels.
///
/// ```dart
/// void _startFall() {
/// _controller.animateWith(new GravitySimulation(
/// 10.0, // acceleration, pixels per second per second
/// 0.0, // starting position, pixels
/// 300.0, // ending position, pixels
/// 0.0, // starting velocity, pixels per second
/// ));
/// }
/// ```
///
/// This [AnimationController] could be used with an [AnimatedBuilder] to
/// animate the position of a child as if it was falling.
///
/// See also:
///
/// * [Curves.bounceOut], a [Curve] that has a similar aesthetics but includes
/// a bouncing effect.
class
GravitySimulation
extends
Simulation
{
/// Creates a [GravitySimulation] using the given arguments, which are,
/// respectively: an acceleration that is to be applied continually over time;
...
...
packages/flutter/lib/src/widgets/animated_cross_fade.dart
View file @
9ac16680
...
...
@@ -50,7 +50,7 @@ enum CrossFadeState {
/// duration: const Duration(seconds: 3),
/// firstChild: const FlutterLogo(style: FlutterLogoStyle.horizontal, size: 100.0),
/// secondChild: const FlutterLogo(style: FlutterLogoStyle.stacked, size: 100.0),
/// crossFadeState: _
on
? CrossFadeState.showFirst : CrossFadeState.showSecond,
/// crossFadeState: _
first
? CrossFadeState.showFirst : CrossFadeState.showSecond,
/// )
/// ```
///
...
...
packages/flutter/lib/src/widgets/async.dart
View file @
9ac16680
...
...
@@ -12,6 +12,9 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/widgets.dart'
;
import
'package:meta/meta.dart'
show
required
;
// Examples can assume:
// dynamic _lot;
/// Base class for widgets that build themselves based on interaction with
/// a specified [Stream].
///
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
9ac16680
...
...
@@ -350,7 +350,7 @@ class CustomPaint extends SingleChildRenderObjectWidget {
/// child: new Align(
/// alignment: FractionalOffset.topCenter,
/// heightFactor: 0.5,
/// child: new Image
(...
),
/// child: new Image
.network(userAvatarUrl
),
/// ),
/// )
/// ```
...
...
packages/flutter/lib/src/widgets/binding.dart
View file @
9ac16680
...
...
@@ -35,14 +35,14 @@ export 'dart:ui' show AppLifecycleState, Locale;
/// lifecycle messages. See [didChangeAppLifecycleState].
///
/// ```dart
/// class Reactor extends StatefulWidget {
/// const Reactor({ Key key }) : super(key: key);
/// class
AppLifecycle
Reactor extends StatefulWidget {
/// const
AppLifecycle
Reactor({ Key key }) : super(key: key);
///
/// @override
/// _
ReactorState createState() => new _
ReactorState();
/// _
AppLifecycleReactorState createState() => new _AppLifecycle
ReactorState();
/// }
///
/// class _
ReactorState extends State<
Reactor> with WidgetsBindingObserver {
/// class _
AppLifecycleReactorState extends State<AppLifecycle
Reactor> with WidgetsBindingObserver {
/// @override
/// void initState() {
/// super.initState();
...
...
@@ -104,14 +104,14 @@ abstract class WidgetsBindingObserver {
/// rotated (or otherwise changes dimensions).
///
/// ```dart
/// class Reactor extends StatefulWidget {
/// const Reactor({ Key key }) : super(key: key);
/// class
Metrics
Reactor extends StatefulWidget {
/// const
Metrics
Reactor({ Key key }) : super(key: key);
///
/// @override
/// _
ReactorState createState() => new _
ReactorState();
/// _
MetricsReactorState createState() => new _Metrics
ReactorState();
/// }
///
/// class _
ReactorState extends State<
Reactor> with WidgetsBindingObserver {
/// class _
MetricsReactorState extends State<Metrics
Reactor> with WidgetsBindingObserver {
/// @override
/// void initState() {
/// super.initState();
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
9ac16680
...
...
@@ -17,6 +17,15 @@ export 'package:flutter/foundation.dart' show FlutterError, debugPrint, debugPri
export
'package:flutter/foundation.dart'
show
VoidCallback
,
ValueChanged
,
ValueGetter
,
ValueSetter
;
export
'package:flutter/rendering.dart'
show
RenderObject
,
RenderBox
,
debugDumpRenderTree
,
debugDumpLayerTree
;
// Examples can assume:
// BuildContext context;
// void setState(VoidCallback fn) { }
// Examples can assume:
// abstract class RenderFrogJar extends RenderObject { }
// abstract class FrogJar extends RenderObjectWidget { }
// abstract class FrogJarParentData extends ParentData { Size size; }
// KEYS
/// A [Key] is an identifier for [Widget]s and [Element]s.
...
...
@@ -643,20 +652,20 @@ abstract class StatelessWidget extends Widget {
///
/// ## Sample code
///
/// The following is a skeleton of a stateful widget subclass called `
GreenFrog
`:
/// The following is a skeleton of a stateful widget subclass called `
YellowBird
`:
///
/// ```dart
/// class
GreenFrog
extends StatefulWidget {
/// const
GreenFrog
({ Key key }) : super(key: key);
/// class
YellowBird
extends StatefulWidget {
/// const
YellowBird
({ Key key }) : super(key: key);
///
/// @override
/// _
GreenFrogState createState() => new _GreenFrog
State();
/// _
YellowBirdState createState() => new _YellowBird
State();
/// }
///
/// class _
GreenFrogState extends State<GreenFrog
> {
/// class _
YellowBirdState extends State<YellowBird
> {
/// @override
/// Widget build(BuildContext context) {
/// return new Container(color: const Color(0xFF
2DBD3A
));
/// return new Container(color: const Color(0xFF
FFE306
));
/// }
/// }
/// ```
...
...
@@ -665,15 +674,15 @@ abstract class StatelessWidget extends Widget {
/// represented as private member fields. Also, normally widgets have more
/// constructor arguments, each of which corresponds to a `final` property.
///
/// The next example shows the more generic widget `
Frog
` which can be given a
/// The next example shows the more generic widget `
Bird
` which can be given a
/// color and a child, and which has some internal state with a method that
/// can be called to mutate it:
///
/// ```dart
/// class
Frog
extends StatefulWidget {
/// const
Frog
({
/// class
Bird
extends StatefulWidget {
/// const
Bird
({
/// Key key,
/// this.color: const Color(0xFF
2DBD3A
),
/// this.color: const Color(0xFF
FFE306
),
/// this.child,
/// }) : super(key: key);
///
...
...
@@ -681,10 +690,10 @@ abstract class StatelessWidget extends Widget {
///
/// final Widget child;
///
/// _
FrogState createState() => new _Frog
State();
/// _
BirdState createState() => new _Bird
State();
/// }
///
/// class _
FrogState extends State<Frog
> {
/// class _
BirdState extends State<Bird
> {
/// double _size = 1.0;
///
/// void grow() {
...
...
@@ -695,7 +704,7 @@ abstract class StatelessWidget extends Widget {
/// Widget build(BuildContext context) {
/// return new Container(
/// color: widget.color,
/// transform: new Matrix4.diagonalValues(_size, _size, 1.0),
/// transform: new Matrix4.diagonal
3
Values(_size, _size, 1.0),
/// child: widget.child,
/// );
/// }
...
...
@@ -1309,7 +1318,7 @@ abstract class ProxyWidget extends Widget {
///
/// ```dart
/// class FrogSize extends ParentDataWidget<FrogJar> {
///
Pond
({
///
FrogSize
({
/// Key key,
/// @required this.size,
/// @required Widget child,
...
...
@@ -1425,7 +1434,7 @@ abstract class ParentDataWidget<T extends RenderObjectWidget> extends ProxyWidge
///
/// ```dart
/// class FrogColor extends InheritedWidget {
/// const FrogColor(
/// const FrogColor(
{
/// Key key,
/// @required this.color,
/// @required Widget child,
...
...
packages/flutter/lib/src/widgets/gesture_detector.dart
View file @
9ac16680
...
...
@@ -408,10 +408,10 @@ class GestureDetector extends StatelessWidget {
/// () => new TapGestureRecognizer(),
/// (TapGestureRecognizer instance) {
/// instance
/// ..onTapDown = (TapDownDetails details) { setState(() { _last = 'down'; }); }
,
/// ..onTapUp = (TapUpDetails details) { setState(() { _last = 'up'; }); }
,
/// ..onTap = () { setState(() { _last = 'tap'; }); }
,
/// ..onTapCancel = () { setState(() { _last = 'cancel'; }); }
,
/// ..onTapDown = (TapDownDetails details) { setState(() { _last = 'down'; }); }
/// ..onTapUp = (TapUpDetails details) { setState(() { _last = 'up'; }); }
/// ..onTap = () { setState(() { _last = 'tap'; }); }
/// ..onTapCancel = () { setState(() { _last = 'cancel'; }); }
;
/// },
/// ),
/// },
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment