mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[H] Cleanup (#23632)
* Avoid abbreviations * Sample code for AppBar.leading * Add a test for OverflowBox/FractionallySizedBox * Minor wording improvements in the text. The words "note that" here don't really contribute to the flow.
This commit is contained in:
parent
5fc6b87174
commit
4a094de290
@ -569,7 +569,7 @@ class ArchivePublisher {
|
||||
///
|
||||
/// Archives contain the executables and customizations for the platform that
|
||||
/// they are created on.
|
||||
Future<void> main(List<String> argList) async {
|
||||
Future<void> main(List<String> rawArguments) async {
|
||||
final ArgParser argParser = ArgParser();
|
||||
argParser.addOption(
|
||||
'temp_dir',
|
||||
@ -612,9 +612,9 @@ Future<void> main(List<String> argList) async {
|
||||
help: 'Print help for this command.',
|
||||
);
|
||||
|
||||
final ArgResults args = argParser.parse(argList);
|
||||
final ArgResults parsedArguments = argParser.parse(rawArguments);
|
||||
|
||||
if (args['help']) {
|
||||
if (parsedArguments['help']) {
|
||||
print(argParser.usage);
|
||||
exit(0);
|
||||
}
|
||||
@ -625,7 +625,7 @@ Future<void> main(List<String> argList) async {
|
||||
exit(exitCode);
|
||||
}
|
||||
|
||||
final String revision = args['revision'];
|
||||
final String revision = parsedArguments['revision'];
|
||||
if (revision.isEmpty) {
|
||||
errorExit('Invalid argument: --revision must be specified.');
|
||||
}
|
||||
@ -633,40 +633,40 @@ Future<void> main(List<String> argList) async {
|
||||
errorExit('Invalid argument: --revision must be the entire hash, not just a prefix.');
|
||||
}
|
||||
|
||||
if (args['branch'].isEmpty) {
|
||||
if (parsedArguments['branch'].isEmpty) {
|
||||
errorExit('Invalid argument: --branch must be specified.');
|
||||
}
|
||||
|
||||
Directory tempDir;
|
||||
bool removeTempDir = false;
|
||||
if (args['temp_dir'] == null || args['temp_dir'].isEmpty) {
|
||||
if (parsedArguments['temp_dir'] == null || parsedArguments['temp_dir'].isEmpty) {
|
||||
tempDir = Directory.systemTemp.createTempSync('flutter_package.');
|
||||
removeTempDir = true;
|
||||
} else {
|
||||
tempDir = Directory(args['temp_dir']);
|
||||
tempDir = Directory(parsedArguments['temp_dir']);
|
||||
if (!tempDir.existsSync()) {
|
||||
errorExit("Temporary directory ${args['temp_dir']} doesn't exist.");
|
||||
errorExit("Temporary directory ${parsedArguments['temp_dir']} doesn't exist.");
|
||||
}
|
||||
}
|
||||
|
||||
Directory outputDir;
|
||||
if (args['output'] == null) {
|
||||
if (parsedArguments['output'] == null) {
|
||||
outputDir = tempDir;
|
||||
} else {
|
||||
outputDir = Directory(args['output']);
|
||||
outputDir = Directory(parsedArguments['output']);
|
||||
if (!outputDir.existsSync()) {
|
||||
outputDir.createSync(recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
final Branch branch = fromBranchName(args['branch']);
|
||||
final Branch branch = fromBranchName(parsedArguments['branch']);
|
||||
final ArchiveCreator creator = ArchiveCreator(tempDir, outputDir, revision, branch);
|
||||
int exitCode = 0;
|
||||
String message;
|
||||
try {
|
||||
final String version = await creator.initializeRepo();
|
||||
final File outputFile = await creator.createArchive();
|
||||
if (args['publish']) {
|
||||
if (parsedArguments['publish']) {
|
||||
final ArchivePublisher publisher = ArchivePublisher(
|
||||
tempDir,
|
||||
revision,
|
||||
|
||||
@ -168,6 +168,36 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
|
||||
/// widget with an [IconButton] that opens the drawer (using [Icons.menu]). If
|
||||
/// there's no [Drawer] and the parent [Navigator] can go back, the [AppBar]
|
||||
/// will use a [BackButton] that calls [Navigator.maybePop].
|
||||
///
|
||||
/// ## Sample code
|
||||
///
|
||||
/// The following code shows how the drawer button could be manually specified
|
||||
/// instead of relying on [automaticallyImplyLeading]:
|
||||
///
|
||||
/// ```dart
|
||||
/// AppBar(
|
||||
/// leading: Builder(
|
||||
/// builder: (BuildContext context) {
|
||||
/// return IconButton(
|
||||
/// icon: const Icon(Icons.menu),
|
||||
/// onPressed: () { Scaffold.of(context).openDrawer(); },
|
||||
/// tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
|
||||
/// );
|
||||
/// },
|
||||
/// ),
|
||||
/// )
|
||||
/// ```
|
||||
///
|
||||
/// The [Builder] is used in this example to ensure that the `context` refers
|
||||
/// to that part of the subtree. That way this code snippet can be used even
|
||||
/// inside the very code that is creating the [Scaffold] (in which case,
|
||||
/// without the [Builder], the `context` wouldn't be able to see the
|
||||
/// [Scaffold], since it would refer to an ancestor of that widget).
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [Scaffold.appBar], in which an [AppBar] is usually placed.
|
||||
/// * [Scaffold.drawer], in which the [Drawer] is usually placed.
|
||||
final Widget leading;
|
||||
|
||||
/// Controls whether we should try to imply the leading widget if null.
|
||||
|
||||
@ -355,14 +355,14 @@ abstract class ScrollView extends StatelessWidget {
|
||||
/// generated semantics of each scrollable item with a semantic index. This can
|
||||
/// be done by wrapping the child widgets in an [IndexedSemantics].
|
||||
///
|
||||
/// This semantic index is not necesarily the same as the index of the widget
|
||||
/// in the scrollable, because some widgets may not contribute semantic
|
||||
/// information. Consider a [new ListView.separated()], every other widget is a
|
||||
/// This semantic index is not necesarily the same as the index of the widget in
|
||||
/// the scrollable, because some widgets may not contribute semantic
|
||||
/// information. Consider a [new ListView.separated()]: every other widget is a
|
||||
/// divider with no semantic information. In this case, only odd numbered
|
||||
/// widgets have a semantic index (equal to the index ~/ 2). Furthermore, the
|
||||
/// total number of children in this example would be half the number of
|
||||
/// widgets. Note that [new ListView.separated()] handles this automatically
|
||||
/// and is only used here as an example.
|
||||
/// widgets. (The [new ListView.separated()] constructor handles this
|
||||
/// automatically; this is only used here as an example.)
|
||||
///
|
||||
/// The total number of visible children can be provided by the constructor
|
||||
/// parameter `semanticChildCount`. This should always be the same as the
|
||||
|
||||
@ -61,4 +61,30 @@ void main() {
|
||||
expect(box.size, equals(const Size(400.0, 300.0)));
|
||||
expect(box.localToGlobal(box.size.center(Offset.zero)), equals(const Offset(0.0 + 400.0 / 2.0, 0.0 + 300.0 / 2.0)));
|
||||
});
|
||||
|
||||
testWidgets('OverflowBox alignment with FractionallySizedBox', (WidgetTester tester) async {
|
||||
final GlobalKey inner = GlobalKey();
|
||||
await tester.pumpWidget(Directionality(
|
||||
textDirection: TextDirection.rtl,
|
||||
child: OverflowBox(
|
||||
minWidth: 0.0,
|
||||
maxWidth: 100.0,
|
||||
minHeight: 0.0,
|
||||
maxHeight: 100.0,
|
||||
alignment: const AlignmentDirectional(1.0, -1.0),
|
||||
child: Center(
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: 0.5,
|
||||
heightFactor: 0.25,
|
||||
child: Container(
|
||||
key: inner
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
final RenderBox box = inner.currentContext.findRenderObject();
|
||||
expect(box.size, equals(const Size(50.0, 25.0)));
|
||||
expect(box.localToGlobal(Offset.zero), equals(const Offset(25.0, 37.5)));
|
||||
});
|
||||
}
|
||||
|
||||
@ -41,7 +41,8 @@ void main() {
|
||||
equals('/home/me/.AndroidStudioWithCheese5.0/config/plugins'));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
// Note that custom home paths are not supported on macOS nor Windows yet:
|
||||
// Custom home paths are not supported on macOS nor Windows yet,
|
||||
// so we force the platform to fake Linux here.
|
||||
Platform: () => linuxPlatform(),
|
||||
});
|
||||
});
|
||||
|
||||
@ -23,7 +23,8 @@ void main() {
|
||||
final NoAndroidStudioValidator validator = NoAndroidStudioValidator();
|
||||
expect((await validator.validate()).type, equals(ValidationType.notAvailable));
|
||||
}, overrides: <Type, Generator>{
|
||||
// Note that custom home paths are not supported on macOS nor Windows yet:
|
||||
// Custom home paths are not supported on macOS nor Windows yet,
|
||||
// so we force the platform to fake Linux here.
|
||||
Platform: () => linuxPlatform(),
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user