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
ce048ee8
Unverified
Commit
ce048ee8
authored
Dec 23, 2020
by
Shi-Hao Hong
Committed by
GitHub
Dec 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NNBD] Migrate sample code pt 1 (#72794)
parent
501a23ab
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
40 deletions
+40
-40
about.dart
packages/flutter/lib/src/material/about.dart
+2
-2
card.dart
packages/flutter/lib/src/material/card.dart
+2
-2
data_table.dart
packages/flutter/lib/src/material/data_table.dart
+5
-5
ink_well.dart
packages/flutter/lib/src/material/ink_well.dart
+1
-1
input_decorator.dart
packages/flutter/lib/src/material/input_decorator.dart
+6
-5
radio_list_tile.dart
packages/flutter/lib/src/material/radio_list_tile.dart
+21
-22
raised_button.dart
packages/flutter/lib/src/material/raised_button.dart
+1
-1
snack_bar.dart
packages/flutter/lib/src/material/snack_bar.dart
+2
-2
No files found.
packages/flutter/lib/src/material/about.dart
View file @
ce048ee8
...
@@ -44,14 +44,14 @@ import 'theme.dart';
...
@@ -44,14 +44,14 @@ import 'theme.dart';
/// If your application does not have a [Drawer], you should provide an
/// If your application does not have a [Drawer], you should provide an
/// affordance to call [showAboutDialog] or (at least) [showLicensePage].
/// affordance to call [showAboutDialog] or (at least) [showLicensePage].
///
///
/// {@tool dartpad --template=stateless_widget_material
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_material}
///
///
/// This sample shows two ways to open [AboutDialog]. The first one
/// This sample shows two ways to open [AboutDialog]. The first one
/// uses an [AboutListTile], and the second uses the [showAboutDialog] function.
/// uses an [AboutListTile], and the second uses the [showAboutDialog] function.
///
///
/// ```dart
/// ```dart
/// Widget build(BuildContext context) {
/// Widget build(BuildContext context) {
/// final TextStyle textStyle = Theme.of(context).textTheme.bodyText2;
/// final TextStyle textStyle = Theme.of(context).textTheme.bodyText2
!
;
/// final List<Widget> aboutBoxChildren = <Widget>[
/// final List<Widget> aboutBoxChildren = <Widget>[
/// SizedBox(height: 24),
/// SizedBox(height: 24),
/// RichText(
/// RichText(
...
...
packages/flutter/lib/src/material/card.dart
View file @
ce048ee8
...
@@ -20,7 +20,7 @@ import 'theme.dart';
...
@@ -20,7 +20,7 @@ import 'theme.dart';
/// some text describing a musical, and the other with buttons for buying
/// some text describing a musical, and the other with buttons for buying
/// tickets or listening to the show.](https://flutter.github.io/assets-for-api-docs/assets/material/card.png)
/// tickets or listening to the show.](https://flutter.github.io/assets-for-api-docs/assets/material/card.png)
///
///
/// {@tool dartpad --template=stateless_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_scaffold}
///
///
/// This sample shows creation of a [Card] widget that shows album information
/// This sample shows creation of a [Card] widget that shows album information
/// and two actions.
/// and two actions.
...
@@ -63,7 +63,7 @@ import 'theme.dart';
...
@@ -63,7 +63,7 @@ import 'theme.dart';
/// Sometimes the primary action area of a card is the card itself. Cards can be
/// Sometimes the primary action area of a card is the card itself. Cards can be
/// one large touch target that shows a detail screen when tapped.
/// one large touch target that shows a detail screen when tapped.
///
///
/// {@tool dartpad --template=stateless_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_scaffold}
///
///
/// This sample shows creation of a [Card] widget that can be tapped. When
/// This sample shows creation of a [Card] widget that can be tapped. When
/// tapped this [Card]'s [InkWell] displays an "ink splash" that fills the
/// tapped this [Card]'s [InkWell] displays an "ink splash" that fills the
...
...
packages/flutter/lib/src/material/data_table.dart
View file @
ce048ee8
...
@@ -260,7 +260,7 @@ class DataCell {
...
@@ -260,7 +260,7 @@ class DataCell {
/// [PaginatedDataTable] which automatically splits the data into
/// [PaginatedDataTable] which automatically splits the data into
/// multiple pages.
/// multiple pages.
///
///
/// {@tool dartpad --template=stateless_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_scaffold}
///
///
/// This sample shows how to display a [DataTable] with three columns: name, age, and
/// This sample shows how to display a [DataTable] with three columns: name, age, and
/// role. The columns are defined by three [DataColumn] objects. The table
/// role. The columns are defined by three [DataColumn] objects. The table
...
@@ -322,7 +322,7 @@ class DataCell {
...
@@ -322,7 +322,7 @@ class DataCell {
/// {@end-tool}
/// {@end-tool}
///
///
///
///
/// {@tool dartpad --template=stateful_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_scaffold}
///
///
/// This sample shows how to display a [DataTable] with alternate colors per
/// This sample shows how to display a [DataTable] with alternate colors per
/// row, and a custom color for when the row is selected.
/// row, and a custom color for when the row is selected.
...
@@ -344,7 +344,7 @@ class DataCell {
...
@@ -344,7 +344,7 @@ class DataCell {
/// rows: List<DataRow>.generate(
/// rows: List<DataRow>.generate(
/// numItems,
/// numItems,
/// (index) => DataRow(
/// (index) => DataRow(
/// color: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) {
/// color: MaterialStateProperty.resolveWith<Color
?
>((Set<MaterialState> states) {
/// // All rows will have the same selected color.
/// // All rows will have the same selected color.
/// if (states.contains(MaterialState.selected))
/// if (states.contains(MaterialState.selected))
/// return Theme.of(context).colorScheme.primary.withOpacity(0.08);
/// return Theme.of(context).colorScheme.primary.withOpacity(0.08);
...
@@ -355,9 +355,9 @@ class DataCell {
...
@@ -355,9 +355,9 @@ class DataCell {
/// }),
/// }),
/// cells: [DataCell(Text('Row $index'))],
/// cells: [DataCell(Text('Row $index'))],
/// selected: selected[index],
/// selected: selected[index],
/// onSelectChanged: (bool value) {
/// onSelectChanged: (bool
?
value) {
/// setState(() {
/// setState(() {
/// selected[index] = value;
/// selected[index] = value
!
;
/// });
/// });
/// },
/// },
/// ),
/// ),
...
...
packages/flutter/lib/src/material/ink_well.dart
View file @
ce048ee8
...
@@ -1171,7 +1171,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
...
@@ -1171,7 +1171,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
///
///
/// An example of this situation is as follows:
/// An example of this situation is as follows:
///
///
/// {@tool dartpad --template=stateful_widget_scaffold_center
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_scaffold_center}
///
///
/// Tap the container to cause it to grow. Then, tap it again and hold before
/// Tap the container to cause it to grow. Then, tap it again and hold before
/// the widget reaches its maximum size to observe the clipped ink splash.
/// the widget reaches its maximum size to observe the clipped ink splash.
...
...
packages/flutter/lib/src/material/input_decorator.dart
View file @
ce048ee8
...
@@ -2389,7 +2389,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
...
@@ -2389,7 +2389,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
/// to describe their decoration. (In fact, this class is merely the
/// to describe their decoration. (In fact, this class is merely the
/// configuration of an [InputDecorator], which does all the heavy lifting.)
/// configuration of an [InputDecorator], which does all the heavy lifting.)
///
///
/// {@tool dartpad --template=stateless_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_scaffold}
///
///
/// This sample shows how to style a `TextField` using an `InputDecorator`. The
/// This sample shows how to style a `TextField` using an `InputDecorator`. The
/// TextField displays a "send message" icon to the left of the input area,
/// TextField displays a "send message" icon to the left of the input area,
...
@@ -2414,7 +2414,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
...
@@ -2414,7 +2414,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
/// ```
/// ```
/// {@end-tool}
/// {@end-tool}
///
///
/// {@tool dartpad --template=stateless_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_scaffold}
///
///
/// This sample shows how to style a "collapsed" `TextField` using an
/// This sample shows how to style a "collapsed" `TextField` using an
/// `InputDecorator`. The collapsed `TextField` surrounds the hint text and
/// `InputDecorator`. The collapsed `TextField` surrounds the hint text and
...
@@ -2434,7 +2434,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
...
@@ -2434,7 +2434,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
/// ```
/// ```
/// {@end-tool}
/// {@end-tool}
///
///
/// {@tool dartpad --template=stateless_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_scaffold}
///
///
/// This sample shows how to create a `TextField` with hint text, a red border
/// This sample shows how to create a `TextField` with hint text, a red border
/// on all sides, and an error message. To display a red border and error
/// on all sides, and an error message. To display a red border and error
...
@@ -2455,7 +2455,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
...
@@ -2455,7 +2455,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
/// ```
/// ```
/// {@end-tool}
/// {@end-tool}
///
///
/// {@tool dartpad --template=stateless_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_scaffold}
///
///
/// This sample shows how to style a `TextField` with a round border and
/// This sample shows how to style a `TextField` with a round border and
/// additional text before and after the input area. It displays "Prefix" before
/// additional text before and after the input area. It displays "Prefix" before
...
@@ -2836,7 +2836,8 @@ class InputDecoration {
...
@@ -2836,7 +2836,8 @@ class InputDecoration {
/// setting the constraints' minimum height and width to a value lower than
/// setting the constraints' minimum height and width to a value lower than
/// 48px.
/// 48px.
///
///
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
/// {@tool dartpad --template=stateless_widget_scaffold}
///
/// This example shows the differences between two `TextField` widgets when
/// This example shows the differences between two `TextField` widgets when
/// [prefixIconConstraints] is set to the default value and when one is not.
/// [prefixIconConstraints] is set to the default value and when one is not.
///
///
...
...
packages/flutter/lib/src/material/radio_list_tile.dart
View file @
ce048ee8
...
@@ -10,7 +10,6 @@ import 'theme.dart';
...
@@ -10,7 +10,6 @@ import 'theme.dart';
import
'theme_data.dart'
;
import
'theme_data.dart'
;
// Examples can assume:
// Examples can assume:
// // @dart = 2.9
// void setState(VoidCallback fn) { }
// void setState(VoidCallback fn) { }
/// A [ListTile] with a [Radio]. In other words, a radio button with a label.
/// A [ListTile] with a [Radio]. In other words, a radio button with a label.
...
@@ -41,7 +40,7 @@ import 'theme_data.dart';
...
@@ -41,7 +40,7 @@ import 'theme_data.dart';
/// To show the [RadioListTile] as disabled, pass null as the [onChanged]
/// To show the [RadioListTile] as disabled, pass null as the [onChanged]
/// callback.
/// callback.
///
///
/// {@tool dartpad --template=stateful_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_scaffold}
///
///
/// ![RadioListTile sample](https://flutter.github.io/assets-for-api-docs/assets/material/radio_list_tile.png)
/// ![RadioListTile sample](https://flutter.github.io/assets-for-api-docs/assets/material/radio_list_tile.png)
///
///
...
@@ -52,7 +51,7 @@ import 'theme_data.dart';
...
@@ -52,7 +51,7 @@ import 'theme_data.dart';
/// enum SingingCharacter { lafayette, jefferson }
/// enum SingingCharacter { lafayette, jefferson }
/// ```
/// ```
/// ```dart
/// ```dart
/// SingingCharacter _character = SingingCharacter.lafayette;
/// SingingCharacter
?
_character = SingingCharacter.lafayette;
///
///
/// @override
/// @override
/// Widget build(BuildContext context) {
/// Widget build(BuildContext context) {
...
@@ -62,13 +61,13 @@ import 'theme_data.dart';
...
@@ -62,13 +61,13 @@ import 'theme_data.dart';
/// title: const Text('Lafayette'),
/// title: const Text('Lafayette'),
/// value: SingingCharacter.lafayette,
/// value: SingingCharacter.lafayette,
/// groupValue: _character,
/// groupValue: _character,
/// onChanged: (SingingCharacter value) { setState(() { _character = value; }); },
/// onChanged: (SingingCharacter
?
value) { setState(() { _character = value; }); },
/// ),
/// ),
/// RadioListTile<SingingCharacter>(
/// RadioListTile<SingingCharacter>(
/// title: const Text('Thomas Jefferson'),
/// title: const Text('Thomas Jefferson'),
/// value: SingingCharacter.jefferson,
/// value: SingingCharacter.jefferson,
/// groupValue: _character,
/// groupValue: _character,
/// onChanged: (SingingCharacter value) { setState(() { _character = value; }); },
/// onChanged: (SingingCharacter
?
value) { setState(() { _character = value; }); },
/// ),
/// ),
/// ],
/// ],
/// );
/// );
...
@@ -93,7 +92,7 @@ import 'theme_data.dart';
...
@@ -93,7 +92,7 @@ import 'theme_data.dart';
/// into one. Therefore, it may be necessary to create a custom radio tile
/// into one. Therefore, it may be necessary to create a custom radio tile
/// widget to accommodate similar use cases.
/// widget to accommodate similar use cases.
///
///
/// {@tool dartpad --template=stateful_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_scaffold}
///
///
/// ![Radio list tile semantics sample](https://flutter.github.io/assets-for-api-docs/assets/material/radio_list_tile_semantics.png)
/// ![Radio list tile semantics sample](https://flutter.github.io/assets-for-api-docs/assets/material/radio_list_tile_semantics.png)
///
///
...
@@ -107,11 +106,11 @@ import 'theme_data.dart';
...
@@ -107,11 +106,11 @@ import 'theme_data.dart';
/// ```dart preamble
/// ```dart preamble
/// class LinkedLabelRadio extends StatelessWidget {
/// class LinkedLabelRadio extends StatelessWidget {
/// const LinkedLabelRadio({
/// const LinkedLabelRadio({
/// this.label,
///
required
this.label,
/// this.padding,
///
required
this.padding,
/// this.groupValue,
///
required
this.groupValue,
/// this.value,
///
required
this.value,
/// this.onChanged,
///
required
this.onChanged,
/// });
/// });
///
///
/// final String label;
/// final String label;
...
@@ -129,7 +128,7 @@ import 'theme_data.dart';
...
@@ -129,7 +128,7 @@ import 'theme_data.dart';
/// Radio<bool>(
/// Radio<bool>(
/// groupValue: groupValue,
/// groupValue: groupValue,
/// value: value,
/// value: value,
/// onChanged: (bool newValue) {
/// onChanged: (bool
?
newValue) {
/// onChanged(newValue);
/// onChanged(newValue);
/// }
/// }
/// ),
/// ),
...
@@ -197,7 +196,7 @@ import 'theme_data.dart';
...
@@ -197,7 +196,7 @@ import 'theme_data.dart';
/// combining [Radio] with other widgets, such as [Text], [Padding] and
/// combining [Radio] with other widgets, such as [Text], [Padding] and
/// [InkWell].
/// [InkWell].
///
///
/// {@tool dartpad --template=stateful_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_scaffold}
///
///
/// ![Custom radio list tile sample](https://flutter.github.io/assets-for-api-docs/assets/material/radio_list_tile_custom.png)
/// ![Custom radio list tile sample](https://flutter.github.io/assets-for-api-docs/assets/material/radio_list_tile_custom.png)
///
///
...
@@ -207,11 +206,11 @@ import 'theme_data.dart';
...
@@ -207,11 +206,11 @@ import 'theme_data.dart';
/// ```dart preamble
/// ```dart preamble
/// class LabeledRadio extends StatelessWidget {
/// class LabeledRadio extends StatelessWidget {
/// const LabeledRadio({
/// const LabeledRadio({
/// this.label,
///
required
this.label,
/// this.padding,
///
required
this.padding,
/// this.groupValue,
///
required
this.groupValue,
/// this.value,
///
required
this.value,
/// this.onChanged,
///
required
this.onChanged,
/// });
/// });
///
///
/// final String label;
/// final String label;
...
@@ -234,7 +233,7 @@ import 'theme_data.dart';
...
@@ -234,7 +233,7 @@ import 'theme_data.dart';
/// Radio<bool>(
/// Radio<bool>(
/// groupValue: groupValue,
/// groupValue: groupValue,
/// value: value,
/// value: value,
/// onChanged: (bool newValue) {
/// onChanged: (bool
?
newValue) {
/// onChanged(newValue);
/// onChanged(newValue);
/// },
/// },
/// ),
/// ),
...
@@ -387,12 +386,12 @@ class RadioListTile<T> extends StatelessWidget {
...
@@ -387,12 +386,12 @@ class RadioListTile<T> extends StatelessWidget {
///
///
/// The default is false.
/// The default is false.
///
///
/// {@tool dartpad --template=stateful_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateful_widget_scaffold}
/// This example shows how to enable deselecting a radio button by setting the
/// This example shows how to enable deselecting a radio button by setting the
/// [toggleable] attribute.
/// [toggleable] attribute.
///
///
/// ```dart
/// ```dart
/// int groupValue;
/// int
?
groupValue;
/// static const List<String> selections = <String>[
/// static const List<String> selections = <String>[
/// 'Hercules Mulligan',
/// 'Hercules Mulligan',
/// 'Eliza Hamilton',
/// 'Eliza Hamilton',
...
@@ -411,7 +410,7 @@ class RadioListTile<T> extends StatelessWidget {
...
@@ -411,7 +410,7 @@ class RadioListTile<T> extends StatelessWidget {
/// groupValue: groupValue,
/// groupValue: groupValue,
/// toggleable: true,
/// toggleable: true,
/// title: Text(selections[index]),
/// title: Text(selections[index]),
/// onChanged: (int value) {
/// onChanged: (int
?
value) {
/// setState(() {
/// setState(() {
/// groupValue = value;
/// groupValue = value;
/// });
/// });
...
...
packages/flutter/lib/src/material/raised_button.dart
View file @
ce048ee8
...
@@ -43,7 +43,7 @@ import 'theme_data.dart';
...
@@ -43,7 +43,7 @@ import 'theme_data.dart';
/// Raised buttons have a minimum size of 88.0 by 36.0 which can be overridden
/// Raised buttons have a minimum size of 88.0 by 36.0 which can be overridden
/// with [ButtonTheme].
/// with [ButtonTheme].
///
///
/// {@tool dartpad --template=stateless_widget_scaffold
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_scaffold}
///
///
/// This sample shows how to render a disabled RaisedButton, an enabled RaisedButton
/// This sample shows how to render a disabled RaisedButton, an enabled RaisedButton
/// and lastly a RaisedButton with gradient background.
/// and lastly a RaisedButton with gradient background.
...
...
packages/flutter/lib/src/material/snack_bar.dart
View file @
ce048ee8
...
@@ -158,7 +158,7 @@ class _SnackBarActionState extends State<SnackBarAction> {
...
@@ -158,7 +158,7 @@ class _SnackBarActionState extends State<SnackBarAction> {
/// A SnackBar with an action will not time out when TalkBack or VoiceOver are
/// A SnackBar with an action will not time out when TalkBack or VoiceOver are
/// enabled. This is controlled by [AccessibilityFeatures.accessibleNavigation].
/// enabled. This is controlled by [AccessibilityFeatures.accessibleNavigation].
///
///
/// {@tool dartpad --template=stateless_widget_scaffold_center
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_scaffold_center}
///
///
/// Here is an example of a [SnackBar] with an [action] button implemented using
/// Here is an example of a [SnackBar] with an [action] button implemented using
/// [SnackBarAction].
/// [SnackBarAction].
...
@@ -185,7 +185,7 @@ class _SnackBarActionState extends State<SnackBarAction> {
...
@@ -185,7 +185,7 @@ class _SnackBarActionState extends State<SnackBarAction> {
/// ```
/// ```
/// {@end-tool}
/// {@end-tool}
///
///
/// {@tool dartpad --template=stateless_widget_scaffold_center
_no_null_safety
}
/// {@tool dartpad --template=stateless_widget_scaffold_center}
///
///
/// Here is an example of a customized [SnackBar]. It utilizes
/// Here is an example of a customized [SnackBar]. It utilizes
/// [behavior], [shape], [padding], [width], and [duration] to customize the
/// [behavior], [shape], [padding], [width], and [duration] to customize the
...
...
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