Prepare to migrate API doc samples and snippets to null safety (#72040)
This commit is contained in:
parent
74298a76e7
commit
ff05ca2503
@ -8,9 +8,11 @@
|
|||||||
// bin/cache/dart-sdk/bin/dart dev/bots/analyze-sample-code.dart
|
// bin/cache/dart-sdk/bin/dart dev/bots/analyze-sample-code.dart
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'dart:isolate';
|
||||||
|
|
||||||
import 'package:args/args.dart';
|
import 'package:args/args.dart';
|
||||||
import 'package:path/path.dart' as path;
|
import 'package:path/path.dart' as path;
|
||||||
|
import 'package:watcher/watcher.dart';
|
||||||
|
|
||||||
final String _flutterRoot = path.dirname(path.dirname(path.dirname(path.fromUri(Platform.script))));
|
final String _flutterRoot = path.dirname(path.dirname(path.dirname(path.fromUri(Platform.script))));
|
||||||
final String _defaultFlutterPackage = path.join(_flutterRoot, 'packages', 'flutter', 'lib');
|
final String _defaultFlutterPackage = path.join(_flutterRoot, 'packages', 'flutter', 'lib');
|
||||||
@ -37,6 +39,11 @@ void main(List<String> arguments) {
|
|||||||
negatable: false,
|
negatable: false,
|
||||||
help: 'Print help for this command.',
|
help: 'Print help for this command.',
|
||||||
);
|
);
|
||||||
|
argParser.addOption(
|
||||||
|
'interactive',
|
||||||
|
abbr: 'i',
|
||||||
|
help: 'Analyzes the sample code in the specified file interactivly.',
|
||||||
|
);
|
||||||
|
|
||||||
final ArgResults parsedArguments = argParser.parse(arguments);
|
final ArgResults parsedArguments = argParser.parse(arguments);
|
||||||
|
|
||||||
@ -69,15 +76,20 @@ void main(List<String> arguments) {
|
|||||||
}
|
}
|
||||||
tempDirectory.createSync();
|
tempDirectory.createSync();
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
exitCode = SampleChecker(
|
if (parsedArguments['interactive'] != null) {
|
||||||
flutterPackage,
|
_runInteractive(tempDirectory, flutterPackage, parsedArguments['interactive'] as String);
|
||||||
tempDirectory: tempDirectory,
|
} else {
|
||||||
verbose: parsedArguments['verbose'] as bool,
|
try {
|
||||||
).checkSamples();
|
exitCode = SampleChecker(
|
||||||
} on SampleCheckerException catch (e) {
|
flutterPackage,
|
||||||
stderr.write(e);
|
tempDirectory: tempDirectory,
|
||||||
exit(1);
|
verbose: parsedArguments['verbose'] as bool,
|
||||||
|
).checkSamples();
|
||||||
|
} on SampleCheckerException catch (e) {
|
||||||
|
stderr.write(e);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,6 +153,9 @@ class SampleChecker {
|
|||||||
/// A RegExp that matches a Dart constructor.
|
/// A RegExp that matches a Dart constructor.
|
||||||
static final RegExp _constructorRegExp = RegExp(r'(const\s+)?_*[A-Z][a-zA-Z0-9<>._]*\(');
|
static final RegExp _constructorRegExp = RegExp(r'(const\s+)?_*[A-Z][a-zA-Z0-9<>._]*\(');
|
||||||
|
|
||||||
|
/// A RegExp that matches a dart version specification in an example preamble.
|
||||||
|
static final RegExp _dartVersionRegExp = RegExp(r'\/\/ \/\/ @dart = ([0-9]+\.[0-9]+)');
|
||||||
|
|
||||||
/// Whether or not to print verbose output.
|
/// Whether or not to print verbose output.
|
||||||
final bool verbose;
|
final bool verbose;
|
||||||
|
|
||||||
@ -186,8 +201,8 @@ class SampleChecker {
|
|||||||
/// Computes the headers needed for each sample file.
|
/// Computes the headers needed for each sample file.
|
||||||
List<Line> get headers {
|
List<Line> get headers {
|
||||||
return _headers ??= <String>[
|
return _headers ??= <String>[
|
||||||
'// @dart = 2.9',
|
|
||||||
'// generated code',
|
'// generated code',
|
||||||
|
'// ignore_for_file: unused_import',
|
||||||
"import 'dart:async';",
|
"import 'dart:async';",
|
||||||
"import 'dart:convert';",
|
"import 'dart:convert';",
|
||||||
"import 'dart:math' as math;",
|
"import 'dart:math' as math;",
|
||||||
@ -211,7 +226,7 @@ class SampleChecker {
|
|||||||
try {
|
try {
|
||||||
final Map<String, Section> sections = <String, Section>{};
|
final Map<String, Section> sections = <String, Section>{};
|
||||||
final Map<String, Sample> snippets = <String, Sample>{};
|
final Map<String, Sample> snippets = <String, Sample>{};
|
||||||
_extractSamples(sections, snippets);
|
_extractSamples(_listDartFiles(_flutterPackage, recursive: true), sectionMap: sections, sampleMap: snippets);
|
||||||
errors = _analyze(_tempDirectory, sections, snippets);
|
errors = _analyze(_tempDirectory, sections, snippets);
|
||||||
} finally {
|
} finally {
|
||||||
if (errors.isNotEmpty) {
|
if (errors.isNotEmpty) {
|
||||||
@ -305,13 +320,13 @@ class SampleChecker {
|
|||||||
return outputFile;
|
return outputFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extracts the samples from the Dart files in [_flutterPackage], writes them
|
/// Extracts the samples from the Dart files in [files], writes them
|
||||||
/// to disk, and adds them to the appropriate [sectionMap] or [sampleMap].
|
/// to disk, and adds them to the appropriate [sectionMap] or [sampleMap].
|
||||||
void _extractSamples(Map<String, Section> sectionMap, Map<String, Sample> sampleMap) {
|
void _extractSamples(List<File> files, {Map<String, Section> sectionMap, Map<String, Sample> sampleMap, bool silent = false}) {
|
||||||
final List<Section> sections = <Section>[];
|
final List<Section> sections = <Section>[];
|
||||||
final List<Sample> samples = <Sample>[];
|
final List<Sample> samples = <Sample>[];
|
||||||
|
|
||||||
for (final File file in _listDartFiles(_flutterPackage, recursive: true)) {
|
for (final File file in files) {
|
||||||
final String relativeFilePath = path.relative(file.path, from: _flutterPackage.path);
|
final String relativeFilePath = path.relative(file.path, from: _flutterPackage.path);
|
||||||
final List<String> sampleLines = file.readAsLinesSync();
|
final List<String> sampleLines = file.readAsLinesSync();
|
||||||
final List<Section> preambleSections = <Section>[];
|
final List<Section> preambleSections = <Section>[];
|
||||||
@ -323,6 +338,7 @@ class SampleChecker {
|
|||||||
bool inSnippet = false;
|
bool inSnippet = false;
|
||||||
// Whether or not we're in a '```dart' segment.
|
// Whether or not we're in a '```dart' segment.
|
||||||
bool inDart = false;
|
bool inDart = false;
|
||||||
|
String dartVersionOverride;
|
||||||
int lineNumber = 0;
|
int lineNumber = 0;
|
||||||
final List<String> block = <String>[];
|
final List<String> block = <String>[];
|
||||||
List<String> snippetArgs = <String>[];
|
List<String> snippetArgs = <String>[];
|
||||||
@ -353,10 +369,16 @@ class SampleChecker {
|
|||||||
} else if (inPreamble) {
|
} else if (inPreamble) {
|
||||||
if (line.isEmpty) {
|
if (line.isEmpty) {
|
||||||
inPreamble = false;
|
inPreamble = false;
|
||||||
preambleSections.add(_processBlock(startLine, block));
|
// If there's only a dartVersionOverride in the preamble, don't add
|
||||||
|
// it as a section. The dartVersionOverride was processed below.
|
||||||
|
if (dartVersionOverride == null || block.isNotEmpty) {
|
||||||
|
preambleSections.add(_processBlock(startLine, block));
|
||||||
|
}
|
||||||
block.clear();
|
block.clear();
|
||||||
} else if (!line.startsWith('// ')) {
|
} else if (!line.startsWith('// ')) {
|
||||||
throw SampleCheckerException('Unexpected content in sample code preamble.', file: relativeFilePath, line: lineNumber);
|
throw SampleCheckerException('Unexpected content in sample code preamble.', file: relativeFilePath, line: lineNumber);
|
||||||
|
} else if (_dartVersionRegExp.hasMatch(line)) {
|
||||||
|
dartVersionOverride = line.substring(3);
|
||||||
} else {
|
} else {
|
||||||
block.add(line.substring(3));
|
block.add(line.substring(3));
|
||||||
}
|
}
|
||||||
@ -371,11 +393,8 @@ class SampleChecker {
|
|||||||
if (_codeBlockEndRegex.hasMatch(trimmedLine)) {
|
if (_codeBlockEndRegex.hasMatch(trimmedLine)) {
|
||||||
inDart = false;
|
inDart = false;
|
||||||
final Section processed = _processBlock(startLine, block);
|
final Section processed = _processBlock(startLine, block);
|
||||||
if (preambleSections.isEmpty) {
|
final Section combinedSection = preambleSections.isEmpty ? processed : Section.combine(preambleSections..add(processed));
|
||||||
sections.add(processed);
|
sections.add(combinedSection.copyWith(dartVersionOverride: dartVersionOverride));
|
||||||
} else {
|
|
||||||
sections.add(Section.combine(preambleSections..add(processed)));
|
|
||||||
}
|
|
||||||
block.clear();
|
block.clear();
|
||||||
} else if (trimmedLine == _dartDocPrefix) {
|
} else if (trimmedLine == _dartDocPrefix) {
|
||||||
block.add('');
|
block.add('');
|
||||||
@ -434,14 +453,19 @@ class SampleChecker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print('Found ${sections.length} sample code sections.');
|
if (!silent)
|
||||||
|
print('Found ${sections.length} sample code sections.');
|
||||||
for (final Section section in sections) {
|
for (final Section section in sections) {
|
||||||
sectionMap[_writeSection(section).path] = section;
|
final String path = _writeSection(section).path;
|
||||||
|
if (sectionMap != null)
|
||||||
|
sectionMap[path] = section;
|
||||||
}
|
}
|
||||||
for (final Sample sample in samples) {
|
for (final Sample sample in samples) {
|
||||||
final File snippetFile = _writeSample(sample);
|
final File snippetFile = _writeSample(sample);
|
||||||
sample.contents = snippetFile.readAsLinesSync();
|
if (sampleMap != null) {
|
||||||
sampleMap[snippetFile.absolute.path] = sample;
|
sample.contents = snippetFile.readAsLinesSync();
|
||||||
|
sampleMap[snippetFile.absolute.path] = sample;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,7 +516,7 @@ class SampleChecker {
|
|||||||
pubSpec.writeAsStringSync('''
|
pubSpec.writeAsStringSync('''
|
||||||
name: analyze_sample_code
|
name: analyze_sample_code
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.10.0 <3.0.0'
|
sdk: ">=2.12.0-0 <3.0.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
@ -512,6 +536,7 @@ linter:
|
|||||||
final String sectionId = _createNameFromSource('snippet', section.start.filename, section.start.line);
|
final String sectionId = _createNameFromSource('snippet', section.start.filename, section.start.line);
|
||||||
final File outputFile = File(path.join(_tempDirectory.path, '$sectionId.dart'))..createSync(recursive: true);
|
final File outputFile = File(path.join(_tempDirectory.path, '$sectionId.dart'))..createSync(recursive: true);
|
||||||
final List<Line> mainContents = <Line>[
|
final List<Line> mainContents = <Line>[
|
||||||
|
if (section.dartVersionOverride != null) Line(section.dartVersionOverride) else const Line(''),
|
||||||
...headers,
|
...headers,
|
||||||
const Line(''),
|
const Line(''),
|
||||||
Line('// From: ${section.start.filename}:${section.start.line}'),
|
Line('// From: ${section.start.filename}:${section.start.line}'),
|
||||||
@ -582,7 +607,7 @@ linter:
|
|||||||
caseSensitive: false,
|
caseSensitive: false,
|
||||||
);
|
);
|
||||||
bool unknownAnalyzerErrors = false;
|
bool unknownAnalyzerErrors = false;
|
||||||
final int headerLength = headers.length + 2;
|
final int headerLength = headers.length + 3;
|
||||||
for (final String error in errors) {
|
for (final String error in errors) {
|
||||||
final Match parts = errorPattern.matchAsPrefix(error);
|
final Match parts = errorPattern.matchAsPrefix(error);
|
||||||
if (parts != null) {
|
if (parts != null) {
|
||||||
@ -803,7 +828,7 @@ class Line {
|
|||||||
|
|
||||||
/// A class to represent a section of sample code, marked by "{@tool snippet}...{@end-tool}".
|
/// A class to represent a section of sample code, marked by "{@tool snippet}...{@end-tool}".
|
||||||
class Section {
|
class Section {
|
||||||
const Section(this.code);
|
const Section(this.code, {this.dartVersionOverride});
|
||||||
factory Section.combine(List<Section> sections) {
|
factory Section.combine(List<Section> sections) {
|
||||||
final List<Line> code = sections
|
final List<Line> code = sections
|
||||||
.expand((Section section) => section.code)
|
.expand((Section section) => section.code)
|
||||||
@ -846,6 +871,11 @@ class Section {
|
|||||||
}
|
}
|
||||||
Line get start => code.firstWhere((Line line) => line.filename != null);
|
Line get start => code.firstWhere((Line line) => line.filename != null);
|
||||||
final List<Line> code;
|
final List<Line> code;
|
||||||
|
final String dartVersionOverride;
|
||||||
|
|
||||||
|
Section copyWith({String dartVersionOverride}) {
|
||||||
|
return Section(code, dartVersionOverride: dartVersionOverride);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A class to represent a sample in the dartdoc comments, marked by
|
/// A class to represent a sample in the dartdoc comments, marked by
|
||||||
@ -908,3 +938,46 @@ class AnalysisError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _runInteractive(Directory tempDir, Directory flutterPackage, String filePath) async {
|
||||||
|
print('Starting up in interactive mode...');
|
||||||
|
filePath = path.isAbsolute(filePath) ? filePath : path.join(path.current, filePath);
|
||||||
|
final File file = File(filePath);
|
||||||
|
if (!file.existsSync()) {
|
||||||
|
throw 'Path ${file.absolute.path} does not exist.';
|
||||||
|
}
|
||||||
|
if (!path.isWithin(_flutterRoot, file.absolute.path)) {
|
||||||
|
throw 'Path ${file.absolute.path} is not within the flutter root: $_flutterRoot';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tempDir == null) {
|
||||||
|
tempDir = Directory.systemTemp.createTempSync('flutter_analyze_sample_code.');
|
||||||
|
ProcessSignal.sigint.watch().listen((_) {
|
||||||
|
print('Deleting temp files...');
|
||||||
|
tempDir.deleteSync(recursive: true);
|
||||||
|
exit(0);
|
||||||
|
});
|
||||||
|
print('Using temp dir ${tempDir.path}');
|
||||||
|
}
|
||||||
|
|
||||||
|
final SampleChecker checker = SampleChecker(flutterPackage, tempDirectory: tempDir)
|
||||||
|
.._createConfigurationFiles(tempDir)
|
||||||
|
.._extractSamples(<File>[file], silent: true);
|
||||||
|
|
||||||
|
await Isolate.spawn(_watcher, <dynamic>[checker, file]);
|
||||||
|
|
||||||
|
await Process.start(
|
||||||
|
_flutter,
|
||||||
|
<String>['--no-wrap', 'analyze', '--no-preamble', '--no-congratulate', '--watch', '.'],
|
||||||
|
workingDirectory: tempDir.absolute.path,
|
||||||
|
mode: ProcessStartMode.inheritStdio
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _watcher(List<dynamic> args) {
|
||||||
|
final File file = args.last as File;
|
||||||
|
final SampleChecker checker = args.first as SampleChecker;
|
||||||
|
Watcher(file.absolute.path).events.listen((_) {
|
||||||
|
checker._extractSamples(<File>[file], silent: true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
// precise contents (including especially the comments) of this file.
|
// precise contents (including especially the comments) of this file.
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// bool _visible = true;
|
// bool _visible = true;
|
||||||
// class _Text extends Text {
|
// class _Text extends Text {
|
||||||
// const _Text(String text) : super(text);
|
// const _Text(String text) : super(text);
|
||||||
@ -34,7 +35,7 @@
|
|||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_material}
|
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||||
/// Bla blabla blabla some [Text] when the `_blabla` blabla blabla is true, and
|
/// Bla blabla blabla some [Text] when the `_blabla` blabla blabla is true, and
|
||||||
/// blabla it when it is blabla:
|
/// blabla it when it is blabla:
|
||||||
///
|
///
|
||||||
|
@ -0,0 +1,134 @@
|
|||||||
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
// This file is used by ../analyze-sample-code_test.dart, which depends on the
|
||||||
|
// precise contents (including especially the comments) of this file.
|
||||||
|
|
||||||
|
// Examples can assume:
|
||||||
|
// bool _visible = true;
|
||||||
|
// class _Text extends Text {
|
||||||
|
// const _Text(String text) : super(text);
|
||||||
|
// const _Text.__(String text) : super(text);
|
||||||
|
// }
|
||||||
|
|
||||||
|
/// A blabla that blabla its blabla blabla blabla.
|
||||||
|
///
|
||||||
|
/// Bla blabla blabla its blabla into an blabla blabla and then blabla the
|
||||||
|
/// blabla back into the blabla blabla blabla.
|
||||||
|
///
|
||||||
|
/// Bla blabla of blabla blabla than 0.0 and 1.0, this blabla is blabla blabla
|
||||||
|
/// blabla it blabla pirates blabla the blabla into of blabla blabla. Bla the
|
||||||
|
/// blabla 0.0, the penzance blabla is blabla not blabla at all. Bla the blabla
|
||||||
|
/// 1.0, the blabla is blabla blabla blabla an blabla blabla.
|
||||||
|
///
|
||||||
|
/// {@tool snippet}
|
||||||
|
/// Bla blabla blabla some [Text] when the `_blabla` blabla blabla is true, and
|
||||||
|
/// blabla it when it is blabla:
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
|
/// new Opacity(
|
||||||
|
/// opacity: _visible ? 1.0 : 0.0,
|
||||||
|
/// child: const Text('Poor wandering ones!'),
|
||||||
|
/// )
|
||||||
|
/// ```
|
||||||
|
/// {@end-tool}
|
||||||
|
///
|
||||||
|
/// {@tool dartpad --template=stateless_widget_material}
|
||||||
|
/// Bla blabla blabla some [Text] when the `_blabla` blabla blabla is true, and
|
||||||
|
/// blabla it when it is blabla:
|
||||||
|
///
|
||||||
|
/// ```dart preamble
|
||||||
|
/// bool _visible = true;
|
||||||
|
/// final GlobalKey globalKey = GlobalKey();
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
|
/// Widget build(BuildContext context) {
|
||||||
|
/// return Opacity(
|
||||||
|
/// key: globalKey,
|
||||||
|
/// opacity: _visible ? 1.0 : 0.0,
|
||||||
|
/// child: const Text('Poor wandering ones!'),
|
||||||
|
/// );
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
/// {@end-tool}
|
||||||
|
///
|
||||||
|
/// {@tool snippet}
|
||||||
|
/// Bla blabla blabla some [Text] when the `_blabla` blabla blabla is true, and
|
||||||
|
/// blabla finale blabla:
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
|
/// new Opacity(
|
||||||
|
/// opacity: _visible ? 1.0 : 0.0,
|
||||||
|
/// child: const Text('Poor wandering ones!'),
|
||||||
|
/// )
|
||||||
|
/// ```
|
||||||
|
/// {@end-tool}
|
||||||
|
///
|
||||||
|
/// {@tool snippet}
|
||||||
|
/// regular const constructor
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
|
/// const Text('Poor wandering ones!')
|
||||||
|
/// ```
|
||||||
|
/// {@end-tool}
|
||||||
|
///
|
||||||
|
/// {@tool snippet}
|
||||||
|
/// const private constructor
|
||||||
|
/// ```dart
|
||||||
|
/// const _Text('Poor wandering ones!')
|
||||||
|
/// ```
|
||||||
|
/// {@end-tool}
|
||||||
|
///
|
||||||
|
/// {@tool snippet}
|
||||||
|
/// yet another const private constructor
|
||||||
|
/// ```dart
|
||||||
|
/// const _Text.__('Poor wandering ones!')
|
||||||
|
/// ```
|
||||||
|
/// {@end-tool}
|
||||||
|
///
|
||||||
|
/// {@tool snippet}
|
||||||
|
/// const variable
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
|
/// const text0 = Text('Poor wandering ones!');
|
||||||
|
/// ```
|
||||||
|
/// {@end-tool}
|
||||||
|
///
|
||||||
|
/// {@tool snippet}
|
||||||
|
/// more const variables
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
|
/// const text1 = _Text('Poor wandering ones!');
|
||||||
|
/// ```
|
||||||
|
/// {@end-tool}
|
||||||
|
///
|
||||||
|
/// {@tool snippet}
|
||||||
|
/// Snippet with null-safe syntax
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
|
/// final String? bar = 'Hello';
|
||||||
|
/// final int foo = null;
|
||||||
|
/// ```
|
||||||
|
/// {@end-tool}
|
||||||
|
///
|
||||||
|
/// {@tool dartpad --template=stateless_widget_material}
|
||||||
|
/// Dartpad with null-safe syntax
|
||||||
|
///
|
||||||
|
/// ```dart preamble
|
||||||
|
/// bool? _visible = true;
|
||||||
|
/// final GlobalKey globalKey = GlobalKey();
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
|
/// Widget build(BuildContext context) {
|
||||||
|
/// final String title;
|
||||||
|
/// return Opacity(
|
||||||
|
/// key: globalKey,
|
||||||
|
/// opacity: _visible! ? 1.0 : 0.0,
|
||||||
|
/// child: Text(title),
|
||||||
|
/// );
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
/// {@end-tool}
|
@ -17,9 +17,9 @@ void main() {
|
|||||||
..removeWhere((String line) => line.startsWith('Analyzer output:') || line.startsWith('Building flutter tool...'));
|
..removeWhere((String line) => line.startsWith('Analyzer output:') || line.startsWith('Building flutter tool...'));
|
||||||
expect(process.exitCode, isNot(equals(0)));
|
expect(process.exitCode, isNot(equals(0)));
|
||||||
expect(stderrLines, <String>[
|
expect(stderrLines, <String>[
|
||||||
'known_broken_documentation.dart:30:9: new Opacity(',
|
'known_broken_documentation.dart:31:9: new Opacity(',
|
||||||
'>>> Unnecessary new keyword (unnecessary_new)',
|
'>>> Unnecessary new keyword (unnecessary_new)',
|
||||||
'known_broken_documentation.dart:62:9: new Opacity(',
|
'known_broken_documentation.dart:63:9: new Opacity(',
|
||||||
'>>> Unnecessary new keyword (unnecessary_new)',
|
'>>> Unnecessary new keyword (unnecessary_new)',
|
||||||
'',
|
'',
|
||||||
'Found 1 sample code errors.',
|
'Found 1 sample code errors.',
|
||||||
@ -27,7 +27,36 @@ void main() {
|
|||||||
]);
|
]);
|
||||||
expect(stdoutLines, <String>[
|
expect(stdoutLines, <String>[
|
||||||
'Found 7 sample code sections.',
|
'Found 7 sample code sections.',
|
||||||
'Starting analysis of code samples.',
|
'Starting analysis of code samples.',
|
||||||
|
'',
|
||||||
|
]);
|
||||||
|
}, skip: Platform.isWindows);
|
||||||
|
|
||||||
|
test('analyze-sample-code null-safe', () {
|
||||||
|
final ProcessResult process = Process.runSync(
|
||||||
|
'../../bin/cache/dart-sdk/bin/dart',
|
||||||
|
<String>['analyze-sample-code.dart', 'test/analyze-sample-code-test-null-safe-input'],
|
||||||
|
);
|
||||||
|
final List<String> stdoutLines = process.stdout.toString().split('\n');
|
||||||
|
final List<String> stderrLines = process.stderr.toString().split('\n')
|
||||||
|
..removeWhere((String line) => line.startsWith('Analyzer output:') || line.startsWith('Building flutter tool...'));
|
||||||
|
expect(process.exitCode, isNot(equals(0)));
|
||||||
|
expect(stderrLines, <String>[
|
||||||
|
'In sample starting at known_broken_documentation.dart:117: child: Text(title),',
|
||||||
|
'>>> The final variable \'title\' can\'t be read because it is potentially unassigned at this point (read_potentially_unassigned_final)',
|
||||||
|
'known_broken_documentation.dart:30:9: new Opacity(',
|
||||||
|
'>>> Unnecessary new keyword (unnecessary_new)',
|
||||||
|
'known_broken_documentation.dart:62:9: new Opacity(',
|
||||||
|
'>>> Unnecessary new keyword (unnecessary_new)',
|
||||||
|
'known_broken_documentation.dart:112:25: final int foo = null;',
|
||||||
|
'>>> A value of type \'Null\' can\'t be assigned to a variable of type \'int\' (invalid_assignment)',
|
||||||
|
'',
|
||||||
|
'Found 2 sample code errors.',
|
||||||
|
''
|
||||||
|
]);
|
||||||
|
expect(stdoutLines, <String>[
|
||||||
|
'Found 8 sample code sections.',
|
||||||
|
'Starting analysis of code samples.',
|
||||||
'',
|
'',
|
||||||
]);
|
]);
|
||||||
}, skip: Platform.isWindows);
|
}, skip: Platform.isWindows);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<div class="snippet-container">
|
<div class="snippet-container">
|
||||||
<div class="snippet" id="longSnippet{{serial}}">
|
<div class="snippet" id="longSnippet{{serial}}">
|
||||||
{{description}}
|
{{description}}
|
||||||
<iframe class="snippet-dartpad" src="https://dartpad.dev/embed-flutter.html?split=60&run=true&sample_id={{id}}&sample_channel={{channel}}"></iframe>
|
<iframe class="snippet-dartpad" src="https://dartpad.dev/embed-flutter.html?split=60&run=true&null_safety=true&sample_id={{id}}&sample_channel={{channel}}"></iframe>
|
||||||
<div class="snippet-description">To create a local project with this code sample, run:<br/>
|
<div class="snippet-description">To create a local project with this code sample, run:<br/>
|
||||||
<span class="snippet-create-command">flutter create --sample={{id}} mysample</span>
|
<span class="snippet-create-command">flutter create --sample={{id}} mysample</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
|
12
dev/snippets/config/templates/freeform_no_null_safety.tmpl
Normal file
12
dev/snippets/config/templates/freeform_no_null_safety.tmpl
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
{{code-main}}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
{{code}}
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateful widget that the main application instantiates.
|
/// This is the stateful widget that the main application instantiates.
|
||||||
class MyStatefulWidget extends StatefulWidget {
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
MyStatefulWidget({Key key}) : super(key: key);
|
MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateful widget that the main application instantiates.
|
/// This is the stateful widget that the main application instantiates.
|
||||||
class MyStatefulWidget extends StatefulWidget {
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
MyStatefulWidget({Key key}) : super(key: key);
|
MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CupertinoApp(
|
||||||
|
title: _title,
|
||||||
|
home: MyStatefulWidget(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateful widget that the main application instantiates.
|
||||||
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
|
MyStatefulWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is the private State class that goes with MyStatefulWidget.
|
||||||
|
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateful widget that the main application instantiates.
|
/// This is the stateful widget that the main application instantiates.
|
||||||
class MyStatefulWidget extends StatefulWidget {
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
MyStatefulWidget({Key key}) : super(key: key);
|
MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CupertinoApp(
|
||||||
|
title: _title,
|
||||||
|
home: CupertinoPageScaffold(
|
||||||
|
navigationBar: CupertinoNavigationBar(middle: const Text(_title)),
|
||||||
|
child: MyStatefulWidget(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateful widget that the main application instantiates.
|
||||||
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
|
MyStatefulWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is the private State class that goes with MyStatefulWidget.
|
||||||
|
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateful widget that the main application instantiates.
|
/// This is the stateful widget that the main application instantiates.
|
||||||
class MyStatefulWidget extends StatefulWidget {
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
MyStatefulWidget({Key key}) : super(key: key);
|
MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CupertinoApp(
|
||||||
|
title: _title,
|
||||||
|
home: MyStatefulWidget(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateful widget that the main application instantiates.
|
||||||
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
|
MyStatefulWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is the private State class that goes with MyStatefulWidget.
|
||||||
|
/// AnimationControllers can be created with `vsync: this` because of TickerProviderStateMixin.
|
||||||
|
class _MyStatefulWidgetState extends State<MyStatefulWidget> with TickerProviderStateMixin {
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateful widget that the main application instantiates.
|
/// This is the stateful widget that the main application instantiates.
|
||||||
class MyStatefulWidget extends StatefulWidget {
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
MyStatefulWidget({Key key}) : super(key: key);
|
MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
title: _title,
|
||||||
|
home: MyStatefulWidget(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateful widget that the main application instantiates.
|
||||||
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
|
MyStatefulWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is the private State class that goes with MyStatefulWidget.
|
||||||
|
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateful widget that the main application instantiates.
|
/// This is the stateful widget that the main application instantiates.
|
||||||
class MyStatefulWidget extends StatefulWidget {
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
MyStatefulWidget({Key key}) : super(key: key);
|
MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
title: _title,
|
||||||
|
home: MyStatefulWidget(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateful widget that the main application instantiates.
|
||||||
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
|
MyStatefulWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is the private State class that goes with MyStatefulWidget.
|
||||||
|
/// AnimationControllers can be created with `vsync: this` because of TickerProviderStateMixin.
|
||||||
|
class _MyStatefulWidgetState extends State<MyStatefulWidget> with TickerProviderStateMixin {
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return WidgetsApp(
|
||||||
|
title: 'Flutter Code Sample',
|
||||||
|
home: MyStatefulWidget(),
|
||||||
|
color: const Color(0xffffffff),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateful widget that the main application instantiates.
|
||||||
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
|
MyStatefulWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is the private State class that goes with MyStatefulWidget.
|
||||||
|
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -27,9 +26,9 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateful widget that the main application instantiates.
|
/// This is the stateful widget that the main application instantiates.
|
||||||
class MyStatefulWidget extends StatefulWidget {
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
MyStatefulWidget({Key key, this.restorationId}) : super(key: key);
|
MyStatefulWidget({Key? key, this.restorationId}) : super(key: key);
|
||||||
|
|
||||||
final String restorationId;
|
final String? restorationId;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
@ -41,7 +40,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> with RestorationMix
|
|||||||
// In this example, the restoration ID for the mixin is passed in through
|
// In this example, the restoration ID for the mixin is passed in through
|
||||||
// the [StatefulWidget]'s constructor.
|
// the [StatefulWidget]'s constructor.
|
||||||
@override
|
@override
|
||||||
String get restorationId => widget.restorationId;
|
String? get restorationId => widget.restorationId;
|
||||||
|
|
||||||
{{code}}
|
{{code}}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return WidgetsApp(
|
||||||
|
title: 'Flutter Code Sample',
|
||||||
|
home: Center(
|
||||||
|
child: MyStatefulWidget(restorationId: 'main'),
|
||||||
|
),
|
||||||
|
color: const Color(0xffffffff),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateful widget that the main application instantiates.
|
||||||
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
|
MyStatefulWidget({Key key, this.restorationId}) : super(key: key);
|
||||||
|
|
||||||
|
final String restorationId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is the private State class that goes with MyStatefulWidget.
|
||||||
|
/// RestorationProperty objects can be used because of RestorationMixin.
|
||||||
|
class _MyStatefulWidgetState extends State<MyStatefulWidget> with RestorationMixin {
|
||||||
|
// In this example, the restoration ID for the mixin is passed in through
|
||||||
|
// the [StatefulWidget]'s constructor.
|
||||||
|
@override
|
||||||
|
String get restorationId => widget.restorationId;
|
||||||
|
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateful widget that the main application instantiates.
|
/// This is the stateful widget that the main application instantiates.
|
||||||
class MyStatefulWidget extends StatefulWidget {
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
MyStatefulWidget({Key key}) : super(key: key);
|
MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -31,7 +30,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateful widget that the main application instantiates.
|
/// This is the stateful widget that the main application instantiates.
|
||||||
class MyStatefulWidget extends StatefulWidget {
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
MyStatefulWidget({Key key}) : super(key: key);
|
MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -31,7 +30,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateful widget that the main application instantiates.
|
/// This is the stateful widget that the main application instantiates.
|
||||||
class MyStatefulWidget extends StatefulWidget {
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
MyStatefulWidget({Key key}) : super(key: key);
|
MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
title: _title,
|
||||||
|
home: Scaffold(
|
||||||
|
appBar: AppBar(title: const Text(_title)),
|
||||||
|
body: Center(
|
||||||
|
child: MyStatefulWidget(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateful widget that the main application instantiates.
|
||||||
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
|
MyStatefulWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is the private State class that goes with MyStatefulWidget.
|
||||||
|
{{code}}
|
@ -0,0 +1,43 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
title: _title,
|
||||||
|
home: Scaffold(
|
||||||
|
appBar: AppBar(title: const Text(_title)),
|
||||||
|
body: Center(
|
||||||
|
child: MyStatefulWidget(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateful widget that the main application instantiates.
|
||||||
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
|
MyStatefulWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is the private State class that goes with MyStatefulWidget.
|
||||||
|
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
title: _title,
|
||||||
|
home: Scaffold(
|
||||||
|
appBar: AppBar(title: const Text(_title)),
|
||||||
|
body: MyStatefulWidget(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateful widget that the main application instantiates.
|
||||||
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
|
MyStatefulWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is the private State class that goes with MyStatefulWidget.
|
||||||
|
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateful widget that the main application instantiates.
|
/// This is the stateful widget that the main application instantiates.
|
||||||
class MyStatefulWidget extends StatefulWidget {
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
MyStatefulWidget({Key key}) : super(key: key);
|
MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return WidgetsApp(
|
||||||
|
title: 'Flutter Code Sample',
|
||||||
|
home: MyStatefulWidget(),
|
||||||
|
color: const Color(0xffffffff),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateful widget that the main application instantiates.
|
||||||
|
class MyStatefulWidget extends StatefulWidget {
|
||||||
|
MyStatefulWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is the private State class that goes with MyStatefulWidget.
|
||||||
|
/// AnimationControllers can be created with `vsync: this` because of TickerProviderStateMixin.
|
||||||
|
class _MyStatefulWidgetState extends State<MyStatefulWidget> with TickerProviderStateMixin {
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -27,7 +26,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateless widget that the main application instantiates.
|
/// This is the stateless widget that the main application instantiates.
|
||||||
class MyStatelessWidget extends StatelessWidget {
|
class MyStatelessWidget extends StatelessWidget {
|
||||||
MyStatelessWidget({Key key}) : super(key: key);
|
MyStatelessWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
{{code}}
|
{{code}}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -27,7 +26,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateless widget that the main application instantiates.
|
/// This is the stateless widget that the main application instantiates.
|
||||||
class MyStatelessWidget extends StatelessWidget {
|
class MyStatelessWidget extends StatelessWidget {
|
||||||
MyStatelessWidget({Key key}) : super(key: key);
|
MyStatelessWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
{{code}}
|
{{code}}
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CupertinoApp(
|
||||||
|
title: _title,
|
||||||
|
home: MyStatelessWidget(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateless widget that the main application instantiates.
|
||||||
|
class MyStatelessWidget extends StatelessWidget {
|
||||||
|
MyStatelessWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateless widget that the main application instantiates.
|
/// This is the stateless widget that the main application instantiates.
|
||||||
class MyStatelessWidget extends StatelessWidget {
|
class MyStatelessWidget extends StatelessWidget {
|
||||||
MyStatelessWidget({Key key}) : super(key: key);
|
MyStatelessWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
{{code}}
|
{{code}}
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CupertinoApp(
|
||||||
|
title: _title,
|
||||||
|
home: CupertinoPageScaffold(
|
||||||
|
navigationBar: CupertinoNavigationBar(middle: const Text(_title)),
|
||||||
|
body: MyStatelessWidget(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateless widget that the main application instantiates.
|
||||||
|
class MyStatelessWidget extends StatelessWidget {
|
||||||
|
MyStatelessWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -27,7 +26,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateless widget that the main application instantiates.
|
/// This is the stateless widget that the main application instantiates.
|
||||||
class MyStatelessWidget extends StatelessWidget {
|
class MyStatelessWidget extends StatelessWidget {
|
||||||
MyStatelessWidget({Key key}) : super(key: key);
|
MyStatelessWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
{{code}}
|
{{code}}
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
title: _title,
|
||||||
|
home: MyStatelessWidget(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateless widget that the main application instantiates.
|
||||||
|
class MyStatelessWidget extends StatelessWidget {
|
||||||
|
MyStatelessWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return WidgetsApp(
|
||||||
|
title: 'Flutter Code Sample',
|
||||||
|
builder: (BuildContext context, Widget navigator) {
|
||||||
|
return MyStatelessWidget();
|
||||||
|
},
|
||||||
|
color: const Color(0xffffffff),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateless widget that the main application instantiates.
|
||||||
|
class MyStatelessWidget extends StatelessWidget {
|
||||||
|
MyStatelessWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateless widget that the main application instantiates.
|
/// This is the stateless widget that the main application instantiates.
|
||||||
class MyStatelessWidget extends StatelessWidget {
|
class MyStatelessWidget extends StatelessWidget {
|
||||||
MyStatelessWidget({Key key}) : super(key: key);
|
MyStatelessWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
{{code}}
|
{{code}}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/// Flutter code sample for {{element}}
|
/// Flutter code sample for {{element}}
|
||||||
// @dart = 2.9
|
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
@ -32,7 +31,7 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
/// This is the stateless widget that the main application instantiates.
|
/// This is the stateless widget that the main application instantiates.
|
||||||
class MyStatelessWidget extends StatelessWidget {
|
class MyStatelessWidget extends StatelessWidget {
|
||||||
MyStatelessWidget({Key key}) : super(key: key);
|
MyStatelessWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
{{code}}
|
{{code}}
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
title: _title,
|
||||||
|
home: Scaffold(
|
||||||
|
appBar: AppBar(title: const Text(_title)),
|
||||||
|
body: Center(
|
||||||
|
child: MyStatelessWidget(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateless widget that the main application instantiates.
|
||||||
|
class MyStatelessWidget extends StatelessWidget {
|
||||||
|
MyStatelessWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
/// Flutter code sample for {{element}}
|
||||||
|
// @dart = 2.9
|
||||||
|
|
||||||
|
{{description}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
{{code-imports}}
|
||||||
|
|
||||||
|
void main() => runApp(new MyApp());
|
||||||
|
|
||||||
|
/// This is the main application widget.
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
title: _title,
|
||||||
|
home: Scaffold(
|
||||||
|
appBar: AppBar(title: const Text(_title)),
|
||||||
|
body: MyStatelessWidget(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{{code-preamble}}
|
||||||
|
|
||||||
|
/// This is the stateless widget that the main application instantiates.
|
||||||
|
class MyStatelessWidget extends StatelessWidget {
|
||||||
|
MyStatelessWidget({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
{{code}}
|
||||||
|
}
|
@ -20,6 +20,7 @@ export 'package:meta/meta.dart' show
|
|||||||
visibleForTesting;
|
visibleForTesting;
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// String _name;
|
// String _name;
|
||||||
// bool _first;
|
// bool _first;
|
||||||
// bool _lights;
|
// bool _lights;
|
||||||
|
@ -8,6 +8,7 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'tween.dart';
|
import 'tween.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// AnimationController _controller;
|
// AnimationController _controller;
|
||||||
|
|
||||||
/// The status of an animation.
|
/// The status of an animation.
|
||||||
|
@ -17,6 +17,7 @@ import 'listener_helpers.dart';
|
|||||||
export 'package:flutter/scheduler.dart' show TickerFuture, TickerCanceled;
|
export 'package:flutter/scheduler.dart' show TickerFuture, TickerCanceled;
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// AnimationController _controller, fadeAnimationController, sizeAnimationController;
|
// AnimationController _controller, fadeAnimationController, sizeAnimationController;
|
||||||
// bool dismissed;
|
// bool dismissed;
|
||||||
// void setState(VoidCallback fn) { }
|
// void setState(VoidCallback fn) { }
|
||||||
|
@ -12,6 +12,7 @@ import 'curves.dart';
|
|||||||
import 'listener_helpers.dart';
|
import 'listener_helpers.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// AnimationController controller;
|
// AnimationController controller;
|
||||||
|
|
||||||
class _AlwaysCompleteAnimation extends Animation<double> {
|
class _AlwaysCompleteAnimation extends Animation<double> {
|
||||||
|
@ -319,7 +319,7 @@ class Cubic extends Curve {
|
|||||||
/// part of the curve, or hardly at all in another part of the curve, depending
|
/// part of the curve, or hardly at all in another part of the curve, depending
|
||||||
/// on the definition of the curve.
|
/// on the definition of the curve.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_material}
|
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||||
/// This example shows how to use a [Curve2D] to modify the position of a widget
|
/// This example shows how to use a [Curve2D] to modify the position of a widget
|
||||||
/// so that it can follow an arbitrary path.
|
/// so that it can follow an arbitrary path.
|
||||||
///
|
///
|
||||||
|
@ -12,6 +12,7 @@ import 'animations.dart';
|
|||||||
import 'curves.dart';
|
import 'curves.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// Animation<Offset> _animation;
|
// Animation<Offset> _animation;
|
||||||
// AnimationController _controller;
|
// AnimationController _controller;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import 'animation.dart';
|
|||||||
import 'tween.dart';
|
import 'tween.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// AnimationController myAnimationController;
|
// AnimationController myAnimationController;
|
||||||
|
|
||||||
/// Enables creating an [Animation] whose value is defined by a sequence of
|
/// Enables creating an [Animation] whose value is defined by a sequence of
|
||||||
|
@ -13,6 +13,9 @@ import 'localizations.dart';
|
|||||||
import 'route.dart';
|
import 'route.dart';
|
||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
|
|
||||||
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
|
|
||||||
/// An application that uses Cupertino design.
|
/// An application that uses Cupertino design.
|
||||||
///
|
///
|
||||||
/// A convenience widget that wraps a number of widgets that are commonly
|
/// A convenience widget that wraps a number of widgets that are commonly
|
||||||
|
@ -12,6 +12,7 @@ import 'interface_level.dart';
|
|||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// Widget child;
|
// Widget child;
|
||||||
// BuildContext context;
|
// BuildContext context;
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ enum _ContextMenuLocation {
|
|||||||
/// child's corners and allowing its aspect ratio to expand, similar to the
|
/// child's corners and allowing its aspect ratio to expand, similar to the
|
||||||
/// Photos app on iOS.
|
/// Photos app on iOS.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_material}
|
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This sample shows a very simple CupertinoContextMenu for an empty red
|
/// This sample shows a very simple CupertinoContextMenu for an empty red
|
||||||
/// 100x100 Container. Simply long press on it to open.
|
/// 100x100 Container. Simply long press on it to open.
|
||||||
|
@ -8,6 +8,9 @@ import 'package:flutter/widgets.dart';
|
|||||||
import 'colors.dart';
|
import 'colors.dart';
|
||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
|
|
||||||
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
|
|
||||||
// Content padding determined via SwiftUI's `Form` view in the iOS 14.2 SDK.
|
// Content padding determined via SwiftUI's `Form` view in the iOS 14.2 SDK.
|
||||||
const EdgeInsetsGeometry _kDefaultPadding =
|
const EdgeInsetsGeometry _kDefaultPadding =
|
||||||
EdgeInsetsDirectional.fromSTEB(20.0, 6.0, 6.0, 6.0);
|
EdgeInsetsDirectional.fromSTEB(20.0, 6.0, 6.0, 6.0);
|
||||||
|
@ -267,7 +267,7 @@ typedef RefreshCallback = Future<void> Function();
|
|||||||
/// sliver such as [CupertinoSliverNavigationBar] and your main scrollable
|
/// sliver such as [CupertinoSliverNavigationBar] and your main scrollable
|
||||||
/// content's sliver.
|
/// content's sliver.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material}
|
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||||
///
|
///
|
||||||
/// When the user scrolls past [refreshTriggerPullDistance],
|
/// When the user scrolls past [refreshTriggerPullDistance],
|
||||||
/// this sample shows the default iOS pull to refresh indicator for 1 second and
|
/// this sample shows the default iOS pull to refresh indicator for 1 second and
|
||||||
|
@ -12,6 +12,9 @@ import 'icons.dart';
|
|||||||
import 'localizations.dart';
|
import 'localizations.dart';
|
||||||
import 'text_field.dart';
|
import 'text_field.dart';
|
||||||
|
|
||||||
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
|
|
||||||
/// A [CupertinoTextField] that mimics the look and behavior of UIKit's
|
/// A [CupertinoTextField] that mimics the look and behavior of UIKit's
|
||||||
/// `UISearchTextField`.
|
/// `UISearchTextField`.
|
||||||
///
|
///
|
||||||
|
@ -11,6 +11,9 @@ import 'package:flutter/widgets.dart';
|
|||||||
|
|
||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
|
|
||||||
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
|
|
||||||
// Minimum padding from edges of the segmented control to edges of
|
// Minimum padding from edges of the segmented control to edges of
|
||||||
// encompassing widget.
|
// encompassing widget.
|
||||||
const EdgeInsetsGeometry _kHorizontalItemPadding = EdgeInsets.symmetric(horizontal: 16.0);
|
const EdgeInsetsGeometry _kHorizontalItemPadding = EdgeInsets.symmetric(horizontal: 16.0);
|
||||||
|
@ -14,6 +14,7 @@ import 'theme.dart';
|
|||||||
import 'thumb_painter.dart';
|
import 'thumb_painter.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// int _cupertinoSliderValue = 1;
|
// int _cupertinoSliderValue = 1;
|
||||||
// void setState(VoidCallback fn) { }
|
// void setState(VoidCallback fn) { }
|
||||||
|
|
||||||
|
@ -12,6 +12,9 @@ import 'package:flutter/widgets.dart';
|
|||||||
|
|
||||||
import 'colors.dart';
|
import 'colors.dart';
|
||||||
|
|
||||||
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
|
|
||||||
// Extracted from https://developer.apple.com/design/resources/.
|
// Extracted from https://developer.apple.com/design/resources/.
|
||||||
|
|
||||||
// Minimum padding from edges of the segmented control to edges of
|
// Minimum padding from edges of the segmented control to edges of
|
||||||
|
@ -14,6 +14,7 @@ import 'colors.dart';
|
|||||||
import 'thumb_painter.dart';
|
import 'thumb_painter.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// bool _lights;
|
// bool _lights;
|
||||||
// void setState(VoidCallback fn) { }
|
// void setState(VoidCallback fn) { }
|
||||||
|
|
||||||
|
@ -16,6 +16,9 @@ import 'theme.dart';
|
|||||||
|
|
||||||
export 'package:flutter/services.dart' show TextInputType, TextInputAction, TextCapitalization, SmartQuotesType, SmartDashesType;
|
export 'package:flutter/services.dart' show TextInputType, TextInputAction, TextCapitalization, SmartQuotesType, SmartDashesType;
|
||||||
|
|
||||||
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
|
|
||||||
const TextStyle _kDefaultPlaceholderStyle = TextStyle(
|
const TextStyle _kDefaultPlaceholderStyle = TextStyle(
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
color: CupertinoColors.placeholderText,
|
color: CupertinoColors.placeholderText,
|
||||||
|
@ -11,6 +11,9 @@ import 'form_row.dart';
|
|||||||
import 'text_field.dart';
|
import 'text_field.dart';
|
||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
|
|
||||||
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
|
|
||||||
/// Creates a [CupertinoFormRow] containing a [FormField] that wraps
|
/// Creates a [CupertinoFormRow] containing a [FormField] that wraps
|
||||||
/// a [CupertinoTextField].
|
/// a [CupertinoTextField].
|
||||||
///
|
///
|
||||||
@ -72,7 +75,7 @@ import 'theme.dart';
|
|||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material}
|
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||||
/// This example shows how to move the focus to the next field when the user
|
/// This example shows how to move the focus to the next field when the user
|
||||||
/// presses the SPACE key.
|
/// presses the SPACE key.
|
||||||
///
|
///
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// class Cat { }
|
// class Cat { }
|
||||||
|
|
||||||
/// A category with which to annotate a class, for documentation
|
/// A category with which to annotate a class, for documentation
|
||||||
|
@ -11,6 +11,7 @@ import 'print.dart';
|
|||||||
import 'stack_frame.dart';
|
import 'stack_frame.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// String runtimeType;
|
// String runtimeType;
|
||||||
// bool draconisAlive;
|
// bool draconisAlive;
|
||||||
// bool draconisAmulet;
|
// bool draconisAmulet;
|
||||||
|
@ -12,6 +12,7 @@ import 'debug.dart';
|
|||||||
import 'object.dart';
|
import 'object.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// int rows, columns;
|
// int rows, columns;
|
||||||
// String _name;
|
// String _name;
|
||||||
// bool inherit;
|
// bool inherit;
|
||||||
|
@ -43,13 +43,13 @@ 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}
|
///
|
||||||
|
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 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>[
|
||||||
@ -110,10 +110,9 @@ import 'theme.dart';
|
|||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// );
|
/// );
|
||||||
///}
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
|
||||||
class AboutListTile extends StatelessWidget {
|
class AboutListTile extends StatelessWidget {
|
||||||
/// Creates a list tile for showing an about box.
|
/// Creates a list tile for showing an about box.
|
||||||
///
|
///
|
||||||
|
@ -10,6 +10,7 @@ part of material_animated_icons;
|
|||||||
// generic vector graphics support in Flutter.
|
// generic vector graphics support in Flutter.
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// AnimationController controller;
|
// AnimationController controller;
|
||||||
|
|
||||||
/// Shows an animated icon at a given animation [progress].
|
/// Shows an animated icon at a given animation [progress].
|
||||||
|
@ -18,6 +18,9 @@ import 'page.dart';
|
|||||||
import 'scaffold.dart' show ScaffoldMessenger, ScaffoldMessengerState;
|
import 'scaffold.dart' show ScaffoldMessenger, ScaffoldMessengerState;
|
||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
|
|
||||||
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
|
|
||||||
/// [MaterialApp] uses this [TextStyle] as its [DefaultTextStyle] to encourage
|
/// [MaterialApp] uses this [TextStyle] as its [DefaultTextStyle] to encourage
|
||||||
/// developers to be intentional about their [DefaultTextStyle].
|
/// developers to be intentional about their [DefaultTextStyle].
|
||||||
///
|
///
|
||||||
|
@ -91,7 +91,7 @@ class _ToolbarContainerLayout extends SingleChildLayoutDelegate {
|
|||||||
/// to false. In that case a null leading widget will result in the middle/title widget
|
/// to false. In that case a null leading widget will result in the middle/title widget
|
||||||
/// stretching to start.
|
/// stretching to start.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_material}
|
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This sample shows an [AppBar] with two simple actions. The first action
|
/// This sample shows an [AppBar] with two simple actions. The first action
|
||||||
/// opens a [SnackBar], while the second action navigates to a new page.
|
/// opens a [SnackBar], while the second action navigates to a new page.
|
||||||
|
@ -18,7 +18,7 @@ import 'theme.dart';
|
|||||||
/// They are persistent and non-modal, allowing the user to either ignore them or
|
/// They are persistent and non-modal, allowing the user to either ignore them or
|
||||||
/// interact with them at any time.
|
/// interact with them at any time.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
|
@ -13,6 +13,7 @@ import 'scaffold.dart';
|
|||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// Widget bottomAppBarContents;
|
// Widget bottomAppBarContents;
|
||||||
|
|
||||||
/// A container that is typically used with [Scaffold.bottomNavigationBar], and
|
/// A container that is typically used with [Scaffold.bottomNavigationBar], and
|
||||||
|
@ -63,7 +63,7 @@ enum BottomNavigationBarType {
|
|||||||
/// case it's assumed that each item will have a different background color
|
/// case it's assumed that each item will have a different background color
|
||||||
/// and that background color will contrast well with white.
|
/// and that background color will contrast well with white.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material}
|
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||||
/// This example shows a [BottomNavigationBar] as it is used within a [Scaffold]
|
/// This example shows a [BottomNavigationBar] as it is used within a [Scaffold]
|
||||||
/// widget. The [BottomNavigationBar] has three [BottomNavigationBarItem]
|
/// widget. The [BottomNavigationBar] has three [BottomNavigationBarItem]
|
||||||
/// widgets and the [currentIndex] is set to index 0. The selected item is
|
/// widgets and the [currentIndex] is set to index 0. The selected item is
|
||||||
|
@ -596,7 +596,7 @@ class _BottomSheetSuspendedCurve extends ParametricCurve<double> {
|
|||||||
/// Returns a `Future` that resolves to the value (if any) that was passed to
|
/// Returns a `Future` that resolves to the value (if any) that was passed to
|
||||||
/// [Navigator.pop] when the modal bottom sheet was closed.
|
/// [Navigator.pop] when the modal bottom sheet was closed.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This example demonstrates how to use `showModalBottomSheet` to display a
|
/// This example demonstrates how to use `showModalBottomSheet` to display a
|
||||||
/// bottom sheet that obscures the content behind it when a user taps a button.
|
/// bottom sheet that obscures the content behind it when a user taps a button.
|
||||||
|
@ -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}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 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';
|
|||||||
/// 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}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 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
|
||||||
|
@ -10,6 +10,7 @@ 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 [Checkbox]. In other words, a checkbox with a label.
|
/// A [ListTile] with a [Checkbox]. In other words, a checkbox with a label.
|
||||||
@ -39,7 +40,7 @@ import 'theme_data.dart';
|
|||||||
/// To show the [CheckboxListTile] as disabled, pass null as the [onChanged]
|
/// To show the [CheckboxListTile] as disabled, pass null as the [onChanged]
|
||||||
/// callback.
|
/// callback.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold_center}
|
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
@ -84,7 +85,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 sample --template=stateful_widget_scaffold_center}
|
/// {@tool sample --template=stateful_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
@ -168,7 +169,7 @@ import 'theme_data.dart';
|
|||||||
/// combining [Checkbox] with other widgets, such as [Text], [Padding] and
|
/// combining [Checkbox] with other widgets, such as [Text], [Padding] and
|
||||||
/// [InkWell].
|
/// [InkWell].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold_center}
|
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
|
@ -23,6 +23,9 @@ import 'theme.dart';
|
|||||||
import 'theme_data.dart';
|
import 'theme_data.dart';
|
||||||
import 'tooltip.dart';
|
import 'tooltip.dart';
|
||||||
|
|
||||||
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
|
|
||||||
// Some design constants
|
// Some design constants
|
||||||
const double _kChipHeight = 32.0;
|
const double _kChipHeight = 32.0;
|
||||||
const double _kDeleteIconSize = 18.0;
|
const double _kDeleteIconSize = 18.0;
|
||||||
@ -221,7 +224,7 @@ abstract class DeletableChipAttributes {
|
|||||||
/// that the user tapped the delete button. In order to delete the chip, you
|
/// that the user tapped the delete button. In order to delete the chip, you
|
||||||
/// have to do something similar to the following sample:
|
/// have to do something similar to the following sample:
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold_center}
|
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This sample shows how to use [onDeleted] to remove an entry when the
|
/// This sample shows how to use [onDeleted] to remove an entry when the
|
||||||
/// delete button is tapped.
|
/// delete button is tapped.
|
||||||
|
@ -9,6 +9,7 @@ import 'theme.dart';
|
|||||||
import 'theme_data.dart';
|
import 'theme_data.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// String userAvatarUrl;
|
// String userAvatarUrl;
|
||||||
|
|
||||||
/// A circle that represents a user.
|
/// A circle that represents a user.
|
||||||
|
@ -6,6 +6,9 @@ import 'dart:ui' show Color;
|
|||||||
|
|
||||||
import 'package:flutter/painting.dart';
|
import 'package:flutter/painting.dart';
|
||||||
|
|
||||||
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
|
|
||||||
/// Defines a single color as well a color swatch with ten shades of the color.
|
/// Defines a single color as well a color swatch with ten shades of the color.
|
||||||
///
|
///
|
||||||
/// The color's shades are referred to by index. The greater the index, the
|
/// The color's shades are referred to by index. The greater the index, the
|
||||||
|
@ -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}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 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 {
|
|||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 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.
|
||||||
|
@ -23,6 +23,7 @@ import 'theme.dart';
|
|||||||
|
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// BuildContext context;
|
// BuildContext context;
|
||||||
|
|
||||||
const Duration _kMonthScrollDuration = Duration(milliseconds: 200);
|
const Duration _kMonthScrollDuration = Duration(milliseconds: 200);
|
||||||
|
@ -18,6 +18,7 @@ import 'theme.dart';
|
|||||||
import 'theme_data.dart';
|
import 'theme_data.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// enum Department { treasury, state }
|
// enum Department { treasury, state }
|
||||||
// BuildContext context;
|
// BuildContext context;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import 'divider_theme.dart';
|
|||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// BuildContext context;
|
// BuildContext context;
|
||||||
|
|
||||||
/// A thin horizontal line, with padding on either side.
|
/// A thin horizontal line, with padding on either side.
|
||||||
@ -24,7 +25,7 @@ import 'theme.dart';
|
|||||||
/// The box's total height is controlled by [height]. The appropriate
|
/// The box's total height is controlled by [height]. The appropriate
|
||||||
/// padding is automatically computed from the height.
|
/// padding is automatically computed from the height.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This sample shows how to display a Divider between an orange and blue box
|
/// This sample shows how to display a Divider between an orange and blue box
|
||||||
/// inside a column. The Divider is 20 logical pixels in height and contains a
|
/// inside a column. The Divider is 20 logical pixels in height and contains a
|
||||||
|
@ -728,7 +728,7 @@ class DropdownButtonHideUnderline extends InheritedWidget {
|
|||||||
/// dropdown's value. It should also call [State.setState] to rebuild the
|
/// dropdown's value. It should also call [State.setState] to rebuild the
|
||||||
/// dropdown with the new value.
|
/// dropdown with the new value.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold_center}
|
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This sample shows a `DropdownButton` with a large arrow icon,
|
/// This sample shows a `DropdownButton` with a large arrow icon,
|
||||||
/// purple text style, and bold purple underline, whose value is one of "One",
|
/// purple text style, and bold purple underline, whose value is one of "One",
|
||||||
@ -912,7 +912,7 @@ class DropdownButton<T> extends StatefulWidget {
|
|||||||
/// from the list corresponds to the [DropdownMenuItem] of the same index
|
/// from the list corresponds to the [DropdownMenuItem] of the same index
|
||||||
/// in [items].
|
/// in [items].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This sample shows a `DropdownButton` with a button with [Text] that
|
/// This sample shows a `DropdownButton` with a button with [Text] that
|
||||||
/// corresponds to but is unique from [DropdownMenuItem].
|
/// corresponds to but is unique from [DropdownMenuItem].
|
||||||
@ -963,7 +963,7 @@ class DropdownButton<T> extends StatefulWidget {
|
|||||||
/// To use a separate text style for selected item when it's displayed within
|
/// To use a separate text style for selected item when it's displayed within
|
||||||
/// the dropdown button, consider using [selectedItemBuilder].
|
/// the dropdown button, consider using [selectedItemBuilder].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This sample shows a `DropdownButton` with a dropdown button text style
|
/// This sample shows a `DropdownButton` with a dropdown button text style
|
||||||
/// that is different than its menu items.
|
/// that is different than its menu items.
|
||||||
|
@ -148,7 +148,7 @@ class ExpansionPanelRadio extends ExpansionPanel {
|
|||||||
/// Note that [expansionCallback] behaves differently for [ExpansionPanelList]
|
/// Note that [expansionCallback] behaves differently for [ExpansionPanelList]
|
||||||
/// and [ExpansionPanelList.radio].
|
/// and [ExpansionPanelList.radio].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// Here is a simple example of how to implement ExpansionPanelList.
|
/// Here is a simple example of how to implement ExpansionPanelList.
|
||||||
///
|
///
|
||||||
@ -252,7 +252,7 @@ class ExpansionPanelList extends StatefulWidget {
|
|||||||
/// arguments must not be null. The [children] objects must be instances
|
/// arguments must not be null. The [children] objects must be instances
|
||||||
/// of [ExpansionPanelRadio].
|
/// of [ExpansionPanelRadio].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// Here is a simple example of how to implement ExpansionPanelList.radio.
|
/// Here is a simple example of how to implement ExpansionPanelList.radio.
|
||||||
///
|
///
|
||||||
|
@ -53,7 +53,7 @@ enum StretchMode {
|
|||||||
/// [FlexibleSpaceBar.createSettings], to convey sizing information down to the
|
/// [FlexibleSpaceBar.createSettings], to convey sizing information down to the
|
||||||
/// [FlexibleSpaceBar].
|
/// [FlexibleSpaceBar].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=freeform}
|
/// {@tool dartpad --template=freeform_no_null_safety}
|
||||||
/// This sample application demonstrates the different features of the
|
/// This sample application demonstrates the different features of the
|
||||||
/// [FlexibleSpaceBar] when used in a [SliverAppBar]. This app bar is configured
|
/// [FlexibleSpaceBar] when used in a [SliverAppBar]. This app bar is configured
|
||||||
/// to stretch into the overscroll space, and uses the
|
/// to stretch into the overscroll space, and uses the
|
||||||
|
@ -58,7 +58,7 @@ class _DefaultHeroTag {
|
|||||||
/// disabled. Consider changing the [backgroundColor] if disabling the floating
|
/// disabled. Consider changing the [backgroundColor] if disabling the floating
|
||||||
/// action button.
|
/// action button.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_material}
|
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||||
/// This example shows how to display a [FloatingActionButton] in a
|
/// This example shows how to display a [FloatingActionButton] in a
|
||||||
/// [Scaffold], with a pink [backgroundColor] and a thumbs up [Icon].
|
/// [Scaffold], with a pink [backgroundColor] and a thumbs up [Icon].
|
||||||
///
|
///
|
||||||
@ -85,7 +85,7 @@ class _DefaultHeroTag {
|
|||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_material}
|
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||||
/// This example shows how to make an extended [FloatingActionButton] in a
|
/// This example shows how to make an extended [FloatingActionButton] in a
|
||||||
/// [Scaffold], with a pink [backgroundColor], a thumbs up [Icon] and a
|
/// [Scaffold], with a pink [backgroundColor], a thumbs up [Icon] and a
|
||||||
/// [Text] label that reads "Approve".
|
/// [Text] label that reads "Approve".
|
||||||
|
@ -431,7 +431,7 @@ abstract class FloatingActionButtonLocation {
|
|||||||
/// You can create your own subclass of [StandardFabLocation]
|
/// You can create your own subclass of [StandardFabLocation]
|
||||||
/// to implement a custom [FloatingActionButtonLocation].
|
/// to implement a custom [FloatingActionButtonLocation].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_material}
|
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This is an example of a user-defined [FloatingActionButtonLocation].
|
/// This is an example of a user-defined [FloatingActionButtonLocation].
|
||||||
///
|
///
|
||||||
|
@ -40,7 +40,7 @@ const double _kMinButtonSize = kMinInteractiveDimension;
|
|||||||
/// requirements in the Material Design specification. The [alignment] controls
|
/// requirements in the Material Design specification. The [alignment] controls
|
||||||
/// how the icon itself is positioned within the hit region.
|
/// how the icon itself is positioned within the hit region.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold_center}
|
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This sample shows an `IconButton` that uses the Material icon "volume_up" to
|
/// This sample shows an `IconButton` that uses the Material icon "volume_up" to
|
||||||
/// increase the volume.
|
/// increase the volume.
|
||||||
@ -84,7 +84,7 @@ const double _kMinButtonSize = kMinInteractiveDimension;
|
|||||||
/// the underlying [Material] along with the splash and highlight
|
/// the underlying [Material] along with the splash and highlight
|
||||||
/// [InkResponse] contributed by descendant widgets.
|
/// [InkResponse] contributed by descendant widgets.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// In this sample the icon button's background color is defined with an [Ink]
|
/// In this sample the icon button's background color is defined with an [Ink]
|
||||||
/// widget whose child is an [IconButton]. The icon button's filled background
|
/// widget whose child is an [IconButton]. The icon button's filled background
|
||||||
|
@ -1170,7 +1170,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}
|
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 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.
|
||||||
|
@ -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}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 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
|
|||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 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
|
|||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 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
|
|||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 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,7 @@ 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}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
/// 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.
|
||||||
///
|
///
|
||||||
@ -3004,7 +3004,7 @@ class InputDecoration {
|
|||||||
/// If null, a [BoxConstraints] with a minimum width and height of 48px is
|
/// If null, a [BoxConstraints] with a minimum width and height of 48px is
|
||||||
/// used.
|
/// used.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
/// This example shows the differences between two `TextField` widgets when
|
/// This example shows the differences between two `TextField` widgets when
|
||||||
/// [suffixIconConstraints] is set to the default value and when one is not.
|
/// [suffixIconConstraints] is set to the default value and when one is not.
|
||||||
///
|
///
|
||||||
|
@ -416,7 +416,7 @@ enum ListTileControlAffinity {
|
|||||||
/// you're looking for, it's easy to create custom list items with a
|
/// you're looking for, it's easy to create custom list items with a
|
||||||
/// combination of other widgets, such as [Row]s and [Column]s.
|
/// combination of other widgets, such as [Row]s and [Column]s.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// Here is an example of a custom list item that resembles a YouTube-related
|
/// Here is an example of a custom list item that resembles a YouTube-related
|
||||||
/// video list item created with [Expanded] and [Container] widgets.
|
/// video list item created with [Expanded] and [Container] widgets.
|
||||||
@ -537,7 +537,7 @@ enum ListTileControlAffinity {
|
|||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// Here is an example of an article list item with multiline titles and
|
/// Here is an example of an article list item with multiline titles and
|
||||||
/// subtitles. It utilizes [Row]s and [Column]s, as well as [Expanded] and
|
/// subtitles. It utilizes [Row]s and [Column]s, as well as [Expanded] and
|
||||||
@ -889,7 +889,7 @@ class ListTile extends StatelessWidget {
|
|||||||
/// By default the selected color is the theme's primary color. The selected color
|
/// By default the selected color is the theme's primary color. The selected color
|
||||||
/// can be overridden with a [ListTileTheme].
|
/// can be overridden with a [ListTileTheme].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// Here is an example of using a [StatefulWidget] to keep track of the
|
/// Here is an example of using a [StatefulWidget] to keep track of the
|
||||||
/// selected index, and using that to set the `selected` property on the
|
/// selected index, and using that to set the `selected` property on the
|
||||||
|
@ -179,7 +179,7 @@ class _MaterialStateColor extends MaterialStateColor {
|
|||||||
/// To use a [MaterialStateMouseCursor], you should create a subclass of
|
/// To use a [MaterialStateMouseCursor], you should create a subclass of
|
||||||
/// [MaterialStateMouseCursor] and implement the abstract `resolve` method.
|
/// [MaterialStateMouseCursor] and implement the abstract `resolve` method.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold_center}
|
/// {@tool dartpad --template=stateless_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This example defines a mouse cursor that resolves to
|
/// This example defines a mouse cursor that resolves to
|
||||||
/// [SystemMouseCursors.forbidden] when its widget is disabled.
|
/// [SystemMouseCursors.forbidden] when its widget is disabled.
|
||||||
@ -294,7 +294,7 @@ class _EnabledAndDisabledMouseCursor extends MaterialStateMouseCursor {
|
|||||||
/// To use a [MaterialStateBorderSide], you should create a subclass of a
|
/// To use a [MaterialStateBorderSide], you should create a subclass of a
|
||||||
/// [MaterialStateBorderSide] and override the abstract `resolve` method.
|
/// [MaterialStateBorderSide] and override the abstract `resolve` method.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material}
|
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This example defines a subclass of [MaterialStateBorderSide], that resolves
|
/// This example defines a subclass of [MaterialStateBorderSide], that resolves
|
||||||
/// to a red border side when its widget is selected.
|
/// to a red border side when its widget is selected.
|
||||||
@ -352,7 +352,7 @@ abstract class MaterialStateBorderSide extends BorderSide implements MaterialSta
|
|||||||
/// [OutlinedBorder] and implement [MaterialStateOutlinedBorder]'s abstract
|
/// [OutlinedBorder] and implement [MaterialStateOutlinedBorder]'s abstract
|
||||||
/// `resolve` method.
|
/// `resolve` method.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material}
|
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This example defines a subclass of [RoundedRectangleBorder] and an
|
/// This example defines a subclass of [RoundedRectangleBorder] and an
|
||||||
/// implementation of [MaterialStateOutlinedBorder], that resolves to
|
/// implementation of [MaterialStateOutlinedBorder], that resolves to
|
||||||
@ -423,7 +423,7 @@ abstract class MaterialStateOutlinedBorder extends OutlinedBorder implements Mat
|
|||||||
/// of their current material state and [resolve] the button style's
|
/// of their current material state and [resolve] the button style's
|
||||||
/// material state properties when their value is needed.
|
/// material state properties when their value is needed.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold_center}
|
/// {@tool dartpad --template=stateless_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This example shows how you can override the default text and icon
|
/// This example shows how you can override the default text and icon
|
||||||
/// color (the "foreground color") of a [TextButton] with a
|
/// color (the "foreground color") of a [TextButton] with a
|
||||||
|
@ -16,6 +16,9 @@ import 'navigation_rail_theme.dart';
|
|||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
import 'theme_data.dart';
|
import 'theme_data.dart';
|
||||||
|
|
||||||
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
|
|
||||||
/// A material widget that is meant to be displayed at the left or right of an
|
/// A material widget that is meant to be displayed at the left or right of an
|
||||||
/// app to navigate between a small number of views, typically between three and
|
/// app to navigate between a small number of views, typically between three and
|
||||||
/// five.
|
/// five.
|
||||||
@ -38,7 +41,7 @@ import 'theme_data.dart';
|
|||||||
/// [https://github.com/flutter/samples/blob/master/experimental/web_dashboard/lib/src/widgets/third_party/adaptive_scaffold.dart]
|
/// [https://github.com/flutter/samples/blob/master/experimental/web_dashboard/lib/src/widgets/third_party/adaptive_scaffold.dart]
|
||||||
/// for an example.
|
/// for an example.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material}
|
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This example shows a [NavigationRail] used within a Scaffold with 3
|
/// This example shows a [NavigationRail] used within a Scaffold with 3
|
||||||
/// [NavigationRailDestination]s. The main content is separated by a divider
|
/// [NavigationRailDestination]s. The main content is separated by a divider
|
||||||
|
@ -57,7 +57,7 @@ const Duration _kElevationDuration = Duration(milliseconds: 75);
|
|||||||
/// Outline buttons have a minimum size of 88.0 by 36.0 which can be overridden
|
/// Outline 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_center}
|
/// {@tool dartpad --template=stateless_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// Here is an example of a basic [OutlineButton].
|
/// Here is an example of a basic [OutlineButton].
|
||||||
///
|
///
|
||||||
|
@ -21,6 +21,7 @@ import 'theme.dart';
|
|||||||
import 'tooltip.dart';
|
import 'tooltip.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// enum Commands { heroAndScholar, hurricaneCame }
|
// enum Commands { heroAndScholar, hurricaneCame }
|
||||||
// dynamic _heroAndScholar;
|
// dynamic _heroAndScholar;
|
||||||
// dynamic _selection;
|
// dynamic _selection;
|
||||||
|
@ -243,7 +243,7 @@ class _LinearProgressIndicatorPainter extends CustomPainter {
|
|||||||
/// The minimum height of the indicator can be specified using [minHeight].
|
/// The minimum height of the indicator can be specified using [minHeight].
|
||||||
/// The indicator can be made taller by wrapping the widget with a [SizedBox].
|
/// The indicator can be made taller by wrapping the widget with a [SizedBox].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material_ticker}
|
/// {@tool dartpad --template=stateful_widget_material_ticker_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This example shows a [LinearProgressIndicator] with a changing value.
|
/// This example shows a [LinearProgressIndicator] with a changing value.
|
||||||
///
|
///
|
||||||
@ -481,7 +481,7 @@ class _CircularProgressIndicatorPainter extends CustomPainter {
|
|||||||
/// The indicator arc is displayed with [valueColor], an animated value. To
|
/// The indicator arc is displayed with [valueColor], an animated value. To
|
||||||
/// specify a constant color use: `AlwaysStoppedAnimation<Color>(color)`.
|
/// specify a constant color use: `AlwaysStoppedAnimation<Color>(color)`.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material_ticker}
|
/// {@tool dartpad --template=stateful_widget_material_ticker_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This example shows a [CircularProgressIndicator] with a changing value.
|
/// This example shows a [CircularProgressIndicator] with a changing value.
|
||||||
///
|
///
|
||||||
|
@ -30,7 +30,7 @@ const double _kInnerRadius = 4.5;
|
|||||||
/// will respond to [onChanged] by calling [State.setState] to update the
|
/// will respond to [onChanged] by calling [State.setState] to update the
|
||||||
/// radio button's [groupValue].
|
/// radio button's [groupValue].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold_center}
|
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// Here is an example of Radio widgets wrapped in ListTiles, which is similar
|
/// Here is an example of Radio widgets wrapped in ListTiles, which is similar
|
||||||
/// to what you could get with the RadioListTile widget.
|
/// to what you could get with the RadioListTile widget.
|
||||||
@ -202,7 +202,7 @@ class Radio<T> extends StatefulWidget {
|
|||||||
///
|
///
|
||||||
/// The default is false.
|
/// The default is false.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
/// 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.
|
||||||
///
|
///
|
||||||
|
@ -10,6 +10,7 @@ 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.
|
||||||
@ -40,7 +41,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}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
@ -92,7 +93,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}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
@ -196,7 +197,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}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
@ -386,7 +387,7 @@ class RadioListTile<T> extends StatelessWidget {
|
|||||||
///
|
///
|
||||||
/// The default is false.
|
/// The default is false.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
/// 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.
|
||||||
///
|
///
|
||||||
|
@ -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}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 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.
|
||||||
|
@ -18,6 +18,7 @@ import 'slider_theme.dart';
|
|||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// RangeValues _rangeValues = RangeValues(0.3, 0.7);
|
// RangeValues _rangeValues = RangeValues(0.3, 0.7);
|
||||||
// RangeValues _dollarsRange = RangeValues(50, 100);
|
// RangeValues _dollarsRange = RangeValues(50, 100);
|
||||||
// void setState(VoidCallback fn) { }
|
// void setState(VoidCallback fn) { }
|
||||||
@ -33,7 +34,7 @@ typedef PaintRangeValueIndicator = void Function(PaintingContext context, Offset
|
|||||||
///
|
///
|
||||||
/// {@youtube 560 315 https://www.youtube.com/watch?v=ufb4gIPDmEs}
|
/// {@youtube 560 315 https://www.youtube.com/watch?v=ufb4gIPDmEs}
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// 
|
/// value indicator.](https://flutter.github.io/assets-for-api-docs/assets/material/range_slider.png)
|
||||||
|
@ -12,6 +12,7 @@ import 'material.dart';
|
|||||||
import 'material_localizations.dart';
|
import 'material_localizations.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// class MyDataObject { }
|
// class MyDataObject { }
|
||||||
|
|
||||||
/// The callback used by [ReorderableListView] to move an item to a new
|
/// The callback used by [ReorderableListView] to move an item to a new
|
||||||
@ -59,7 +60,7 @@ typedef ReorderCallback = void Function(int oldIndex, int newIndex);
|
|||||||
/// The [onReorder] parameter is required and will be called when a child
|
/// The [onReorder] parameter is required and will be called when a child
|
||||||
/// widget is dragged to a new position.
|
/// widget is dragged to a new position.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// List<String> _list = List.generate(5, (i) => "${i}");
|
/// List<String> _list = List.generate(5, (i) => "${i}");
|
||||||
|
@ -30,6 +30,7 @@ import 'theme.dart';
|
|||||||
import 'theme_data.dart';
|
import 'theme_data.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
|
// // @dart = 2.9
|
||||||
// TabController tabController;
|
// TabController tabController;
|
||||||
// void setState(VoidCallback fn) { }
|
// void setState(VoidCallback fn) { }
|
||||||
// String appBarTitle;
|
// String appBarTitle;
|
||||||
@ -68,7 +69,7 @@ enum _ScaffoldSlot {
|
|||||||
/// [BuildContext] via [ScaffoldMessenger.of] and use the
|
/// [BuildContext] via [ScaffoldMessenger.of] and use the
|
||||||
/// [ScaffoldMessengerState.showSnackBar] function.
|
/// [ScaffoldMessengerState.showSnackBar] function.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold_center}
|
/// {@tool dartpad --template=stateless_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// Here is an example of showing a [SnackBar] when the user presses a button.
|
/// Here is an example of showing a [SnackBar] when the user presses a button.
|
||||||
///
|
///
|
||||||
@ -111,7 +112,7 @@ class ScaffoldMessenger extends StatefulWidget {
|
|||||||
/// The state from the closest instance of this class that encloses the given
|
/// The state from the closest instance of this class that encloses the given
|
||||||
/// context.
|
/// context.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold_center}
|
/// {@tool dartpad --template=stateless_widget_scaffold_center_no_null_safety}
|
||||||
/// Typical usage of the [ScaffoldMessenger.of] function is to call it in
|
/// Typical usage of the [ScaffoldMessenger.of] function is to call it in
|
||||||
/// response to a user gesture or an application state change.
|
/// response to a user gesture or an application state change.
|
||||||
///
|
///
|
||||||
@ -137,7 +138,7 @@ class ScaffoldMessenger extends StatefulWidget {
|
|||||||
/// function. The [MaterialApp.scaffoldMessengerKey] refers to the root
|
/// function. The [MaterialApp.scaffoldMessengerKey] refers to the root
|
||||||
/// ScaffoldMessenger that is provided by default.
|
/// ScaffoldMessenger that is provided by default.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=freeform}
|
/// {@tool dartpad --template=freeform_no_null_safety}
|
||||||
/// Sometimes [SnackBar]s are produced by code that doesn't have ready access
|
/// Sometimes [SnackBar]s are produced by code that doesn't have ready access
|
||||||
/// to a valid [BuildContext]. One such example of this is when you show a
|
/// to a valid [BuildContext]. One such example of this is when you show a
|
||||||
/// SnackBar from a method outside of the `build` function. In these
|
/// SnackBar from a method outside of the `build` function. In these
|
||||||
@ -303,7 +304,7 @@ class ScaffoldMessengerState extends State<ScaffoldMessenger> with TickerProvide
|
|||||||
/// See [ScaffoldMessenger.of] for information about how to obtain the
|
/// See [ScaffoldMessenger.of] for information about how to obtain the
|
||||||
/// [ScaffoldMessengerState].
|
/// [ScaffoldMessengerState].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold_center}
|
/// {@tool dartpad --template=stateless_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// Here is an example of showing a [SnackBar] when the user presses a button.
|
/// Here is an example of showing a [SnackBar] when the user presses a button.
|
||||||
///
|
///
|
||||||
@ -1258,7 +1259,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
|
|||||||
/// [ScaffoldState] for the current [BuildContext] via [Scaffold.of] and use the
|
/// [ScaffoldState] for the current [BuildContext] via [Scaffold.of] and use the
|
||||||
/// [ScaffoldState.showBottomSheet] function.
|
/// [ScaffoldState.showBottomSheet] function.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material}
|
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||||
/// This example shows a [Scaffold] with a [body] and [FloatingActionButton].
|
/// This example shows a [Scaffold] with a [body] and [FloatingActionButton].
|
||||||
/// The [body] is a [Text] placed in a [Center] in order to center the text
|
/// The [body] is a [Text] placed in a [Center] in order to center the text
|
||||||
/// within the [Scaffold]. The [FloatingActionButton] is connected to a
|
/// within the [Scaffold]. The [FloatingActionButton] is connected to a
|
||||||
@ -1287,7 +1288,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
|
|||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material}
|
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||||
/// This example shows a [Scaffold] with a blueGrey [backgroundColor], [body]
|
/// This example shows a [Scaffold] with a blueGrey [backgroundColor], [body]
|
||||||
/// and [FloatingActionButton]. The [body] is a [Text] placed in a [Center] in
|
/// and [FloatingActionButton]. The [body] is a [Text] placed in a [Center] in
|
||||||
/// order to center the text within the [Scaffold]. The [FloatingActionButton]
|
/// order to center the text within the [Scaffold]. The [FloatingActionButton]
|
||||||
@ -1317,7 +1318,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
|
|||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material}
|
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||||
/// This example shows a [Scaffold] with an [AppBar], a [BottomAppBar] and a
|
/// This example shows a [Scaffold] with an [AppBar], a [BottomAppBar] and a
|
||||||
/// [FloatingActionButton]. The [body] is a [Text] placed in a [Center] in order
|
/// [FloatingActionButton]. The [body] is a [Text] placed in a [Center] in order
|
||||||
/// to center the text within the [Scaffold]. The [FloatingActionButton] is
|
/// to center the text within the [Scaffold]. The [FloatingActionButton] is
|
||||||
@ -1559,7 +1560,7 @@ class Scaffold extends StatefulWidget {
|
|||||||
///
|
///
|
||||||
/// To close the drawer, use [Navigator.pop].
|
/// To close the drawer, use [Navigator.pop].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material}
|
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||||
/// To disable the drawer edge swipe, set the
|
/// To disable the drawer edge swipe, set the
|
||||||
/// [Scaffold.drawerEnableOpenDragGesture] to false. Then, use
|
/// [Scaffold.drawerEnableOpenDragGesture] to false. Then, use
|
||||||
/// [ScaffoldState.openDrawer] to open the drawer and [Navigator.pop] to close
|
/// [ScaffoldState.openDrawer] to open the drawer and [Navigator.pop] to close
|
||||||
@ -1622,7 +1623,7 @@ class Scaffold extends StatefulWidget {
|
|||||||
///
|
///
|
||||||
/// To close the drawer, use [Navigator.pop].
|
/// To close the drawer, use [Navigator.pop].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateful_widget_material}
|
/// {@tool dartpad --template=stateful_widget_material_no_null_safety}
|
||||||
/// To disable the drawer edge swipe, set the
|
/// To disable the drawer edge swipe, set the
|
||||||
/// [Scaffold.endDrawerEnableOpenDragGesture] to false. Then, use
|
/// [Scaffold.endDrawerEnableOpenDragGesture] to false. Then, use
|
||||||
/// [ScaffoldState.openEndDrawer] to open the drawer and [Navigator.pop] to
|
/// [ScaffoldState.openEndDrawer] to open the drawer and [Navigator.pop] to
|
||||||
@ -1789,7 +1790,7 @@ class Scaffold extends StatefulWidget {
|
|||||||
/// If no instance of this class encloses the given context, will cause an
|
/// If no instance of this class encloses the given context, will cause an
|
||||||
/// assert in debug mode, and throw an exception in release mode.
|
/// assert in debug mode, and throw an exception in release mode.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=freeform}
|
/// {@tool dartpad --template=freeform_no_null_safety}
|
||||||
/// Typical usage of the [Scaffold.of] function is to call it from within the
|
/// Typical usage of the [Scaffold.of] function is to call it from within the
|
||||||
/// `build` method of a child of a [Scaffold].
|
/// `build` method of a child of a [Scaffold].
|
||||||
///
|
///
|
||||||
@ -1860,7 +1861,7 @@ class Scaffold extends StatefulWidget {
|
|||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_material}
|
/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
|
||||||
/// When the [Scaffold] is actually created in the same `build` function, the
|
/// When the [Scaffold] is actually created in the same `build` function, the
|
||||||
/// `context` argument to the `build` function can't be used to find the
|
/// `context` argument to the `build` function can't be used to find the
|
||||||
/// [Scaffold] (since it's "above" the widget being returned in the widget
|
/// [Scaffold] (since it's "above" the widget being returned in the widget
|
||||||
@ -2172,7 +2173,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
|
|||||||
/// See [ScaffoldMessenger.of] for information about how to obtain the
|
/// See [ScaffoldMessenger.of] for information about how to obtain the
|
||||||
/// [ScaffoldMessengerState].
|
/// [ScaffoldMessengerState].
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold_center}
|
/// {@tool dartpad --template=stateless_widget_scaffold_center_no_null_safety}
|
||||||
///
|
///
|
||||||
/// Here is an example of showing a [SnackBar] when the user presses a button.
|
/// Here is an example of showing a [SnackBar] when the user presses a button.
|
||||||
///
|
///
|
||||||
@ -2546,7 +2547,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
|
|||||||
/// of the app. Modal bottom sheets can be created and displayed with the
|
/// of the app. Modal bottom sheets can be created and displayed with the
|
||||||
/// [showModalBottomSheet] function.
|
/// [showModalBottomSheet] function.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad --template=stateless_widget_scaffold}
|
/// {@tool dartpad --template=stateless_widget_scaffold_no_null_safety}
|
||||||
///
|
///
|
||||||
/// This example demonstrates how to use `showBottomSheet` to display a
|
/// This example demonstrates how to use `showBottomSheet` to display a
|
||||||
/// bottom sheet when a user taps a button. It also demonstrates how to
|
/// bottom sheet when a user taps a button. It also demonstrates how to
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user