Update samples to use repo analysis options, Fix sample templates and a ton of analyzer issues (#77868)
This commit is contained in:
parent
d6f5767ec8
commit
a8d820a46e
@ -7,6 +7,7 @@
|
|||||||
// To run this, from the root of the Flutter repository:
|
// To run this, from the root of the Flutter repository:
|
||||||
// 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:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:args/args.dart';
|
import 'package:args/args.dart';
|
||||||
@ -41,7 +42,7 @@ void main(List<String> arguments) {
|
|||||||
argParser.addOption(
|
argParser.addOption(
|
||||||
'interactive',
|
'interactive',
|
||||||
abbr: 'i',
|
abbr: 'i',
|
||||||
help: 'Analyzes the sample code in the specified file interactivly.',
|
help: 'Analyzes the sample code in the specified file interactively.',
|
||||||
);
|
);
|
||||||
|
|
||||||
final ArgResults parsedArguments = argParser.parse(arguments);
|
final ArgResults parsedArguments = argParser.parse(arguments);
|
||||||
@ -326,6 +327,8 @@ class SampleChecker {
|
|||||||
void _extractSamples(List<File> files, {Map<String, Section> sectionMap, Map<String, Sample> sampleMap, bool silent = false}) {
|
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>[];
|
||||||
|
int dartpadCount = 0;
|
||||||
|
int sampleCount = 0;
|
||||||
|
|
||||||
for (final File file in files) {
|
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);
|
||||||
@ -430,6 +433,12 @@ class SampleChecker {
|
|||||||
} else if (sampleMatch != null) {
|
} else if (sampleMatch != null) {
|
||||||
inSnippet = sampleMatch != null && (sampleMatch[1] == 'sample' || sampleMatch[1] == 'dartpad');
|
inSnippet = sampleMatch != null && (sampleMatch[1] == 'sample' || sampleMatch[1] == 'dartpad');
|
||||||
if (inSnippet) {
|
if (inSnippet) {
|
||||||
|
if (sampleMatch[1] == 'sample') {
|
||||||
|
sampleCount++;
|
||||||
|
}
|
||||||
|
if (sampleMatch[1] == 'dartpad') {
|
||||||
|
dartpadCount++;
|
||||||
|
}
|
||||||
startLine = Line(
|
startLine = Line(
|
||||||
'',
|
'',
|
||||||
filename: relativeFilePath,
|
filename: relativeFilePath,
|
||||||
@ -455,7 +464,7 @@ class SampleChecker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!silent)
|
if (!silent)
|
||||||
print('Found ${sections.length} sample code sections.');
|
print('Found ${sections.length} snippet code blocks, $sampleCount sample code sections, and $dartpadCount dartpad sections.');
|
||||||
for (final Section section in sections) {
|
for (final Section section in sections) {
|
||||||
final String path = _writeSection(section).path;
|
final String path = _writeSection(section).path;
|
||||||
if (sectionMap != null)
|
if (sectionMap != null)
|
||||||
@ -510,10 +519,10 @@ class SampleChecker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Creates the configuration files necessary for the analyzer to consider
|
/// Creates the configuration files necessary for the analyzer to consider
|
||||||
/// the temporary director a package, and sets which lint rules to enforce.
|
/// the temporary directory a package, and sets which lint rules to enforce.
|
||||||
void _createConfigurationFiles(Directory directory) {
|
void _createConfigurationFiles(Directory directory) {
|
||||||
final File pubSpec = File(path.join(directory.path, 'pubspec.yaml'))..createSync(recursive: true);
|
final File pubSpec = File(path.join(directory.path, 'pubspec.yaml'))..createSync(recursive: true);
|
||||||
final File analysisOptions = File(path.join(directory.path, 'analysis_options.yaml'))..createSync(recursive: true);
|
|
||||||
pubSpec.writeAsStringSync('''
|
pubSpec.writeAsStringSync('''
|
||||||
name: analyze_sample_code
|
name: analyze_sample_code
|
||||||
environment:
|
environment:
|
||||||
@ -524,12 +533,9 @@ dependencies:
|
|||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
''');
|
''');
|
||||||
analysisOptions.writeAsStringSync('''
|
|
||||||
linter:
|
// Copy in the analysis options from the Flutter root.
|
||||||
rules:
|
File(path.join(_flutterRoot,'analysis_options.yaml')).copySync(path.join(directory.path, 'analysis_options.yaml'));
|
||||||
- unnecessary_const
|
|
||||||
- unnecessary_new
|
|
||||||
''');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Writes out a sample section to the disk and returns the file.
|
/// Writes out a sample section to the disk and returns the file.
|
||||||
@ -606,22 +612,30 @@ linter:
|
|||||||
final String kBullet = Platform.isWindows ? ' - ' : ' • ';
|
final String kBullet = Platform.isWindows ? ' - ' : ' • ';
|
||||||
// RegExp to match an error output line of the analyzer.
|
// RegExp to match an error output line of the analyzer.
|
||||||
final RegExp errorPattern = RegExp(
|
final RegExp errorPattern = RegExp(
|
||||||
'^ +([a-z]+)$kBullet(.+)$kBullet(.+):([0-9]+):([0-9]+)$kBullet([-a-z_]+)\$',
|
'^ +(?<type>[a-z]+)'
|
||||||
|
'$kBullet(?<description>.+)'
|
||||||
|
'$kBullet(?<file>.+):(?<line>[0-9]+):(?<column>[0-9]+)'
|
||||||
|
'$kBullet(?<code>[-a-z_]+)\$',
|
||||||
caseSensitive: false,
|
caseSensitive: false,
|
||||||
);
|
);
|
||||||
bool unknownAnalyzerErrors = false;
|
bool unknownAnalyzerErrors = false;
|
||||||
final int headerLength = headers.length + 3;
|
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 RegExpMatch match = errorPattern.firstMatch(error);
|
||||||
if (parts != null) {
|
if (match == null) {
|
||||||
final String message = parts[2];
|
stderr.writeln('Analyzer output: $error');
|
||||||
final File file = File(path.join(_tempDirectory.path, parts[3]));
|
unknownAnalyzerErrors = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
final String type = match.namedGroup('type');
|
||||||
|
final String message = match.namedGroup('description');
|
||||||
|
final File file = File(path.join(_tempDirectory.path, match.namedGroup('file')));
|
||||||
final List<String> fileContents = file.readAsLinesSync();
|
final List<String> fileContents = file.readAsLinesSync();
|
||||||
final bool isSnippet = path.basename(file.path).startsWith('snippet.');
|
final bool isSnippet = path.basename(file.path).startsWith('snippet.');
|
||||||
final bool isSample = path.basename(file.path).startsWith('sample.');
|
final bool isSample = path.basename(file.path).startsWith('sample.');
|
||||||
final String line = parts[4];
|
final String line = match.namedGroup('line');
|
||||||
final String column = parts[5];
|
final String column = match.namedGroup('column');
|
||||||
final String errorCode = parts[6];
|
final String errorCode = match.namedGroup('code');
|
||||||
final int lineNumber = int.parse(line, radix: 10) - (isSnippet ? headerLength : 0);
|
final int lineNumber = int.parse(line, radix: 10) - (isSnippet ? headerLength : 0);
|
||||||
final int columnNumber = int.parse(column, radix: 10);
|
final int columnNumber = int.parse(column, radix: 10);
|
||||||
|
|
||||||
@ -630,6 +644,7 @@ linter:
|
|||||||
addAnalysisError(
|
addAnalysisError(
|
||||||
file,
|
file,
|
||||||
AnalysisError(
|
AnalysisError(
|
||||||
|
type,
|
||||||
lineNumber,
|
lineNumber,
|
||||||
columnNumber,
|
columnNumber,
|
||||||
message,
|
message,
|
||||||
@ -652,6 +667,7 @@ linter:
|
|||||||
addAnalysisError(
|
addAnalysisError(
|
||||||
file,
|
file,
|
||||||
AnalysisError(
|
AnalysisError(
|
||||||
|
type,
|
||||||
lineNumber,
|
lineNumber,
|
||||||
columnNumber,
|
columnNumber,
|
||||||
message,
|
message,
|
||||||
@ -665,6 +681,7 @@ linter:
|
|||||||
addAnalysisError(
|
addAnalysisError(
|
||||||
file,
|
file,
|
||||||
AnalysisError(
|
AnalysisError(
|
||||||
|
type,
|
||||||
lineNumber,
|
lineNumber,
|
||||||
columnNumber,
|
columnNumber,
|
||||||
message,
|
message,
|
||||||
@ -692,6 +709,7 @@ linter:
|
|||||||
addAnalysisError(
|
addAnalysisError(
|
||||||
file,
|
file,
|
||||||
AnalysisError(
|
AnalysisError(
|
||||||
|
type,
|
||||||
actualLine.line,
|
actualLine.line,
|
||||||
actualLine.indent + fileContents[lineNumber - 2].length - 1,
|
actualLine.indent + fileContents[lineNumber - 2].length - 1,
|
||||||
'Unexpected comma at end of sample code.',
|
'Unexpected comma at end of sample code.',
|
||||||
@ -704,6 +722,7 @@ linter:
|
|||||||
addAnalysisError(
|
addAnalysisError(
|
||||||
file,
|
file,
|
||||||
AnalysisError(
|
AnalysisError(
|
||||||
|
type,
|
||||||
lineNumber - 1,
|
lineNumber - 1,
|
||||||
columnNumber,
|
columnNumber,
|
||||||
message,
|
message,
|
||||||
@ -716,6 +735,7 @@ linter:
|
|||||||
addAnalysisError(
|
addAnalysisError(
|
||||||
file,
|
file,
|
||||||
AnalysisError(
|
AnalysisError(
|
||||||
|
type,
|
||||||
actualLine.line,
|
actualLine.line,
|
||||||
actualLine.indent + columnNumber,
|
actualLine.indent + columnNumber,
|
||||||
message,
|
message,
|
||||||
@ -725,10 +745,6 @@ linter:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
stderr.writeln('Analyzer output: $error');
|
|
||||||
unknownAnalyzerErrors = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (_exitCode == 1 && analysisErrors.isEmpty && !unknownAnalyzerErrors) {
|
if (_exitCode == 1 && analysisErrors.isEmpty && !unknownAnalyzerErrors) {
|
||||||
_exitCode = 0;
|
_exitCode = 0;
|
||||||
@ -906,6 +922,7 @@ class Sample {
|
|||||||
/// Changes how it converts to a string based on the source of the error.
|
/// Changes how it converts to a string based on the source of the error.
|
||||||
class AnalysisError {
|
class AnalysisError {
|
||||||
const AnalysisError(
|
const AnalysisError(
|
||||||
|
this.type,
|
||||||
this.line,
|
this.line,
|
||||||
this.column,
|
this.column,
|
||||||
this.message,
|
this.message,
|
||||||
@ -914,6 +931,7 @@ class AnalysisError {
|
|||||||
this.sample,
|
this.sample,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final String type;
|
||||||
final int line;
|
final int line;
|
||||||
final int column;
|
final int column;
|
||||||
final String message;
|
final String message;
|
||||||
@ -924,19 +942,18 @@ class AnalysisError {
|
|||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
return '${source.toStringWithColumn(column)}\n>>> $message ($errorCode)';
|
return '${source.toStringWithColumn(column)}\n>>> $type: $message ($errorCode)';
|
||||||
} else if (sample != null) {
|
} else if (sample != null) {
|
||||||
return 'In sample starting at '
|
return 'In sample starting at '
|
||||||
'${sample.start.filename}:${sample.start.line}:${sample.contents[line - 1]}\n'
|
'${sample.start.filename}:${sample.start.line}:${sample.contents[line - 1]}\n'
|
||||||
'>>> $message ($errorCode)';
|
'>>> $type: $message ($errorCode)';
|
||||||
} else {
|
} else {
|
||||||
return '<source unknown>:$line:$column\n>>> $message ($errorCode)';
|
return '<source unknown>:$line:$column\n>>> $type: $message ($errorCode)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _runInteractive(Directory tempDir, Directory flutterPackage, String filePath) async {
|
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);
|
filePath = path.isAbsolute(filePath) ? filePath : path.join(path.current, filePath);
|
||||||
final File file = File(filePath);
|
final File file = File(filePath);
|
||||||
if (!file.existsSync()) {
|
if (!file.existsSync()) {
|
||||||
@ -955,6 +972,7 @@ Future<void> _runInteractive(Directory tempDir, Directory flutterPackage, String
|
|||||||
});
|
});
|
||||||
print('Using temp dir ${tempDir.path}');
|
print('Using temp dir ${tempDir.path}');
|
||||||
}
|
}
|
||||||
|
print('Starting up in interactive mode on ${path.relative(filePath, from: _flutterRoot)} ...');
|
||||||
|
|
||||||
void analyze(SampleChecker checker, File file) {
|
void analyze(SampleChecker checker, File file) {
|
||||||
final Map<String, Section> sections = <String, Section>{};
|
final Map<String, Section> sections = <String, Section>{};
|
||||||
@ -976,8 +994,32 @@ Future<void> _runInteractive(Directory tempDir, Directory flutterPackage, String
|
|||||||
.._createConfigurationFiles(tempDir);
|
.._createConfigurationFiles(tempDir);
|
||||||
analyze(checker, file);
|
analyze(checker, file);
|
||||||
|
|
||||||
Watcher(file.absolute.path).events.listen((_) {
|
print('Type "q" to quit, or "r" to delete temp dir and manually reload.');
|
||||||
|
|
||||||
|
void rerun() {
|
||||||
print('\n\nRerunning...');
|
print('\n\nRerunning...');
|
||||||
|
try {
|
||||||
analyze(checker, file);
|
analyze(checker, file);
|
||||||
|
} on SampleCheckerException catch (e) {
|
||||||
|
print('Caught Exception (${e.runtimeType}), press "r" to retry:\n$e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stdin.lineMode = false;
|
||||||
|
stdin.echoMode = false;
|
||||||
|
stdin.transform(utf8.decoder).listen((String input) {
|
||||||
|
switch (input) {
|
||||||
|
case 'q':
|
||||||
|
print('Exiting...');
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
print('Deleting temp files...');
|
||||||
|
tempDir.deleteSync(recursive: true);
|
||||||
|
rerun();
|
||||||
|
break;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Watcher(file.absolute.path).events.listen((_) => rerun());
|
||||||
}
|
}
|
||||||
|
@ -17,20 +17,32 @@ 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>[
|
||||||
|
'In sample starting at known_broken_documentation.dart:117:bool? _visible = true;',
|
||||||
|
'>>> info: Use late for private members with non-nullable type (use_late_for_private_fields_and_variables)',
|
||||||
'In sample starting at known_broken_documentation.dart:117: child: Text(title),',
|
'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)',
|
'>>> error: 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(',
|
'known_broken_documentation.dart:30:9: new Opacity(',
|
||||||
'>>> Unnecessary new keyword (unnecessary_new)',
|
'>>> info: Unnecessary new keyword (unnecessary_new)',
|
||||||
'known_broken_documentation.dart:62:9: new Opacity(',
|
'known_broken_documentation.dart:62:9: new Opacity(',
|
||||||
'>>> Unnecessary new keyword (unnecessary_new)',
|
'>>> info: Unnecessary new keyword (unnecessary_new)',
|
||||||
|
'known_broken_documentation.dart:95:9: const text0 = Text(\'Poor wandering ones!\');',
|
||||||
|
'>>> info: Specify type annotations (always_specify_types)',
|
||||||
|
'known_broken_documentation.dart:103:9: const text1 = _Text(\'Poor wandering ones!\');',
|
||||||
|
'>>> info: Specify type annotations (always_specify_types)',
|
||||||
|
'known_broken_documentation.dart:111:9: final String? bar = \'Hello\';',
|
||||||
|
'>>> info: Prefer const over final for declarations (prefer_const_declarations)',
|
||||||
|
'known_broken_documentation.dart:111:23: final String? bar = \'Hello\';',
|
||||||
|
'>>> info: Use a non-nullable type for a final variable initialized with a non-nullable value (unnecessary_nullable_for_final_variable_declarations)',
|
||||||
|
'known_broken_documentation.dart:112:9: final int foo = null;',
|
||||||
|
'>>> info: Prefer const over final for declarations (prefer_const_declarations)',
|
||||||
'known_broken_documentation.dart:112:25: final int foo = null;',
|
'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)',
|
'>>> error: A value of type \'Null\' can\'t be assigned to a variable of type \'int\' (invalid_assignment)',
|
||||||
'',
|
'',
|
||||||
'Found 2 sample code errors.',
|
'Found 2 sample code errors.',
|
||||||
''
|
''
|
||||||
]);
|
]);
|
||||||
expect(stdoutLines, <String>[
|
expect(stdoutLines, <String>[
|
||||||
'Found 8 sample code sections.',
|
'Found 8 snippet code blocks, 0 sample code sections, and 2 dartpad sections.',
|
||||||
'Starting analysis of code samples.',
|
'Starting analysis of code samples.',
|
||||||
'',
|
'',
|
||||||
]);
|
]);
|
||||||
|
@ -28,7 +28,12 @@ Future<String> capture(AsyncVoidCallback callback, { int exitCode = 0 }) async {
|
|||||||
} finally {
|
} finally {
|
||||||
print = oldPrint;
|
print = oldPrint;
|
||||||
}
|
}
|
||||||
|
if (stdout.supportsAnsiEscapes) {
|
||||||
|
// Remove ANSI escapes when this test is running on a terminal.
|
||||||
|
return buffer.toString().replaceAll(RegExp(r'(\x9B|\x1B\[)[0-?]{1,3}[ -/]*[@-~]'), '');
|
||||||
|
} else {
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
|
{{code-dartImports}}
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
{{code-main}}
|
{{code-main}}
|
||||||
|
@ -2,20 +2,23 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/widgets.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return WidgetsApp(
|
return const WidgetsApp(
|
||||||
title: 'Flutter Code Sample',
|
title: 'Flutter Code Sample',
|
||||||
home: MyStatefulWidget(),
|
home: MyStatefulWidget(),
|
||||||
color: const Color(0xffffffff),
|
color: Color(0xffffffff),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,7 +27,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);
|
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -2,19 +2,22 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoApp(
|
return const CupertinoApp(
|
||||||
title: _title,
|
title: _title,
|
||||||
home: MyStatefulWidget(),
|
home: MyStatefulWidget(),
|
||||||
);
|
);
|
||||||
@ -25,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);
|
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -2,19 +2,22 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoApp(
|
return const CupertinoApp(
|
||||||
title: _title,
|
title: _title,
|
||||||
home: CupertinoPageScaffold(
|
home: CupertinoPageScaffold(
|
||||||
navigationBar: CupertinoNavigationBar(middle: const Text(_title)),
|
navigationBar: CupertinoNavigationBar(middle: const Text(_title)),
|
||||||
@ -28,7 +31,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);
|
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -2,19 +2,22 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoApp(
|
return const CupertinoApp(
|
||||||
title: _title,
|
title: _title,
|
||||||
home: MyStatefulWidget(),
|
home: MyStatefulWidget(),
|
||||||
);
|
);
|
||||||
@ -25,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);
|
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -2,19 +2,22 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return const MaterialApp(
|
||||||
title: _title,
|
title: _title,
|
||||||
home: MyStatefulWidget(),
|
home: MyStatefulWidget(),
|
||||||
);
|
);
|
||||||
@ -25,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);
|
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -2,19 +2,22 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return const MaterialApp(
|
||||||
title: _title,
|
title: _title,
|
||||||
home: MyStatefulWidget(),
|
home: MyStatefulWidget(),
|
||||||
);
|
);
|
||||||
@ -25,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);
|
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -2,19 +2,22 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return WidgetsApp(
|
return WidgetsApp(
|
||||||
title: 'Flutter Code Sample',
|
title: 'Flutter Code Sample',
|
||||||
home: Center(
|
home: const Center(
|
||||||
child: MyStatefulWidget(restorationId: 'main'),
|
child: MyStatefulWidget(restorationId: 'main'),
|
||||||
),
|
),
|
||||||
color: const Color(0xffffffff),
|
color: const Color(0xffffffff),
|
||||||
@ -26,7 +29,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, this.restorationId}) : super(key: key);
|
const MyStatefulWidget({Key? key, this.restorationId}) : super(key: key);
|
||||||
|
|
||||||
final String? restorationId;
|
final String? restorationId;
|
||||||
|
|
||||||
|
@ -2,14 +2,17 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -18,7 +21,7 @@ class MyApp extends StatelessWidget {
|
|||||||
title: _title,
|
title: _title,
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(title: const Text(_title)),
|
appBar: AppBar(title: const Text(_title)),
|
||||||
body: MyStatefulWidget(),
|
body: const MyStatefulWidget(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -28,7 +31,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);
|
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -2,14 +2,17 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -18,7 +21,7 @@ class MyApp extends StatelessWidget {
|
|||||||
title: _title,
|
title: _title,
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(title: const Text(_title)),
|
appBar: AppBar(title: const Text(_title)),
|
||||||
body: Center(
|
body: const Center(
|
||||||
child: MyStatefulWidget(),
|
child: MyStatefulWidget(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -30,7 +33,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);
|
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -2,14 +2,17 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -18,7 +21,7 @@ class MyApp extends StatelessWidget {
|
|||||||
title: _title,
|
title: _title,
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(title: const Text(_title)),
|
appBar: AppBar(title: const Text(_title)),
|
||||||
body: Center(
|
body: const Center(
|
||||||
child: MyStatefulWidget(),
|
child: MyStatefulWidget(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -30,7 +33,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);
|
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -2,20 +2,23 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/widgets.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return WidgetsApp(
|
return const WidgetsApp(
|
||||||
title: 'Flutter Code Sample',
|
title: 'Flutter Code Sample',
|
||||||
home: MyStatefulWidget(),
|
home: MyStatefulWidget(),
|
||||||
color: const Color(0xffffffff),
|
color: Color(0xffffffff),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,7 +27,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);
|
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
|
@ -2,21 +2,22 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/widgets.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return WidgetsApp(
|
return WidgetsApp(
|
||||||
title: 'Flutter Code Sample',
|
title: 'Flutter Code Sample',
|
||||||
builder: (BuildContext context, Widget navigator) {
|
builder: (BuildContext context, Widget? navigator) => const MyStatelessWidget(),
|
||||||
return MyStatelessWidget();
|
|
||||||
},
|
|
||||||
color: const Color(0xffffffff),
|
color: const Color(0xffffffff),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -26,7 +27,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);
|
const MyStatelessWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
{{code}}
|
{{code}}
|
||||||
|
@ -2,19 +2,22 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoApp(
|
return const CupertinoApp(
|
||||||
title: _title,
|
title: _title,
|
||||||
home: MyStatelessWidget(),
|
home: MyStatelessWidget(),
|
||||||
);
|
);
|
||||||
@ -26,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);
|
const MyStatelessWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
{{code}}
|
{{code}}
|
||||||
|
@ -2,19 +2,22 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoApp(
|
return const CupertinoApp(
|
||||||
title: _title,
|
title: _title,
|
||||||
home: CupertinoPageScaffold(
|
home: CupertinoPageScaffold(
|
||||||
navigationBar: CupertinoNavigationBar(middle: const Text(_title)),
|
navigationBar: CupertinoNavigationBar(middle: const Text(_title)),
|
||||||
@ -29,7 +32,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);
|
const MyStatelessWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
{{code}}
|
{{code}}
|
||||||
|
@ -2,19 +2,22 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return const MaterialApp(
|
||||||
title: _title,
|
title: _title,
|
||||||
home: MyStatelessWidget(),
|
home: MyStatelessWidget(),
|
||||||
);
|
);
|
||||||
@ -26,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);
|
const MyStatelessWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
{{code}}
|
{{code}}
|
||||||
|
@ -2,14 +2,17 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -18,7 +21,7 @@ class MyApp extends StatelessWidget {
|
|||||||
title: _title,
|
title: _title,
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(title: const Text(_title)),
|
appBar: AppBar(title: const Text(_title)),
|
||||||
body: MyStatelessWidget(),
|
body: const MyStatelessWidget(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -29,7 +32,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);
|
const MyStatelessWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
{{code}}
|
{{code}}
|
||||||
|
@ -2,14 +2,17 @@
|
|||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
{{code-dartImports}}
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
{{code-imports}}
|
{{code-imports}}
|
||||||
|
|
||||||
void main() => runApp(new MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
/// This is the main application widget.
|
/// This is the main application widget.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const String _title = 'Flutter Code Sample';
|
static const String _title = 'Flutter Code Sample';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -18,7 +21,7 @@ class MyApp extends StatelessWidget {
|
|||||||
title: _title,
|
title: _title,
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(title: const Text(_title)),
|
appBar: AppBar(title: const Text(_title)),
|
||||||
body: Center(
|
body: const Center(
|
||||||
child: MyStatelessWidget(),
|
child: MyStatelessWidget(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -31,7 +34,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);
|
const MyStatelessWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
{{code}}
|
{{code}}
|
||||||
|
@ -138,7 +138,7 @@ abstract class Animation<T> extends Listenable implements ValueListenable<T> {
|
|||||||
/// final Animatable<Alignment> _tween = AlignmentTween(begin: Alignment.topLeft, end: Alignment.topRight)
|
/// final Animatable<Alignment> _tween = AlignmentTween(begin: Alignment.topLeft, end: Alignment.topRight)
|
||||||
/// .chain(CurveTween(curve: Curves.easeIn));
|
/// .chain(CurveTween(curve: Curves.easeIn));
|
||||||
/// // ...
|
/// // ...
|
||||||
/// Animation<Alignment> _alignment2 = _controller.drive(_tween);
|
/// final Animation<Alignment> _alignment2 = _controller.drive(_tween);
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
/// {@tool snippet}
|
/// {@tool snippet}
|
||||||
|
@ -136,7 +136,7 @@ enum AnimationBehavior {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class Foo extends StatefulWidget {
|
/// class Foo extends StatefulWidget {
|
||||||
/// Foo({ Key? key, required this.duration }) : super(key: key);
|
/// const Foo({ Key? key, required this.duration }) : super(key: key);
|
||||||
///
|
///
|
||||||
/// final Duration duration;
|
/// final Duration duration;
|
||||||
///
|
///
|
||||||
|
@ -339,8 +339,8 @@ class Cubic extends Curve {
|
|||||||
/// Offset(0.93, 0.93),
|
/// Offset(0.93, 0.93),
|
||||||
/// Offset(0.05, 0.75),
|
/// Offset(0.05, 0.75),
|
||||||
/// ],
|
/// ],
|
||||||
/// startHandle: Offset(0.93, 0.93),
|
/// startHandle: const Offset(0.93, 0.93),
|
||||||
/// endHandle: Offset(0.18, 0.23),
|
/// endHandle: const Offset(0.18, 0.23),
|
||||||
/// tension: 0.0,
|
/// tension: 0.0,
|
||||||
/// );
|
/// );
|
||||||
///
|
///
|
||||||
@ -389,7 +389,7 @@ class Cubic extends Curve {
|
|||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// // Scale the path values to match the -1.0 to 1.0 domain of the Alignment widget.
|
/// // Scale the path values to match the -1.0 to 1.0 domain of the Alignment widget.
|
||||||
/// final Offset position = widget.path.transform(animation.value) * 2.0 - Offset(1.0, 1.0);
|
/// final Offset position = widget.path.transform(animation.value) * 2.0 - const Offset(1.0, 1.0);
|
||||||
/// return Align(
|
/// return Align(
|
||||||
/// alignment: Alignment(position.dx, position.dy),
|
/// alignment: Alignment(position.dx, position.dy),
|
||||||
/// child: widget.child,
|
/// child: widget.child,
|
||||||
@ -411,7 +411,7 @@ class Cubic extends Curve {
|
|||||||
/// backgroundColor: Colors.yellow,
|
/// backgroundColor: Colors.yellow,
|
||||||
/// child: DefaultTextStyle(
|
/// child: DefaultTextStyle(
|
||||||
/// style: Theme.of(context).textTheme.headline6!,
|
/// style: Theme.of(context).textTheme.headline6!,
|
||||||
/// child: Text("B"), // Buzz, buzz!
|
/// child: const Text('B'), // Buzz, buzz!
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -22,7 +22,7 @@ import 'tween.dart';
|
|||||||
/// for the next 20%, and then returns to 5.0 for the final 40%.
|
/// for the next 20%, and then returns to 5.0 for the final 40%.
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// final Animation<double> animation = TweenSequence(
|
/// final Animation<double> animation = TweenSequence<double>(
|
||||||
/// <TweenSequenceItem<double>>[
|
/// <TweenSequenceItem<double>>[
|
||||||
/// TweenSequenceItem<double>(
|
/// TweenSequenceItem<double>(
|
||||||
/// tween: Tween<double>(begin: 5.0, end: 10.0)
|
/// tween: Tween<double>(begin: 5.0, end: 10.0)
|
||||||
|
@ -105,6 +105,8 @@ const double _kDividerThickness = 1.0;
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class MyStatefulWidget extends StatefulWidget {
|
/// class MyStatefulWidget extends StatefulWidget {
|
||||||
|
/// const MyStatefulWidget({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// _MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
/// _MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||||
/// }
|
/// }
|
||||||
@ -116,12 +118,12 @@ const double _kDividerThickness = 1.0;
|
|||||||
/// child: Center(
|
/// child: Center(
|
||||||
/// child: CupertinoButton(
|
/// child: CupertinoButton(
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// showCupertinoModalPopup(
|
/// showCupertinoModalPopup<void>(
|
||||||
/// context: context,
|
/// context: context,
|
||||||
/// builder: (BuildContext context) => CupertinoActionSheet(
|
/// builder: (BuildContext context) => CupertinoActionSheet(
|
||||||
/// title: const Text('Title'),
|
/// title: const Text('Title'),
|
||||||
/// message: const Text('Message'),
|
/// message: const Text('Message'),
|
||||||
/// actions: [
|
/// actions: <CupertinoActionSheetAction>[
|
||||||
/// CupertinoActionSheetAction(
|
/// CupertinoActionSheetAction(
|
||||||
/// child: const Text('Action One'),
|
/// child: const Text('Action One'),
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
@ -138,7 +140,7 @@ const double _kDividerThickness = 1.0;
|
|||||||
/// ),
|
/// ),
|
||||||
/// );
|
/// );
|
||||||
/// },
|
/// },
|
||||||
/// child: Text('CupertinoActionSheet'),
|
/// child: const Text('CupertinoActionSheet'),
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// );
|
/// );
|
||||||
|
@ -57,10 +57,10 @@ import 'theme.dart';
|
|||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// CupertinoApp(
|
/// const CupertinoApp(
|
||||||
/// home: CupertinoPageScaffold(
|
/// home: CupertinoPageScaffold(
|
||||||
/// navigationBar: CupertinoNavigationBar(
|
/// navigationBar: CupertinoNavigationBar(
|
||||||
/// middle: const Text('Home'),
|
/// middle: Text('Home'),
|
||||||
/// ),
|
/// ),
|
||||||
/// child: Center(child: Icon(CupertinoIcons.share)),
|
/// child: Center(child: Icon(CupertinoIcons.share)),
|
||||||
/// ),
|
/// ),
|
||||||
@ -77,17 +77,17 @@ import 'theme.dart';
|
|||||||
/// CupertinoApp(
|
/// CupertinoApp(
|
||||||
/// routes: <String, WidgetBuilder>{
|
/// routes: <String, WidgetBuilder>{
|
||||||
/// '/': (BuildContext context) {
|
/// '/': (BuildContext context) {
|
||||||
/// return CupertinoPageScaffold(
|
/// return const CupertinoPageScaffold(
|
||||||
/// navigationBar: CupertinoNavigationBar(
|
/// navigationBar: CupertinoNavigationBar(
|
||||||
/// middle: const Text('Home Route'),
|
/// middle: Text('Home Route'),
|
||||||
/// ),
|
/// ),
|
||||||
/// child: Center(child: Icon(CupertinoIcons.share)),
|
/// child: Center(child: Icon(CupertinoIcons.share)),
|
||||||
/// );
|
/// );
|
||||||
/// },
|
/// },
|
||||||
/// '/about': (BuildContext context) {
|
/// '/about': (BuildContext context) {
|
||||||
/// return CupertinoPageScaffold(
|
/// return const CupertinoPageScaffold(
|
||||||
/// navigationBar: CupertinoNavigationBar(
|
/// navigationBar: CupertinoNavigationBar(
|
||||||
/// middle: const Text('About Route'),
|
/// middle: Text('About Route'),
|
||||||
/// ),
|
/// ),
|
||||||
/// child: Center(child: Icon(CupertinoIcons.share)),
|
/// child: Center(child: Icon(CupertinoIcons.share)),
|
||||||
/// );
|
/// );
|
||||||
@ -104,14 +104,14 @@ import 'theme.dart';
|
|||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// CupertinoApp(
|
/// const CupertinoApp(
|
||||||
/// theme: CupertinoThemeData(
|
/// theme: CupertinoThemeData(
|
||||||
/// brightness: Brightness.dark,
|
/// brightness: Brightness.dark,
|
||||||
/// primaryColor: CupertinoColors.systemOrange,
|
/// primaryColor: CupertinoColors.systemOrange,
|
||||||
/// ),
|
/// ),
|
||||||
/// home: CupertinoPageScaffold(
|
/// home: CupertinoPageScaffold(
|
||||||
/// navigationBar: CupertinoNavigationBar(
|
/// navigationBar: CupertinoNavigationBar(
|
||||||
/// middle: const Text('CupertinoApp Theme'),
|
/// middle: Text('CupertinoApp Theme'),
|
||||||
/// ),
|
/// ),
|
||||||
/// child: Center(child: Icon(CupertinoIcons.share)),
|
/// child: Center(child: Icon(CupertinoIcons.share)),
|
||||||
/// ),
|
/// ),
|
||||||
@ -374,7 +374,7 @@ class CupertinoApp extends StatefulWidget {
|
|||||||
/// return WidgetsApp(
|
/// return WidgetsApp(
|
||||||
/// actions: <Type, Action<Intent>>{
|
/// actions: <Type, Action<Intent>>{
|
||||||
/// ... WidgetsApp.defaultActions,
|
/// ... WidgetsApp.defaultActions,
|
||||||
/// ActivateAction: CallbackAction(
|
/// ActivateAction: CallbackAction<Intent>(
|
||||||
/// onInvoke: (Intent intent) {
|
/// onInvoke: (Intent intent) {
|
||||||
/// // Do something here...
|
/// // Do something here...
|
||||||
/// return null;
|
/// return null;
|
||||||
|
@ -601,7 +601,7 @@ class CupertinoColors {
|
|||||||
/// CupertinoButton(
|
/// CupertinoButton(
|
||||||
/// child: child,
|
/// child: child,
|
||||||
/// // CupertinoDynamicColor works out of box in a CupertinoButton.
|
/// // CupertinoDynamicColor works out of box in a CupertinoButton.
|
||||||
/// color: CupertinoDynamicColor.withBrightness(
|
/// color: const CupertinoDynamicColor.withBrightness(
|
||||||
/// color: CupertinoColors.white,
|
/// color: CupertinoColors.white,
|
||||||
/// darkColor: CupertinoColors.black,
|
/// darkColor: CupertinoColors.black,
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -86,7 +86,7 @@ enum _ContextMenuLocation {
|
|||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// body: Center(
|
/// body: Center(
|
||||||
/// child: Container(
|
/// child: SizedBox(
|
||||||
/// width: 100,
|
/// width: 100,
|
||||||
/// height: 100,
|
/// height: 100,
|
||||||
/// child: CupertinoContextMenu(
|
/// child: CupertinoContextMenu(
|
||||||
|
@ -41,7 +41,7 @@ const EdgeInsetsGeometry _kDefaultPadding =
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class FlutterDemo extends StatefulWidget {
|
/// class FlutterDemo extends StatefulWidget {
|
||||||
/// FlutterDemo({Key? key}) : super(key: key);
|
/// const FlutterDemo({Key? key}) : super(key: key);
|
||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// _FlutterDemoState createState() => _FlutterDemoState();
|
/// _FlutterDemoState createState() => _FlutterDemoState();
|
||||||
@ -55,20 +55,20 @@ const EdgeInsetsGeometry _kDefaultPadding =
|
|||||||
/// return CupertinoPageScaffold(
|
/// return CupertinoPageScaffold(
|
||||||
/// child: Center(
|
/// child: Center(
|
||||||
/// child: CupertinoFormSection(
|
/// child: CupertinoFormSection(
|
||||||
/// header: Text('SECTION 1'),
|
/// header: const Text('SECTION 1'),
|
||||||
/// children: <Widget>[
|
/// children: <Widget>[
|
||||||
/// CupertinoFormRow(
|
/// CupertinoFormRow(
|
||||||
/// child: CupertinoSwitch(
|
/// child: CupertinoSwitch(
|
||||||
/// value: this.toggleValue,
|
/// value: toggleValue,
|
||||||
/// onChanged: (value) {
|
/// onChanged: (bool value) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
/// this.toggleValue = value;
|
/// toggleValue = value;
|
||||||
/// });
|
/// });
|
||||||
/// },
|
/// },
|
||||||
/// ),
|
/// ),
|
||||||
/// prefix: Text('Toggle'),
|
/// prefix: const Text('Toggle'),
|
||||||
/// helper: Text('Use your instincts'),
|
/// helper: const Text('Use your instincts'),
|
||||||
/// error: toggleValue ? Text('Cannot be true') : null,
|
/// error: toggleValue ? const Text('Cannot be true') : null,
|
||||||
/// ),
|
/// ),
|
||||||
/// ],
|
/// ],
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -189,6 +189,7 @@ bool _isTransitionable(BuildContext context) {
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return CupertinoPageScaffold(
|
/// return CupertinoPageScaffold(
|
||||||
/// navigationBar: CupertinoNavigationBar(
|
/// navigationBar: CupertinoNavigationBar(
|
||||||
@ -197,7 +198,7 @@ bool _isTransitionable(BuildContext context) {
|
|||||||
/// middle: const Text('Sample Code'),
|
/// middle: const Text('Sample Code'),
|
||||||
/// ),
|
/// ),
|
||||||
/// child: Column(
|
/// child: Column(
|
||||||
/// children: [
|
/// children: <Widget>[
|
||||||
/// Container(height: 50, color: CupertinoColors.systemRed),
|
/// Container(height: 50, color: CupertinoColors.systemRed),
|
||||||
/// Container(height: 50, color: CupertinoColors.systemGreen),
|
/// Container(height: 50, color: CupertinoColors.systemGreen),
|
||||||
/// Container(height: 50, color: CupertinoColors.systemBlue),
|
/// Container(height: 50, color: CupertinoColors.systemBlue),
|
||||||
|
@ -26,15 +26,16 @@ import 'theme.dart';
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// int _count = 0;
|
/// int _count = 0;
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return CupertinoPageScaffold(
|
/// return CupertinoPageScaffold(
|
||||||
/// // Uncomment to change the background color
|
/// // Uncomment to change the background color
|
||||||
/// // backgroundColor: CupertinoColors.systemPink,
|
/// // backgroundColor: CupertinoColors.systemPink,
|
||||||
/// navigationBar: CupertinoNavigationBar(
|
/// navigationBar: const CupertinoNavigationBar(
|
||||||
/// middle: const Text('Sample Code'),
|
/// middle: const Text('Sample Code'),
|
||||||
/// ),
|
/// ),
|
||||||
/// child: ListView(
|
/// child: ListView(
|
||||||
/// children: [
|
/// children: <Widget>[
|
||||||
/// CupertinoButton(
|
/// CupertinoButton(
|
||||||
/// onPressed: () => setState(() => _count++),
|
/// onPressed: () => setState(() => _count++),
|
||||||
/// child: const Icon(CupertinoIcons.add),
|
/// child: const Icon(CupertinoIcons.add),
|
||||||
|
@ -273,12 +273,12 @@ typedef RefreshCallback = Future<void> Function();
|
|||||||
/// adds a new item to the top of the list view.
|
/// adds a new item to the top of the list view.
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// List<Color> colors = [
|
/// List<Color> colors = <Color>[
|
||||||
/// CupertinoColors.systemYellow,
|
/// CupertinoColors.systemYellow,
|
||||||
/// CupertinoColors.systemOrange,
|
/// CupertinoColors.systemOrange,
|
||||||
/// CupertinoColors.systemPink
|
/// CupertinoColors.systemPink
|
||||||
/// ];
|
/// ];
|
||||||
/// List<Widget> items = [
|
/// List<Widget> items = <Widget>[
|
||||||
/// Container(color: CupertinoColors.systemPink, height: 100.0),
|
/// Container(color: CupertinoColors.systemPink, height: 100.0),
|
||||||
/// Container(color: CupertinoColors.systemOrange, height: 100.0),
|
/// Container(color: CupertinoColors.systemOrange, height: 100.0),
|
||||||
/// Container(color: CupertinoColors.systemYellow, height: 100.0),
|
/// Container(color: CupertinoColors.systemYellow, height: 100.0),
|
||||||
@ -296,7 +296,7 @@ typedef RefreshCallback = Future<void> Function();
|
|||||||
/// refreshTriggerPullDistance: 100.0,
|
/// refreshTriggerPullDistance: 100.0,
|
||||||
/// refreshIndicatorExtent: 60.0,
|
/// refreshIndicatorExtent: 60.0,
|
||||||
/// onRefresh: () async {
|
/// onRefresh: () async {
|
||||||
/// await Future.delayed(Duration(milliseconds: 1000));
|
/// await Future<void>.delayed(const Duration(milliseconds: 1000));
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
/// items.insert(0, Container(color: colors[items.length % 3], height: 100.0));
|
/// items.insert(0, Container(color: colors[items.length % 3], height: 100.0));
|
||||||
/// });
|
/// });
|
||||||
|
@ -1144,13 +1144,15 @@ class CupertinoModalPopupRoute<T> extends PopupRoute<T> {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// void main() {
|
/// void main() {
|
||||||
/// runApp(MyApp());
|
/// runApp(const MyApp());
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class MyApp extends StatelessWidget {
|
/// class MyApp extends StatelessWidget {
|
||||||
|
/// const MyApp({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return CupertinoApp(
|
/// return const CupertinoApp(
|
||||||
/// restorationScopeId: 'app',
|
/// restorationScopeId: 'app',
|
||||||
/// home: MyHomePage(),
|
/// home: MyHomePage(),
|
||||||
/// );
|
/// );
|
||||||
@ -1158,13 +1160,15 @@ class CupertinoModalPopupRoute<T> extends PopupRoute<T> {
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class MyHomePage extends StatelessWidget {
|
/// class MyHomePage extends StatelessWidget {
|
||||||
/// static Route _modalBuilder(BuildContext context, Object? arguments) {
|
/// const MyHomePage({Key? key}) : super(key: key);
|
||||||
/// return CupertinoModalPopupRoute(
|
///
|
||||||
|
/// static Route<void> _modalBuilder(BuildContext context, Object? arguments) {
|
||||||
|
/// return CupertinoModalPopupRoute<void>(
|
||||||
/// builder: (BuildContext context) {
|
/// builder: (BuildContext context) {
|
||||||
/// return CupertinoActionSheet(
|
/// return CupertinoActionSheet(
|
||||||
/// title: const Text('Title'),
|
/// title: const Text('Title'),
|
||||||
/// message: const Text('Message'),
|
/// message: const Text('Message'),
|
||||||
/// actions: [
|
/// actions: <CupertinoActionSheetAction>[
|
||||||
/// CupertinoActionSheetAction(
|
/// CupertinoActionSheetAction(
|
||||||
/// child: const Text('Action One'),
|
/// child: const Text('Action One'),
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
@ -1306,13 +1310,15 @@ Widget _buildCupertinoDialogTransitions(BuildContext context, Animation<double>
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// void main() {
|
/// void main() {
|
||||||
/// runApp(MyApp());
|
/// runApp(const MyApp());
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class MyApp extends StatelessWidget {
|
/// class MyApp extends StatelessWidget {
|
||||||
|
/// const MyApp({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return CupertinoApp(
|
/// return const CupertinoApp(
|
||||||
/// restorationScopeId: 'app',
|
/// restorationScopeId: 'app',
|
||||||
/// home: MyHomePage(),
|
/// home: MyHomePage(),
|
||||||
/// );
|
/// );
|
||||||
@ -1320,6 +1326,8 @@ Widget _buildCupertinoDialogTransitions(BuildContext context, Animation<double>
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class MyHomePage extends StatelessWidget {
|
/// class MyHomePage extends StatelessWidget {
|
||||||
|
/// const MyHomePage({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// static Route<Object?> _dialogBuilder(BuildContext context, Object? arguments) {
|
/// static Route<Object?> _dialogBuilder(BuildContext context, Object? arguments) {
|
||||||
/// return CupertinoDialogRoute<void>(
|
/// return CupertinoDialogRoute<void>(
|
||||||
/// context: context,
|
/// context: context,
|
||||||
|
@ -25,6 +25,8 @@ import 'text_field.dart';
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class MyPrefilledSearch extends StatefulWidget {
|
/// class MyPrefilledSearch extends StatefulWidget {
|
||||||
|
/// const MyPrefilledSearch({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// _MyPrefilledSearchState createState() => _MyPrefilledSearchState();
|
/// _MyPrefilledSearchState createState() => _MyPrefilledSearchState();
|
||||||
/// }
|
/// }
|
||||||
@ -54,6 +56,8 @@ import 'text_field.dart';
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class MyPrefilledSearch extends StatefulWidget {
|
/// class MyPrefilledSearch extends StatefulWidget {
|
||||||
|
/// const MyPrefilledSearch({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// _MyPrefilledSearchState createState() => _MyPrefilledSearchState();
|
/// _MyPrefilledSearchState createState() => _MyPrefilledSearchState();
|
||||||
/// }
|
/// }
|
||||||
@ -62,11 +66,11 @@ import 'text_field.dart';
|
|||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return CupertinoSearchTextField(
|
/// return CupertinoSearchTextField(
|
||||||
/// onChanged: (value) {
|
/// onChanged: (String value) {
|
||||||
/// print("The text has changed to: " + value);
|
/// print('The text has changed to: $value');
|
||||||
/// },
|
/// },
|
||||||
/// onSubmitted: (value) {
|
/// onSubmitted: (String value) {
|
||||||
/// print("Submitted text: " + value);
|
/// print('Submitted text: $value');
|
||||||
/// },
|
/// },
|
||||||
/// );
|
/// );
|
||||||
/// }
|
/// }
|
||||||
|
@ -127,12 +127,14 @@ class CupertinoSegmentedControl<T extends Object> extends StatefulWidget {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class SegmentedControlExample extends StatefulWidget {
|
/// class SegmentedControlExample extends StatefulWidget {
|
||||||
|
/// const SegmentedControlExample({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// State createState() => SegmentedControlExampleState();
|
/// State createState() => SegmentedControlExampleState();
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class SegmentedControlExampleState extends State<SegmentedControlExample> {
|
/// class SegmentedControlExampleState extends State<SegmentedControlExample> {
|
||||||
/// final Map<int, Widget> children = const {
|
/// final Map<int, Widget> children = const <int, Widget>{
|
||||||
/// 0: Text('Child 1'),
|
/// 0: Text('Child 1'),
|
||||||
/// 1: Text('Child 2'),
|
/// 1: Text('Child 2'),
|
||||||
/// };
|
/// };
|
||||||
@ -141,8 +143,7 @@ class CupertinoSegmentedControl<T extends Object> extends StatefulWidget {
|
|||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Container(
|
/// return CupertinoSegmentedControl<int>(
|
||||||
/// child: CupertinoSegmentedControl<int>(
|
|
||||||
/// children: children,
|
/// children: children,
|
||||||
/// onValueChanged: (int newValue) {
|
/// onValueChanged: (int newValue) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
@ -150,7 +151,6 @@ class CupertinoSegmentedControl<T extends Object> extends StatefulWidget {
|
|||||||
/// });
|
/// });
|
||||||
/// },
|
/// },
|
||||||
/// groupValue: currentValue,
|
/// groupValue: currentValue,
|
||||||
/// ),
|
|
||||||
/// );
|
/// );
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
|
@ -352,12 +352,14 @@ class CupertinoSlidingSegmentedControl<T> extends StatefulWidget {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class SegmentedControlExample extends StatefulWidget {
|
/// class SegmentedControlExample extends StatefulWidget {
|
||||||
|
/// const SegmentedControlExample({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// State createState() => SegmentedControlExampleState();
|
/// State createState() => SegmentedControlExampleState();
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class SegmentedControlExampleState extends State<SegmentedControlExample> {
|
/// class SegmentedControlExampleState extends State<SegmentedControlExample> {
|
||||||
/// final Map<int, Widget> children = const {
|
/// final Map<int, Widget> children = const <int, Widget>{
|
||||||
/// 0: Text('Child 1'),
|
/// 0: Text('Child 1'),
|
||||||
/// 1: Text('Child 2'),
|
/// 1: Text('Child 2'),
|
||||||
/// };
|
/// };
|
||||||
@ -366,8 +368,7 @@ class CupertinoSlidingSegmentedControl<T> extends StatefulWidget {
|
|||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Container(
|
/// return CupertinoSlidingSegmentedControl<int>(
|
||||||
/// child: CupertinoSlidingSegmentedControl<int>(
|
|
||||||
/// children: children,
|
/// children: children,
|
||||||
/// onValueChanged: (int? newValue) {
|
/// onValueChanged: (int? newValue) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
@ -375,7 +376,6 @@ class CupertinoSlidingSegmentedControl<T> extends StatefulWidget {
|
|||||||
/// });
|
/// });
|
||||||
/// },
|
/// },
|
||||||
/// groupValue: currentValue,
|
/// groupValue: currentValue,
|
||||||
/// ),
|
|
||||||
/// );
|
/// );
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
|
@ -35,7 +35,7 @@ import 'thumb_painter.dart';
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// MergeSemantics(
|
/// MergeSemantics(
|
||||||
/// child: ListTile(
|
/// child: ListTile(
|
||||||
/// title: Text('Lights'),
|
/// title: const Text('Lights'),
|
||||||
/// trailing: CupertinoSwitch(
|
/// trailing: CupertinoSwitch(
|
||||||
/// value: _lights,
|
/// value: _lights,
|
||||||
/// onChanged: (bool value) { setState(() { _lights = value; }); },
|
/// onChanged: (bool value) { setState(() { _lights = value; }); },
|
||||||
|
@ -20,6 +20,8 @@ import 'theme.dart';
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class MyCupertinoTabScaffoldPage extends StatefulWidget {
|
/// class MyCupertinoTabScaffoldPage extends StatefulWidget {
|
||||||
|
/// const MyCupertinoTabScaffoldPage({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// _CupertinoTabScaffoldPageState createState() => _CupertinoTabScaffoldPageState();
|
/// _CupertinoTabScaffoldPageState createState() => _CupertinoTabScaffoldPageState();
|
||||||
/// }
|
/// }
|
||||||
@ -31,7 +33,7 @@ import 'theme.dart';
|
|||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return CupertinoTabScaffold(
|
/// return CupertinoTabScaffold(
|
||||||
/// tabBar: CupertinoTabBar(
|
/// tabBar: CupertinoTabBar(
|
||||||
/// items: <BottomNavigationBarItem> [
|
/// items: const <BottomNavigationBarItem> [
|
||||||
/// // ...
|
/// // ...
|
||||||
/// ],
|
/// ],
|
||||||
/// ),
|
/// ),
|
||||||
@ -143,7 +145,7 @@ class CupertinoTabController extends ChangeNotifier {
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// CupertinoTabScaffold(
|
/// CupertinoTabScaffold(
|
||||||
/// tabBar: CupertinoTabBar(
|
/// tabBar: CupertinoTabBar(
|
||||||
/// items: <BottomNavigationBarItem> [
|
/// items: const <BottomNavigationBarItem> [
|
||||||
/// // ...
|
/// // ...
|
||||||
/// ],
|
/// ],
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -149,6 +149,8 @@ class _CupertinoTextFieldSelectionGestureDetectorBuilder extends TextSelectionGe
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class MyPrefilledText extends StatefulWidget {
|
/// class MyPrefilledText extends StatefulWidget {
|
||||||
|
/// const MyPrefilledText({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// _MyPrefilledTextState createState() => _MyPrefilledTextState();
|
/// _MyPrefilledTextState createState() => _MyPrefilledTextState();
|
||||||
/// }
|
/// }
|
||||||
|
@ -58,7 +58,7 @@ import 'text_field.dart';
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// CupertinoTextFormFieldRow(
|
/// CupertinoTextFormFieldRow(
|
||||||
/// prefix: Text('Username'),
|
/// prefix: const Text('Username'),
|
||||||
/// onSaved: (String? value) {
|
/// onSaved: (String? value) {
|
||||||
/// // This optional block of code can be used to run
|
/// // This optional block of code can be used to run
|
||||||
/// // code when the user saves the form.
|
/// // code when the user saves the form.
|
||||||
@ -79,6 +79,7 @@ import 'text_field.dart';
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return CupertinoPageScaffold(
|
/// return CupertinoPageScaffold(
|
||||||
/// child: Center(
|
/// child: Center(
|
||||||
@ -88,12 +89,12 @@ import 'text_field.dart';
|
|||||||
/// Form.of(primaryFocus!.context!)?.save();
|
/// Form.of(primaryFocus!.context!)?.save();
|
||||||
/// },
|
/// },
|
||||||
/// child: CupertinoFormSection.insetGrouped(
|
/// child: CupertinoFormSection.insetGrouped(
|
||||||
/// header: Text('SECTION 1'),
|
/// header: const Text('SECTION 1'),
|
||||||
/// children: List<Widget>.generate(5, (int index) {
|
/// children: List<Widget>.generate(5, (int index) {
|
||||||
/// return CupertinoTextFormFieldRow(
|
/// return CupertinoTextFormFieldRow(
|
||||||
/// prefix: Text('Enter text'),
|
/// prefix: const Text('Enter text'),
|
||||||
/// placeholder: 'Enter text',
|
/// placeholder: 'Enter text',
|
||||||
/// validator: (value) {
|
/// validator: (String? value) {
|
||||||
/// if (value == null || value.isEmpty) {
|
/// if (value == null || value.isEmpty) {
|
||||||
/// return 'Please enter a value';
|
/// return 'Please enter a value';
|
||||||
/// }
|
/// }
|
||||||
|
@ -1763,8 +1763,8 @@ abstract class DiagnosticsNode {
|
|||||||
/// of an actual property of the object:
|
/// of an actual property of the object:
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// var table = MessageProperty('table size', '$columns\u00D7$rows');
|
/// MessageProperty table = MessageProperty('table size', '$columns\u00D7$rows');
|
||||||
/// var usefulness = MessageProperty('usefulness ratio', 'no metrics collected yet (never painted)');
|
/// MessageProperty usefulness = MessageProperty('usefulness ratio', 'no metrics collected yet (never painted)');
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
/// {@tool snippet}
|
/// {@tool snippet}
|
||||||
@ -1773,7 +1773,7 @@ abstract class DiagnosticsNode {
|
|||||||
/// concrete value that is a string:
|
/// concrete value that is a string:
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// var name = StringProperty('name', _name);
|
/// StringProperty name = StringProperty('name', _name);
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
///
|
///
|
||||||
@ -3068,7 +3068,7 @@ class DiagnosticPropertiesBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
// class ExampleSuperclass with Diagnosticable { late String message; late double stepWidth; late double scale; late double paintExtent; late double hitTestExtent; late double paintExtend; late double maxWidth; late bool primary; late double progress; late int maxLines; late Duration duration; late int depth; late dynamic boxShadow; late dynamic style; late bool hasSize; late Matrix4 transform; Map<Listenable, VoidCallback>? handles; late Color color; late bool obscureText; late ImageRepeat repeat; late Size size; late Widget widget; late bool isCurrent; late bool keepAlive; late TextAlign textAlign; }
|
// class ExampleSuperclass with Diagnosticable { late String message; late double stepWidth; late double scale; late double paintExtent; late double hitTestExtent; late double paintExtend; late double maxWidth; late bool primary; late double progress; late int maxLines; late Duration duration; late int depth; Iterable<BoxShadow>? boxShadow; late DiagnosticsTreeStyle style; late bool hasSize; late Matrix4 transform; Map<Listenable, VoidCallback>? handles; late Color color; late bool obscureText; late ImageRepeat repeat; late Size size; late Widget widget; late bool isCurrent; late bool keepAlive; late TextAlign textAlign; }
|
||||||
|
|
||||||
/// A mixin class for providing string and [DiagnosticsNode] debug
|
/// A mixin class for providing string and [DiagnosticsNode] debug
|
||||||
/// representations describing the properties of an object.
|
/// representations describing the properties of an object.
|
||||||
|
@ -71,7 +71,7 @@ enum _LicenseEntryWithLineBreaksParserState {
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// void initMyLibrary() {
|
/// void initMyLibrary() {
|
||||||
/// LicenseRegistry.addLicense(() async* {
|
/// LicenseRegistry.addLicense(() async* {
|
||||||
/// yield LicenseEntryWithLineBreaks(<String>['my_library'], '''
|
/// yield const LicenseEntryWithLineBreaks(<String>['my_library'], '''
|
||||||
/// Copyright 2016 The Sample Authors. All rights reserved.
|
/// Copyright 2016 The Sample Authors. All rights reserved.
|
||||||
///
|
///
|
||||||
/// Redistribution and use in source and binary forms, with or without
|
/// Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -52,7 +52,7 @@ import 'theme.dart';
|
|||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// final TextStyle textStyle = Theme.of(context).textTheme.bodyText2!;
|
/// final TextStyle textStyle = Theme.of(context).textTheme.bodyText2!;
|
||||||
/// final List<Widget> aboutBoxChildren = <Widget>[
|
/// final List<Widget> aboutBoxChildren = <Widget>[
|
||||||
/// SizedBox(height: 24),
|
/// const SizedBox(height: 24),
|
||||||
/// RichText(
|
/// RichText(
|
||||||
/// text: TextSpan(
|
/// text: TextSpan(
|
||||||
/// children: <TextSpan>[
|
/// children: <TextSpan>[
|
||||||
@ -77,14 +77,14 @@ import 'theme.dart';
|
|||||||
///
|
///
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
/// title: Text('Show About Example'),
|
/// title: const Text('Show About Example'),
|
||||||
/// ),
|
/// ),
|
||||||
/// drawer: Drawer(
|
/// drawer: Drawer(
|
||||||
/// child: SingleChildScrollView(
|
/// child: SingleChildScrollView(
|
||||||
/// child: SafeArea(
|
/// child: SafeArea(
|
||||||
/// child: AboutListTile(
|
/// child: AboutListTile(
|
||||||
/// icon: Icon(Icons.info),
|
/// icon: const Icon(Icons.info),
|
||||||
/// applicationIcon: FlutterLogo(),
|
/// applicationIcon: const FlutterLogo(),
|
||||||
/// applicationName: 'Show About Example',
|
/// applicationName: 'Show About Example',
|
||||||
/// applicationVersion: 'August 2019',
|
/// applicationVersion: 'August 2019',
|
||||||
/// applicationLegalese: '\u{a9} 2014 The Flutter Authors',
|
/// applicationLegalese: '\u{a9} 2014 The Flutter Authors',
|
||||||
@ -95,11 +95,11 @@ import 'theme.dart';
|
|||||||
/// ),
|
/// ),
|
||||||
/// body: Center(
|
/// body: Center(
|
||||||
/// child: ElevatedButton(
|
/// child: ElevatedButton(
|
||||||
/// child: Text('Show About Example'),
|
/// child: const Text('Show About Example'),
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// showAboutDialog(
|
/// showAboutDialog(
|
||||||
/// context: context,
|
/// context: context,
|
||||||
/// applicationIcon: FlutterLogo(),
|
/// applicationIcon: const FlutterLogo(),
|
||||||
/// applicationName: 'Show About Example',
|
/// applicationName: 'Show About Example',
|
||||||
/// applicationVersion: 'August 2019',
|
/// applicationVersion: 'August 2019',
|
||||||
/// applicationLegalese: '\u{a9} 2014 The Flutter Authors',
|
/// applicationLegalese: '\u{a9} 2014 The Flutter Authors',
|
||||||
|
@ -613,7 +613,7 @@ class MaterialApp extends StatefulWidget {
|
|||||||
/// return WidgetsApp(
|
/// return WidgetsApp(
|
||||||
/// actions: <Type, Action<Intent>>{
|
/// actions: <Type, Action<Intent>>{
|
||||||
/// ... WidgetsApp.defaultActions,
|
/// ... WidgetsApp.defaultActions,
|
||||||
/// ActivateAction: CallbackAction(
|
/// ActivateAction: CallbackAction<Intent>(
|
||||||
/// onInvoke: (Intent intent) {
|
/// onInvoke: (Intent intent) {
|
||||||
/// // Do something here...
|
/// // Do something here...
|
||||||
/// return null;
|
/// return null;
|
||||||
|
@ -115,7 +115,7 @@ class _ToolbarContainerLayout extends SingleChildLayoutDelegate {
|
|||||||
/// icon: const Icon(Icons.navigate_next),
|
/// icon: const Icon(Icons.navigate_next),
|
||||||
/// tooltip: 'Go to the next page',
|
/// tooltip: 'Go to the next page',
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// Navigator.push(context, MaterialPageRoute(
|
/// Navigator.push(context, MaterialPageRoute<void>(
|
||||||
/// builder: (BuildContext context) {
|
/// builder: (BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
@ -317,10 +317,10 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
|
|||||||
/// primary: true,
|
/// primary: true,
|
||||||
/// slivers: <Widget>[
|
/// slivers: <Widget>[
|
||||||
/// SliverAppBar(
|
/// SliverAppBar(
|
||||||
/// title: Text('Hello World'),
|
/// title: const Text('Hello World'),
|
||||||
/// actions: <Widget>[
|
/// actions: <Widget>[
|
||||||
/// IconButton(
|
/// IconButton(
|
||||||
/// icon: Icon(Icons.shopping_cart),
|
/// icon: const Icon(Icons.shopping_cart),
|
||||||
/// tooltip: 'Open shopping cart',
|
/// tooltip: 'Open shopping cart',
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// // handle the press
|
/// // handle the press
|
||||||
@ -1273,7 +1273,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// void main() => runApp(MyApp());
|
/// void main() => runApp(const MyApp());
|
||||||
///
|
///
|
||||||
/// class MyApp extends StatefulWidget {
|
/// class MyApp extends StatefulWidget {
|
||||||
/// const MyApp({Key? key}) : super(key: key);
|
/// const MyApp({Key? key}) : super(key: key);
|
||||||
@ -1296,20 +1296,20 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
|
|||||||
/// body: CustomScrollView(
|
/// body: CustomScrollView(
|
||||||
/// slivers: <Widget>[
|
/// slivers: <Widget>[
|
||||||
/// SliverAppBar(
|
/// SliverAppBar(
|
||||||
/// pinned: this._pinned,
|
/// pinned: _pinned,
|
||||||
/// snap: this._snap,
|
/// snap: _snap,
|
||||||
/// floating: this._floating,
|
/// floating: _floating,
|
||||||
/// expandedHeight: 160.0,
|
/// expandedHeight: 160.0,
|
||||||
/// flexibleSpace: FlexibleSpaceBar(
|
/// flexibleSpace: const FlexibleSpaceBar(
|
||||||
/// title: const Text("SliverAppBar"),
|
/// title: Text('SliverAppBar'),
|
||||||
/// background: FlutterLogo(),
|
/// background: FlutterLogo(),
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// SliverToBoxAdapter(
|
/// const SliverToBoxAdapter(
|
||||||
/// child: Center(
|
/// child: Center(
|
||||||
/// child: Container(
|
/// child: SizedBox(
|
||||||
/// height: 2000,
|
/// height: 2000,
|
||||||
/// child: const Text("Scroll to see SliverAppBar in effect ."),
|
/// child: const Text('Scroll to see SliverAppBar in effect .'),
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
@ -1325,10 +1325,10 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
|
|||||||
/// Switch(
|
/// Switch(
|
||||||
/// onChanged: (bool val) {
|
/// onChanged: (bool val) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
/// this._pinned = val;
|
/// _pinned = val;
|
||||||
/// });
|
/// });
|
||||||
/// },
|
/// },
|
||||||
/// value: this._pinned,
|
/// value: _pinned,
|
||||||
/// ),
|
/// ),
|
||||||
/// ],
|
/// ],
|
||||||
/// ),
|
/// ),
|
||||||
@ -1338,12 +1338,12 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
|
|||||||
/// Switch(
|
/// Switch(
|
||||||
/// onChanged: (bool val) {
|
/// onChanged: (bool val) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
/// this._snap = val;
|
/// _snap = val;
|
||||||
/// //Snapping only applies when the app bar is floating.
|
/// //Snapping only applies when the app bar is floating.
|
||||||
/// this._floating = this._floating || val;
|
/// _floating = _floating || val;
|
||||||
/// });
|
/// });
|
||||||
/// },
|
/// },
|
||||||
/// value: this._snap,
|
/// value: _snap,
|
||||||
/// ),
|
/// ),
|
||||||
/// ],
|
/// ],
|
||||||
/// ),
|
/// ),
|
||||||
@ -1353,15 +1353,15 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
|
|||||||
/// Switch(
|
/// Switch(
|
||||||
/// onChanged: (bool val) {
|
/// onChanged: (bool val) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
/// this._floating = val;
|
/// _floating = val;
|
||||||
/// if (this._snap == true) {
|
/// if (_snap == true) {
|
||||||
/// if (this._floating != true) {
|
/// if (_floating != true) {
|
||||||
/// this._snap = false;
|
/// _snap = false;
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// });
|
/// });
|
||||||
/// },
|
/// },
|
||||||
/// value: this._floating,
|
/// value: _floating,
|
||||||
/// ),
|
/// ),
|
||||||
/// ],
|
/// ],
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -57,6 +57,7 @@ import 'text_form_field.dart';
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
|
/// @immutable
|
||||||
/// class User {
|
/// class User {
|
||||||
/// const User({
|
/// const User({
|
||||||
/// required this.email,
|
/// required this.email,
|
||||||
@ -73,8 +74,9 @@ import 'text_form_field.dart';
|
|||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// bool operator ==(Object other) {
|
/// bool operator ==(Object other) {
|
||||||
/// if (other.runtimeType != runtimeType)
|
/// if (other.runtimeType != runtimeType) {
|
||||||
/// return false;
|
/// return false;
|
||||||
|
/// }
|
||||||
/// return other is User
|
/// return other is User
|
||||||
/// && other.name == name
|
/// && other.name == name
|
||||||
/// && other.email == email;
|
/// && other.email == email;
|
||||||
@ -85,9 +87,9 @@ import 'text_form_field.dart';
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class AutocompleteBasicUserExample extends StatelessWidget {
|
/// class AutocompleteBasicUserExample extends StatelessWidget {
|
||||||
/// AutocompleteBasicUserExample({Key? key}) : super(key: key);
|
/// const AutocompleteBasicUserExample({Key? key}) : super(key: key);
|
||||||
///
|
///
|
||||||
/// static final List<User> _userOptions = <User>[
|
/// static const List<User> _userOptions = <User>[
|
||||||
/// User(name: 'Alice', email: 'alice@example.com'),
|
/// User(name: 'Alice', email: 'alice@example.com'),
|
||||||
/// User(name: 'Bob', email: 'bob@example.com'),
|
/// User(name: 'Bob', email: 'bob@example.com'),
|
||||||
/// User(name: 'Charlie', email: 'charlie123@gmail.com'),
|
/// User(name: 'Charlie', email: 'charlie123@gmail.com'),
|
||||||
|
@ -27,7 +27,7 @@ import 'theme.dart';
|
|||||||
/// color: Colors.white,
|
/// color: Colors.white,
|
||||||
/// child: bottomAppBarContents,
|
/// child: bottomAppBarContents,
|
||||||
/// ),
|
/// ),
|
||||||
/// floatingActionButton: FloatingActionButton(onPressed: null),
|
/// floatingActionButton: const FloatingActionButton(onPressed: null),
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
@ -42,20 +42,20 @@ import 'theme.dart';
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// void main() {
|
/// void main() {
|
||||||
/// runApp(BottomAppBarDemo());
|
/// runApp(const BottomAppBarDemo());
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class BottomAppBarDemo extends StatefulWidget {
|
/// class BottomAppBarDemo extends StatefulWidget {
|
||||||
/// const BottomAppBarDemo();
|
/// const BottomAppBarDemo({Key? key}) : super(key: key);
|
||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// State createState() => _BottomAppBarDemoState();
|
/// State createState() => _BottomAppBarDemoState();
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
|
/// class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
|
||||||
/// var _showFab = true;
|
/// bool _showFab = true;
|
||||||
/// var _showNotch = true;
|
/// bool _showNotch = true;
|
||||||
/// var _fabLocation = FloatingActionButtonLocation.endDocked;
|
/// FloatingActionButtonLocation _fabLocation = FloatingActionButtonLocation.endDocked;
|
||||||
///
|
///
|
||||||
/// void _onShowNotchChanged(bool value) {
|
/// void _onShowNotchChanged(bool value) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
@ -69,9 +69,9 @@ import 'theme.dart';
|
|||||||
/// });
|
/// });
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// void _onFabLocationChanged(dynamic value) {
|
/// void _onFabLocationChanged(FloatingActionButtonLocation? value) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
/// _fabLocation = value;
|
/// _fabLocation = value ?? FloatingActionButtonLocation.endDocked;
|
||||||
/// });
|
/// });
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
@ -81,55 +81,47 @@ import 'theme.dart';
|
|||||||
/// home: Scaffold(
|
/// home: Scaffold(
|
||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
/// automaticallyImplyLeading: false,
|
/// automaticallyImplyLeading: false,
|
||||||
/// title: Text("Bottom App Bar Demo"),
|
/// title: const Text('Bottom App Bar Demo'),
|
||||||
/// ),
|
/// ),
|
||||||
/// body: ListView(
|
/// body: ListView(
|
||||||
/// padding: const EdgeInsets.only(bottom: 88),
|
/// padding: const EdgeInsets.only(bottom: 88),
|
||||||
/// children: [
|
/// children: <Widget>[
|
||||||
/// SwitchListTile(
|
/// SwitchListTile(
|
||||||
/// title: Text(
|
/// title: const Text(
|
||||||
/// "Floating Action Button",
|
/// 'Floating Action Button',
|
||||||
/// ),
|
/// ),
|
||||||
/// value: _showFab,
|
/// value: _showFab,
|
||||||
/// onChanged: _onShowFabChanged,
|
/// onChanged: _onShowFabChanged,
|
||||||
/// ),
|
/// ),
|
||||||
/// SwitchListTile(
|
/// SwitchListTile(
|
||||||
/// title: Text("Notch"),
|
/// title: const Text('Notch'),
|
||||||
/// value: _showNotch,
|
/// value: _showNotch,
|
||||||
/// onChanged: _onShowNotchChanged,
|
/// onChanged: _onShowNotchChanged,
|
||||||
/// ),
|
/// ),
|
||||||
/// Padding(
|
/// const Padding(
|
||||||
/// padding: const EdgeInsets.all(16),
|
/// padding: EdgeInsets.all(16),
|
||||||
/// child: Text("Floating action button position"),
|
/// child: Text('Floating action button position'),
|
||||||
/// ),
|
/// ),
|
||||||
/// RadioListTile<FloatingActionButtonLocation>(
|
/// RadioListTile<FloatingActionButtonLocation>(
|
||||||
/// title: Text(
|
/// title: const Text('Docked - End'),
|
||||||
/// "Docked - End",
|
|
||||||
/// ),
|
|
||||||
/// value: FloatingActionButtonLocation.endDocked,
|
/// value: FloatingActionButtonLocation.endDocked,
|
||||||
/// groupValue: _fabLocation,
|
/// groupValue: _fabLocation,
|
||||||
/// onChanged: _onFabLocationChanged,
|
/// onChanged: _onFabLocationChanged,
|
||||||
/// ),
|
/// ),
|
||||||
/// RadioListTile<FloatingActionButtonLocation>(
|
/// RadioListTile<FloatingActionButtonLocation>(
|
||||||
/// title: Text(
|
/// title: const Text('Docked - Center'),
|
||||||
/// "Docked - Center",
|
|
||||||
/// ),
|
|
||||||
/// value: FloatingActionButtonLocation.centerDocked,
|
/// value: FloatingActionButtonLocation.centerDocked,
|
||||||
/// groupValue: _fabLocation,
|
/// groupValue: _fabLocation,
|
||||||
/// onChanged: _onFabLocationChanged,
|
/// onChanged: _onFabLocationChanged,
|
||||||
/// ),
|
/// ),
|
||||||
/// RadioListTile<FloatingActionButtonLocation>(
|
/// RadioListTile<FloatingActionButtonLocation>(
|
||||||
/// title: Text(
|
/// title: const Text('Floating - End'),
|
||||||
/// "Floating - End",
|
|
||||||
/// ),
|
|
||||||
/// value: FloatingActionButtonLocation.endFloat,
|
/// value: FloatingActionButtonLocation.endFloat,
|
||||||
/// groupValue: _fabLocation,
|
/// groupValue: _fabLocation,
|
||||||
/// onChanged: _onFabLocationChanged,
|
/// onChanged: _onFabLocationChanged,
|
||||||
/// ),
|
/// ),
|
||||||
/// RadioListTile<FloatingActionButtonLocation>(
|
/// RadioListTile<FloatingActionButtonLocation>(
|
||||||
/// title: Text(
|
/// title: const Text('Floating - Center'),
|
||||||
/// "Floating - Center",
|
|
||||||
/// ),
|
|
||||||
/// value: FloatingActionButtonLocation.centerFloat,
|
/// value: FloatingActionButtonLocation.centerFloat,
|
||||||
/// groupValue: _fabLocation,
|
/// groupValue: _fabLocation,
|
||||||
/// onChanged: _onFabLocationChanged,
|
/// onChanged: _onFabLocationChanged,
|
||||||
@ -140,7 +132,7 @@ import 'theme.dart';
|
|||||||
/// ? FloatingActionButton(
|
/// ? FloatingActionButton(
|
||||||
/// onPressed: () {},
|
/// onPressed: () {},
|
||||||
/// child: const Icon(Icons.add),
|
/// child: const Icon(Icons.add),
|
||||||
/// tooltip: "Create",
|
/// tooltip: 'Create',
|
||||||
/// )
|
/// )
|
||||||
/// : null,
|
/// : null,
|
||||||
/// floatingActionButtonLocation: _fabLocation,
|
/// floatingActionButtonLocation: _fabLocation,
|
||||||
@ -160,9 +152,9 @@ import 'theme.dart';
|
|||||||
/// });
|
/// });
|
||||||
///
|
///
|
||||||
/// final FloatingActionButtonLocation fabLocation;
|
/// final FloatingActionButtonLocation fabLocation;
|
||||||
/// final dynamic shape;
|
/// final NotchedShape? shape;
|
||||||
///
|
///
|
||||||
/// static final centerLocations = <FloatingActionButtonLocation>[
|
/// static final List<FloatingActionButtonLocation> centerLocations = <FloatingActionButtonLocation>[
|
||||||
/// FloatingActionButtonLocation.centerDocked,
|
/// FloatingActionButtonLocation.centerDocked,
|
||||||
/// FloatingActionButtonLocation.centerFloat,
|
/// FloatingActionButtonLocation.centerFloat,
|
||||||
/// ];
|
/// ];
|
||||||
@ -175,7 +167,7 @@ import 'theme.dart';
|
|||||||
/// child: IconTheme(
|
/// child: IconTheme(
|
||||||
/// data: IconThemeData(color: Theme.of(context).colorScheme.onPrimary),
|
/// data: IconThemeData(color: Theme.of(context).colorScheme.onPrimary),
|
||||||
/// child: Row(
|
/// child: Row(
|
||||||
/// children: [
|
/// children: <Widget>[
|
||||||
/// IconButton(
|
/// IconButton(
|
||||||
/// tooltip: 'Open navigation menu',
|
/// tooltip: 'Open navigation menu',
|
||||||
/// icon: const Icon(Icons.menu),
|
/// icon: const Icon(Icons.menu),
|
||||||
@ -183,12 +175,12 @@ import 'theme.dart';
|
|||||||
/// ),
|
/// ),
|
||||||
/// if (centerLocations.contains(fabLocation)) const Spacer(),
|
/// if (centerLocations.contains(fabLocation)) const Spacer(),
|
||||||
/// IconButton(
|
/// IconButton(
|
||||||
/// tooltip: "Search",
|
/// tooltip: 'Search',
|
||||||
/// icon: const Icon(Icons.search),
|
/// icon: const Icon(Icons.search),
|
||||||
/// onPressed: () {},
|
/// onPressed: () {},
|
||||||
/// ),
|
/// ),
|
||||||
/// IconButton(
|
/// IconButton(
|
||||||
/// tooltip: "Favorite",
|
/// tooltip: 'Favorite',
|
||||||
/// icon: const Icon(Icons.favorite),
|
/// icon: const Icon(Icons.favorite),
|
||||||
/// onPressed: () {},
|
/// onPressed: () {},
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -78,7 +78,7 @@ import 'theme.dart';
|
|||||||
/// onTap: () {
|
/// onTap: () {
|
||||||
/// print('Card tapped.');
|
/// print('Card tapped.');
|
||||||
/// },
|
/// },
|
||||||
/// child: Container(
|
/// child: const SizedBox(
|
||||||
/// width: 300,
|
/// width: 300,
|
||||||
/// height: 100,
|
/// height: 100,
|
||||||
/// child: Text('A card that can be tapped'),
|
/// child: Text('A card that can be tapped'),
|
||||||
|
@ -39,6 +39,8 @@ import 'toggleable.dart';
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// bool isChecked = false;
|
/// bool isChecked = false;
|
||||||
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// Color getColor(Set<MaterialState> states) {
|
/// Color getColor(Set<MaterialState> states) {
|
||||||
/// const Set<MaterialState> interactiveStates = <MaterialState>{
|
/// const Set<MaterialState> interactiveStates = <MaterialState>{
|
||||||
@ -55,9 +57,9 @@ import 'toggleable.dart';
|
|||||||
/// checkColor: Colors.white,
|
/// checkColor: Colors.white,
|
||||||
/// fillColor: MaterialStateProperty.resolveWith(getColor),
|
/// fillColor: MaterialStateProperty.resolveWith(getColor),
|
||||||
/// value: isChecked,
|
/// value: isChecked,
|
||||||
/// onChanged: (val) {
|
/// onChanged: (bool? value) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
/// isChecked = !isChecked;
|
/// isChecked = value!;
|
||||||
/// });
|
/// });
|
||||||
/// },
|
/// },
|
||||||
/// );
|
/// );
|
||||||
|
@ -99,11 +99,12 @@ import 'theme_data.dart';
|
|||||||
/// ```dart preamble
|
/// ```dart preamble
|
||||||
/// class LinkedLabelCheckbox extends StatelessWidget {
|
/// class LinkedLabelCheckbox extends StatelessWidget {
|
||||||
/// const LinkedLabelCheckbox({
|
/// const LinkedLabelCheckbox({
|
||||||
|
/// Key? key,
|
||||||
/// required this.label,
|
/// required this.label,
|
||||||
/// required this.padding,
|
/// required this.padding,
|
||||||
/// required this.value,
|
/// required this.value,
|
||||||
/// required this.onChanged,
|
/// required this.onChanged,
|
||||||
/// });
|
/// }) : super(key: key);
|
||||||
///
|
///
|
||||||
/// final String label;
|
/// final String label;
|
||||||
/// final EdgeInsets padding;
|
/// final EdgeInsets padding;
|
||||||
@ -120,7 +121,7 @@ import 'theme_data.dart';
|
|||||||
/// child: RichText(
|
/// child: RichText(
|
||||||
/// text: TextSpan(
|
/// text: TextSpan(
|
||||||
/// text: label,
|
/// text: label,
|
||||||
/// style: TextStyle(
|
/// style: const TextStyle(
|
||||||
/// color: Colors.blueAccent,
|
/// color: Colors.blueAccent,
|
||||||
/// decoration: TextDecoration.underline,
|
/// decoration: TextDecoration.underline,
|
||||||
/// ),
|
/// ),
|
||||||
@ -179,11 +180,12 @@ import 'theme_data.dart';
|
|||||||
/// ```dart preamble
|
/// ```dart preamble
|
||||||
/// class LabeledCheckbox extends StatelessWidget {
|
/// class LabeledCheckbox extends StatelessWidget {
|
||||||
/// const LabeledCheckbox({
|
/// const LabeledCheckbox({
|
||||||
|
/// Key? key,
|
||||||
/// required this.label,
|
/// required this.label,
|
||||||
/// required this.padding,
|
/// required this.padding,
|
||||||
/// required this.value,
|
/// required this.value,
|
||||||
/// required this.onChanged,
|
/// required this.onChanged,
|
||||||
/// });
|
/// }) : super(key: key);
|
||||||
///
|
///
|
||||||
/// final String label;
|
/// final String label;
|
||||||
/// final EdgeInsets padding;
|
/// final EdgeInsets padding;
|
||||||
|
@ -232,6 +232,8 @@ abstract class DeletableChipAttributes {
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class CastList extends StatefulWidget {
|
/// class CastList extends StatefulWidget {
|
||||||
|
/// const CastList({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// State createState() => CastListState();
|
/// State createState() => CastListState();
|
||||||
/// }
|
/// }
|
||||||
@ -275,7 +277,7 @@ abstract class DeletableChipAttributes {
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return CastList();
|
/// return const CastList();
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
@ -383,6 +385,8 @@ abstract class SelectableChipAttributes {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class Wood extends StatefulWidget {
|
/// class Wood extends StatefulWidget {
|
||||||
|
/// const Wood({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// State<StatefulWidget> createState() => WoodState();
|
/// State<StatefulWidget> createState() => WoodState();
|
||||||
/// }
|
/// }
|
||||||
@ -519,6 +523,8 @@ abstract class TappableChipAttributes {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class Blacksmith extends StatelessWidget {
|
/// class Blacksmith extends StatelessWidget {
|
||||||
|
/// const Blacksmith({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// void startHammering() {
|
/// void startHammering() {
|
||||||
/// print('bang bang bang');
|
/// print('bang bang bang');
|
||||||
/// }
|
/// }
|
||||||
@ -567,9 +573,9 @@ abstract class TappableChipAttributes {
|
|||||||
/// Chip(
|
/// Chip(
|
||||||
/// avatar: CircleAvatar(
|
/// avatar: CircleAvatar(
|
||||||
/// backgroundColor: Colors.grey.shade800,
|
/// backgroundColor: Colors.grey.shade800,
|
||||||
/// child: Text('AB'),
|
/// child: const Text('AB'),
|
||||||
/// ),
|
/// ),
|
||||||
/// label: Text('Aaron Burr'),
|
/// label: const Text('Aaron Burr'),
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
@ -716,9 +722,9 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri
|
|||||||
/// InputChip(
|
/// InputChip(
|
||||||
/// avatar: CircleAvatar(
|
/// avatar: CircleAvatar(
|
||||||
/// backgroundColor: Colors.grey.shade800,
|
/// backgroundColor: Colors.grey.shade800,
|
||||||
/// child: Text('AB'),
|
/// child: const Text('AB'),
|
||||||
/// ),
|
/// ),
|
||||||
/// label: Text('Aaron Burr'),
|
/// label: const Text('Aaron Burr'),
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// print('I am the one thing in life.');
|
/// print('I am the one thing in life.');
|
||||||
/// }
|
/// }
|
||||||
@ -916,6 +922,8 @@ class InputChip extends StatelessWidget
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class MyThreeOptions extends StatefulWidget {
|
/// class MyThreeOptions extends StatefulWidget {
|
||||||
|
/// const MyThreeOptions({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// _MyThreeOptionsState createState() => _MyThreeOptionsState();
|
/// _MyThreeOptionsState createState() => _MyThreeOptionsState();
|
||||||
/// }
|
/// }
|
||||||
@ -1106,6 +1114,8 @@ class ChoiceChip extends StatelessWidget
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class CastFilter extends StatefulWidget {
|
/// class CastFilter extends StatefulWidget {
|
||||||
|
/// const CastFilter({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// State createState() => CastFilterState();
|
/// State createState() => CastFilterState();
|
||||||
/// }
|
/// }
|
||||||
@ -1117,7 +1127,7 @@ class ChoiceChip extends StatelessWidget
|
|||||||
/// const ActorFilterEntry('Eliza Hamilton', 'EH'),
|
/// const ActorFilterEntry('Eliza Hamilton', 'EH'),
|
||||||
/// const ActorFilterEntry('James Madison', 'JM'),
|
/// const ActorFilterEntry('James Madison', 'JM'),
|
||||||
/// ];
|
/// ];
|
||||||
/// List<String> _filters = <String>[];
|
/// final List<String> _filters = <String>[];
|
||||||
///
|
///
|
||||||
/// Iterable<Widget> get actorWidgets sync* {
|
/// Iterable<Widget> get actorWidgets sync* {
|
||||||
/// for (final ActorFilterEntry actor in _cast) {
|
/// for (final ActorFilterEntry actor in _cast) {
|
||||||
@ -1331,11 +1341,11 @@ class FilterChip extends StatelessWidget
|
|||||||
/// ActionChip(
|
/// ActionChip(
|
||||||
/// avatar: CircleAvatar(
|
/// avatar: CircleAvatar(
|
||||||
/// backgroundColor: Colors.grey.shade800,
|
/// backgroundColor: Colors.grey.shade800,
|
||||||
/// child: Text('AB'),
|
/// child: const Text('AB'),
|
||||||
/// ),
|
/// ),
|
||||||
/// label: Text('Aaron Burr'),
|
/// label: const Text('Aaron Burr'),
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// print("If you stand for nothing, Burr, what’ll you fall for?");
|
/// print('If you stand for nothing, Burr, what’ll you fall for?');
|
||||||
/// }
|
/// }
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -65,6 +65,8 @@ class ChipTheme extends InheritedTheme {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class Spaceship extends StatelessWidget {
|
/// class Spaceship extends StatelessWidget {
|
||||||
|
/// const Spaceship({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return ChipTheme(
|
/// return ChipTheme(
|
||||||
@ -122,6 +124,8 @@ class ChipTheme extends InheritedTheme {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class CarColor extends StatefulWidget {
|
/// class CarColor extends StatefulWidget {
|
||||||
|
/// const CarColor({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// State createState() => _CarColorState();
|
/// State createState() => _CarColorState();
|
||||||
/// }
|
/// }
|
||||||
@ -134,7 +138,7 @@ class ChipTheme extends InheritedTheme {
|
|||||||
/// return ChipTheme(
|
/// return ChipTheme(
|
||||||
/// data: ChipTheme.of(context).copyWith(backgroundColor: Colors.lightBlue),
|
/// data: ChipTheme.of(context).copyWith(backgroundColor: Colors.lightBlue),
|
||||||
/// child: ChoiceChip(
|
/// child: ChoiceChip(
|
||||||
/// label: Text('Light Blue'),
|
/// label: const Text('Light Blue'),
|
||||||
/// onSelected: (bool value) {
|
/// onSelected: (bool value) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
/// _color = value ? Colors.lightBlue : Colors.red;
|
/// _color = value ? Colors.lightBlue : Colors.red;
|
||||||
|
@ -46,7 +46,7 @@ import 'theme.dart';
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// CircleAvatar(
|
/// CircleAvatar(
|
||||||
/// backgroundColor: Colors.brown.shade800,
|
/// backgroundColor: Colors.brown.shade800,
|
||||||
/// child: Text('AH'),
|
/// child: const Text('AH'),
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
|
@ -373,7 +373,7 @@ class DataCell {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// static const int numItems = 10;
|
/// static const int numItems = 10;
|
||||||
/// List<bool> selected = List<bool>.generate(numItems, (index) => false);
|
/// List<bool> selected = List<bool>.generate(numItems, (int index) => false);
|
||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
@ -387,17 +387,18 @@ class DataCell {
|
|||||||
/// ],
|
/// ],
|
||||||
/// rows: List<DataRow>.generate(
|
/// rows: List<DataRow>.generate(
|
||||||
/// numItems,
|
/// numItems,
|
||||||
/// (index) => DataRow(
|
/// (int index) => DataRow(
|
||||||
/// color: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
/// color: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
/// // All rows will have the same selected color.
|
/// // All rows will have the same selected color.
|
||||||
/// if (states.contains(MaterialState.selected))
|
/// if (states.contains(MaterialState.selected))
|
||||||
/// return Theme.of(context).colorScheme.primary.withOpacity(0.08);
|
/// return Theme.of(context).colorScheme.primary.withOpacity(0.08);
|
||||||
/// // Even rows will have a grey color.
|
/// // Even rows will have a grey color.
|
||||||
/// if (index % 2 == 0)
|
/// if (index.isEven) {
|
||||||
/// return Colors.grey.withOpacity(0.3);
|
/// return Colors.grey.withOpacity(0.3);
|
||||||
|
/// }
|
||||||
/// return null; // Use default value for other states and odd rows.
|
/// return null; // Use default value for other states and odd rows.
|
||||||
/// }),
|
/// }),
|
||||||
/// cells: [DataCell(Text('Row $index'))],
|
/// cells: <DataCell>[ DataCell(Text('Row $index')) ],
|
||||||
/// selected: selected[index],
|
/// selected: selected[index],
|
||||||
/// onSelectChanged: (bool? value) {
|
/// onSelectChanged: (bool? value) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
|
@ -194,10 +194,10 @@ class Dialog extends StatelessWidget {
|
|||||||
/// barrierDismissible: false, // user must tap button!
|
/// barrierDismissible: false, // user must tap button!
|
||||||
/// builder: (BuildContext context) {
|
/// builder: (BuildContext context) {
|
||||||
/// return AlertDialog(
|
/// return AlertDialog(
|
||||||
/// title: Text('AlertDialog Title'),
|
/// title: const Text('AlertDialog Title'),
|
||||||
/// content: SingleChildScrollView(
|
/// content: SingleChildScrollView(
|
||||||
/// child: ListBody(
|
/// child: ListBody(
|
||||||
/// children: <Widget>[
|
/// children: const <Widget>[
|
||||||
/// Text('This is a demo alert dialog.'),
|
/// Text('This is a demo alert dialog.'),
|
||||||
/// Text('Would you like to approve of this message?'),
|
/// Text('Would you like to approve of this message?'),
|
||||||
/// ],
|
/// ],
|
||||||
@ -205,7 +205,7 @@ class Dialog extends StatelessWidget {
|
|||||||
/// ),
|
/// ),
|
||||||
/// actions: <Widget>[
|
/// actions: <Widget>[
|
||||||
/// TextButton(
|
/// TextButton(
|
||||||
/// child: Text('Approve'),
|
/// child: const Text('Approve'),
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// Navigator.of(context).pop();
|
/// Navigator.of(context).pop();
|
||||||
/// },
|
/// },
|
||||||
@ -232,7 +232,7 @@ class Dialog extends StatelessWidget {
|
|||||||
/// builder: (BuildContext context) => AlertDialog(
|
/// builder: (BuildContext context) => AlertDialog(
|
||||||
/// title: const Text('AlertDialog Tilte'),
|
/// title: const Text('AlertDialog Tilte'),
|
||||||
/// content: const Text('AlertDialog description'),
|
/// content: const Text('AlertDialog description'),
|
||||||
/// actions: [
|
/// actions: <Widget>[
|
||||||
/// TextButton(
|
/// TextButton(
|
||||||
/// onPressed: () => Navigator.pop(context, 'Cancel'),
|
/// onPressed: () => Navigator.pop(context, 'Cancel'),
|
||||||
/// child: const Text('Cancel'),
|
/// child: const Text('Cancel'),
|
||||||
@ -244,7 +244,7 @@ class Dialog extends StatelessWidget {
|
|||||||
/// ],
|
/// ],
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// child: Text('Show Dialog'),
|
/// child: const Text('Show Dialog'),
|
||||||
/// );
|
/// );
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
@ -367,13 +367,13 @@ class AlertDialog extends StatelessWidget {
|
|||||||
/// This is an example of a set of actions aligned with the content widget.
|
/// This is an example of a set of actions aligned with the content widget.
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// AlertDialog(
|
/// AlertDialog(
|
||||||
/// title: Text('Title'),
|
/// title: const Text('Title'),
|
||||||
/// content: Container(width: 200, height: 200, color: Colors.green),
|
/// content: Container(width: 200, height: 200, color: Colors.green),
|
||||||
/// actions: <Widget>[
|
/// actions: <Widget>[
|
||||||
/// ElevatedButton(onPressed: () {}, child: Text('Button 1')),
|
/// ElevatedButton(onPressed: () {}, child: const Text('Button 1')),
|
||||||
/// ElevatedButton(onPressed: () {}, child: Text('Button 2')),
|
/// ElevatedButton(onPressed: () {}, child: const Text('Button 2')),
|
||||||
/// ],
|
/// ],
|
||||||
/// actionsPadding: EdgeInsets.symmetric(horizontal: 8.0),
|
/// actionsPadding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
@ -1009,13 +1009,15 @@ Widget _buildMaterialDialogTransitions(BuildContext context, Animation<double> a
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// void main() {
|
/// void main() {
|
||||||
/// runApp(MyApp());
|
/// runApp(const MyApp());
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class MyApp extends StatelessWidget {
|
/// class MyApp extends StatelessWidget {
|
||||||
|
/// const MyApp({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return MaterialApp(
|
/// return const MaterialApp(
|
||||||
/// restorationScopeId: 'app',
|
/// restorationScopeId: 'app',
|
||||||
/// title: 'Restorable Routes Demo',
|
/// title: 'Restorable Routes Demo',
|
||||||
/// home: MyHomePage(),
|
/// home: MyHomePage(),
|
||||||
@ -1024,6 +1026,8 @@ Widget _buildMaterialDialogTransitions(BuildContext context, Animation<double> a
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class MyHomePage extends StatelessWidget {
|
/// class MyHomePage extends StatelessWidget {
|
||||||
|
/// const MyHomePage({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// static Route<Object?> _dialogBuilder(BuildContext context, Object? arguments) {
|
/// static Route<Object?> _dialogBuilder(BuildContext context, Object? arguments) {
|
||||||
/// return DialogRoute<void>(
|
/// return DialogRoute<void>(
|
||||||
/// context: context,
|
/// context: context,
|
||||||
|
@ -140,7 +140,7 @@ class Divider extends StatelessWidget {
|
|||||||
/// {@tool snippet}
|
/// {@tool snippet}
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// Divider(
|
/// const Divider(
|
||||||
/// color: Colors.deepOrange,
|
/// color: Colors.deepOrange,
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
@ -332,7 +332,7 @@ class VerticalDivider extends StatelessWidget {
|
|||||||
/// {@tool snippet}
|
/// {@tool snippet}
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// Divider(
|
/// const Divider(
|
||||||
/// color: Colors.deepOrange,
|
/// color: Colors.deepOrange,
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -760,10 +760,10 @@ class DropdownButtonHideUnderline extends InheritedWidget {
|
|||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return DropdownButton<String>(
|
/// return DropdownButton<String>(
|
||||||
/// value: dropdownValue,
|
/// value: dropdownValue,
|
||||||
/// icon: Icon(Icons.arrow_downward),
|
/// icon: const Icon(Icons.arrow_downward),
|
||||||
/// iconSize: 24,
|
/// iconSize: 24,
|
||||||
/// elevation: 16,
|
/// elevation: 16,
|
||||||
/// style: TextStyle(
|
/// style: const TextStyle(
|
||||||
/// color: Colors.deepPurple
|
/// color: Colors.deepPurple
|
||||||
/// ),
|
/// ),
|
||||||
/// underline: Container(
|
/// underline: Container(
|
||||||
@ -1002,12 +1002,12 @@ class DropdownButton<T> extends StatefulWidget {
|
|||||||
/// dropdownValue = newValue!;
|
/// dropdownValue = newValue!;
|
||||||
/// });
|
/// });
|
||||||
/// },
|
/// },
|
||||||
/// style: TextStyle(color: Colors.blue),
|
/// style: const TextStyle(color: Colors.blue),
|
||||||
/// selectedItemBuilder: (BuildContext context) {
|
/// selectedItemBuilder: (BuildContext context) {
|
||||||
/// return options.map((String value) {
|
/// return options.map((String value) {
|
||||||
/// return Text(
|
/// return Text(
|
||||||
/// dropdownValue,
|
/// dropdownValue,
|
||||||
/// style: TextStyle(color: Colors.white),
|
/// style: const TextStyle(color: Colors.white),
|
||||||
/// );
|
/// );
|
||||||
/// }).toList();
|
/// }).toList();
|
||||||
/// },
|
/// },
|
||||||
|
@ -52,9 +52,10 @@ import 'theme_data.dart';
|
|||||||
/// This sample produces an enabled and a disabled ElevatedButton.
|
/// This sample produces an enabled and a disabled ElevatedButton.
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// final ButtonStyle style =
|
/// final ButtonStyle style =
|
||||||
/// ElevatedButton.styleFrom(textStyle: TextStyle(fontSize: 20));
|
/// ElevatedButton.styleFrom(textStyle: const TextStyle(fontSize: 20));
|
||||||
///
|
///
|
||||||
/// return Center(
|
/// return Center(
|
||||||
/// child: Column(
|
/// child: Column(
|
||||||
|
@ -166,7 +166,7 @@ class ExpansionPanelRadio extends ExpansionPanel {
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// List<Item> generateItems(int numberOfItems) {
|
/// List<Item> generateItems(int numberOfItems) {
|
||||||
/// return List.generate(numberOfItems, (int index) {
|
/// return List<Item>.generate(numberOfItems, (int index) {
|
||||||
/// return Item(
|
/// return Item(
|
||||||
/// headerValue: 'Panel $index',
|
/// headerValue: 'Panel $index',
|
||||||
/// expandedValue: 'This is item number $index',
|
/// expandedValue: 'This is item number $index',
|
||||||
@ -176,7 +176,7 @@ class ExpansionPanelRadio extends ExpansionPanel {
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// List<Item> _data = generateItems(8);
|
/// final List<Item> _data = generateItems(8);
|
||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
@ -203,11 +203,11 @@ class ExpansionPanelRadio extends ExpansionPanel {
|
|||||||
/// },
|
/// },
|
||||||
/// body: ListTile(
|
/// body: ListTile(
|
||||||
/// title: Text(item.expandedValue),
|
/// title: Text(item.expandedValue),
|
||||||
/// subtitle: Text('To delete this panel, tap the trash can icon'),
|
/// subtitle: const Text('To delete this panel, tap the trash can icon'),
|
||||||
/// trailing: Icon(Icons.delete),
|
/// trailing: const Icon(Icons.delete),
|
||||||
/// onTap: () {
|
/// onTap: () {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
/// _data.removeWhere((currentItem) => item == currentItem);
|
/// _data.removeWhere((Item currentItem) => item == currentItem);
|
||||||
/// });
|
/// });
|
||||||
/// }
|
/// }
|
||||||
/// ),
|
/// ),
|
||||||
@ -270,7 +270,7 @@ class ExpansionPanelList extends StatefulWidget {
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// List<Item> generateItems(int numberOfItems) {
|
/// List<Item> generateItems(int numberOfItems) {
|
||||||
/// return List.generate(numberOfItems, (int index) {
|
/// return List<Item>.generate(numberOfItems, (int index) {
|
||||||
/// return Item(
|
/// return Item(
|
||||||
/// id: index,
|
/// id: index,
|
||||||
/// headerValue: 'Panel $index',
|
/// headerValue: 'Panel $index',
|
||||||
@ -281,7 +281,7 @@ class ExpansionPanelList extends StatefulWidget {
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// List<Item> _data = generateItems(8);
|
/// final List<Item> _data = generateItems(8);
|
||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
@ -305,11 +305,11 @@ class ExpansionPanelList extends StatefulWidget {
|
|||||||
/// },
|
/// },
|
||||||
/// body: ListTile(
|
/// body: ListTile(
|
||||||
/// title: Text(item.expandedValue),
|
/// title: Text(item.expandedValue),
|
||||||
/// subtitle: Text('To delete this panel, tap the trash can icon'),
|
/// subtitle: const Text('To delete this panel, tap the trash can icon'),
|
||||||
/// trailing: Icon(Icons.delete),
|
/// trailing: const Icon(Icons.delete),
|
||||||
/// onTap: () {
|
/// onTap: () {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
/// _data.removeWhere((currentItem) => item == currentItem);
|
/// _data.removeWhere((Item currentItem) => item == currentItem);
|
||||||
/// });
|
/// });
|
||||||
/// }
|
/// }
|
||||||
/// )
|
/// )
|
||||||
|
@ -32,6 +32,8 @@ import 'theme.dart';
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class WidgetWithWrappedHandler extends StatelessWidget {
|
/// class WidgetWithWrappedHandler extends StatelessWidget {
|
||||||
|
/// const WidgetWithWrappedHandler({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return GestureDetector(
|
/// return GestureDetector(
|
||||||
@ -58,6 +60,8 @@ import 'theme.dart';
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class WidgetWithExplicitCall extends StatelessWidget {
|
/// class WidgetWithExplicitCall extends StatelessWidget {
|
||||||
|
/// const WidgetWithExplicitCall({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return GestureDetector(
|
/// return GestureDetector(
|
||||||
|
@ -66,9 +66,11 @@ enum StretchMode {
|
|||||||
/// import 'package:flutter/material.dart';
|
/// import 'package:flutter/material.dart';
|
||||||
/// ```
|
/// ```
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// void main() => runApp(MaterialApp(home: MyApp()));
|
/// void main() => runApp(const MaterialApp(home: MyApp()));
|
||||||
///
|
///
|
||||||
/// class MyApp extends StatelessWidget {
|
/// class MyApp extends StatelessWidget {
|
||||||
|
/// const MyApp({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
@ -79,11 +81,11 @@ enum StretchMode {
|
|||||||
/// stretch: true,
|
/// stretch: true,
|
||||||
/// onStretchTrigger: () {
|
/// onStretchTrigger: () {
|
||||||
/// // Function callback for stretch
|
/// // Function callback for stretch
|
||||||
/// return Future.value();
|
/// return Future<void>.value();
|
||||||
/// },
|
/// },
|
||||||
/// expandedHeight: 300.0,
|
/// expandedHeight: 300.0,
|
||||||
/// flexibleSpace: FlexibleSpaceBar(
|
/// flexibleSpace: FlexibleSpaceBar(
|
||||||
/// stretchModes: <StretchMode>[
|
/// stretchModes: const <StretchMode>[
|
||||||
/// StretchMode.zoomBackground,
|
/// StretchMode.zoomBackground,
|
||||||
/// StretchMode.blurBackground,
|
/// StretchMode.blurBackground,
|
||||||
/// StretchMode.fadeTitle,
|
/// StretchMode.fadeTitle,
|
||||||
@ -92,7 +94,7 @@ enum StretchMode {
|
|||||||
/// title: const Text('Flight Report'),
|
/// title: const Text('Flight Report'),
|
||||||
/// background: Stack(
|
/// background: Stack(
|
||||||
/// fit: StackFit.expand,
|
/// fit: StackFit.expand,
|
||||||
/// children: [
|
/// children: <Widget>[
|
||||||
/// Image.network(
|
/// Image.network(
|
||||||
/// 'https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg',
|
/// 'https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg',
|
||||||
/// fit: BoxFit.cover,
|
/// fit: BoxFit.cover,
|
||||||
@ -114,7 +116,8 @@ enum StretchMode {
|
|||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// SliverList(
|
/// SliverList(
|
||||||
/// delegate: SliverChildListDelegate([
|
/// delegate: SliverChildListDelegate(
|
||||||
|
/// const <Widget>[
|
||||||
/// ListTile(
|
/// ListTile(
|
||||||
/// leading: Icon(Icons.wb_sunny),
|
/// leading: Icon(Icons.wb_sunny),
|
||||||
/// title: Text('Sunday'),
|
/// title: Text('Sunday'),
|
||||||
@ -126,7 +129,8 @@ enum StretchMode {
|
|||||||
/// subtitle: Text('sunny, h: 80, l: 65'),
|
/// subtitle: Text('sunny, h: 80, l: 65'),
|
||||||
/// ),
|
/// ),
|
||||||
/// // ListTiles++
|
/// // ListTiles++
|
||||||
/// ]),
|
/// ],
|
||||||
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// ],
|
/// ],
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -69,14 +69,14 @@ class _DefaultHeroTag {
|
|||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
/// title: const Text('Floating Action Button'),
|
/// title: const Text('Floating Action Button'),
|
||||||
/// ),
|
/// ),
|
||||||
/// body: Center(
|
/// body: const Center(
|
||||||
/// child: const Text('Press the button below!')
|
/// child: Text('Press the button below!')
|
||||||
/// ),
|
/// ),
|
||||||
/// floatingActionButton: FloatingActionButton(
|
/// floatingActionButton: FloatingActionButton(
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// // Add your onPressed code here!
|
/// // Add your onPressed code here!
|
||||||
/// },
|
/// },
|
||||||
/// child: Icon(Icons.navigation),
|
/// child: const Icon(Icons.navigation),
|
||||||
/// backgroundColor: Colors.green,
|
/// backgroundColor: Colors.green,
|
||||||
/// ),
|
/// ),
|
||||||
/// );
|
/// );
|
||||||
@ -97,15 +97,15 @@ class _DefaultHeroTag {
|
|||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
/// title: const Text('Floating Action Button Label'),
|
/// title: const Text('Floating Action Button Label'),
|
||||||
/// ),
|
/// ),
|
||||||
/// body: Center(
|
/// body: const Center(
|
||||||
/// child: const Text('Press the button with a label below!'),
|
/// child: Text('Press the button with a label below!'),
|
||||||
/// ),
|
/// ),
|
||||||
/// floatingActionButton: FloatingActionButton.extended(
|
/// floatingActionButton: FloatingActionButton.extended(
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// // Add your onPressed code here!
|
/// // Add your onPressed code here!
|
||||||
/// },
|
/// },
|
||||||
/// label: Text('Approve'),
|
/// label: const Text('Approve'),
|
||||||
/// icon: Icon(Icons.thumb_up),
|
/// icon: const Icon(Icons.thumb_up),
|
||||||
/// backgroundColor: Colors.pink,
|
/// backgroundColor: Colors.pink,
|
||||||
/// ),
|
/// ),
|
||||||
/// );
|
/// );
|
||||||
|
@ -461,12 +461,12 @@ abstract class FloatingActionButtonLocation {
|
|||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
/// title: Text('Home page'),
|
/// title: const Text('Home page'),
|
||||||
/// ),
|
/// ),
|
||||||
/// floatingActionButton: FloatingActionButton(
|
/// floatingActionButton: FloatingActionButton(
|
||||||
/// onPressed: () { print('FAB pressed.'); },
|
/// onPressed: () { print('FAB pressed.'); },
|
||||||
/// tooltip: 'Increment',
|
/// tooltip: 'Increment',
|
||||||
/// child: Icon(Icons.add),
|
/// child: const Icon(Icons.add),
|
||||||
/// ),
|
/// ),
|
||||||
/// floatingActionButtonLocation: AlmostEndFloatFabLocation(),
|
/// floatingActionButtonLocation: AlmostEndFloatFabLocation(),
|
||||||
/// );
|
/// );
|
||||||
|
@ -52,12 +52,13 @@ const double _kMinButtonSize = kMinInteractiveDimension;
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Column(
|
/// return Column(
|
||||||
/// mainAxisSize: MainAxisSize.min,
|
/// mainAxisSize: MainAxisSize.min,
|
||||||
/// children: <Widget>[
|
/// children: <Widget>[
|
||||||
/// IconButton(
|
/// IconButton(
|
||||||
/// icon: Icon(Icons.volume_up),
|
/// icon: const Icon(Icons.volume_up),
|
||||||
/// tooltip: 'Increase volume by 10',
|
/// tooltip: 'Increase volume by 10',
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
@ -94,6 +95,7 @@ const double _kMinButtonSize = kMinInteractiveDimension;
|
|||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Material(
|
/// return Material(
|
||||||
/// color: Colors.white,
|
/// color: Colors.white,
|
||||||
@ -104,7 +106,7 @@ const double _kMinButtonSize = kMinInteractiveDimension;
|
|||||||
/// shape: CircleBorder(),
|
/// shape: CircleBorder(),
|
||||||
/// ),
|
/// ),
|
||||||
/// child: IconButton(
|
/// child: IconButton(
|
||||||
/// icon: Icon(Icons.android),
|
/// icon: const Icon(Icons.android),
|
||||||
/// color: Colors.white,
|
/// color: Colors.white,
|
||||||
/// onPressed: () {},
|
/// onPressed: () {},
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -59,7 +59,7 @@ import 'material.dart';
|
|||||||
/// height: 100.0,
|
/// height: 100.0,
|
||||||
/// child: InkWell(
|
/// child: InkWell(
|
||||||
/// onTap: () { /* ... */ },
|
/// onTap: () { /* ... */ },
|
||||||
/// child: Center(
|
/// child: const Center(
|
||||||
/// child: Text('YELLOW'),
|
/// child: Text('YELLOW'),
|
||||||
/// )
|
/// )
|
||||||
/// ),
|
/// ),
|
||||||
@ -78,17 +78,23 @@ import 'material.dart';
|
|||||||
/// color: Colors.grey[800],
|
/// color: Colors.grey[800],
|
||||||
/// child: Center(
|
/// child: Center(
|
||||||
/// child: Ink.image(
|
/// child: Ink.image(
|
||||||
/// image: AssetImage('cat.jpeg'),
|
/// image: const AssetImage('cat.jpeg'),
|
||||||
/// fit: BoxFit.cover,
|
/// fit: BoxFit.cover,
|
||||||
/// width: 300.0,
|
/// width: 300.0,
|
||||||
/// height: 200.0,
|
/// height: 200.0,
|
||||||
/// child: InkWell(
|
/// child: InkWell(
|
||||||
/// onTap: () { /* ... */ },
|
/// onTap: () { /* ... */ },
|
||||||
/// child: Align(
|
/// child: const Align(
|
||||||
/// alignment: Alignment.topLeft,
|
/// alignment: Alignment.topLeft,
|
||||||
/// child: Padding(
|
/// child: Padding(
|
||||||
/// padding: const EdgeInsets.all(10.0),
|
/// padding: EdgeInsets.all(10.0),
|
||||||
/// child: Text('KITTEN', style: TextStyle(fontWeight: FontWeight.w900, color: Colors.white)),
|
/// child: Text(
|
||||||
|
/// 'KITTEN',
|
||||||
|
/// style: TextStyle(
|
||||||
|
/// fontWeight: FontWeight.w900,
|
||||||
|
/// color: Colors.white,
|
||||||
|
/// ),
|
||||||
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// )
|
/// )
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -1182,11 +1182,12 @@ class _InkResponseState extends State<_InkResponseStateWidget>
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// double sideLength = 50;
|
/// double sideLength = 50;
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return AnimatedContainer(
|
/// return AnimatedContainer(
|
||||||
/// height: sideLength,
|
/// height: sideLength,
|
||||||
/// width: sideLength,
|
/// width: sideLength,
|
||||||
/// duration: Duration(seconds: 2),
|
/// duration: const Duration(seconds: 2),
|
||||||
/// curve: Curves.easeIn,
|
/// curve: Curves.easeIn,
|
||||||
/// child: Material(
|
/// child: Material(
|
||||||
/// color: Colors.yellow,
|
/// color: Colors.yellow,
|
||||||
|
@ -2415,7 +2415,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return TextField(
|
/// return const TextField(
|
||||||
/// decoration: InputDecoration(
|
/// decoration: InputDecoration(
|
||||||
/// icon: Icon(Icons.send),
|
/// icon: Icon(Icons.send),
|
||||||
/// hintText: 'Hint Text',
|
/// hintText: 'Hint Text',
|
||||||
@ -2438,7 +2438,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return TextField(
|
/// return const TextField(
|
||||||
/// decoration: InputDecoration.collapsed(
|
/// decoration: InputDecoration.collapsed(
|
||||||
/// hintText: 'Hint Text',
|
/// hintText: 'Hint Text',
|
||||||
/// border: OutlineInputBorder(),
|
/// border: OutlineInputBorder(),
|
||||||
@ -2458,7 +2458,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return TextField(
|
/// return const TextField(
|
||||||
/// decoration: InputDecoration(
|
/// decoration: InputDecoration(
|
||||||
/// hintText: 'Hint Text',
|
/// hintText: 'Hint Text',
|
||||||
/// errorText: 'Error Text',
|
/// errorText: 'Error Text',
|
||||||
@ -2875,7 +2875,7 @@ class InputDecoration {
|
|||||||
/// padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
/// padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
/// child: Column(
|
/// child: Column(
|
||||||
/// mainAxisAlignment: MainAxisAlignment.center,
|
/// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
/// children: <Widget>[
|
/// children: const <Widget>[
|
||||||
/// TextField(
|
/// TextField(
|
||||||
/// decoration: InputDecoration(
|
/// decoration: InputDecoration(
|
||||||
/// hintText: 'Normal Icon Constraints',
|
/// hintText: 'Normal Icon Constraints',
|
||||||
@ -3043,7 +3043,7 @@ class InputDecoration {
|
|||||||
/// padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
/// padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
/// child: Column(
|
/// child: Column(
|
||||||
/// mainAxisAlignment: MainAxisAlignment.center,
|
/// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
/// children: <Widget>[
|
/// children: const <Widget>[
|
||||||
/// TextField(
|
/// TextField(
|
||||||
/// decoration: InputDecoration(
|
/// decoration: InputDecoration(
|
||||||
/// hintText: 'Normal Icon Constraints',
|
/// hintText: 'Normal Icon Constraints',
|
||||||
|
@ -399,12 +399,12 @@ enum ListTileControlAffinity {
|
|||||||
/// child: Container(
|
/// child: Container(
|
||||||
/// width: 48,
|
/// width: 48,
|
||||||
/// height: 48,
|
/// height: 48,
|
||||||
/// padding: EdgeInsets.symmetric(vertical: 4.0),
|
/// padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||||
/// alignment: Alignment.center,
|
/// alignment: Alignment.center,
|
||||||
/// child: CircleAvatar(),
|
/// child: const CircleAvatar(),
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// title: Text('title'),
|
/// title: const Text('title'),
|
||||||
/// dense: false,
|
/// dense: false,
|
||||||
/// ),
|
/// ),
|
||||||
/// ```
|
/// ```
|
||||||
@ -426,11 +426,12 @@ enum ListTileControlAffinity {
|
|||||||
/// ```dart preamble
|
/// ```dart preamble
|
||||||
/// class CustomListItem extends StatelessWidget {
|
/// class CustomListItem extends StatelessWidget {
|
||||||
/// const CustomListItem({
|
/// const CustomListItem({
|
||||||
|
/// Key? key,
|
||||||
/// required this.thumbnail,
|
/// required this.thumbnail,
|
||||||
/// required this.title,
|
/// required this.title,
|
||||||
/// required this.user,
|
/// required this.user,
|
||||||
/// required this.viewCount,
|
/// required this.viewCount,
|
||||||
/// });
|
/// }) : super(key: key);
|
||||||
///
|
///
|
||||||
/// final Widget thumbnail;
|
/// final Widget thumbnail;
|
||||||
/// final String title;
|
/// final String title;
|
||||||
@ -547,7 +548,7 @@ enum ListTileControlAffinity {
|
|||||||
///
|
///
|
||||||
/// ```dart preamble
|
/// ```dart preamble
|
||||||
/// class _ArticleDescription extends StatelessWidget {
|
/// class _ArticleDescription extends StatelessWidget {
|
||||||
/// _ArticleDescription({
|
/// const _ArticleDescription({
|
||||||
/// Key? key,
|
/// Key? key,
|
||||||
/// required this.title,
|
/// required this.title,
|
||||||
/// required this.subtitle,
|
/// required this.subtitle,
|
||||||
@ -573,7 +574,7 @@ enum ListTileControlAffinity {
|
|||||||
/// crossAxisAlignment: CrossAxisAlignment.start,
|
/// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
/// children: <Widget>[
|
/// children: <Widget>[
|
||||||
/// Text(
|
/// Text(
|
||||||
/// '$title',
|
/// title,
|
||||||
/// maxLines: 2,
|
/// maxLines: 2,
|
||||||
/// overflow: TextOverflow.ellipsis,
|
/// overflow: TextOverflow.ellipsis,
|
||||||
/// style: const TextStyle(
|
/// style: const TextStyle(
|
||||||
@ -582,7 +583,7 @@ enum ListTileControlAffinity {
|
|||||||
/// ),
|
/// ),
|
||||||
/// const Padding(padding: EdgeInsets.only(bottom: 2.0)),
|
/// const Padding(padding: EdgeInsets.only(bottom: 2.0)),
|
||||||
/// Text(
|
/// Text(
|
||||||
/// '$subtitle',
|
/// subtitle,
|
||||||
/// maxLines: 2,
|
/// maxLines: 2,
|
||||||
/// overflow: TextOverflow.ellipsis,
|
/// overflow: TextOverflow.ellipsis,
|
||||||
/// style: const TextStyle(
|
/// style: const TextStyle(
|
||||||
@ -600,7 +601,7 @@ enum ListTileControlAffinity {
|
|||||||
/// mainAxisAlignment: MainAxisAlignment.end,
|
/// mainAxisAlignment: MainAxisAlignment.end,
|
||||||
/// children: <Widget>[
|
/// children: <Widget>[
|
||||||
/// Text(
|
/// Text(
|
||||||
/// '$author',
|
/// author,
|
||||||
/// style: const TextStyle(
|
/// style: const TextStyle(
|
||||||
/// fontSize: 12.0,
|
/// fontSize: 12.0,
|
||||||
/// color: Colors.black87,
|
/// color: Colors.black87,
|
||||||
@ -622,7 +623,7 @@ enum ListTileControlAffinity {
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class CustomListItemTwo extends StatelessWidget {
|
/// class CustomListItemTwo extends StatelessWidget {
|
||||||
/// CustomListItemTwo({
|
/// const CustomListItemTwo({
|
||||||
/// Key? key,
|
/// Key? key,
|
||||||
/// required this.thumbnail,
|
/// required this.thumbnail,
|
||||||
/// required this.title,
|
/// required this.title,
|
||||||
@ -683,7 +684,7 @@ enum ListTileControlAffinity {
|
|||||||
/// ),
|
/// ),
|
||||||
/// title: 'Flutter 1.0 Launch',
|
/// title: 'Flutter 1.0 Launch',
|
||||||
/// subtitle:
|
/// subtitle:
|
||||||
/// 'Flutter continues to improve and expand its horizons.'
|
/// 'Flutter continues to improve and expand its horizons. '
|
||||||
/// 'This text should max out at two lines and clip',
|
/// 'This text should max out at two lines and clip',
|
||||||
/// author: 'Dash',
|
/// author: 'Dash',
|
||||||
/// publishDate: 'Dec 28',
|
/// publishDate: 'Dec 28',
|
||||||
|
@ -109,11 +109,11 @@ typedef MaterialPropertyResolver<T> = T Function(Set<MaterialState> states);
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class MyColor extends MaterialStateColor {
|
/// class MyColor extends MaterialStateColor {
|
||||||
|
/// const MyColor() : super(_defaultColor);
|
||||||
|
///
|
||||||
/// static const int _defaultColor = 0xcafefeed;
|
/// static const int _defaultColor = 0xcafefeed;
|
||||||
/// static const int _pressedColor = 0xdeadbeef;
|
/// static const int _pressedColor = 0xdeadbeef;
|
||||||
///
|
///
|
||||||
/// const MyColor() : super(_defaultColor);
|
|
||||||
///
|
|
||||||
/// @override
|
/// @override
|
||||||
/// Color resolve(Set<MaterialState> states) {
|
/// Color resolve(Set<MaterialState> states) {
|
||||||
/// if (states.contains(MaterialState.pressed)) {
|
/// if (states.contains(MaterialState.pressed)) {
|
||||||
@ -204,7 +204,7 @@ class _MaterialStateColor extends MaterialStateColor {
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return ListTile(
|
/// return ListTile(
|
||||||
/// title: Text('Disabled ListTile'),
|
/// title: const Text('Disabled ListTile'),
|
||||||
/// enabled: false,
|
/// enabled: false,
|
||||||
/// mouseCursor: ListTileCursor(),
|
/// mouseCursor: ListTileCursor(),
|
||||||
/// );
|
/// );
|
||||||
@ -304,7 +304,7 @@ class _EnabledAndDisabledMouseCursor extends MaterialStateMouseCursor {
|
|||||||
/// @override
|
/// @override
|
||||||
/// BorderSide? resolve(Set<MaterialState> states) {
|
/// BorderSide? resolve(Set<MaterialState> states) {
|
||||||
/// if (states.contains(MaterialState.selected)) {
|
/// if (states.contains(MaterialState.selected)) {
|
||||||
/// return BorderSide(
|
/// return const BorderSide(
|
||||||
/// width: 1,
|
/// width: 1,
|
||||||
/// color: Colors.red,
|
/// color: Colors.red,
|
||||||
/// );
|
/// );
|
||||||
@ -317,9 +317,10 @@ class _EnabledAndDisabledMouseCursor extends MaterialStateMouseCursor {
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// bool isSelected = true;
|
/// bool isSelected = true;
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return FilterChip(
|
/// return FilterChip(
|
||||||
/// label: Text('Select chip'),
|
/// label: const Text('Select chip'),
|
||||||
/// selected: isSelected,
|
/// selected: isSelected,
|
||||||
/// onSelected: (bool value) {
|
/// onSelected: (bool value) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
@ -364,7 +365,7 @@ abstract class MaterialStateBorderSide extends BorderSide implements MaterialSta
|
|||||||
/// @override
|
/// @override
|
||||||
/// OutlinedBorder? resolve(Set<MaterialState> states) {
|
/// OutlinedBorder? resolve(Set<MaterialState> states) {
|
||||||
/// if (states.contains(MaterialState.selected)) {
|
/// if (states.contains(MaterialState.selected)) {
|
||||||
/// return RoundedRectangleBorder();
|
/// return const RoundedRectangleBorder();
|
||||||
/// }
|
/// }
|
||||||
/// return null; // Defer to default value on the theme or widget.
|
/// return null; // Defer to default value on the theme or widget.
|
||||||
/// }
|
/// }
|
||||||
@ -374,9 +375,10 @@ abstract class MaterialStateBorderSide extends BorderSide implements MaterialSta
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// bool isSelected = true;
|
/// bool isSelected = true;
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return FilterChip(
|
/// return FilterChip(
|
||||||
/// label: Text('Select chip'),
|
/// label: const Text('Select chip'),
|
||||||
/// selected: isSelected,
|
/// selected: isSelected,
|
||||||
/// onSelected: (bool value) {
|
/// onSelected: (bool value) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
@ -451,7 +453,7 @@ abstract class MaterialStateOutlinedBorder extends OutlinedBorder implements Mat
|
|||||||
/// foregroundColor: MaterialStateProperty.resolveWith(getColor),
|
/// foregroundColor: MaterialStateProperty.resolveWith(getColor),
|
||||||
/// ),
|
/// ),
|
||||||
/// onPressed: () {},
|
/// onPressed: () {},
|
||||||
/// child: Text('TextButton'),
|
/// child: const Text('TextButton'),
|
||||||
/// );
|
/// );
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -58,7 +58,7 @@ import 'theme.dart';
|
|||||||
/// });
|
/// });
|
||||||
/// },
|
/// },
|
||||||
/// labelType: NavigationRailLabelType.selected,
|
/// labelType: NavigationRailLabelType.selected,
|
||||||
/// destinations: [
|
/// destinations: const <NavigationRailDestination>[
|
||||||
/// NavigationRailDestination(
|
/// NavigationRailDestination(
|
||||||
/// icon: Icon(Icons.favorite_border),
|
/// icon: Icon(Icons.favorite_border),
|
||||||
/// selectedIcon: Icon(Icons.favorite),
|
/// selectedIcon: Icon(Icons.favorite),
|
||||||
@ -76,7 +76,7 @@ import 'theme.dart';
|
|||||||
/// ),
|
/// ),
|
||||||
/// ],
|
/// ],
|
||||||
/// ),
|
/// ),
|
||||||
/// VerticalDivider(thickness: 1, width: 1),
|
/// const VerticalDivider(thickness: 1, width: 1),
|
||||||
/// // This is the main content.
|
/// // This is the main content.
|
||||||
/// Expanded(
|
/// Expanded(
|
||||||
/// child: Center(
|
/// child: Center(
|
||||||
@ -329,7 +329,7 @@ class NavigationRail extends StatefulWidget {
|
|||||||
/// This can be used to synchronize animations in the [leading] or [trailing]
|
/// This can be used to synchronize animations in the [leading] or [trailing]
|
||||||
/// widget, such as an animated menu or a [FloatingActionButton] animation.
|
/// widget, such as an animated menu or a [FloatingActionButton] animation.
|
||||||
///
|
///
|
||||||
/// {@tool snippet}
|
/// {@tool dartpad --template=stateless_widget_material}
|
||||||
///
|
///
|
||||||
/// This example shows how to use this animation to create a
|
/// This example shows how to use this animation to create a
|
||||||
/// [FloatingActionButton] that animates itself between the normal and
|
/// [FloatingActionButton] that animates itself between the normal and
|
||||||
@ -338,10 +338,11 @@ class NavigationRail extends StatefulWidget {
|
|||||||
/// An instance of `ExtendableFab` would be created for
|
/// An instance of `ExtendableFab` would be created for
|
||||||
/// [NavigationRail.leading].
|
/// [NavigationRail.leading].
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart dartImports
|
||||||
/// import 'dart:ui';
|
/// import 'dart:ui';
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// @override
|
/// ```dart
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// final Animation<double> animation = NavigationRail.extendedAnimation(context);
|
/// final Animation<double> animation = NavigationRail.extendedAnimation(context);
|
||||||
/// return AnimatedBuilder(
|
/// return AnimatedBuilder(
|
||||||
@ -355,7 +356,7 @@ class NavigationRail extends StatefulWidget {
|
|||||||
/// ),
|
/// ),
|
||||||
/// child: animation.value == 0
|
/// child: animation.value == 0
|
||||||
/// ? FloatingActionButton(
|
/// ? FloatingActionButton(
|
||||||
/// child: Icon(Icons.add),
|
/// child: const Icon(Icons.add),
|
||||||
/// onPressed: () {},
|
/// onPressed: () {},
|
||||||
/// )
|
/// )
|
||||||
/// : Align(
|
/// : Align(
|
||||||
@ -364,8 +365,8 @@ class NavigationRail extends StatefulWidget {
|
|||||||
/// child: Padding(
|
/// child: Padding(
|
||||||
/// padding: const EdgeInsetsDirectional.only(start: 8),
|
/// padding: const EdgeInsetsDirectional.only(start: 8),
|
||||||
/// child: FloatingActionButton.extended(
|
/// child: FloatingActionButton.extended(
|
||||||
/// icon: Icon(Icons.add),
|
/// icon: const Icon(Icons.add),
|
||||||
/// label: Text('CREATE'),
|
/// label: const Text('CREATE'),
|
||||||
/// onPressed: () {},
|
/// onPressed: () {},
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -22,8 +22,8 @@ import 'tooltip.dart';
|
|||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
// enum Commands { heroAndScholar, hurricaneCame }
|
// enum Commands { heroAndScholar, hurricaneCame }
|
||||||
// dynamic _heroAndScholar;
|
// late bool _heroAndScholar;
|
||||||
// dynamic _selection;
|
// late dynamic _selection;
|
||||||
// late BuildContext context;
|
// late BuildContext context;
|
||||||
// void setState(VoidCallback fn) { }
|
// void setState(VoidCallback fn) { }
|
||||||
|
|
||||||
|
@ -267,14 +267,15 @@ class _LinearProgressIndicatorPainter extends CustomPainter {
|
|||||||
/// super.dispose();
|
/// super.dispose();
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// body: Padding(
|
/// body: Padding(
|
||||||
/// padding: const EdgeInsets.all(20.0),
|
/// padding: const EdgeInsets.all(20.0),
|
||||||
/// child: Column(
|
/// child: Column(
|
||||||
/// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
/// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
/// children: [
|
/// children: <Widget>[
|
||||||
/// Text(
|
/// const Text(
|
||||||
/// 'Linear progress indicator with a fixed color',
|
/// 'Linear progress indicator with a fixed color',
|
||||||
/// style: const TextStyle(fontSize: 20),
|
/// style: const TextStyle(fontSize: 20),
|
||||||
/// ),
|
/// ),
|
||||||
@ -505,13 +506,14 @@ class _CircularProgressIndicatorPainter extends CustomPainter {
|
|||||||
/// super.dispose();
|
/// super.dispose();
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// body: Padding(
|
/// body: Padding(
|
||||||
/// padding: const EdgeInsets.all(20.0),
|
/// padding: const EdgeInsets.all(20.0),
|
||||||
/// child: Column(
|
/// child: Column(
|
||||||
/// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
/// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
/// children: [
|
/// children: <Widget>[
|
||||||
/// Text(
|
/// Text(
|
||||||
/// 'Linear progress indicator with a fixed color',
|
/// 'Linear progress indicator with a fixed color',
|
||||||
/// style: Theme.of(context).textTheme.headline6,
|
/// style: Theme.of(context).textTheme.headline6,
|
||||||
|
@ -52,12 +52,13 @@ const double _kInnerRadius = 4.5;
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// SingingCharacter? _character = SingingCharacter.lafayette;
|
/// SingingCharacter? _character = SingingCharacter.lafayette;
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Column(
|
/// return Column(
|
||||||
/// children: <Widget>[
|
/// children: <Widget>[
|
||||||
/// ListTile(
|
/// ListTile(
|
||||||
/// title: const Text('Lafayette'),
|
/// title: const Text('Lafayette'),
|
||||||
/// leading: Radio(
|
/// leading: Radio<SingingCharacter>(
|
||||||
/// value: SingingCharacter.lafayette,
|
/// value: SingingCharacter.lafayette,
|
||||||
/// groupValue: _character,
|
/// groupValue: _character,
|
||||||
/// onChanged: (SingingCharacter? value) {
|
/// onChanged: (SingingCharacter? value) {
|
||||||
@ -67,7 +68,7 @@ const double _kInnerRadius = 4.5;
|
|||||||
/// ),
|
/// ),
|
||||||
/// ListTile(
|
/// ListTile(
|
||||||
/// title: const Text('Thomas Jefferson'),
|
/// title: const Text('Thomas Jefferson'),
|
||||||
/// leading: Radio(
|
/// leading: Radio<SingingCharacter>(
|
||||||
/// value: SingingCharacter.jefferson,
|
/// value: SingingCharacter.jefferson,
|
||||||
/// groupValue: _character,
|
/// groupValue: _character,
|
||||||
/// onChanged: (SingingCharacter? value) {
|
/// onChanged: (SingingCharacter? value) {
|
||||||
@ -218,7 +219,7 @@ class Radio<T> extends StatefulWidget {
|
|||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// body: ListView.builder(
|
/// body: ListView.builder(
|
||||||
/// itemBuilder: (context, index) {
|
/// itemBuilder: (BuildContext context, int index) {
|
||||||
/// return Row(
|
/// return Row(
|
||||||
/// mainAxisSize: MainAxisSize.min,
|
/// mainAxisSize: MainAxisSize.min,
|
||||||
/// crossAxisAlignment: CrossAxisAlignment.center,
|
/// crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
@ -108,12 +108,13 @@ import 'theme_data.dart';
|
|||||||
/// ```dart preamble
|
/// ```dart preamble
|
||||||
/// class LinkedLabelRadio extends StatelessWidget {
|
/// class LinkedLabelRadio extends StatelessWidget {
|
||||||
/// const LinkedLabelRadio({
|
/// const LinkedLabelRadio({
|
||||||
|
/// Key? key,
|
||||||
/// required this.label,
|
/// required this.label,
|
||||||
/// required this.padding,
|
/// required this.padding,
|
||||||
/// required this.groupValue,
|
/// required this.groupValue,
|
||||||
/// required this.value,
|
/// required this.value,
|
||||||
/// required this.onChanged,
|
/// required this.onChanged,
|
||||||
/// });
|
/// }) :super(key: key);
|
||||||
///
|
///
|
||||||
/// final String label;
|
/// final String label;
|
||||||
/// final EdgeInsets padding;
|
/// final EdgeInsets padding;
|
||||||
@ -137,7 +138,7 @@ import 'theme_data.dart';
|
|||||||
/// RichText(
|
/// RichText(
|
||||||
/// text: TextSpan(
|
/// text: TextSpan(
|
||||||
/// text: label,
|
/// text: label,
|
||||||
/// style: TextStyle(
|
/// style: const TextStyle(
|
||||||
/// color: Colors.blueAccent,
|
/// color: Colors.blueAccent,
|
||||||
/// decoration: TextDecoration.underline,
|
/// decoration: TextDecoration.underline,
|
||||||
/// ),
|
/// ),
|
||||||
@ -164,7 +165,7 @@ import 'theme_data.dart';
|
|||||||
/// children: <Widget>[
|
/// children: <Widget>[
|
||||||
/// LinkedLabelRadio(
|
/// LinkedLabelRadio(
|
||||||
/// label: 'First tappable label text',
|
/// label: 'First tappable label text',
|
||||||
/// padding: EdgeInsets.symmetric(horizontal: 5.0),
|
/// padding: const EdgeInsets.symmetric(horizontal: 5.0),
|
||||||
/// value: true,
|
/// value: true,
|
||||||
/// groupValue: _isRadioSelected,
|
/// groupValue: _isRadioSelected,
|
||||||
/// onChanged: (bool newValue) {
|
/// onChanged: (bool newValue) {
|
||||||
@ -175,7 +176,7 @@ import 'theme_data.dart';
|
|||||||
/// ),
|
/// ),
|
||||||
/// LinkedLabelRadio(
|
/// LinkedLabelRadio(
|
||||||
/// label: 'Second tappable label text',
|
/// label: 'Second tappable label text',
|
||||||
/// padding: EdgeInsets.symmetric(horizontal: 5.0),
|
/// padding: const EdgeInsets.symmetric(horizontal: 5.0),
|
||||||
/// value: false,
|
/// value: false,
|
||||||
/// groupValue: _isRadioSelected,
|
/// groupValue: _isRadioSelected,
|
||||||
/// onChanged: (bool newValue) {
|
/// onChanged: (bool newValue) {
|
||||||
@ -208,12 +209,13 @@ import 'theme_data.dart';
|
|||||||
/// ```dart preamble
|
/// ```dart preamble
|
||||||
/// class LabeledRadio extends StatelessWidget {
|
/// class LabeledRadio extends StatelessWidget {
|
||||||
/// const LabeledRadio({
|
/// const LabeledRadio({
|
||||||
|
/// Key? key,
|
||||||
/// required this.label,
|
/// required this.label,
|
||||||
/// required this.padding,
|
/// required this.padding,
|
||||||
/// required this.groupValue,
|
/// required this.groupValue,
|
||||||
/// required this.value,
|
/// required this.value,
|
||||||
/// required this.onChanged,
|
/// required this.onChanged,
|
||||||
/// });
|
/// }) : super(key: key);
|
||||||
///
|
///
|
||||||
/// final String label;
|
/// final String label;
|
||||||
/// final EdgeInsets padding;
|
/// final EdgeInsets padding;
|
||||||
@ -225,8 +227,9 @@ import 'theme_data.dart';
|
|||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return InkWell(
|
/// return InkWell(
|
||||||
/// onTap: () {
|
/// onTap: () {
|
||||||
/// if (value != groupValue)
|
/// if (value != groupValue) {
|
||||||
/// onChanged(value);
|
/// onChanged(value);
|
||||||
|
/// }
|
||||||
/// },
|
/// },
|
||||||
/// child: Padding(
|
/// child: Padding(
|
||||||
/// padding: padding,
|
/// padding: padding,
|
||||||
@ -406,7 +409,7 @@ class RadioListTile<T> extends StatelessWidget {
|
|||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// body: ListView.builder(
|
/// body: ListView.builder(
|
||||||
/// itemBuilder: (context, index) {
|
/// itemBuilder: (BuildContext context, int index) {
|
||||||
/// return RadioListTile<int>(
|
/// return RadioListTile<int>(
|
||||||
/// value: index,
|
/// value: index,
|
||||||
/// groupValue: groupValue,
|
/// groupValue: groupValue,
|
||||||
|
@ -18,8 +18,8 @@ import 'slider_theme.dart';
|
|||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
// RangeValues _rangeValues = RangeValues(0.3, 0.7);
|
// RangeValues _rangeValues = const RangeValues(0.3, 0.7);
|
||||||
// RangeValues _dollarsRange = RangeValues(50, 100);
|
// RangeValues _dollarsRange = const RangeValues(50, 100);
|
||||||
// void setState(VoidCallback fn) { }
|
// void setState(VoidCallback fn) { }
|
||||||
|
|
||||||
/// [RangeSlider] uses this callback to paint the value indicator on the overlay.
|
/// [RangeSlider] uses this callback to paint the value indicator on the overlay.
|
||||||
|
@ -34,10 +34,11 @@ import 'theme.dart';
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// final List<int> _items = List<int>.generate(50, (int index) => index);
|
/// final List<int> _items = List<int>.generate(50, (int index) => index);
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context){
|
/// Widget build(BuildContext context){
|
||||||
/// final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
/// final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||||
/// final oddItemColor = colorScheme.primary.withOpacity(0.05);
|
/// final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
|
||||||
/// final evenItemColor = colorScheme.primary.withOpacity(0.15);
|
/// final Color evenItemColor = colorScheme.primary.withOpacity(0.15);
|
||||||
///
|
///
|
||||||
/// return ReorderableListView(
|
/// return ReorderableListView(
|
||||||
/// padding: const EdgeInsets.symmetric(horizontal: 40),
|
/// padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
@ -186,10 +187,11 @@ class ReorderableListView extends StatefulWidget {
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// final List<int> _items = List<int>.generate(50, (int index) => index);
|
/// final List<int> _items = List<int>.generate(50, (int index) => index);
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context){
|
/// Widget build(BuildContext context){
|
||||||
/// final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
/// final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||||
/// final oddItemColor = colorScheme.primary.withOpacity(0.05);
|
/// final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
|
||||||
/// final evenItemColor = colorScheme.primary.withOpacity(0.15);
|
/// final Color evenItemColor = colorScheme.primary.withOpacity(0.15);
|
||||||
///
|
///
|
||||||
/// return ReorderableListView(
|
/// return ReorderableListView(
|
||||||
/// buildDefaultDragHandles: false,
|
/// buildDefaultDragHandles: false,
|
||||||
@ -217,7 +219,7 @@ class ReorderableListView extends StatefulWidget {
|
|||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// ],
|
/// ],
|
||||||
/// onReorder: (oldIndex, newIndex) {
|
/// onReorder: (int oldIndex, int newIndex) {
|
||||||
/// setState(() {
|
/// setState(() {
|
||||||
/// if (oldIndex < newIndex) {
|
/// if (oldIndex < newIndex) {
|
||||||
/// newIndex -= 1;
|
/// newIndex -= 1;
|
||||||
|
@ -152,9 +152,11 @@ class ScaffoldMessenger extends StatefulWidget {
|
|||||||
/// import 'package:flutter/material.dart';
|
/// import 'package:flutter/material.dart';
|
||||||
/// ```
|
/// ```
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// void main() => runApp(MyApp());
|
/// void main() => runApp(const MyApp());
|
||||||
///
|
///
|
||||||
/// class MyApp extends StatefulWidget {
|
/// class MyApp extends StatefulWidget {
|
||||||
|
/// const MyApp({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// _MyAppState createState() => _MyAppState();
|
/// _MyAppState createState() => _MyAppState();
|
||||||
/// }
|
/// }
|
||||||
@ -179,12 +181,12 @@ class ScaffoldMessenger extends StatefulWidget {
|
|||||||
/// return MaterialApp(
|
/// return MaterialApp(
|
||||||
/// scaffoldMessengerKey: _scaffoldMessengerKey,
|
/// scaffoldMessengerKey: _scaffoldMessengerKey,
|
||||||
/// home: Scaffold(
|
/// home: Scaffold(
|
||||||
/// appBar: AppBar(title: Text('ScaffoldMessenger Demo')),
|
/// appBar: AppBar(title: const Text('ScaffoldMessenger Demo')),
|
||||||
/// body: Center(
|
/// body: Center(
|
||||||
/// child: Column(
|
/// child: Column(
|
||||||
/// mainAxisAlignment: MainAxisAlignment.center,
|
/// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
/// children: <Widget>[
|
/// children: <Widget>[
|
||||||
/// Text(
|
/// const Text(
|
||||||
/// 'You have pushed the button this many times:',
|
/// 'You have pushed the button this many times:',
|
||||||
/// ),
|
/// ),
|
||||||
/// Text(
|
/// Text(
|
||||||
@ -197,7 +199,7 @@ class ScaffoldMessenger extends StatefulWidget {
|
|||||||
/// floatingActionButton: FloatingActionButton(
|
/// floatingActionButton: FloatingActionButton(
|
||||||
/// onPressed: _incrementCounter,
|
/// onPressed: _incrementCounter,
|
||||||
/// tooltip: 'Increment',
|
/// tooltip: 'Increment',
|
||||||
/// child: Icon(Icons.add),
|
/// child: const Icon(Icons.add),
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// );
|
/// );
|
||||||
@ -1291,6 +1293,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// int _count = 0;
|
/// int _count = 0;
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
@ -1320,6 +1323,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// int _count = 0;
|
/// int _count = 0;
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
@ -1352,6 +1356,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// int _count = 0;
|
/// int _count = 0;
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
@ -1369,7 +1374,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
|
|||||||
/// _count++;
|
/// _count++;
|
||||||
/// }),
|
/// }),
|
||||||
/// tooltip: 'Increment Counter',
|
/// tooltip: 'Increment Counter',
|
||||||
/// child: Icon(Icons.add),
|
/// child: const Icon(Icons.add),
|
||||||
/// ),
|
/// ),
|
||||||
/// floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
/// floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||||
/// );
|
/// );
|
||||||
@ -1665,11 +1670,11 @@ class Scaffold extends StatefulWidget {
|
|||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// key: _scaffoldKey,
|
/// key: _scaffoldKey,
|
||||||
/// appBar: AppBar(title: Text('Drawer Demo')),
|
/// appBar: AppBar(title: const Text('Drawer Demo')),
|
||||||
/// body: Center(
|
/// body: Center(
|
||||||
/// child: ElevatedButton(
|
/// child: ElevatedButton(
|
||||||
/// onPressed: _openEndDrawer,
|
/// onPressed: _openEndDrawer,
|
||||||
/// child: Text('Open End Drawer'),
|
/// child: const Text('Open End Drawer'),
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// endDrawer: Drawer(
|
/// endDrawer: Drawer(
|
||||||
@ -1822,11 +1827,13 @@ class Scaffold extends StatefulWidget {
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ```dart main
|
/// ```dart main
|
||||||
/// void main() => runApp(MyApp());
|
/// void main() => runApp(const MyApp());
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ```dart preamble
|
/// ```dart preamble
|
||||||
/// class MyApp extends StatelessWidget {
|
/// class MyApp extends StatelessWidget {
|
||||||
|
/// const MyApp({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// // This widget is the root of your application.
|
/// // This widget is the root of your application.
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
@ -1836,7 +1843,7 @@ class Scaffold extends StatefulWidget {
|
|||||||
/// primarySwatch: Colors.blue,
|
/// primarySwatch: Colors.blue,
|
||||||
/// ),
|
/// ),
|
||||||
/// home: Scaffold(
|
/// home: Scaffold(
|
||||||
/// body: MyScaffoldBody(),
|
/// body: const MyScaffoldBody(),
|
||||||
/// appBar: AppBar(title: const Text('Scaffold.of Example')),
|
/// appBar: AppBar(title: const Text('Scaffold.of Example')),
|
||||||
/// ),
|
/// ),
|
||||||
/// color: Colors.white,
|
/// color: Colors.white,
|
||||||
@ -1847,6 +1854,8 @@ class Scaffold extends StatefulWidget {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class MyScaffoldBody extends StatelessWidget {
|
/// class MyScaffoldBody extends StatelessWidget {
|
||||||
|
/// const MyScaffoldBody({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Center(
|
/// return Center(
|
||||||
@ -2213,8 +2222,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
|
|||||||
/// return OutlinedButton(
|
/// return OutlinedButton(
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// ScaffoldMessenger.of(context).showSnackBar(
|
/// ScaffoldMessenger.of(context).showSnackBar(
|
||||||
/// SnackBar(
|
/// const SnackBar(
|
||||||
/// content: const Text('A SnackBar has been shown.'),
|
/// content: Text('A SnackBar has been shown.'),
|
||||||
/// ),
|
/// ),
|
||||||
/// );
|
/// );
|
||||||
/// },
|
/// },
|
||||||
|
@ -101,7 +101,7 @@ abstract class SearchDelegate<T> {
|
|||||||
///
|
///
|
||||||
/// {@tool snippet}
|
/// {@tool snippet}
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class CustomSearchHintDelegate extends SearchDelegate {
|
/// class CustomSearchHintDelegate extends SearchDelegate<String> {
|
||||||
/// CustomSearchHintDelegate({
|
/// CustomSearchHintDelegate({
|
||||||
/// required String hintText,
|
/// required String hintText,
|
||||||
/// }) : super(
|
/// }) : super(
|
||||||
@ -111,22 +111,23 @@ abstract class SearchDelegate<T> {
|
|||||||
/// );
|
/// );
|
||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget buildLeading(BuildContext context) => Text("leading");
|
/// Widget buildLeading(BuildContext context) => const Text('leading');
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// PreferredSizeWidget buildBottom(BuildContext context) {
|
/// PreferredSizeWidget buildBottom(BuildContext context) {
|
||||||
/// return PreferredSize(
|
/// return const PreferredSize(
|
||||||
/// preferredSize: Size.fromHeight(56.0),
|
/// preferredSize: Size.fromHeight(56.0),
|
||||||
/// child: Text("bottom"));
|
/// child: Text('bottom'));
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget buildSuggestions(BuildContext context) => Text("suggestions");
|
/// Widget buildSuggestions(BuildContext context) => const Text('suggestions');
|
||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget buildResults(BuildContext context) => Text('results');
|
/// Widget buildResults(BuildContext context) => const Text('results');
|
||||||
///
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// List<Widget> buildActions(BuildContext context) => [];
|
/// List<Widget> buildActions(BuildContext context) => <Widget>[];
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
|
@ -125,7 +125,7 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur
|
|||||||
/// {@tool snippet}
|
/// {@tool snippet}
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// SelectableText(
|
/// const SelectableText(
|
||||||
/// 'Hello! How are you?',
|
/// 'Hello! How are you?',
|
||||||
/// textAlign: TextAlign.center,
|
/// textAlign: TextAlign.center,
|
||||||
/// style: TextStyle(fontWeight: FontWeight.bold),
|
/// style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
@ -84,6 +84,8 @@ class SliderTheme extends InheritedTheme {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class Launch extends StatefulWidget {
|
/// class Launch extends StatefulWidget {
|
||||||
|
/// const Launch({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// State createState() => LaunchState();
|
/// State createState() => LaunchState();
|
||||||
/// }
|
/// }
|
||||||
@ -244,6 +246,8 @@ class SliderThemeData with Diagnosticable {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class Blissful extends StatefulWidget {
|
/// class Blissful extends StatefulWidget {
|
||||||
|
/// const Blissful({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// State createState() => BlissfulState();
|
/// State createState() => BlissfulState();
|
||||||
/// }
|
/// }
|
||||||
|
@ -165,13 +165,13 @@ class _SnackBarActionState extends State<SnackBarAction> {
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return ElevatedButton(
|
/// return ElevatedButton(
|
||||||
/// child: Text("Show Snackbar"),
|
/// child: const Text('Show Snackbar'),
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// ScaffoldMessenger.of(context).showSnackBar(
|
/// ScaffoldMessenger.of(context).showSnackBar(
|
||||||
/// SnackBar(
|
/// SnackBar(
|
||||||
/// content: Text("Awesome Snackbar!"),
|
/// content: const Text('Awesome Snackbar!'),
|
||||||
/// action: SnackBarAction(
|
/// action: SnackBarAction(
|
||||||
/// label: "Action",
|
/// label: 'Action',
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// // Code to execute.
|
/// // Code to execute.
|
||||||
/// },
|
/// },
|
||||||
@ -193,21 +193,22 @@ class _SnackBarActionState extends State<SnackBarAction> {
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return ElevatedButton(
|
/// return ElevatedButton(
|
||||||
/// child: Text("Show Snackbar"),
|
/// child: const Text('Show Snackbar'),
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// ScaffoldMessenger.of(context).showSnackBar(
|
/// ScaffoldMessenger.of(context).showSnackBar(
|
||||||
/// SnackBar(
|
/// SnackBar(
|
||||||
/// action: SnackBarAction(
|
/// action: SnackBarAction(
|
||||||
/// label: "Action",
|
/// label: 'Action',
|
||||||
/// onPressed: () {
|
/// onPressed: () {
|
||||||
/// // Code to execute.
|
/// // Code to execute.
|
||||||
/// },
|
/// },
|
||||||
/// ),
|
/// ),
|
||||||
/// content: Text("Awesome SnackBar!"),
|
/// content: const Text('Awesome SnackBar!'),
|
||||||
/// duration: Duration(milliseconds: 1500),
|
/// duration: const Duration(milliseconds: 1500),
|
||||||
/// width: 280.0, // Width of the SnackBar.
|
/// width: 280.0, // Width of the SnackBar.
|
||||||
/// padding: EdgeInsets.symmetric(
|
/// padding: const EdgeInsets.symmetric(
|
||||||
/// horizontal: 8.0), // Inner padding for SnackBar content.
|
/// horizontal: 8.0, // Inner padding for SnackBar content.
|
||||||
|
/// ),
|
||||||
/// behavior: SnackBarBehavior.floating,
|
/// behavior: SnackBarBehavior.floating,
|
||||||
/// shape: RoundedRectangleBorder(
|
/// shape: RoundedRectangleBorder(
|
||||||
/// borderRadius: BorderRadius.circular(10.0),
|
/// borderRadius: BorderRadius.circular(10.0),
|
||||||
|
@ -126,29 +126,33 @@ class Step {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// int _index = 0;
|
/// int _index = 0;
|
||||||
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Stepper(
|
/// return Stepper(
|
||||||
/// currentStep: _index,
|
/// currentStep: _index,
|
||||||
/// onStepCancel: () {
|
/// onStepCancel: () {
|
||||||
/// if (_index > 0)
|
/// if (_index > 0) {
|
||||||
/// setState(() { _index -= 1; });
|
/// setState(() { _index -= 1; });
|
||||||
|
/// }
|
||||||
/// },
|
/// },
|
||||||
/// onStepContinue: () {
|
/// onStepContinue: () {
|
||||||
/// if (_index <= 0)
|
/// if (_index <= 0) {
|
||||||
/// setState(() { _index += 1; });
|
/// setState(() { _index += 1; });
|
||||||
|
/// }
|
||||||
/// },
|
/// },
|
||||||
/// onStepTapped: (index) {
|
/// onStepTapped: (int index) {
|
||||||
/// setState(() { _index = index; });
|
/// setState(() { _index = index; });
|
||||||
/// },
|
/// },
|
||||||
/// steps: <Step>[
|
/// steps: <Step>[
|
||||||
/// Step(
|
/// Step(
|
||||||
/// title: Text('Step 1 title'),
|
/// title: const Text('Step 1 title'),
|
||||||
/// content: Container(
|
/// content: Container(
|
||||||
/// alignment: Alignment.centerLeft,
|
/// alignment: Alignment.centerLeft,
|
||||||
/// child: Text('Content for Step 1')
|
/// child: const Text('Content for Step 1')
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// Step(
|
/// const Step(
|
||||||
/// title: Text('Step 2 title'),
|
/// title: Text('Step 2 title'),
|
||||||
/// content: Text('Content for Step 2'),
|
/// content: Text('Content for Step 2'),
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -102,11 +102,12 @@ enum _SwitchListTileType { material, adaptive }
|
|||||||
/// ```dart preamble
|
/// ```dart preamble
|
||||||
/// class LinkedLabelSwitch extends StatelessWidget {
|
/// class LinkedLabelSwitch extends StatelessWidget {
|
||||||
/// const LinkedLabelSwitch({
|
/// const LinkedLabelSwitch({
|
||||||
|
/// Key? key,
|
||||||
/// required this.label,
|
/// required this.label,
|
||||||
/// required this.padding,
|
/// required this.padding,
|
||||||
/// required this.value,
|
/// required this.value,
|
||||||
/// required this.onChanged,
|
/// required this.onChanged,
|
||||||
/// });
|
/// }) : super(key: key);
|
||||||
///
|
///
|
||||||
/// final String label;
|
/// final String label;
|
||||||
/// final EdgeInsets padding;
|
/// final EdgeInsets padding;
|
||||||
@ -123,7 +124,7 @@ enum _SwitchListTileType { material, adaptive }
|
|||||||
/// child: RichText(
|
/// child: RichText(
|
||||||
/// text: TextSpan(
|
/// text: TextSpan(
|
||||||
/// text: label,
|
/// text: label,
|
||||||
/// style: TextStyle(
|
/// style: const TextStyle(
|
||||||
/// color: Colors.blueAccent,
|
/// color: Colors.blueAccent,
|
||||||
/// decoration: TextDecoration.underline,
|
/// decoration: TextDecoration.underline,
|
||||||
/// ),
|
/// ),
|
||||||
@ -182,11 +183,12 @@ enum _SwitchListTileType { material, adaptive }
|
|||||||
/// ```dart preamble
|
/// ```dart preamble
|
||||||
/// class LabeledSwitch extends StatelessWidget {
|
/// class LabeledSwitch extends StatelessWidget {
|
||||||
/// const LabeledSwitch({
|
/// const LabeledSwitch({
|
||||||
|
/// Key? key,
|
||||||
/// required this.label,
|
/// required this.label,
|
||||||
/// required this.padding,
|
/// required this.padding,
|
||||||
/// required this.value,
|
/// required this.value,
|
||||||
/// required this.onChanged,
|
/// required this.onChanged,
|
||||||
/// });
|
/// }) : super(key: key);
|
||||||
///
|
///
|
||||||
/// final String label;
|
/// final String label;
|
||||||
/// final EdgeInsets padding;
|
/// final EdgeInsets padding;
|
||||||
|
@ -38,7 +38,7 @@ import 'constants.dart';
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class _MyTabbedPageState extends State<MyTabbedPage> with SingleTickerProviderStateMixin {
|
/// class _MyTabbedPageState extends State<MyTabbedPage> with SingleTickerProviderStateMixin {
|
||||||
/// final List<Tab> myTabs = <Tab>[
|
/// static const List<Tab> myTabs = <Tab>[
|
||||||
/// Tab(text: 'LEFT'),
|
/// Tab(text: 'LEFT'),
|
||||||
/// Tab(text: 'RIGHT'),
|
/// Tab(text: 'RIGHT'),
|
||||||
/// ];
|
/// ];
|
||||||
@ -90,7 +90,7 @@ import 'constants.dart';
|
|||||||
/// when using [DefaultTabController].
|
/// when using [DefaultTabController].
|
||||||
///
|
///
|
||||||
/// ```dart preamble
|
/// ```dart preamble
|
||||||
/// final List<Tab> tabs = <Tab>[
|
/// const List<Tab> tabs = <Tab>[
|
||||||
/// Tab(text: 'Zeroth'),
|
/// Tab(text: 'Zeroth'),
|
||||||
/// Tab(text: 'First'),
|
/// Tab(text: 'First'),
|
||||||
/// Tab(text: 'Second'),
|
/// Tab(text: 'Second'),
|
||||||
@ -114,7 +114,7 @@ import 'constants.dart';
|
|||||||
/// });
|
/// });
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
/// bottom: TabBar(
|
/// bottom: const TabBar(
|
||||||
/// tabs: tabs,
|
/// tabs: tabs,
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -579,8 +579,8 @@ class _TabBarScrollController extends ScrollController {
|
|||||||
/// length: 3,
|
/// length: 3,
|
||||||
/// child: Scaffold(
|
/// child: Scaffold(
|
||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
/// title: Text('TabBar Widget'),
|
/// title: const Text('TabBar Widget'),
|
||||||
/// bottom: TabBar(
|
/// bottom: const TabBar(
|
||||||
/// tabs: <Widget>[
|
/// tabs: <Widget>[
|
||||||
/// Tab(
|
/// Tab(
|
||||||
/// icon: Icon(Icons.cloud_outlined),
|
/// icon: Icon(Icons.cloud_outlined),
|
||||||
@ -594,7 +594,7 @@ class _TabBarScrollController extends ScrollController {
|
|||||||
/// ],
|
/// ],
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// body: TabBarView(
|
/// body: const TabBarView(
|
||||||
/// children: <Widget>[
|
/// children: <Widget>[
|
||||||
/// Center(
|
/// Center(
|
||||||
/// child: Text('It\'s cloudy here'),
|
/// child: Text('It\'s cloudy here'),
|
||||||
@ -628,13 +628,14 @@ class _TabBarScrollController extends ScrollController {
|
|||||||
/// _tabController = TabController(length: 3, vsync: this);
|
/// _tabController = TabController(length: 3, vsync: this);
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
/// title: Text('TabBar Widget'),
|
/// title: const Text('TabBar Widget'),
|
||||||
/// bottom: TabBar(
|
/// bottom: TabBar(
|
||||||
/// controller: _tabController,
|
/// controller: _tabController,
|
||||||
/// tabs: <Widget>[
|
/// tabs: const <Widget>[
|
||||||
/// Tab(
|
/// Tab(
|
||||||
/// icon: Icon(Icons.cloud_outlined),
|
/// icon: Icon(Icons.cloud_outlined),
|
||||||
/// ),
|
/// ),
|
||||||
@ -649,7 +650,7 @@ class _TabBarScrollController extends ScrollController {
|
|||||||
/// ),
|
/// ),
|
||||||
/// body: TabBarView(
|
/// body: TabBarView(
|
||||||
/// controller: _tabController,
|
/// controller: _tabController,
|
||||||
/// children: <Widget>[
|
/// children: const <Widget>[
|
||||||
/// Center(
|
/// Center(
|
||||||
/// child: Text('It\'s cloudy here'),
|
/// child: Text('It\'s cloudy here'),
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -64,7 +64,7 @@ import 'theme_data.dart';
|
|||||||
/// children: <Widget>[
|
/// children: <Widget>[
|
||||||
/// TextButton(
|
/// TextButton(
|
||||||
/// style: TextButton.styleFrom(
|
/// style: TextButton.styleFrom(
|
||||||
/// textStyle: TextStyle(fontSize: 20),
|
/// textStyle: const TextStyle(fontSize: 20),
|
||||||
/// ),
|
/// ),
|
||||||
/// onPressed: null,
|
/// onPressed: null,
|
||||||
/// child: const Text('Disabled'),
|
/// child: const Text('Disabled'),
|
||||||
@ -72,7 +72,7 @@ import 'theme_data.dart';
|
|||||||
/// const SizedBox(height: 30),
|
/// const SizedBox(height: 30),
|
||||||
/// TextButton(
|
/// TextButton(
|
||||||
/// style: TextButton.styleFrom(
|
/// style: TextButton.styleFrom(
|
||||||
/// textStyle: TextStyle(fontSize: 20),
|
/// textStyle: const TextStyle(fontSize: 20),
|
||||||
/// ),
|
/// ),
|
||||||
/// onPressed: () {},
|
/// onPressed: () {},
|
||||||
/// child: const Text('Enabled'),
|
/// child: const Text('Enabled'),
|
||||||
@ -99,7 +99,7 @@ import 'theme_data.dart';
|
|||||||
/// style: TextButton.styleFrom(
|
/// style: TextButton.styleFrom(
|
||||||
/// padding: const EdgeInsets.all(16.0),
|
/// padding: const EdgeInsets.all(16.0),
|
||||||
/// primary: Colors.white,
|
/// primary: Colors.white,
|
||||||
/// textStyle: TextStyle(fontSize: 20),
|
/// textStyle: const TextStyle(fontSize: 20),
|
||||||
/// ),
|
/// ),
|
||||||
/// onPressed: () {},
|
/// onPressed: () {},
|
||||||
/// child: const Text('Gradient'),
|
/// child: const Text('Gradient'),
|
||||||
|
@ -181,7 +181,7 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete
|
|||||||
/// 
|
/// 
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// TextField(
|
/// const TextField(
|
||||||
/// obscureText: true,
|
/// obscureText: true,
|
||||||
/// decoration: InputDecoration(
|
/// decoration: InputDecoration(
|
||||||
/// border: OutlineInputBorder(),
|
/// border: OutlineInputBorder(),
|
||||||
@ -205,16 +205,19 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// late TextEditingController _controller;
|
/// late TextEditingController _controller;
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// void initState() {
|
/// void initState() {
|
||||||
/// super.initState();
|
/// super.initState();
|
||||||
/// _controller = TextEditingController();
|
/// _controller = TextEditingController();
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// void dispose() {
|
/// void dispose() {
|
||||||
/// _controller.dispose();
|
/// _controller.dispose();
|
||||||
/// super.dispose();
|
/// super.dispose();
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Scaffold(
|
/// return Scaffold(
|
||||||
/// body: Center(
|
/// body: Center(
|
||||||
|
@ -76,6 +76,7 @@ export 'package:flutter/services.dart' show SmartQuotesType, SmartDashesType;
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Material(
|
/// return Material(
|
||||||
/// child: Center(
|
/// child: Center(
|
||||||
|
@ -118,7 +118,7 @@ class TextSelectionThemeData with Diagnosticable {
|
|||||||
/// color with light blue selection handles to the child text field.
|
/// color with light blue selection handles to the child text field.
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// TextSelectionTheme(
|
/// const TextSelectionTheme(
|
||||||
/// data: TextSelectionThemeData(
|
/// data: TextSelectionThemeData(
|
||||||
/// cursorColor: Colors.blue,
|
/// cursorColor: Colors.blue,
|
||||||
/// selectionHandleColor: Colors.lightBlue,
|
/// selectionHandleColor: Colors.lightBlue,
|
||||||
|
@ -353,7 +353,7 @@ class TextTheme with Diagnosticable {
|
|||||||
/// /// A Widget that sets the ambient theme's title text color for its
|
/// /// A Widget that sets the ambient theme's title text color for its
|
||||||
/// /// descendants, while leaving other ambient theme attributes alone.
|
/// /// descendants, while leaving other ambient theme attributes alone.
|
||||||
/// class TitleColorThemeCopy extends StatelessWidget {
|
/// class TitleColorThemeCopy extends StatelessWidget {
|
||||||
/// TitleColorThemeCopy({Key? key, required this.child, required this.titleColor}) : super(key: key);
|
/// const TitleColorThemeCopy({Key? key, required this.child, required this.titleColor}) : super(key: key);
|
||||||
///
|
///
|
||||||
/// final Color titleColor;
|
/// final Color titleColor;
|
||||||
/// final Widget child;
|
/// final Widget child;
|
||||||
@ -494,7 +494,7 @@ class TextTheme with Diagnosticable {
|
|||||||
/// /// A Widget that sets the ambient theme's title text color for its
|
/// /// A Widget that sets the ambient theme's title text color for its
|
||||||
/// /// descendants, while leaving other ambient theme attributes alone.
|
/// /// descendants, while leaving other ambient theme attributes alone.
|
||||||
/// class TitleColorTheme extends StatelessWidget {
|
/// class TitleColorTheme extends StatelessWidget {
|
||||||
/// TitleColorTheme({Key? key, required this.child, required this.titleColor}) : super(key: key);
|
/// const TitleColorTheme({Key? key, required this.child, required this.titleColor}) : super(key: key);
|
||||||
///
|
///
|
||||||
/// final Color titleColor;
|
/// final Color titleColor;
|
||||||
/// final Widget child;
|
/// final Widget child;
|
||||||
@ -507,7 +507,7 @@ class TextTheme with Diagnosticable {
|
|||||||
/// // set the title, but everything else would be null. This isn't very
|
/// // set the title, but everything else would be null. This isn't very
|
||||||
/// // useful, so merge it with the existing theme to keep all of the
|
/// // useful, so merge it with the existing theme to keep all of the
|
||||||
/// // preexisting definitions for the other styles.
|
/// // preexisting definitions for the other styles.
|
||||||
/// TextTheme partialTheme = TextTheme(headline6: TextStyle(color: titleColor));
|
/// final TextTheme partialTheme = TextTheme(headline6: TextStyle(color: titleColor));
|
||||||
/// theme = theme.copyWith(textTheme: theme.textTheme.merge(partialTheme));
|
/// theme = theme.copyWith(textTheme: theme.textTheme.merge(partialTheme));
|
||||||
/// return Theme(data: theme, child: child);
|
/// return Theme(data: theme, child: child);
|
||||||
/// }
|
/// }
|
||||||
|
@ -164,7 +164,7 @@ enum MaterialTapTargetSize {
|
|||||||
/// theme: ThemeData(
|
/// theme: ThemeData(
|
||||||
/// primaryColor: Colors.blue,
|
/// primaryColor: Colors.blue,
|
||||||
/// accentColor: Colors.green,
|
/// accentColor: Colors.green,
|
||||||
/// textTheme: TextTheme(bodyText2: TextStyle(color: Colors.purple)),
|
/// textTheme: const TextTheme(bodyText2: TextStyle(color: Colors.purple)),
|
||||||
/// ),
|
/// ),
|
||||||
/// home: Scaffold(
|
/// home: Scaffold(
|
||||||
/// appBar: AppBar(
|
/// appBar: AppBar(
|
||||||
@ -174,10 +174,8 @@ enum MaterialTapTargetSize {
|
|||||||
/// child: const Icon(Icons.add),
|
/// child: const Icon(Icons.add),
|
||||||
/// onPressed: () {},
|
/// onPressed: () {},
|
||||||
/// ),
|
/// ),
|
||||||
/// body: Center(
|
/// body: const Center(
|
||||||
/// child: Text(
|
/// child: Text('Button pressed 0 times'),
|
||||||
/// 'Button pressed 0 times',
|
|
||||||
/// ),
|
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// )
|
/// )
|
||||||
@ -722,8 +720,8 @@ class ThemeData with Diagnosticable {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// MaterialApp(
|
/// MaterialApp(
|
||||||
/// theme: ThemeData.from(colorScheme: ColorScheme.light()),
|
/// theme: ThemeData.from(colorScheme: const ColorScheme.light()),
|
||||||
/// darkTheme: ThemeData.from(colorScheme: ColorScheme.dark()),
|
/// darkTheme: ThemeData.from(colorScheme: const ColorScheme.dark()),
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
|
@ -31,7 +31,7 @@ enum DayPeriod {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// TimeOfDay now = TimeOfDay.now();
|
/// TimeOfDay now = TimeOfDay.now();
|
||||||
/// TimeOfDay releaseTime = TimeOfDay(hour: 15, minute: 0); // 3:00pm
|
/// const TimeOfDay releaseTime = TimeOfDay(hour: 15, minute: 0); // 3:00pm
|
||||||
/// TimeOfDay roomBooked = TimeOfDay.fromDateTime(DateTime.parse('2018-10-20 16:30:04Z')); // 4:30pm
|
/// TimeOfDay roomBooked = TimeOfDay.fromDateTime(DateTime.parse('2018-10-20 16:30:04Z')); // 4:30pm
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
|
@ -2174,7 +2174,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// Future<TimeOfDay?> selectedTime24Hour = showTimePicker(
|
/// Future<TimeOfDay?> selectedTime24Hour = showTimePicker(
|
||||||
/// context: context,
|
/// context: context,
|
||||||
/// initialTime: TimeOfDay(hour: 10, minute: 47),
|
/// initialTime: const TimeOfDay(hour: 10, minute: 47),
|
||||||
/// builder: (BuildContext context, Widget? child) {
|
/// builder: (BuildContext context, Widget? child) {
|
||||||
/// return MediaQuery(
|
/// return MediaQuery(
|
||||||
/// data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true),
|
/// data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true),
|
||||||
|
@ -38,9 +38,9 @@ import 'tooltip_theme.dart';
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Tooltip(
|
/// return const Tooltip(
|
||||||
/// message: "I am a Tooltip",
|
/// message: 'I am a Tooltip',
|
||||||
/// child: Text("Hover over the text to show a tooltip."),
|
/// child: Text('Hover over the text to show a tooltip.'),
|
||||||
/// );
|
/// );
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
@ -63,20 +63,20 @@ import 'tooltip_theme.dart';
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Tooltip(
|
/// return Tooltip(
|
||||||
/// message: "I am a Tooltip",
|
/// message: 'I am a Tooltip',
|
||||||
/// child: Text("Tap this text and hold down to show a tooltip."),
|
/// child: const Text('Tap this text and hold down to show a tooltip.'),
|
||||||
/// decoration: BoxDecoration(
|
/// decoration: BoxDecoration(
|
||||||
/// borderRadius: BorderRadius.circular(25),
|
/// borderRadius: BorderRadius.circular(25),
|
||||||
/// gradient: LinearGradient(colors: [Colors.amber, Colors.red]),
|
/// gradient: const LinearGradient(colors: <Color>[Colors.amber, Colors.red]),
|
||||||
/// ),
|
/// ),
|
||||||
/// height: 50,
|
/// height: 50,
|
||||||
/// padding: EdgeInsets.all(8.0),
|
/// padding: const EdgeInsets.all(8.0),
|
||||||
/// preferBelow: false,
|
/// preferBelow: false,
|
||||||
/// textStyle: TextStyle(
|
/// textStyle: const TextStyle(
|
||||||
/// fontSize: 24,
|
/// fontSize: 24,
|
||||||
/// ),
|
/// ),
|
||||||
/// showDuration: Duration(seconds: 2),
|
/// showDuration: const Duration(seconds: 2),
|
||||||
/// waitDuration: Duration(seconds: 1),
|
/// waitDuration: const Duration(seconds: 1),
|
||||||
/// );
|
/// );
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -207,7 +207,7 @@ class TooltipThemeData with Diagnosticable {
|
|||||||
/// message: 'Example tooltip',
|
/// message: 'Example tooltip',
|
||||||
/// child: IconButton(
|
/// child: IconButton(
|
||||||
/// iconSize: 36.0,
|
/// iconSize: 36.0,
|
||||||
/// icon: Icon(Icons.touch_app),
|
/// icon: const Icon(Icons.touch_app),
|
||||||
/// onPressed: () {},
|
/// onPressed: () {},
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -38,14 +38,14 @@ enum BorderStyle {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// Container(
|
/// Container(
|
||||||
/// padding: EdgeInsets.all(8.0),
|
/// padding: const EdgeInsets.all(8.0),
|
||||||
/// decoration: BoxDecoration(
|
/// decoration: BoxDecoration(
|
||||||
/// border: Border(
|
/// border: Border(
|
||||||
/// top: BorderSide(width: 16.0, color: Colors.lightBlue.shade50),
|
/// top: BorderSide(width: 16.0, color: Colors.lightBlue.shade50),
|
||||||
/// bottom: BorderSide(width: 16.0, color: Colors.lightBlue.shade900),
|
/// bottom: BorderSide(width: 16.0, color: Colors.lightBlue.shade900),
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// child: Text('Flutter in the sky', textAlign: TextAlign.center),
|
/// child: const Text('Flutter in the sky', textAlign: TextAlign.center),
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
|
@ -267,20 +267,20 @@ abstract class BoxBorder extends ShapeBorder {
|
|||||||
/// Container(
|
/// Container(
|
||||||
/// decoration: const BoxDecoration(
|
/// decoration: const BoxDecoration(
|
||||||
/// border: Border(
|
/// border: Border(
|
||||||
/// top: BorderSide(width: 1.0, color: Color(0xFFFFFFFFFF)),
|
/// top: BorderSide(width: 1.0, color: Color(0xFFFFFFFF)),
|
||||||
/// left: BorderSide(width: 1.0, color: Color(0xFFFFFFFFFF)),
|
/// left: BorderSide(width: 1.0, color: Color(0xFFFFFFFF)),
|
||||||
/// right: BorderSide(width: 1.0, color: Color(0xFFFF000000)),
|
/// right: BorderSide(width: 1.0, color: Color(0xFF000000)),
|
||||||
/// bottom: BorderSide(width: 1.0, color: Color(0xFFFF000000)),
|
/// bottom: BorderSide(width: 1.0, color: Color(0xFF000000)),
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
/// child: Container(
|
/// child: Container(
|
||||||
/// padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 2.0),
|
/// padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 2.0),
|
||||||
/// decoration: const BoxDecoration(
|
/// decoration: const BoxDecoration(
|
||||||
/// border: Border(
|
/// border: Border(
|
||||||
/// top: BorderSide(width: 1.0, color: Color(0xFFFFDFDFDF)),
|
/// top: BorderSide(width: 1.0, color: Color(0xFFDFDFDF)),
|
||||||
/// left: BorderSide(width: 1.0, color: Color(0xFFFFDFDFDF)),
|
/// left: BorderSide(width: 1.0, color: Color(0xFFDFDFDF)),
|
||||||
/// right: BorderSide(width: 1.0, color: Color(0xFFFF7F7F7F)),
|
/// right: BorderSide(width: 1.0, color: Color(0xFF7F7F7F)),
|
||||||
/// bottom: BorderSide(width: 1.0, color: Color(0xFFFF7F7F7F)),
|
/// bottom: BorderSide(width: 1.0, color: Color(0xFF7F7F7F)),
|
||||||
/// ),
|
/// ),
|
||||||
/// color: Color(0xFFBFBFBF),
|
/// color: Color(0xFFBFBFBF),
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -338,11 +338,11 @@ abstract class Gradient {
|
|||||||
/// ```dart
|
/// ```dart
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Container(
|
/// return Container(
|
||||||
/// decoration: BoxDecoration(
|
/// decoration: const BoxDecoration(
|
||||||
/// gradient: LinearGradient(
|
/// gradient: const LinearGradient(
|
||||||
/// begin: Alignment.topLeft,
|
/// begin: Alignment.topLeft,
|
||||||
/// end: Alignment(0.8, 0.0), // 10% of the width, so there are ten blinds.
|
/// end: Alignment(0.8, 0.0), // 10% of the width, so there are ten blinds.
|
||||||
/// colors: [const Color(0xffee0000), const Color(0xffeeee00)], // red to yellow
|
/// colors: const <Color>[Color(0xffee0000), Color(0xffeeee00)], // red to yellow
|
||||||
/// tileMode: TileMode.repeated, // repeats the gradient over the canvas
|
/// tileMode: TileMode.repeated, // repeats the gradient over the canvas
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
@ -562,17 +562,17 @@ class LinearGradient extends Gradient {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// void paintSky(Canvas canvas, Rect rect) {
|
/// void paintSky(Canvas canvas, Rect rect) {
|
||||||
/// var gradient = RadialGradient(
|
/// const RadialGradient gradient = RadialGradient(
|
||||||
/// center: const Alignment(0.7, -0.6), // near the top right
|
/// center: Alignment(0.7, -0.6), // near the top right
|
||||||
/// radius: 0.2,
|
/// radius: 0.2,
|
||||||
/// colors: [
|
/// colors: <Color>[
|
||||||
/// const Color(0xFFFFFF00), // yellow sun
|
/// Color(0xFFFFFF00), // yellow sun
|
||||||
/// const Color(0xFF0099FF), // blue sky
|
/// Color(0xFF0099FF), // blue sky
|
||||||
/// ],
|
/// ],
|
||||||
/// stops: [0.4, 1.0],
|
/// stops: <double>[0.4, 1.0],
|
||||||
/// );
|
/// );
|
||||||
/// // rect is the area we are painting over
|
/// // rect is the area we are painting over
|
||||||
/// var paint = Paint()
|
/// final Paint paint = Paint()
|
||||||
/// ..shader = gradient.createShader(rect);
|
/// ..shader = gradient.createShader(rect);
|
||||||
/// canvas.drawRect(rect, paint);
|
/// canvas.drawRect(rect, paint);
|
||||||
/// }
|
/// }
|
||||||
@ -810,19 +810,19 @@ class RadialGradient extends Gradient {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// Container(
|
/// Container(
|
||||||
/// decoration: BoxDecoration(
|
/// decoration: const BoxDecoration(
|
||||||
/// gradient: SweepGradient(
|
/// gradient: SweepGradient(
|
||||||
/// center: FractionalOffset.center,
|
/// center: FractionalOffset.center,
|
||||||
/// startAngle: 0.0,
|
/// startAngle: 0.0,
|
||||||
/// endAngle: math.pi * 2,
|
/// endAngle: math.pi * 2,
|
||||||
/// colors: const <Color>[
|
/// colors: <Color>[
|
||||||
/// Color(0xFF4285F4), // blue
|
/// Color(0xFF4285F4), // blue
|
||||||
/// Color(0xFF34A853), // green
|
/// Color(0xFF34A853), // green
|
||||||
/// Color(0xFFFBBC05), // yellow
|
/// Color(0xFFFBBC05), // yellow
|
||||||
/// Color(0xFFEA4335), // red
|
/// Color(0xFFEA4335), // red
|
||||||
/// Color(0xFF4285F4), // blue again to seamlessly transition to the start
|
/// Color(0xFF4285F4), // blue again to seamlessly transition to the start
|
||||||
/// ],
|
/// ],
|
||||||
/// stops: const <double>[0.0, 0.25, 0.5, 0.75, 1.0],
|
/// stops: <double>[0.0, 0.25, 0.5, 0.75, 1.0],
|
||||||
/// ),
|
/// ),
|
||||||
/// )
|
/// )
|
||||||
/// )
|
/// )
|
||||||
@ -836,19 +836,19 @@ class RadialGradient extends Gradient {
|
|||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// Container(
|
/// Container(
|
||||||
/// decoration: BoxDecoration(
|
/// decoration: const BoxDecoration(
|
||||||
/// gradient: SweepGradient(
|
/// gradient: SweepGradient(
|
||||||
/// center: FractionalOffset.center,
|
/// center: FractionalOffset.center,
|
||||||
/// startAngle: 0.0,
|
/// startAngle: 0.0,
|
||||||
/// endAngle: math.pi * 2,
|
/// endAngle: math.pi * 2,
|
||||||
/// colors: const <Color>[
|
/// colors: <Color>[
|
||||||
/// Color(0xFF4285F4), // blue
|
/// Color(0xFF4285F4), // blue
|
||||||
/// Color(0xFF34A853), // green
|
/// Color(0xFF34A853), // green
|
||||||
/// Color(0xFFFBBC05), // yellow
|
/// Color(0xFFFBBC05), // yellow
|
||||||
/// Color(0xFFEA4335), // red
|
/// Color(0xFFEA4335), // red
|
||||||
/// Color(0xFF4285F4), // blue again to seamlessly transition to the start
|
/// Color(0xFF4285F4), // blue again to seamlessly transition to the start
|
||||||
/// ],
|
/// ],
|
||||||
/// stops: const <double>[0.0, 0.25, 0.5, 0.75, 1.0],
|
/// stops: <double>[0.0, 0.25, 0.5, 0.75, 1.0],
|
||||||
/// transform: GradientRotation(math.pi/4),
|
/// transform: GradientRotation(math.pi/4),
|
||||||
/// ),
|
/// ),
|
||||||
/// ),
|
/// ),
|
||||||
|
@ -19,7 +19,7 @@ const int _kDefaultSizeBytes = 100 << 20; // 100 MiB
|
|||||||
/// MB. The maximum size can be adjusted using [maximumSize] and
|
/// MB. The maximum size can be adjusted using [maximumSize] and
|
||||||
/// [maximumSizeBytes].
|
/// [maximumSizeBytes].
|
||||||
///
|
///
|
||||||
/// The cache also holds a list of "live" references. An image is considered
|
/// The cache also holds a list of 'live' references. An image is considered
|
||||||
/// live if its [ImageStreamCompleter]'s listener count has never dropped to
|
/// live if its [ImageStreamCompleter]'s listener count has never dropped to
|
||||||
/// zero after adding at least one listener. The cache uses
|
/// zero after adding at least one listener. The cache uses
|
||||||
/// [ImageStreamCompleter.addOnLastListenerRemovedCallback] to determine when
|
/// [ImageStreamCompleter.addOnLastListenerRemovedCallback] to determine when
|
||||||
@ -28,7 +28,7 @@ const int _kDefaultSizeBytes = 100 << 20; // 100 MiB
|
|||||||
/// The [putIfAbsent] method is the main entry-point to the cache API. It
|
/// The [putIfAbsent] method is the main entry-point to the cache API. It
|
||||||
/// returns the previously cached [ImageStreamCompleter] for the given key, if
|
/// returns the previously cached [ImageStreamCompleter] for the given key, if
|
||||||
/// available; if not, it calls the given callback to obtain it first. In either
|
/// available; if not, it calls the given callback to obtain it first. In either
|
||||||
/// case, the key is moved to the "most recently used" position.
|
/// case, the key is moved to the 'most recently used' position.
|
||||||
///
|
///
|
||||||
/// A caller can determine whether an image is already in the cache by using
|
/// A caller can determine whether an image is already in the cache by using
|
||||||
/// [containsKey], which will return true if the image is tracked by the cache
|
/// [containsKey], which will return true if the image is tracked by the cache
|
||||||
@ -52,7 +52,7 @@ const int _kDefaultSizeBytes = 100 << 20; // 100 MiB
|
|||||||
/// class MyImageCache extends ImageCache {
|
/// class MyImageCache extends ImageCache {
|
||||||
/// @override
|
/// @override
|
||||||
/// void clear() {
|
/// void clear() {
|
||||||
/// print("Clearing cache!");
|
/// print('Clearing cache!');
|
||||||
/// super.clear();
|
/// super.clear();
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
@ -65,10 +65,12 @@ const int _kDefaultSizeBytes = 100 << 20; // 100 MiB
|
|||||||
/// void main() {
|
/// void main() {
|
||||||
/// // The constructor sets global variables.
|
/// // The constructor sets global variables.
|
||||||
/// MyWidgetsBinding();
|
/// MyWidgetsBinding();
|
||||||
/// runApp(MyApp());
|
/// runApp(const MyApp());
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// class MyApp extends StatelessWidget {
|
/// class MyApp extends StatelessWidget {
|
||||||
|
/// const MyApp({Key? key}) : super(key: key);
|
||||||
|
///
|
||||||
/// @override
|
/// @override
|
||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return Container();
|
/// return Container();
|
||||||
@ -309,7 +311,7 @@ class ImageCache {
|
|||||||
|
|
||||||
/// Returns the previously cached [ImageStream] for the given key, if available;
|
/// Returns the previously cached [ImageStream] for the given key, if available;
|
||||||
/// if not, calls the given callback to obtain it first. In either case, the
|
/// if not, calls the given callback to obtain it first. In either case, the
|
||||||
/// key is moved to the "most recently used" position.
|
/// key is moved to the 'most recently used' position.
|
||||||
///
|
///
|
||||||
/// The arguments must not be null. The `loader` cannot return null.
|
/// The arguments must not be null. The `loader` cannot return null.
|
||||||
///
|
///
|
||||||
|
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