text
stringlengths 6
13.6M
| id
stringlengths 13
176
| metadata
dict | __index_level_0__
int64 0
1.69k
|
---|---|---|---|
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/os.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:process/process.dart';
import '../../src/common.dart';
import '../../src/context.dart';
void main() {
group('OperatingSystemUtils', () {
late Directory tempDir;
late FileSystem fileSystem;
setUp(() {
fileSystem = LocalFileSystem.test(signals: FakeSignals());
tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_tools_os_utils_test.');
});
tearDown(() {
tryToDelete(tempDir);
});
testWithoutContext('makeExecutable', () async {
const Platform platform = LocalPlatform();
final OperatingSystemUtils operatingSystemUtils = OperatingSystemUtils(
fileSystem: fileSystem,
logger: BufferLogger.test(),
platform: platform,
processManager: const LocalProcessManager(),
);
final File file = fileSystem.file(fileSystem.path.join(tempDir.path, 'foo.script'));
file.writeAsStringSync('hello world');
operatingSystemUtils.makeExecutable(file);
// Skip this test on windows.
if (!platform.isWindows) {
final String mode = file.statSync().modeString();
// rwxr--r--
expect(mode.substring(0, 3), endsWith('x'));
}
});
});
}
| flutter/packages/flutter_tools/test/general.shard/base/os_utils_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/base/os_utils_test.dart",
"repo_id": "flutter",
"token_count": 574
} | 771 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/deferred_component.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/build_system/build_system.dart';
import 'package:flutter_tools/src/build_system/depfile.dart';
import 'package:flutter_tools/src/build_system/targets/android.dart';
import 'package:flutter_tools/src/convert.dart';
import '../../../src/common.dart';
import '../../../src/context.dart';
import '../../../src/fake_process_manager.dart';
void main() {
late FakeProcessManager processManager;
late FileSystem fileSystem;
late Artifacts artifacts;
late Logger logger;
setUp(() {
logger = BufferLogger.test();
fileSystem = MemoryFileSystem.test();
processManager = FakeProcessManager.empty();
artifacts = Artifacts.test();
});
testWithoutContext('Android AOT targets has analyticsName', () {
expect(androidArmProfile.analyticsName, 'android_aot');
});
testUsingContext('debug bundle contains expected resources', () async {
final Environment environment = Environment.test(
fileSystem.currentDirectory,
outputDir: fileSystem.directory('out')..createSync(),
defines: <String, String>{
kBuildMode: 'debug',
},
processManager: processManager,
artifacts: artifacts,
fileSystem: fileSystem,
logger: logger,
);
environment.buildDir.createSync(recursive: true);
// create pre-requisites.
environment.buildDir.childFile('app.dill')
.writeAsStringSync('abcd');
fileSystem
.file(artifacts.getArtifactPath(Artifact.vmSnapshotData, mode: BuildMode.debug))
.createSync(recursive: true);
fileSystem
.file(artifacts.getArtifactPath(Artifact.isolateSnapshotData, mode: BuildMode.debug))
.createSync(recursive: true);
await const DebugAndroidApplication().build(environment);
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'isolate_snapshot_data')).existsSync(), true);
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'vm_snapshot_data')).existsSync(), true);
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'kernel_blob.bin')).existsSync(), true);
});
testUsingContext('debug bundle contains expected resources with bundle SkSL', () async {
final Environment environment = Environment.test(
fileSystem.currentDirectory,
outputDir: fileSystem.directory('out')..createSync(),
defines: <String, String>{
kBuildMode: 'debug',
},
inputs: <String, String>{
kBundleSkSLPath: 'bundle.sksl',
},
processManager: processManager,
artifacts: artifacts,
fileSystem: fileSystem,
logger: logger,
engineVersion: '2',
);
environment.buildDir.createSync(recursive: true);
fileSystem.file('bundle.sksl').writeAsStringSync(json.encode(
<String, Object>{
'engineRevision': '2',
'platform': 'android',
'data': <String, Object>{
'A': 'B',
},
},
));
// create pre-requisites.
environment.buildDir.childFile('app.dill')
.writeAsStringSync('abcd');
fileSystem
.file(artifacts.getArtifactPath(Artifact.vmSnapshotData, mode: BuildMode.debug))
.createSync(recursive: true);
fileSystem
.file(artifacts.getArtifactPath(Artifact.isolateSnapshotData, mode: BuildMode.debug))
.createSync(recursive: true);
await const DebugAndroidApplication().build(environment);
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'isolate_snapshot_data')), exists);
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'vm_snapshot_data')), exists);
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'kernel_blob.bin')), exists);
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'io.flutter.shaders.json')), exists);
});
testWithoutContext('profile bundle contains expected resources', () async {
final Environment environment = Environment.test(
fileSystem.currentDirectory,
outputDir: fileSystem.directory('out')..createSync(),
defines: <String, String>{
kBuildMode: 'profile',
},
artifacts: artifacts,
processManager: processManager,
fileSystem: fileSystem,
logger: logger,
);
environment.buildDir.createSync(recursive: true);
// create pre-requisites.
environment.buildDir.childFile('app.so')
.writeAsStringSync('abcd');
await const ProfileAndroidApplication().build(environment);
expect(fileSystem.file(fileSystem.path.join('out', 'app.so')).existsSync(), true);
});
testWithoutContext('release bundle contains expected resources', () async {
final Environment environment = Environment.test(
fileSystem.currentDirectory,
outputDir: fileSystem.directory('out')..createSync(),
defines: <String, String>{
kBuildMode: 'release',
},
artifacts: artifacts,
processManager: processManager,
fileSystem: fileSystem,
logger: logger,
);
environment.buildDir.createSync(recursive: true);
// create pre-requisites.
environment.buildDir.childFile('app.so')
.writeAsStringSync('abcd');
await const ReleaseAndroidApplication().build(environment);
expect(fileSystem.file(fileSystem.path.join('out', 'app.so')).existsSync(), true);
});
testUsingContext('AndroidAot can build provided target platform', () async {
processManager = FakeProcessManager.empty();
final Environment environment = Environment.test(
fileSystem.currentDirectory,
outputDir: fileSystem.directory('out')..createSync(),
defines: <String, String>{
kBuildMode: 'release',
},
artifacts: artifacts,
processManager: processManager,
fileSystem: fileSystem,
logger: logger,
);
processManager.addCommand(FakeCommand(command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
platform: TargetPlatform.android_arm64,
mode: BuildMode.release,
),
'--deterministic',
'--snapshot_kind=app-aot-elf',
'--elf=${environment.buildDir.childDirectory('arm64-v8a').childFile('app.so').path}',
'--strip',
environment.buildDir.childFile('app.dill').path,
],
));
environment.buildDir.createSync(recursive: true);
environment.buildDir.childFile('app.dill').createSync();
environment.projectDir.childFile('.packages').writeAsStringSync('\n');
const AndroidAot androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
await androidAot.build(environment);
expect(processManager, hasNoRemainingExpectations);
});
testUsingContext('AndroidAot provide code size information.', () async {
processManager = FakeProcessManager.empty();
final Environment environment = Environment.test(
fileSystem.currentDirectory,
outputDir: fileSystem.directory('out')..createSync(),
defines: <String, String>{
kBuildMode: 'release',
kCodeSizeDirectory: 'code_size_1',
},
artifacts: artifacts,
processManager: processManager,
fileSystem: fileSystem,
logger: logger,
);
processManager.addCommand(FakeCommand(command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
platform: TargetPlatform.android_arm64,
mode: BuildMode.release,
),
'--deterministic',
'--write-v8-snapshot-profile-to=code_size_1/snapshot.arm64-v8a.json',
'--trace-precompiler-to=code_size_1/trace.arm64-v8a.json',
'--snapshot_kind=app-aot-elf',
'--elf=${environment.buildDir.childDirectory('arm64-v8a').childFile('app.so').path}',
'--strip',
environment.buildDir.childFile('app.dill').path,
],
));
environment.buildDir.createSync(recursive: true);
environment.buildDir.childFile('app.dill').createSync();
environment.projectDir.childFile('.packages').writeAsStringSync('\n');
const AndroidAot androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
await androidAot.build(environment);
expect(processManager, hasNoRemainingExpectations);
});
testUsingContext('kExtraGenSnapshotOptions passes values to gen_snapshot', () async {
processManager = FakeProcessManager.empty();
final Environment environment = Environment.test(
fileSystem.currentDirectory,
outputDir: fileSystem.directory('out')..createSync(),
defines: <String, String>{
kBuildMode: 'release',
kExtraGenSnapshotOptions: 'foo,bar,baz=2',
kTargetPlatform: 'android-arm',
},
processManager: processManager,
artifacts: artifacts,
fileSystem: fileSystem,
logger: logger,
);
processManager.addCommand(
FakeCommand(command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
platform: TargetPlatform.android_arm64,
mode: BuildMode.release,
),
'--deterministic',
'foo',
'bar',
'baz=2',
'--snapshot_kind=app-aot-elf',
'--elf=${environment.buildDir.childDirectory('arm64-v8a').childFile('app.so').path}',
'--strip',
environment.buildDir.childFile('app.dill').path,
],
));
environment.buildDir.createSync(recursive: true);
environment.buildDir.childFile('app.dill').createSync();
environment.projectDir.childFile('.packages').writeAsStringSync('\n');
await const AndroidAot(TargetPlatform.android_arm64, BuildMode.release)
.build(environment);
});
testUsingContext('--no-strip in kExtraGenSnapshotOptions suppresses --strip gen_snapshot flag', () async {
processManager = FakeProcessManager.empty();
final Environment environment = Environment.test(
fileSystem.currentDirectory,
outputDir: fileSystem.directory('out')..createSync(),
defines: <String, String>{
kBuildMode: 'release',
kExtraGenSnapshotOptions: 'foo,--no-strip,bar',
kTargetPlatform: 'android-arm',
},
processManager: processManager,
artifacts: artifacts,
fileSystem: fileSystem,
logger: logger,
);
processManager.addCommand(
FakeCommand(command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
platform: TargetPlatform.android_arm64,
mode: BuildMode.release,
),
'--deterministic',
'foo',
'bar',
'--snapshot_kind=app-aot-elf',
'--elf=${environment.buildDir.childDirectory('arm64-v8a').childFile('app.so').path}',
environment.buildDir.childFile('app.dill').path,
],
));
environment.buildDir.createSync(recursive: true);
environment.buildDir.childFile('app.dill').createSync();
environment.projectDir.childFile('.packages').writeAsStringSync('\n');
await const AndroidAot(TargetPlatform.android_arm64, BuildMode.release)
.build(environment);
});
testWithoutContext('android aot bundle copies so from abi directory', () async {
final Environment environment = Environment.test(
fileSystem.currentDirectory,
outputDir: fileSystem.directory('out')..createSync(),
defines: <String, String>{
kBuildMode: 'release',
},
processManager: processManager,
artifacts: artifacts,
fileSystem: fileSystem,
logger: logger,
);
environment.buildDir.createSync(recursive: true);
const AndroidAot androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
const AndroidAotBundle androidAotBundle = AndroidAotBundle(androidAot);
// Create required files.
environment.buildDir
.childDirectory('arm64-v8a')
.childFile('app.so')
.createSync(recursive: true);
await androidAotBundle.build(environment);
expect(environment.outputDir
.childDirectory('arm64-v8a')
.childFile('app.so').existsSync(), true);
});
test('copyDeferredComponentSoFiles copies all files to correct locations', () {
final Environment environment = Environment.test(
fileSystem.currentDirectory,
outputDir: fileSystem.directory('/out')..createSync(),
defines: <String, String>{
kBuildMode: 'release',
},
processManager: processManager,
artifacts: artifacts,
fileSystem: fileSystem,
logger: logger,
);
final File so1 = fileSystem.file('/unit2/abi1/part.so');
so1.createSync(recursive: true);
so1.writeAsStringSync('lib1');
final File so2 = fileSystem.file('/unit3/abi1/part.so');
so2.createSync(recursive: true);
so2.writeAsStringSync('lib2');
final File so3 = fileSystem.file('/unit4/abi1/part.so');
so3.createSync(recursive: true);
so3.writeAsStringSync('lib3');
final File so4 = fileSystem.file('/unit2/abi2/part.so');
so4.createSync(recursive: true);
so4.writeAsStringSync('lib1');
final File so5 = fileSystem.file('/unit3/abi2/part.so');
so5.createSync(recursive: true);
so5.writeAsStringSync('lib2');
final File so6 = fileSystem.file('/unit4/abi2/part.so');
so6.createSync(recursive: true);
so6.writeAsStringSync('lib3');
final List<DeferredComponent> components = <DeferredComponent>[
DeferredComponent(name: 'component2', libraries: <String>['lib1']),
DeferredComponent(name: 'component3', libraries: <String>['lib2']),
];
final List<LoadingUnit> loadingUnits = <LoadingUnit>[
LoadingUnit(id: 2, libraries: <String>['lib1'], path: '/unit2/abi1/part.so'),
LoadingUnit(id: 3, libraries: <String>['lib2'], path: '/unit3/abi1/part.so'),
LoadingUnit(id: 4, libraries: <String>['lib3'], path: '/unit4/abi1/part.so'),
LoadingUnit(id: 2, libraries: <String>['lib1'], path: '/unit2/abi2/part.so'),
LoadingUnit(id: 3, libraries: <String>['lib2'], path: '/unit3/abi2/part.so'),
LoadingUnit(id: 4, libraries: <String>['lib3'], path: '/unit4/abi2/part.so'),
];
for (final DeferredComponent component in components) {
component.assignLoadingUnits(loadingUnits);
}
final Directory buildDir = fileSystem.directory('/build');
if (!buildDir.existsSync()) {
buildDir.createSync(recursive: true);
}
final Depfile depfile = copyDeferredComponentSoFiles(
environment,
components,
loadingUnits,
buildDir,
<String>['abi1', 'abi2'],
BuildMode.release
);
expect(depfile.inputs.length, 6);
expect(depfile.outputs.length, 6);
expect(depfile.inputs[0].path, so1.path);
expect(depfile.inputs[1].path, so2.path);
expect(depfile.inputs[2].path, so4.path);
expect(depfile.inputs[3].path, so5.path);
expect(depfile.inputs[4].path, so3.path);
expect(depfile.inputs[5].path, so6.path);
expect(depfile.outputs[0].readAsStringSync(), so1.readAsStringSync());
expect(depfile.outputs[1].readAsStringSync(), so2.readAsStringSync());
expect(depfile.outputs[2].readAsStringSync(), so4.readAsStringSync());
expect(depfile.outputs[3].readAsStringSync(), so5.readAsStringSync());
expect(depfile.outputs[4].readAsStringSync(), so3.readAsStringSync());
expect(depfile.outputs[5].readAsStringSync(), so6.readAsStringSync());
expect(depfile.outputs[0].path, '/build/component2/intermediates/flutter/release/deferred_libs/abi1/libapp.so-2.part.so');
expect(depfile.outputs[1].path, '/build/component3/intermediates/flutter/release/deferred_libs/abi1/libapp.so-3.part.so');
expect(depfile.outputs[2].path, '/build/component2/intermediates/flutter/release/deferred_libs/abi2/libapp.so-2.part.so');
expect(depfile.outputs[3].path, '/build/component3/intermediates/flutter/release/deferred_libs/abi2/libapp.so-3.part.so');
expect(depfile.outputs[4].path, '/out/abi1/app.so-4.part.so');
expect(depfile.outputs[5].path, '/out/abi2/app.so-4.part.so');
});
test('copyDeferredComponentSoFiles copies files for only listed abis', () {
final Environment environment = Environment.test(
fileSystem.currentDirectory,
outputDir: fileSystem.directory('/out')..createSync(),
defines: <String, String>{
kBuildMode: 'release',
},
processManager: processManager,
artifacts: artifacts,
fileSystem: fileSystem,
logger: logger,
);
final File so1 = fileSystem.file('/unit2/abi1/part.so');
so1.createSync(recursive: true);
so1.writeAsStringSync('lib1');
final File so2 = fileSystem.file('/unit3/abi1/part.so');
so2.createSync(recursive: true);
so2.writeAsStringSync('lib2');
final File so3 = fileSystem.file('/unit4/abi1/part.so');
so3.createSync(recursive: true);
so3.writeAsStringSync('lib3');
final File so4 = fileSystem.file('/unit2/abi2/part.so');
so4.createSync(recursive: true);
so4.writeAsStringSync('lib1');
final File so5 = fileSystem.file('/unit3/abi2/part.so');
so5.createSync(recursive: true);
so5.writeAsStringSync('lib2');
final File so6 = fileSystem.file('/unit4/abi2/part.so');
so6.createSync(recursive: true);
so6.writeAsStringSync('lib3');
final List<DeferredComponent> components = <DeferredComponent>[
DeferredComponent(name: 'component2', libraries: <String>['lib1']),
DeferredComponent(name: 'component3', libraries: <String>['lib2']),
];
final List<LoadingUnit> loadingUnits = <LoadingUnit>[
LoadingUnit(id: 2, libraries: <String>['lib1'], path: '/unit2/abi1/part.so'),
LoadingUnit(id: 3, libraries: <String>['lib2'], path: '/unit3/abi1/part.so'),
LoadingUnit(id: 4, libraries: <String>['lib3'], path: '/unit4/abi1/part.so'),
LoadingUnit(id: 2, libraries: <String>['lib1'], path: '/unit2/abi2/part.so'),
LoadingUnit(id: 3, libraries: <String>['lib2'], path: '/unit3/abi2/part.so'),
LoadingUnit(id: 4, libraries: <String>['lib3'], path: '/unit4/abi2/part.so'),
];
for (final DeferredComponent component in components) {
component.assignLoadingUnits(loadingUnits);
}
final Directory buildDir = fileSystem.directory('/build');
if (!buildDir.existsSync()) {
buildDir.createSync(recursive: true);
}
final Depfile depfile = copyDeferredComponentSoFiles(
environment,
components,
loadingUnits,
buildDir,
<String>['abi1'],
BuildMode.release
);
expect(depfile.inputs.length, 3);
expect(depfile.outputs.length, 3);
expect(depfile.inputs[0].path, so1.path);
expect(depfile.inputs[1].path, so2.path);
expect(depfile.inputs[2].path, so3.path);
expect(depfile.outputs[0].readAsStringSync(), so1.readAsStringSync());
expect(depfile.outputs[1].readAsStringSync(), so2.readAsStringSync());
expect(depfile.outputs[2].readAsStringSync(), so3.readAsStringSync());
expect(depfile.outputs[0].path, '/build/component2/intermediates/flutter/release/deferred_libs/abi1/libapp.so-2.part.so');
expect(depfile.outputs[1].path, '/build/component3/intermediates/flutter/release/deferred_libs/abi1/libapp.so-3.part.so');
expect(depfile.outputs[2].path, '/out/abi1/app.so-4.part.so');
});
testUsingContext('DebugAndroidApplication with impeller and shader compilation', () async {
// Create impellerc to work around fallback detection logic.
fileSystem.file(artifacts.getHostArtifact(HostArtifact.impellerc)).createSync(recursive: true);
final Environment environment = Environment.test(
fileSystem.currentDirectory,
outputDir: fileSystem.directory('out')..createSync(),
defines: <String, String>{
kBuildMode: 'debug',
},
processManager: processManager,
artifacts: artifacts,
fileSystem: fileSystem,
logger: logger,
);
environment.buildDir.createSync(recursive: true);
// create pre-requisites.
environment.buildDir.childFile('app.dill')
.writeAsStringSync('abcd');
fileSystem
.file(artifacts.getArtifactPath(Artifact.vmSnapshotData, mode: BuildMode.debug))
.createSync(recursive: true);
fileSystem
.file(artifacts.getArtifactPath(Artifact.isolateSnapshotData, mode: BuildMode.debug))
.createSync(recursive: true);
fileSystem.file('pubspec.yaml').writeAsStringSync('name: hello\nflutter:\n shaders:\n - shader.glsl');
fileSystem.file('.packages').writeAsStringSync('\n');
fileSystem.file('shader.glsl').writeAsStringSync('test');
processManager.addCommands(<FakeCommand>[
const FakeCommand(command: <String>[
'HostArtifact.impellerc',
'--sksl',
'--runtime-stage-gles',
'--runtime-stage-vulkan',
'--iplr',
'--sl=out/flutter_assets/shader.glsl',
'--spirv=out/flutter_assets/shader.glsl.spirv',
'--input=/shader.glsl',
'--input-type=frag',
'--include=/',
'--include=/./shader_lib',
]),
]);
await const DebugAndroidApplication().build(environment);
expect(processManager, hasNoRemainingExpectations);
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'isolate_snapshot_data')).existsSync(), true);
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'vm_snapshot_data')).existsSync(), true);
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'kernel_blob.bin')).existsSync(), true);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
});
}
| flutter/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart",
"repo_id": "flutter",
"token_count": 8271
} | 772 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:typed_data';
import 'package:args/args.dart';
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/asset.dart';
import 'package:flutter_tools/src/base/config.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/build_system/build_system.dart';
import 'package:flutter_tools/src/bundle.dart' hide defaultManifestPath;
import 'package:flutter_tools/src/bundle_builder.dart';
import 'package:flutter_tools/src/devfs.dart';
import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/flutter_manifest.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:flutter_tools/src/project.dart';
import 'package:test/fake.dart';
import '../src/common.dart';
import '../src/context.dart';
import '../src/test_build_system.dart';
// Tests for BundleBuilder.
void main() {
testUsingContext('Copies assets to expected directory after building', () async {
final BuildSystem buildSystem = TestBuildSystem.all(
BuildResult(success: true),
(Target target, Environment environment) {
environment.outputDir.childFile('kernel_blob.bin').createSync(recursive: true);
environment.outputDir.childFile('isolate_snapshot_data').createSync();
environment.outputDir.childFile('vm_snapshot_data').createSync();
environment.outputDir.childFile('LICENSE').createSync(recursive: true);
}
);
await BundleBuilder().build(
platform: TargetPlatform.ios,
buildInfo: BuildInfo.debug,
project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
mainPath: globals.fs.path.join('lib', 'main.dart'),
assetDirPath: 'example',
depfilePath: 'example.d',
buildSystem: buildSystem
);
expect(globals.fs.file(globals.fs.path.join('example', 'kernel_blob.bin')).existsSync(), true);
expect(globals.fs.file(globals.fs.path.join('example', 'LICENSE')).existsSync(), true);
expect(globals.fs.file(globals.fs.path.join('example.d')).existsSync(), false);
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(),
});
testWithoutContext('writeBundle applies transformations to any assets that have them defined', () async {
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final File asset = fileSystem.file('my-asset.txt')
..createSync()
..writeAsBytesSync(<int>[1, 2, 3]);
final Artifacts artifacts = Artifacts.test();
final FakeProcessManager processManager = FakeProcessManager.list(
<FakeCommand>[
FakeCommand(
command: <Pattern>[
artifacts.getArtifactPath(Artifact.engineDartBinary),
'run',
'increment',
'--input=/.tmp_rand0/my-asset.txt-transformOutput0.txt',
'--output=/.tmp_rand0/my-asset.txt-transformOutput1.txt'
],
onRun: (List<String> command) {
final ArgResults argParseResults = (ArgParser()
..addOption('input', mandatory: true)
..addOption('output', mandatory: true))
.parse(command);
final File inputFile = fileSystem.file(argParseResults['input']);
final File outputFile = fileSystem.file(argParseResults['output']);
expect(inputFile, exists);
outputFile
..createSync()
..writeAsBytesSync(
Uint8List.fromList(
inputFile.readAsBytesSync().map((int b) => b + 1).toList(),
),
);
},
),
],
);
final FakeAssetBundle bundle = FakeAssetBundle()
..entries['my-asset.txt'] = AssetBundleEntry(
DevFSFileContent(asset),
kind: AssetKind.regular,
transformers: const <AssetTransformerEntry>[
AssetTransformerEntry(package: 'increment', args: <String>[]),
],
);
final Directory bundleDir = fileSystem.directory(
getAssetBuildDirectory(Config.test(), fileSystem),
);
await writeBundle(
bundleDir,
bundle.entries,
targetPlatform: TargetPlatform.tester,
impellerStatus: ImpellerStatus.platformDefault,
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
logger: BufferLogger.test(),
projectDir: fileSystem.currentDirectory,
);
final File outputAssetFile = fileSystem.file('build/flutter_assets/my-asset.txt');
expect(outputAssetFile, exists);
expect(outputAssetFile.readAsBytesSync(), orderedEquals(<int>[2, 3, 4]));
});
testUsingContext('Handles build system failure', () {
expect(
() => BundleBuilder().build(
platform: TargetPlatform.ios,
buildInfo: BuildInfo.debug,
project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
mainPath: 'lib/main.dart',
assetDirPath: 'example',
depfilePath: 'example.d',
buildSystem: TestBuildSystem.all(BuildResult(success: false))
),
throwsToolExit()
);
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(),
});
testUsingContext('Passes correct defines to build system', () async {
final FlutterProject project = FlutterProject.fromDirectoryTest(globals.fs.currentDirectory);
final String mainPath = globals.fs.path.join('lib', 'main.dart');
const String assetDirPath = 'example';
const String depfilePath = 'example.d';
Environment? env;
final BuildSystem buildSystem = TestBuildSystem.all(
BuildResult(success: true),
(Target target, Environment environment) {
env = environment;
environment.outputDir.childFile('kernel_blob.bin').createSync(recursive: true);
environment.outputDir.childFile('isolate_snapshot_data').createSync();
environment.outputDir.childFile('vm_snapshot_data').createSync();
environment.outputDir.childFile('LICENSE').createSync(recursive: true);
}
);
await BundleBuilder().build(
platform: TargetPlatform.ios,
buildInfo: const BuildInfo(
BuildMode.debug,
null,
trackWidgetCreation: true,
frontendServerStarterPath: 'path/to/frontend_server_starter.dart',
extraFrontEndOptions: <String>['test1', 'test2'],
extraGenSnapshotOptions: <String>['test3', 'test4'],
fileSystemRoots: <String>['test5', 'test6'],
fileSystemScheme: 'test7',
dartDefines: <String>['test8', 'test9'],
treeShakeIcons: true,
),
project: project,
mainPath: mainPath,
assetDirPath: assetDirPath,
depfilePath: depfilePath,
buildSystem: buildSystem
);
expect(env, isNotNull);
expect(env!.defines[kBuildMode], 'debug');
expect(env!.defines[kTargetPlatform], 'ios');
expect(env!.defines[kTargetFile], mainPath);
expect(env!.defines[kTrackWidgetCreation], 'true');
expect(env!.defines[kFrontendServerStarterPath], 'path/to/frontend_server_starter.dart');
expect(env!.defines[kExtraFrontEndOptions], 'test1,test2');
expect(env!.defines[kExtraGenSnapshotOptions], 'test3,test4');
expect(env!.defines[kFileSystemRoots], 'test5,test6');
expect(env!.defines[kFileSystemScheme], 'test7');
expect(env!.defines[kDartDefines], encodeDartDefines(<String>['test8', 'test9']));
expect(env!.defines[kIconTreeShakerFlag], 'true');
expect(env!.defines[kDeferredComponents], 'false');
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(),
});
testWithoutContext('--enable-experiment is removed from getDefaultCachedKernelPath hash', () {
final FileSystem fileSystem = MemoryFileSystem.test();
final Config config = Config.test();
expect(getDefaultCachedKernelPath(
trackWidgetCreation: true,
dartDefines: <String>[],
extraFrontEndOptions: <String>['--enable-experiment=foo'],
fileSystem: fileSystem,
config: config,
), 'build/cache.dill.track.dill');
expect(getDefaultCachedKernelPath(
trackWidgetCreation: true,
dartDefines: <String>['foo=bar'],
extraFrontEndOptions: <String>['--enable-experiment=foo'],
fileSystem: fileSystem,
config: config,
), 'build/06ad47d8e64bd28de537b62ff85357c4.cache.dill.track.dill');
expect(getDefaultCachedKernelPath(
trackWidgetCreation: false,
dartDefines: <String>[],
extraFrontEndOptions: <String>['--enable-experiment=foo'],
fileSystem: fileSystem,
config: config,
), 'build/cache.dill');
expect(getDefaultCachedKernelPath(
trackWidgetCreation: true,
dartDefines: <String>[],
extraFrontEndOptions: <String>['--enable-experiment=foo', '--foo=bar'],
fileSystem: fileSystem,
config: config,
), 'build/95b595cca01caa5f0ca0a690339dd7f6.cache.dill.track.dill');
});
}
class FakeAssetBundle extends Fake implements AssetBundle {
@override
final Map<String, AssetBundleEntry> entries = <String, AssetBundleEntry>{};
}
| flutter/packages/flutter_tools/test/general.shard/bundle_builder_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/bundle_builder_test.dart",
"repo_id": "flutter",
"token_count": 3741
} | 773 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:convert' show jsonEncode;
import 'dart:io' show Directory, File;
import 'package:coverage/coverage.dart' show HitMap;
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart' show FileSystem;
import 'package:flutter_tools/src/test/coverage_collector.dart';
import 'package:flutter_tools/src/test/test_device.dart' show TestDevice;
import 'package:flutter_tools/src/test/test_time_recorder.dart';
import 'package:stream_channel/stream_channel.dart' show StreamChannel;
import 'package:vm_service/vm_service.dart';
import '../src/common.dart';
import '../src/context.dart';
import '../src/fake_vm_services.dart';
import '../src/logging_logger.dart';
void main() {
testWithoutContext('Coverage collector Can handle coverage SentinelException', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
FakeVmServiceRequest(
method: 'getVM',
jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
})!,
]
).toJson(),
),
FakeVmServiceRequest(
method: 'getVersion',
jsonResponse: Version(major: 3, minor: 51).toJson(),
),
const FakeVmServiceRequest(
method: 'getScripts',
args: <String, Object>{
'isolateId': '1',
},
jsonResponse: <String, Object>{
'type': 'Sentinel',
},
),
],
);
final Map<String, Object?> result = await collect(
Uri(),
<String>{'foo'},
serviceOverride: fakeVmServiceHost.vmService,
coverableLineCache: <String, Set<int>>{},
);
expect(result, <String, Object>{'type': 'CodeCoverage', 'coverage': <Object>[]});
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('Coverage collector processes coverage and script data', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
FakeVmServiceRequest(
method: 'getVM',
jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
})!,
]
).toJson(),
),
FakeVmServiceRequest(
method: 'getVersion',
jsonResponse: Version(major: 3, minor: 51).toJson(),
),
FakeVmServiceRequest(
method: 'getScripts',
args: <String, Object>{
'isolateId': '1',
},
jsonResponse: ScriptList(scripts: <ScriptRef>[
ScriptRef(uri: 'package:foo/foo.dart', id: '1'),
ScriptRef(uri: 'package:bar/bar.dart', id: '2'),
]).toJson(),
),
FakeVmServiceRequest(
method: 'getSourceReport',
args: <String, Object>{
'isolateId': '1',
'reports': <Object>['Coverage'],
'scriptId': '1',
'forceCompile': true,
'reportLines': true,
},
jsonResponse: SourceReport(
ranges: <SourceReportRange>[
SourceReportRange(
scriptIndex: 0,
startPos: 0,
endPos: 0,
compiled: true,
coverage: SourceReportCoverage(
hits: <int>[1, 3],
misses: <int>[2],
),
),
],
scripts: <ScriptRef>[
ScriptRef(
uri: 'package:foo/foo.dart',
id: '1',
),
],
).toJson(),
),
],
);
final Map<String, Object?> result = await collect(
Uri(),
<String>{'foo'},
serviceOverride: fakeVmServiceHost.vmService,
coverableLineCache: <String, Set<int>>{},
);
expect(result, <String, Object>{
'type': 'CodeCoverage',
'coverage': <Object>[
<String, Object>{
'source': 'package:foo/foo.dart',
'script': <String, Object>{
'type': '@Script',
'fixedId': true,
'id': 'libraries/1/scripts/package%3Afoo%2Ffoo.dart',
'uri': 'package:foo/foo.dart',
'_kind': 'library',
},
'hits': <Object>[1, 1, 3, 1, 2, 0],
},
],
});
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('Coverage collector with null libraryNames accepts all libraries', () async {
final FakeVmServiceHost fakeVmServiceHost = createFakeVmServiceHostWithFooAndBar();
final Map<String, Object?> result = await collect(
Uri(),
null,
serviceOverride: fakeVmServiceHost.vmService,
coverableLineCache: <String, Set<int>>{},
);
expect(result, <String, Object>{
'type': 'CodeCoverage',
'coverage': <Object>[
<String, Object>{
'source': 'package:foo/foo.dart',
'script': <String, Object>{
'type': '@Script',
'fixedId': true,
'id': 'libraries/1/scripts/package%3Afoo%2Ffoo.dart',
'uri': 'package:foo/foo.dart',
'_kind': 'library',
},
'hits': <Object>[1, 1, 3, 1, 2, 0],
},
<String, Object>{
'source': 'package:bar/bar.dart',
'script': <String, Object>{
'type': '@Script',
'fixedId': true,
'id': 'libraries/1/scripts/package%3Abar%2Fbar.dart',
'uri': 'package:bar/bar.dart',
'_kind': 'library',
},
'hits': <Object>[47, 1, 21, 1, 32, 0, 86, 0],
},
],
});
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('Coverage collector with libraryFilters', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
FakeVmServiceRequest(
method: 'getVM',
jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
})!,
]
).toJson(),
),
FakeVmServiceRequest(
method: 'getVersion',
jsonResponse: Version(major: 3, minor: 57).toJson(),
),
FakeVmServiceRequest(
method: 'getSourceReport',
args: <String, Object>{
'isolateId': '1',
'reports': <Object>['Coverage'],
'forceCompile': true,
'reportLines': true,
'libraryFilters': <Object>['package:foo/'],
},
jsonResponse: SourceReport(
ranges: <SourceReportRange>[
SourceReportRange(
scriptIndex: 0,
startPos: 0,
endPos: 0,
compiled: true,
coverage: SourceReportCoverage(
hits: <int>[1, 3],
misses: <int>[2],
),
),
],
scripts: <ScriptRef>[
ScriptRef(
uri: 'package:foo/foo.dart',
id: '1',
),
],
).toJson(),
),
],
);
final Map<String, Object?> result = await collect(
Uri(),
<String>{'foo'},
serviceOverride: fakeVmServiceHost.vmService,
coverableLineCache: <String, Set<int>>{},
);
expect(result, <String, Object>{
'type': 'CodeCoverage',
'coverage': <Object>[
<String, Object>{
'source': 'package:foo/foo.dart',
'script': <String, Object>{
'type': '@Script',
'fixedId': true,
'id': 'libraries/1/scripts/package%3Afoo%2Ffoo.dart',
'uri': 'package:foo/foo.dart',
'_kind': 'library',
},
'hits': <Object>[1, 1, 3, 1, 2, 0],
},
],
});
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('Coverage collector with libraryFilters and null libraryNames', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
FakeVmServiceRequest(
method: 'getVM',
jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
})!,
]
).toJson(),
),
FakeVmServiceRequest(
method: 'getVersion',
jsonResponse: Version(major: 3, minor: 57).toJson(),
),
FakeVmServiceRequest(
method: 'getSourceReport',
args: <String, Object>{
'isolateId': '1',
'reports': <Object>['Coverage'],
'forceCompile': true,
'reportLines': true,
},
jsonResponse: SourceReport(
ranges: <SourceReportRange>[
SourceReportRange(
scriptIndex: 0,
startPos: 0,
endPos: 0,
compiled: true,
coverage: SourceReportCoverage(
hits: <int>[1, 3],
misses: <int>[2],
),
),
],
scripts: <ScriptRef>[
ScriptRef(
uri: 'package:foo/foo.dart',
id: '1',
),
],
).toJson(),
),
],
);
final Map<String, Object?> result = await collect(
Uri(),
null,
serviceOverride: fakeVmServiceHost.vmService,
coverableLineCache: <String, Set<int>>{},
);
expect(result, <String, Object>{
'type': 'CodeCoverage',
'coverage': <Object>[
<String, Object>{
'source': 'package:foo/foo.dart',
'script': <String, Object>{
'type': '@Script',
'fixedId': true,
'id': 'libraries/1/scripts/package%3Afoo%2Ffoo.dart',
'uri': 'package:foo/foo.dart',
'_kind': 'library',
},
'hits': <Object>[1, 1, 3, 1, 2, 0],
},
],
});
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('Coverage collector with branch coverage', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
FakeVmServiceRequest(
method: 'getVM',
jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
})!,
]
).toJson(),
),
FakeVmServiceRequest(
method: 'getVersion',
jsonResponse: Version(major: 3, minor: 56).toJson(),
),
FakeVmServiceRequest(
method: 'getScripts',
args: <String, Object>{
'isolateId': '1',
},
jsonResponse: ScriptList(scripts: <ScriptRef>[
ScriptRef(uri: 'package:foo/foo.dart', id: '1'),
ScriptRef(uri: 'package:bar/bar.dart', id: '2'),
]).toJson(),
),
FakeVmServiceRequest(
method: 'getSourceReport',
args: <String, Object>{
'isolateId': '1',
'reports': <Object>['Coverage', 'BranchCoverage'],
'scriptId': '1',
'forceCompile': true,
'reportLines': true,
},
jsonResponse: SourceReport(
ranges: <SourceReportRange>[
SourceReportRange(
scriptIndex: 0,
startPos: 0,
endPos: 0,
compiled: true,
coverage: SourceReportCoverage(
hits: <int>[1, 3],
misses: <int>[2],
),
branchCoverage: SourceReportCoverage(
hits: <int>[4, 6],
misses: <int>[5],
),
),
],
scripts: <ScriptRef>[
ScriptRef(
uri: 'package:foo/foo.dart',
id: '1',
),
],
).toJson(),
),
],
);
final Map<String, Object?> result = await collect(
Uri(),
<String>{'foo'},
serviceOverride: fakeVmServiceHost.vmService,
branchCoverage: true,
coverableLineCache: <String, Set<int>>{},
);
expect(result, <String, Object>{
'type': 'CodeCoverage',
'coverage': <Object>[
<String, Object>{
'source': 'package:foo/foo.dart',
'script': <String, Object>{
'type': '@Script',
'fixedId': true,
'id': 'libraries/1/scripts/package%3Afoo%2Ffoo.dart',
'uri': 'package:foo/foo.dart',
'_kind': 'library',
},
'hits': <Object>[1, 1, 3, 1, 2, 0],
'branchHits': <Object>[4, 1, 6, 1, 5, 0],
},
],
});
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('Coverage collector caches read files', () async {
Directory? tempDir;
try {
tempDir = Directory.systemTemp.createTempSync('flutter_coverage_collector_test.');
final File packagesFile = writeFooBarPackagesJson(tempDir);
final Directory fooDir = Directory('${tempDir.path}/foo/');
fooDir.createSync();
final File fooFile = File('${fooDir.path}/foo.dart');
fooFile.writeAsStringSync('hit\nnohit but ignored // coverage:ignore-line\nhit\n');
final String packagesPath = packagesFile.path;
final CoverageCollector collector = CoverageCollector(
libraryNames: <String>{'foo', 'bar'},
verbose: false,
packagesPath: packagesPath,
resolver: await CoverageCollector.getResolver(packagesPath)
);
await collector.collectCoverage(
TestTestDevice(),
serviceOverride: createFakeVmServiceHostWithFooAndBar(libraryFilters: <String>['package:foo/', 'package:bar/']).vmService,
);
Future<void> getHitMapAndVerify() async {
final Map<String, HitMap> gottenHitmap = <String, HitMap>{};
await collector.finalizeCoverage(formatter: (Map<String, HitMap> hitmap) {
gottenHitmap.addAll(hitmap);
return '';
});
expect(gottenHitmap.keys.toList()..sort(), <String>['package:bar/bar.dart', 'package:foo/foo.dart']);
expect(gottenHitmap['package:foo/foo.dart']!.lineHits, <int, int>{1: 1, /* 2: 0, is ignored in file */ 3: 1});
expect(gottenHitmap['package:bar/bar.dart']!.lineHits, <int, int>{21: 1, 32: 0, 47: 1, 86: 0});
}
Future<void> verifyHitmapEmpty() async {
final Map<String, HitMap> gottenHitmap = <String, HitMap>{};
await collector.finalizeCoverage(formatter: (Map<String, HitMap> hitmap) {
gottenHitmap.addAll(hitmap);
return '';
});
expect(gottenHitmap.isEmpty, isTrue);
}
// Get hit map the first time.
await getHitMapAndVerify();
// Getting the hitmap clears it so we now doesn't get any data.
await verifyHitmapEmpty();
// Collecting again gets us the same data even though the foo file has been deleted.
// This means that the fact that line 2 was ignored has been cached.
fooFile.deleteSync();
await collector.collectCoverage(
TestTestDevice(),
serviceOverride: createFakeVmServiceHostWithFooAndBar(libraryFilters: <String>['package:foo/', 'package:bar/']).vmService,
);
await getHitMapAndVerify();
} finally {
tempDir?.deleteSync(recursive: true);
}
});
testWithoutContext('Coverage collector respects ignore whole file', () async {
Directory? tempDir;
try {
tempDir = Directory.systemTemp.createTempSync('flutter_coverage_collector_test.');
final File packagesFile = writeFooBarPackagesJson(tempDir);
final Directory fooDir = Directory('${tempDir.path}/foo/');
fooDir.createSync();
final File fooFile = File('${fooDir.path}/foo.dart');
fooFile.writeAsStringSync('hit\nnohit but ignored // coverage:ignore-file\nhit\n');
final String packagesPath = packagesFile.path;
final CoverageCollector collector = CoverageCollector(
libraryNames: <String>{'foo', 'bar'},
verbose: false,
packagesPath: packagesPath,
resolver: await CoverageCollector.getResolver(packagesPath)
);
await collector.collectCoverage(
TestTestDevice(),
serviceOverride: createFakeVmServiceHostWithFooAndBar(libraryFilters: <String>['package:foo/', 'package:bar/']).vmService,
);
final Map<String, HitMap> gottenHitmap = <String, HitMap>{};
await collector.finalizeCoverage(formatter: (Map<String, HitMap> hitmap) {
gottenHitmap.addAll(hitmap);
return '';
});
expect(gottenHitmap.keys.toList()..sort(), <String>['package:bar/bar.dart']);
expect(gottenHitmap['package:bar/bar.dart']!.lineHits, <int, int>{21: 1, 32: 0, 47: 1, 86: 0});
} finally {
tempDir?.deleteSync(recursive: true);
}
});
testUsingContext('Coverage collector respects libraryNames in finalized report', () async {
Directory? tempDir;
try {
tempDir = Directory.systemTemp.createTempSync('flutter_coverage_collector_test.');
final File packagesFile = writeFooBarPackagesJson(tempDir);
File('${tempDir.path}/foo/foo.dart').createSync(recursive: true);
File('${tempDir.path}/bar/bar.dart').createSync(recursive: true);
final String packagesPath = packagesFile.path;
CoverageCollector collector = CoverageCollector(
libraryNames: <String>{'foo', 'bar'},
verbose: false,
packagesPath: packagesPath,
resolver: await CoverageCollector.getResolver(packagesPath)
);
await collector.collectCoverage(
TestTestDevice(),
serviceOverride: createFakeVmServiceHostWithFooAndBar(libraryFilters: <String>['package:foo/', 'package:bar/']).vmService,
);
String? report = await collector.finalizeCoverage();
expect(report, contains('foo.dart'));
expect(report, contains('bar.dart'));
collector = CoverageCollector(
libraryNames: <String>{'foo'},
verbose: false,
packagesPath: packagesPath,
resolver: await CoverageCollector.getResolver(packagesPath)
);
await collector.collectCoverage(
TestTestDevice(),
serviceOverride: createFakeVmServiceHostWithFooAndBar(libraryFilters: <String>['package:foo/']).vmService,
);
report = await collector.finalizeCoverage();
expect(report, contains('foo.dart'));
expect(report, isNot(contains('bar.dart')));
} finally {
tempDir?.deleteSync(recursive: true);
}
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(),
});
testWithoutContext('Coverage collector records test timings when provided TestTimeRecorder', () async {
Directory? tempDir;
try {
tempDir = Directory.systemTemp.createTempSync('flutter_coverage_collector_test.');
final File packagesFile = writeFooBarPackagesJson(tempDir);
final Directory fooDir = Directory('${tempDir.path}/foo/');
fooDir.createSync();
final File fooFile = File('${fooDir.path}/foo.dart');
fooFile.writeAsStringSync('hit\nnohit but ignored // coverage:ignore-line\nhit\n');
final String packagesPath = packagesFile.path;
final LoggingLogger logger = LoggingLogger();
final TestTimeRecorder testTimeRecorder = TestTimeRecorder(logger);
final CoverageCollector collector = CoverageCollector(
libraryNames: <String>{'foo', 'bar'},
verbose: false,
packagesPath: packagesPath,
resolver: await CoverageCollector.getResolver(packagesPath),
testTimeRecorder: testTimeRecorder
);
await collector.collectCoverage(
TestTestDevice(),
serviceOverride: createFakeVmServiceHostWithFooAndBar(libraryFilters: <String>['package:foo/', 'package:bar/']).vmService,
);
// Expect one message for each phase.
final List<String> logPhaseMessages = testTimeRecorder.getPrintAsListForTesting().where((String m) => m.startsWith('Runtime for phase ')).toList();
expect(logPhaseMessages, hasLength(TestTimePhases.values.length));
// Several phases actually does something, but here we just expect at
// least one phase to take a non-zero amount of time.
final List<String> logPhaseMessagesNonZero = logPhaseMessages.where((String m) => !m.contains(Duration.zero.toString())).toList();
expect(logPhaseMessagesNonZero, isNotEmpty);
} finally {
tempDir?.deleteSync(recursive: true);
}
});
testWithoutContext('Coverage collector fills coverableLineCache', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
FakeVmServiceRequest(
method: 'getVM',
jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
})!,
]
).toJson(),
),
FakeVmServiceRequest(
method: 'getVersion',
jsonResponse: Version(major: 4, minor: 13).toJson(),
),
FakeVmServiceRequest(
method: 'getSourceReport',
args: <String, Object>{
'isolateId': '1',
'reports': <Object>['Coverage'],
'forceCompile': true,
'reportLines': true,
'libraryFilters': <String>['package:foo/'],
'librariesAlreadyCompiled': <String>[],
},
jsonResponse: SourceReport(
ranges: <SourceReportRange>[
SourceReportRange(
scriptIndex: 0,
startPos: 0,
endPos: 0,
compiled: true,
coverage: SourceReportCoverage(
hits: <int>[1, 3],
misses: <int>[2],
),
),
],
scripts: <ScriptRef>[
ScriptRef(
uri: 'package:foo/foo.dart',
id: '1',
),
],
).toJson(),
),
],
);
final Map<String, Set<int>> coverableLineCache = <String, Set<int>>{};
final Map<String, Object?> result = await collect(
Uri(),
<String>{'foo'},
serviceOverride: fakeVmServiceHost.vmService,
coverableLineCache: coverableLineCache,
);
expect(result, <String, Object>{
'type': 'CodeCoverage',
'coverage': <Object>[
<String, Object>{
'source': 'package:foo/foo.dart',
'script': <String, Object>{
'type': '@Script',
'fixedId': true,
'id': 'libraries/1/scripts/package%3Afoo%2Ffoo.dart',
'uri': 'package:foo/foo.dart',
'_kind': 'library',
},
'hits': <Object>[1, 1, 3, 1, 2, 0],
},
],
});
// coverableLineCache should contain every line mentioned in the report.
expect(coverableLineCache, <String, Set<int>>{
'package:foo/foo.dart': <int>{1, 2, 3},
});
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('Coverage collector avoids recompiling libraries in coverableLineCache', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
FakeVmServiceRequest(
method: 'getVM',
jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
})!,
]
).toJson(),
),
FakeVmServiceRequest(
method: 'getVersion',
jsonResponse: Version(major: 4, minor: 13).toJson(),
),
// This collection sets librariesAlreadyCompiled. The response doesn't
// include any misses.
FakeVmServiceRequest(
method: 'getSourceReport',
args: <String, Object>{
'isolateId': '1',
'reports': <Object>['Coverage'],
'forceCompile': true,
'reportLines': true,
'libraryFilters': <String>['package:foo/'],
'librariesAlreadyCompiled': <String>['package:foo/foo.dart'],
},
jsonResponse: SourceReport(
ranges: <SourceReportRange>[
SourceReportRange(
scriptIndex: 0,
startPos: 0,
endPos: 0,
compiled: true,
coverage: SourceReportCoverage(
hits: <int>[1, 3],
misses: <int>[],
),
),
],
scripts: <ScriptRef>[
ScriptRef(
uri: 'package:foo/foo.dart',
id: '1',
),
],
).toJson(),
),
],
);
final Map<String, Set<int>> coverableLineCache = <String, Set<int>>{
'package:foo/foo.dart': <int>{1, 2, 3},
};
final Map<String, Object?> result2 = await collect(
Uri(),
<String>{'foo'},
serviceOverride: fakeVmServiceHost.vmService,
coverableLineCache: coverableLineCache,
);
// Expect that line 2 is marked as missed, even though it wasn't mentioned
// in the getSourceReport response.
expect(result2, <String, Object>{
'type': 'CodeCoverage',
'coverage': <Object>[
<String, Object>{
'source': 'package:foo/foo.dart',
'script': <String, Object>{
'type': '@Script',
'fixedId': true,
'id': 'libraries/1/scripts/package%3Afoo%2Ffoo.dart',
'uri': 'package:foo/foo.dart',
'_kind': 'library',
},
'hits': <Object>[1, 1, 2, 0, 3, 1],
},
],
});
expect(coverableLineCache, <String, Set<int>>{
'package:foo/foo.dart': <int>{1, 2, 3},
});
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
}
File writeFooBarPackagesJson(Directory tempDir) {
final File file = File('${tempDir.path}/packages.json');
file.writeAsStringSync(jsonEncode(<String, dynamic>{
'configVersion': 2,
'packages': <Map<String, String>>[
<String, String>{
'name': 'foo',
'rootUri': 'foo',
},
<String, String>{
'name': 'bar',
'rootUri': 'bar',
},
],
}));
return file;
}
FakeVmServiceHost createFakeVmServiceHostWithFooAndBar({
List<String>? libraryFilters,
}) {
return FakeVmServiceHost(
requests: <VmServiceExpectation>[
FakeVmServiceRequest(
method: 'getVM',
jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
})!,
]
).toJson(),
),
FakeVmServiceRequest(
method: 'getVersion',
jsonResponse: Version(major: 3, minor: 61).toJson(),
),
FakeVmServiceRequest(
method: 'getSourceReport',
args: <String, Object>{
'isolateId': '1',
'reports': <Object>['Coverage'],
'forceCompile': true,
'reportLines': true,
if (libraryFilters != null) 'libraryFilters': libraryFilters,
},
jsonResponse: SourceReport(
ranges: <SourceReportRange>[
SourceReportRange(
scriptIndex: 0,
startPos: 0,
endPos: 0,
compiled: true,
coverage: SourceReportCoverage(
hits: <int>[1, 3],
misses: <int>[2],
),
),
SourceReportRange(
scriptIndex: 1,
startPos: 0,
endPos: 0,
compiled: true,
coverage: SourceReportCoverage(
hits: <int>[47, 21],
misses: <int>[32, 86],
),
),
],
scripts: <ScriptRef>[
ScriptRef(
uri: 'package:foo/foo.dart',
id: '1',
),
ScriptRef(
uri: 'package:bar/bar.dart',
id: '2',
),
],
).toJson(),
),
],
);
}
class TestTestDevice extends TestDevice {
@override
Future<void> get finished => Future<void>.delayed(const Duration(seconds: 1));
@override
Future<void> kill() => Future<void>.value();
@override
Future<Uri?> get vmServiceUri => Future<Uri?>.value(Uri());
@override
Future<StreamChannel<String>> start(String entrypointPath) {
throw UnimplementedError();
}
}
| flutter/packages/flutter_tools/test/general.shard/coverage_collector_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/coverage_collector_test.dart",
"repo_id": "flutter",
"token_count": 14236
} | 774 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io' as io;
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/device_port_forwarder.dart';
import 'package:test/fake.dart';
import '../src/common.dart';
void main() {
testWithoutContext('dispose does not throw exception if no process is present', () {
final ForwardedPort forwardedPort = ForwardedPort(123, 456);
expect(forwardedPort.context, isNull);
forwardedPort.dispose();
});
testWithoutContext('dispose kills process if process was available', () {
final FakeProcess process = FakeProcess();
final ForwardedPort forwardedPort = ForwardedPort.withContext(123, 456, process);
forwardedPort.dispose();
expect(forwardedPort.context, isNotNull);
expect(process.killed, true);
});
}
class FakeProcess extends Fake implements Process {
bool killed = false;
@override
bool kill([io.ProcessSignal signal = io.ProcessSignal.sigterm]) {
return killed = true;
}
}
| flutter/packages/flutter_tools/test/general.shard/device_port_forwarder_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/device_port_forwarder_test.dart",
"repo_id": "flutter",
"token_count": 350
} | 775 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/application_package.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/dds.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/base/time.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/device_port_forwarder.dart';
import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_device.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_ffx.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_kernel_compiler.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_pm.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:flutter_tools/src/project.dart';
import 'package:flutter_tools/src/vmservice.dart';
import 'package:test/fake.dart';
import 'package:vm_service/vm_service.dart' as vm_service;
import '../../src/common.dart';
import '../../src/context.dart';
import '../../src/fake_vm_services.dart';
import '../../src/fakes.dart';
final vm_service.Isolate fakeIsolate = vm_service.Isolate(
id: '1',
pauseEvent: vm_service.Event(
kind: vm_service.EventKind.kResume,
timestamp: 0,
),
breakpoints: <vm_service.Breakpoint>[],
libraries: <vm_service.LibraryRef>[],
livePorts: 0,
name: 'wrong name',
number: '1',
pauseOnExit: false,
runnable: true,
startTime: 0,
isSystemIsolate: false,
isolateFlags: <vm_service.IsolateFlag>[],
);
void main() {
group('fuchsia device', () {
late MemoryFileSystem memoryFileSystem;
late File sshConfig;
late FakeProcessManager processManager;
setUp(() {
memoryFileSystem = MemoryFileSystem.test();
sshConfig = memoryFileSystem.file('ssh_config')..writeAsStringSync('\n');
processManager = FakeProcessManager.empty();
});
testWithoutContext('stores the requested id and name', () {
const String deviceId = 'e80::0000:a00a:f00f:2002/3';
const String name = 'halfbaked';
final FuchsiaDevice device = FuchsiaDevice(deviceId, name: name);
expect(device.id, deviceId);
expect(device.name, name);
});
testWithoutContext('supports all runtime modes besides jitRelease', () {
const String deviceId = 'e80::0000:a00a:f00f:2002/3';
const String name = 'halfbaked';
final FuchsiaDevice device = FuchsiaDevice(deviceId, name: name);
expect(device.supportsRuntimeMode(BuildMode.debug), true);
expect(device.supportsRuntimeMode(BuildMode.profile), true);
expect(device.supportsRuntimeMode(BuildMode.release), true);
expect(device.supportsRuntimeMode(BuildMode.jitRelease), false);
});
testWithoutContext('lists nothing when workflow cannot list devices',
() async {
final FakeFuchsiaWorkflow fuchsiaWorkflow =
FakeFuchsiaWorkflow(canListDevices: false);
final FuchsiaDevices fuchsiaDevices = FuchsiaDevices(
platform: FakePlatform(),
fuchsiaSdk: FakeFuchsiaSdk(devices: 'ignored'),
fuchsiaWorkflow: fuchsiaWorkflow,
logger: BufferLogger.test(),
);
expect(fuchsiaDevices.canListAnything, false);
expect(await fuchsiaDevices.pollingGetDevices(), isEmpty);
});
testWithoutContext('can parse ffx output for single device', () async {
final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow();
final FakeFuchsiaSdk fuchsiaSdk = FakeFuchsiaSdk(
devices:
'2001:0db8:85a3:0000:0000:8a2e:0370:7334 paper-pulp-bush-angel');
final FuchsiaDevices fuchsiaDevices = FuchsiaDevices(
platform: FakePlatform(environment: <String, String>{}),
fuchsiaSdk: fuchsiaSdk,
fuchsiaWorkflow: fuchsiaWorkflow,
logger: BufferLogger.test(),
);
final Device device = (await fuchsiaDevices.pollingGetDevices()).single;
expect(device.name, 'paper-pulp-bush-angel');
expect(device.id, '192.168.42.10');
});
testWithoutContext('can parse ffx output for multiple devices', () async {
final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow();
final FakeFuchsiaSdk fuchsiaSdk = FakeFuchsiaSdk(
devices:
'2001:0db8:85a3:0000:0000:8a2e:0370:7334 paper-pulp-bush-angel\n'
'2001:0db8:85a3:0000:0000:8a2e:0370:7335 foo-bar-fiz-buzz');
final FuchsiaDevices fuchsiaDevices = FuchsiaDevices(
platform: FakePlatform(),
fuchsiaSdk: fuchsiaSdk,
fuchsiaWorkflow: fuchsiaWorkflow,
logger: BufferLogger.test(),
);
final List<Device> devices = await fuchsiaDevices.pollingGetDevices();
expect(devices.first.name, 'paper-pulp-bush-angel');
expect(devices.first.id, '192.168.42.10');
expect(devices.last.name, 'foo-bar-fiz-buzz');
expect(devices.last.id, '192.168.42.10');
});
testWithoutContext('can parse junk output from ffx', () async {
final FakeFuchsiaWorkflow fuchsiaWorkflow =
FakeFuchsiaWorkflow(canListDevices: false);
final FakeFuchsiaSdk fuchsiaSdk = FakeFuchsiaSdk(devices: 'junk');
final FuchsiaDevices fuchsiaDevices = FuchsiaDevices(
platform: FakePlatform(),
fuchsiaSdk: fuchsiaSdk,
fuchsiaWorkflow: fuchsiaWorkflow,
logger: BufferLogger.test(),
);
final List<Device> devices = await fuchsiaDevices.pollingGetDevices();
expect(devices, isEmpty);
});
testUsingContext('disposing device disposes the portForwarder', () async {
final FakePortForwarder portForwarder = FakePortForwarder();
final FuchsiaDevice device = FuchsiaDevice('123', name: 'device');
device.portForwarder = portForwarder;
await device.dispose();
expect(portForwarder.disposed, true);
});
testWithoutContext('default capabilities', () async {
final FuchsiaDevice device = FuchsiaDevice('123', name: 'device');
final FlutterProject project =
FlutterProject.fromDirectoryTest(memoryFileSystem.currentDirectory);
memoryFileSystem.directory('fuchsia').createSync(recursive: true);
memoryFileSystem.file('pubspec.yaml').createSync();
expect(device.supportsHotReload, true);
expect(device.supportsHotRestart, false);
expect(device.supportsFlutterExit, false);
expect(device.isSupportedForProject(project), true);
});
test('is ephemeral', () {
final FuchsiaDevice device = FuchsiaDevice('123', name: 'device');
expect(device.ephemeral, true);
});
testWithoutContext('supported for project', () async {
final FuchsiaDevice device = FuchsiaDevice('123', name: 'device');
final FlutterProject project =
FlutterProject.fromDirectoryTest(memoryFileSystem.currentDirectory);
memoryFileSystem.directory('fuchsia').createSync(recursive: true);
memoryFileSystem.file('pubspec.yaml').createSync();
expect(device.isSupportedForProject(project), true);
});
testWithoutContext('not supported for project', () async {
final FuchsiaDevice device = FuchsiaDevice('123', name: 'device');
final FlutterProject project =
FlutterProject.fromDirectoryTest(memoryFileSystem.currentDirectory);
memoryFileSystem.file('pubspec.yaml').createSync();
expect(device.isSupportedForProject(project), false);
});
testUsingContext('targetPlatform does not throw when sshConfig is missing',
() async {
final FuchsiaDevice device = FuchsiaDevice('123', name: 'device');
expect(await device.targetPlatform, TargetPlatform.fuchsia_arm64);
}, overrides: <Type, Generator>{
FuchsiaArtifacts: () => FuchsiaArtifacts(),
FuchsiaSdk: () => FakeFuchsiaSdk(),
ProcessManager: () => processManager,
});
testUsingContext('targetPlatform arm64 works', () async {
processManager.addCommand(const FakeCommand(
command: <String>['ssh', '-F', '/ssh_config', '123', 'uname -m'],
stdout: 'aarch64',
));
final FuchsiaDevice device = FuchsiaDevice('123', name: 'device');
expect(await device.targetPlatform, TargetPlatform.fuchsia_arm64);
}, overrides: <Type, Generator>{
FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig),
FuchsiaSdk: () => FakeFuchsiaSdk(),
ProcessManager: () => processManager,
});
testUsingContext('targetPlatform x64 works', () async {
processManager.addCommand(const FakeCommand(
command: <String>['ssh', '-F', '/ssh_config', '123', 'uname -m'],
stdout: 'x86_64',
));
final FuchsiaDevice device = FuchsiaDevice('123', name: 'device');
expect(await device.targetPlatform, TargetPlatform.fuchsia_x64);
}, overrides: <Type, Generator>{
FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig),
FuchsiaSdk: () => FakeFuchsiaSdk(),
ProcessManager: () => processManager,
});
testUsingContext('hostAddress parsing works', () async {
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/ssh_config',
'id',
r'echo $SSH_CONNECTION'
],
stdout:
'fe80::8c6c:2fff:fe3d:c5e1%ethp0003 50666 fe80::5054:ff:fe63:5e7a%ethp0003 22',
));
final FuchsiaDevice device = FuchsiaDevice('id', name: 'device');
expect(await device.hostAddress, 'fe80::8c6c:2fff:fe3d:c5e1%25ethp0003');
}, overrides: <Type, Generator>{
FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig),
FuchsiaSdk: () => FakeFuchsiaSdk(),
ProcessManager: () => processManager,
});
testUsingContext('hostAddress parsing throws tool error on failure',
() async {
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/ssh_config',
'id',
r'echo $SSH_CONNECTION'
],
exitCode: 1,
));
final FuchsiaDevice device = FuchsiaDevice('id', name: 'device');
await expectLater(() => device.hostAddress, throwsToolExit());
}, overrides: <Type, Generator>{
FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig),
FuchsiaSdk: () => FakeFuchsiaSdk(),
ProcessManager: () => processManager,
});
testUsingContext('hostAddress parsing throws tool error on empty response',
() async {
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/ssh_config',
'id',
r'echo $SSH_CONNECTION'
],
));
final FuchsiaDevice device = FuchsiaDevice('id', name: 'device');
expect(() async => device.hostAddress, throwsToolExit());
}, overrides: <Type, Generator>{
FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig),
FuchsiaSdk: () => FakeFuchsiaSdk(),
ProcessManager: () => processManager,
});
});
group('displays friendly error when', () {
late File artifactFile;
late FakeProcessManager processManager;
setUp(() {
processManager = FakeProcessManager.empty();
artifactFile = MemoryFileSystem.test().file('artifact');
});
testUsingContext('No vmservices found', () async {
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/artifact',
'id',
'find /hub -name vmservice-port'
],
));
final FuchsiaDevice device = FuchsiaDevice('id', name: 'device');
await expectLater(
device.servicePorts,
throwsToolExit(
message:
'No Dart Observatories found. Are you running a debug build?'));
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
FuchsiaArtifacts: () => FuchsiaArtifacts(
sshConfig: artifactFile,
ffx: artifactFile,
),
FuchsiaSdk: () => FakeFuchsiaSdk(),
});
group('device logs', () {
const String exampleUtcLogs = '''
[2018-11-09 01:27:45][3][297950920][log] INFO: example_app.cm(flutter): Error doing thing
[2018-11-09 01:27:58][46257][46269][foo] INFO: Using a thing
[2018-11-09 01:29:58][46257][46269][foo] INFO: Blah blah blah
[2018-11-09 01:29:58][46257][46269][foo] INFO: other_app.cm(flutter): Do thing
[2018-11-09 01:30:02][41175][41187][bar] INFO: Invoking a bar
[2018-11-09 01:30:12][52580][52983][log] INFO: example_app.cm(flutter): Did thing this time
''';
late FakeProcessManager processManager;
late File ffx;
late File sshConfig;
setUp(() {
processManager = FakeProcessManager.empty();
final FileSystem memoryFileSystem = MemoryFileSystem.test();
ffx = memoryFileSystem.file('ffx')..writeAsStringSync('\n');
sshConfig = memoryFileSystem.file('ssh_config')
..writeAsStringSync('\n');
});
testUsingContext('can be parsed for an app', () async {
final Completer<void> lock = Completer<void>();
processManager.addCommand(FakeCommand(
command: const <String>[
'ssh',
'-F',
'/ssh_config',
'id',
'log_listener --clock Local'
],
stdout: exampleUtcLogs,
completer: lock,
));
final FuchsiaDevice device = FuchsiaDevice('id', name: 'tester');
final DeviceLogReader reader =
device.getLogReader(app: FuchsiaModulePackage(name: 'example_app'));
final List<String> logLines = <String>[];
reader.logLines.listen((String line) {
logLines.add(line);
if (logLines.length == 2) {
lock.complete();
}
});
expect(logLines, isEmpty);
await lock.future;
expect(logLines, <String>[
'[2018-11-09 01:27:45.000] Flutter: Error doing thing',
'[2018-11-09 01:30:12.000] Flutter: Did thing this time',
]);
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
SystemClock: () => SystemClock.fixed(DateTime(2018, 11, 9, 1, 25, 45)),
FuchsiaArtifacts: () =>
FuchsiaArtifacts(sshConfig: sshConfig, ffx: ffx),
});
testUsingContext('cuts off prior logs', () async {
final Completer<void> lock = Completer<void>();
processManager.addCommand(FakeCommand(
command: const <String>[
'ssh',
'-F',
'/ssh_config',
'id',
'log_listener --clock Local'
],
stdout: exampleUtcLogs,
completer: lock,
));
final FuchsiaDevice device = FuchsiaDevice('id', name: 'tester');
final DeviceLogReader reader =
device.getLogReader(app: FuchsiaModulePackage(name: 'example_app'));
final List<String> logLines = <String>[];
reader.logLines.listen((String line) {
logLines.add(line);
lock.complete();
});
expect(logLines, isEmpty);
await lock.future.timeout(const Duration(seconds: 1));
expect(logLines, <String>[
'[2018-11-09 01:30:12.000] Flutter: Did thing this time',
]);
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
SystemClock: () => SystemClock.fixed(DateTime(2018, 11, 9, 1, 29, 45)),
FuchsiaArtifacts: () =>
FuchsiaArtifacts(sshConfig: sshConfig, ffx: ffx),
});
testUsingContext('can be parsed for all apps', () async {
final Completer<void> lock = Completer<void>();
processManager.addCommand(FakeCommand(
command: const <String>[
'ssh',
'-F',
'/ssh_config',
'id',
'log_listener --clock Local'
],
stdout: exampleUtcLogs,
completer: lock,
));
final FuchsiaDevice device = FuchsiaDevice('id', name: 'tester');
final DeviceLogReader reader = device.getLogReader();
final List<String> logLines = <String>[];
reader.logLines.listen((String line) {
logLines.add(line);
if (logLines.length == 3) {
lock.complete();
}
});
expect(logLines, isEmpty);
await lock.future.timeout(const Duration(seconds: 1));
expect(logLines, <String>[
'[2018-11-09 01:27:45.000] Flutter: Error doing thing',
'[2018-11-09 01:29:58.000] Flutter: Do thing',
'[2018-11-09 01:30:12.000] Flutter: Did thing this time',
]);
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
SystemClock: () => SystemClock.fixed(DateTime(2018, 11, 9, 1, 25, 45)),
FuchsiaArtifacts: () =>
FuchsiaArtifacts(sshConfig: sshConfig, ffx: ffx),
});
});
});
group('screenshot', () {
late FakeProcessManager processManager;
setUp(() {
processManager = FakeProcessManager.empty();
});
testUsingContext('is supported on posix platforms', () {
final FuchsiaDevice device = FuchsiaDevice('id', name: 'tester');
expect(device.supportsScreenshot, true);
}, overrides: <Type, Generator>{
Platform: () => FakePlatform(),
FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: true),
});
testUsingContext('is not supported on Windows', () {
final FuchsiaDevice device = FuchsiaDevice('id', name: 'tester');
expect(device.supportsScreenshot, false);
}, overrides: <Type, Generator>{
Platform: () => FakePlatform(
operatingSystem: 'windows',
),
FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: true),
});
test("takeScreenshot throws if file isn't .ppm", () async {
final FuchsiaDevice device = FuchsiaDevice('id', name: 'tester');
await expectLater(
() => device.takeScreenshot(globals.fs.file('file.invalid')),
throwsA(isA<Exception>().having(
(Exception exception) => exception.toString(),
'message',
contains('file.invalid must be a .ppm file'))),
);
});
testUsingContext('takeScreenshot throws if screencap failed', () async {
processManager.addCommand(const FakeCommand(command: <String>[
'ssh',
'-F',
'/fuchsia/out/default/.ssh',
'0.0.0.0',
'screencap > /tmp/screenshot.ppm',
], exitCode: 1, stderr: '<error-message>'));
final FuchsiaDevice device = FuchsiaDevice('0.0.0.0', name: 'tester');
await expectLater(
() => device.takeScreenshot(globals.fs.file('file.ppm')),
throwsA(isA<Exception>().having(
(Exception exception) => exception.toString(),
'message',
contains(
'Could not take a screenshot on device tester:\n<error-message>'))),
);
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
FileSystem: () => MemoryFileSystem.test(),
Platform: () => FakePlatform(
environment: <String, String>{
'FUCHSIA_SSH_CONFIG': '/fuchsia/out/default/.ssh',
},
),
FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: true),
});
testUsingContext('takeScreenshot throws if scp failed', () async {
final FuchsiaDevice device = FuchsiaDevice('0.0.0.0', name: 'tester');
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/fuchsia/out/default/.ssh',
'0.0.0.0',
'screencap > /tmp/screenshot.ppm',
],
));
processManager.addCommand(const FakeCommand(
command: <String>[
'scp',
'-F',
'/fuchsia/out/default/.ssh',
'0.0.0.0:/tmp/screenshot.ppm',
'file.ppm',
],
exitCode: 1,
stderr: '<error-message>',
));
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/fuchsia/out/default/.ssh',
'0.0.0.0',
'rm /tmp/screenshot.ppm',
],
));
await expectLater(
() => device.takeScreenshot(globals.fs.file('file.ppm')),
throwsA(isA<Exception>().having(
(Exception exception) => exception.toString(),
'message',
contains(
'Failed to copy screenshot from device:\n<error-message>'))),
);
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
FileSystem: () => MemoryFileSystem.test(),
Platform: () => FakePlatform(
environment: <String, String>{
'FUCHSIA_SSH_CONFIG': '/fuchsia/out/default/.ssh',
},
),
FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: true),
});
testUsingContext(
"takeScreenshot prints error if can't delete file from device",
() async {
final FuchsiaDevice device = FuchsiaDevice('0.0.0.0', name: 'tester');
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/fuchsia/out/default/.ssh',
'0.0.0.0',
'screencap > /tmp/screenshot.ppm',
],
));
processManager.addCommand(const FakeCommand(
command: <String>[
'scp',
'-F',
'/fuchsia/out/default/.ssh',
'0.0.0.0:/tmp/screenshot.ppm',
'file.ppm',
],
));
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/fuchsia/out/default/.ssh',
'0.0.0.0',
'rm /tmp/screenshot.ppm',
],
exitCode: 1,
stderr: '<error-message>',
));
await device.takeScreenshot(globals.fs.file('file.ppm'));
expect(
testLogger.errorText,
contains(
'Failed to delete screenshot.ppm from the device:\n<error-message>'),
);
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
FileSystem: () => MemoryFileSystem.test(),
Platform: () => FakePlatform(
environment: <String, String>{
'FUCHSIA_SSH_CONFIG': '/fuchsia/out/default/.ssh',
},
),
FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: true),
}, testOn: 'posix');
testUsingContext('takeScreenshot returns', () async {
final FuchsiaDevice device = FuchsiaDevice('0.0.0.0', name: 'tester');
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/fuchsia/out/default/.ssh',
'0.0.0.0',
'screencap > /tmp/screenshot.ppm',
],
));
processManager.addCommand(const FakeCommand(
command: <String>[
'scp',
'-F',
'/fuchsia/out/default/.ssh',
'0.0.0.0:/tmp/screenshot.ppm',
'file.ppm',
],
));
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/fuchsia/out/default/.ssh',
'0.0.0.0',
'rm /tmp/screenshot.ppm',
],
));
expect(() => device.takeScreenshot(globals.fs.file('file.ppm')),
returnsNormally);
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
FileSystem: () => MemoryFileSystem.test(),
Platform: () => FakePlatform(
environment: <String, String>{
'FUCHSIA_SSH_CONFIG': '/fuchsia/out/default/.ssh',
},
),
FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: true),
});
});
group('portForwarder', () {
late FakeProcessManager processManager;
late File sshConfig;
setUp(() {
processManager = FakeProcessManager.empty();
sshConfig = MemoryFileSystem.test().file('irrelevant')
..writeAsStringSync('\n');
});
testUsingContext(
'`unforward` prints stdout and stderr if ssh command failed', () async {
final FuchsiaDevice device = FuchsiaDevice('id', name: 'tester');
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/irrelevant',
'-O',
'cancel',
'-vvv',
'-L',
'0:127.0.0.1:1',
'id'
],
exitCode: 1,
stdout: '<stdout>',
stderr: '<stderr>',
));
await expectLater(
() => device.portForwarder
.unforward(ForwardedPort(/*hostPort=*/ 0, /*devicePort=*/ 1)),
throwsToolExit(
message:
'Unforward command failed:\nstdout: <stdout>\nstderr: <stderr>'),
);
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig),
});
});
group('FuchsiaIsolateDiscoveryProtocol', () {
Future<Uri> findUri(
List<FlutterView> views, String expectedIsolateName) async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
FakeVmServiceRequest(
method: kListViewsMethod,
jsonResponse: <String, Object>{
'views': <Object>[
for (final FlutterView view in views) view.toJson(),
],
},
),
],
httpAddress: Uri.parse('example'),
);
final MockFuchsiaDevice fuchsiaDevice =
MockFuchsiaDevice('123', const NoOpDevicePortForwarder(), false);
final FuchsiaIsolateDiscoveryProtocol discoveryProtocol =
FuchsiaIsolateDiscoveryProtocol(
fuchsiaDevice,
expectedIsolateName,
(Uri uri) async => fakeVmServiceHost.vmService,
(Device device, Uri uri, bool enableServiceAuthCodes) async {},
true, // only poll once.
);
return discoveryProtocol.uri;
}
testUsingContext('can find flutter view with matching isolate name',
() async {
const String expectedIsolateName = 'foobar';
final Uri uri = await findUri(<FlutterView>[
// no ui isolate.
FlutterView(id: '1', uiIsolate: fakeIsolate),
// wrong name.
FlutterView(
id: '2',
uiIsolate: vm_service.Isolate.parse(<String, dynamic>{
...fakeIsolate.toJson(),
'name': 'Wrong name',
}),
),
// matching name.
FlutterView(
id: '3',
uiIsolate: vm_service.Isolate.parse(<String, dynamic>{
...fakeIsolate.toJson(),
'name': expectedIsolateName,
}),
),
], expectedIsolateName);
expect(
uri.toString(), 'http://${InternetAddress.loopbackIPv4.address}:0/');
});
testUsingContext('can handle flutter view without matching isolate name',
() async {
const String expectedIsolateName = 'foobar';
final Future<Uri> uri = findUri(<FlutterView>[
// no ui isolate.
FlutterView(id: '1', uiIsolate: fakeIsolate),
// wrong name.
FlutterView(
id: '2',
uiIsolate: vm_service.Isolate.parse(<String, Object?>{
...fakeIsolate.toJson(),
'name': 'wrong name',
})),
], expectedIsolateName);
expect(uri, throwsException);
});
testUsingContext('can handle non flutter view', () async {
const String expectedIsolateName = 'foobar';
final Future<Uri> uri = findUri(<FlutterView>[
FlutterView(id: '1', uiIsolate: fakeIsolate), // no ui isolate.
], expectedIsolateName);
expect(uri, throwsException);
});
});
testUsingContext('Correct flutter runner', () async {
final Cache cache = Cache.test(
processManager: FakeProcessManager.any(),
);
final FileSystem fileSystem = MemoryFileSystem.test();
final CachedArtifacts artifacts = CachedArtifacts(
cache: cache,
fileSystem: fileSystem,
platform: FakePlatform(),
operatingSystemUtils: globals.os,
);
expect(
artifacts.getArtifactPath(
Artifact.fuchsiaFlutterRunner,
platform: TargetPlatform.fuchsia_x64,
mode: BuildMode.debug,
),
contains('flutter_jit_runner'),
);
expect(
artifacts.getArtifactPath(
Artifact.fuchsiaFlutterRunner,
platform: TargetPlatform.fuchsia_x64,
mode: BuildMode.profile,
),
contains('flutter_aot_runner'),
);
expect(
artifacts.getArtifactPath(
Artifact.fuchsiaFlutterRunner,
platform: TargetPlatform.fuchsia_x64,
mode: BuildMode.release,
),
contains('flutter_aot_product_runner'),
);
expect(
artifacts.getArtifactPath(
Artifact.fuchsiaFlutterRunner,
platform: TargetPlatform.fuchsia_x64,
mode: BuildMode.jitRelease,
),
contains('flutter_jit_product_runner'),
);
});
group('sdkNameAndVersion: ', () {
late File sshConfig;
late FakeProcessManager processManager;
setUp(() {
sshConfig = MemoryFileSystem.test().file('ssh_config')
..writeAsStringSync('\n');
processManager = FakeProcessManager.empty();
});
testUsingContext('does not throw on non-existent ssh config', () async {
final FuchsiaDevice device = FuchsiaDevice('123', name: 'device');
expect(await device.sdkNameAndVersion, equals('Fuchsia'));
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
FuchsiaArtifacts: () => FuchsiaArtifacts(),
FuchsiaSdk: () => FakeFuchsiaSdk(),
});
testUsingContext('returns what we get from the device on success',
() async {
processManager.addCommand(const FakeCommand(command: <String>[
'ssh',
'-F',
'/ssh_config',
'123',
'cat /pkgfs/packages/build-info/0/data/version'
], stdout: 'version'));
final FuchsiaDevice device = FuchsiaDevice('123', name: 'device');
expect(await device.sdkNameAndVersion, equals('Fuchsia version'));
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig),
FuchsiaSdk: () => FakeFuchsiaSdk(),
});
testUsingContext('returns "Fuchsia" when device command fails', () async {
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/ssh_config',
'123',
'cat /pkgfs/packages/build-info/0/data/version'
],
exitCode: 1,
));
final FuchsiaDevice device = FuchsiaDevice('123', name: 'device');
expect(await device.sdkNameAndVersion, equals('Fuchsia'));
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig),
FuchsiaSdk: () => FakeFuchsiaSdk(),
});
testUsingContext('returns "Fuchsia" when device gives an empty result',
() async {
processManager.addCommand(const FakeCommand(
command: <String>[
'ssh',
'-F',
'/ssh_config',
'123',
'cat /pkgfs/packages/build-info/0/data/version'
],
));
final FuchsiaDevice device = FuchsiaDevice('123', name: 'device');
expect(await device.sdkNameAndVersion, equals('Fuchsia'));
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig),
FuchsiaSdk: () => FakeFuchsiaSdk(),
});
});
}
class FuchsiaModulePackage extends ApplicationPackage {
FuchsiaModulePackage({required this.name}) : super(id: name);
@override
final String name;
}
class MockFuchsiaDevice extends Fake implements FuchsiaDevice {
MockFuchsiaDevice(this.id, this.portForwarder, this._ipv6);
final bool _ipv6;
@override
bool get ipv6 => _ipv6;
@override
final String id;
@override
final DevicePortForwarder portForwarder;
@override
Future<TargetPlatform> get targetPlatform async =>
TargetPlatform.fuchsia_arm64;
@override
String get name => 'fuchsia';
@override
Future<List<int>> servicePorts() async => <int>[1];
@override
DartDevelopmentService get dds => FakeDartDevelopmentService();
}
class FakePortForwarder extends Fake implements DevicePortForwarder {
bool disposed = false;
@override
Future<void> dispose() async {
disposed = true;
}
}
class FakeFuchsiaFfx implements FuchsiaFfx {
@override
Future<List<String>> list({Duration? timeout}) async {
return <String>['192.168.42.172 scare-cable-skip-ffx'];
}
@override
Future<String> resolve(String deviceName) async {
return '192.168.42.10';
}
@override
Future<String?> sessionShow() async {
return null;
}
@override
Future<bool> sessionAdd(String url) async {
return false;
}
}
class FakeFuchsiaPM extends Fake implements FuchsiaPM {}
class FakeFuchsiaKernelCompiler extends Fake implements FuchsiaKernelCompiler {}
class FakeFuchsiaSdk extends Fake implements FuchsiaSdk {
FakeFuchsiaSdk({
FuchsiaPM? pm,
FuchsiaKernelCompiler? compiler,
FuchsiaFfx? ffx,
String? devices,
}) : fuchsiaPM = pm ?? FakeFuchsiaPM(),
fuchsiaKernelCompiler = compiler ?? FakeFuchsiaKernelCompiler(),
fuchsiaFfx = ffx ?? FakeFuchsiaFfx(),
_devices = devices;
@override
final FuchsiaPM fuchsiaPM;
@override
final FuchsiaKernelCompiler fuchsiaKernelCompiler;
@override
final FuchsiaFfx fuchsiaFfx;
final String? _devices;
@override
Future<String?> listDevices({Duration? timeout}) async {
return _devices;
}
}
class FakeDartDevelopmentService extends Fake
implements DartDevelopmentService {
@override
Future<void> startDartDevelopmentService(
Uri vmServiceUri, {
required Logger logger,
int? hostPort,
bool? ipv6,
bool? disableServiceAuthCodes,
bool cacheStartupProfile = false,
}) async {}
@override
Uri get uri => Uri.parse('example');
}
class FakeFuchsiaWorkflow implements FuchsiaWorkflow {
FakeFuchsiaWorkflow({
this.appliesToHostPlatform = true,
this.canLaunchDevices = true,
this.canListDevices = true,
this.canListEmulators = true,
});
@override
bool appliesToHostPlatform;
@override
bool canLaunchDevices;
@override
bool canListDevices;
@override
bool canListEmulators;
}
| flutter/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart",
"repo_id": "flutter",
"token_count": 15040
} | 776 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/memory.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/ios/application_package.dart';
import 'package:flutter_tools/src/ios/core_devices.dart';
import 'package:flutter_tools/src/ios/devices.dart';
import 'package:flutter_tools/src/ios/ios_deploy.dart';
import 'package:flutter_tools/src/ios/iproxy.dart';
import 'package:flutter_tools/src/ios/mac.dart';
import 'package:flutter_tools/src/ios/xcode_debug.dart';
import 'package:test/fake.dart';
import '../../src/common.dart';
import '../../src/fake_process_manager.dart';
import '../../src/fakes.dart';
const Map<String, String> kDyLdLibEntry = <String, String>{
'DYLD_LIBRARY_PATH': '/path/to/libraries',
};
void main() {
late Artifacts artifacts;
late String iosDeployPath;
late FileSystem fileSystem;
late Directory bundleDirectory;
setUp(() {
artifacts = Artifacts.test();
fileSystem = MemoryFileSystem.test();
bundleDirectory = fileSystem.directory('bundle');
iosDeployPath = artifacts.getHostArtifact(HostArtifact.iosDeploy).path;
});
testWithoutContext('IOSDevice.installApp calls ios-deploy correctly with USB', () async {
final IOSApp iosApp = PrebuiltIOSApp(
projectBundleId: 'app',
uncompressedBundle: fileSystem.currentDirectory,
applicationPackage: bundleDirectory,
);
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(
command: <String>[
iosDeployPath,
'--id',
'1234',
'--bundle',
'/',
'--no-wifi',
],
environment: const <String, String>{
'PATH': '/usr/bin:null',
...kDyLdLibEntry,
},
),
]);
final IOSDevice device = setUpIOSDevice(
processManager: processManager,
fileSystem: fileSystem,
interfaceType: DeviceConnectionInterface.attached,
artifacts: artifacts,
);
final bool wasInstalled = await device.installApp(iosApp);
expect(wasInstalled, true);
expect(processManager, hasNoRemainingExpectations);
});
testWithoutContext('IOSDevice.installApp calls ios-deploy correctly with network', () async {
final IOSApp iosApp = PrebuiltIOSApp(
projectBundleId: 'app',
uncompressedBundle: fileSystem.currentDirectory,
applicationPackage: bundleDirectory,
);
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(
command: <String>[
iosDeployPath,
'--id',
'1234',
'--bundle',
'/',
],
environment: const <String, String>{
'PATH': '/usr/bin:null',
...kDyLdLibEntry,
},
),
]);
final IOSDevice device = setUpIOSDevice(
processManager: processManager,
fileSystem: fileSystem,
interfaceType: DeviceConnectionInterface.wireless,
artifacts: artifacts,
);
final bool wasInstalled = await device.installApp(iosApp);
expect(wasInstalled, true);
expect(processManager, hasNoRemainingExpectations);
});
testWithoutContext('IOSDevice.installApp uses devicectl for CoreDevices', () async {
final IOSApp iosApp = PrebuiltIOSApp(
projectBundleId: 'app',
uncompressedBundle: fileSystem.currentDirectory,
applicationPackage: bundleDirectory,
);
final FakeProcessManager processManager = FakeProcessManager.empty();
final IOSDevice device = setUpIOSDevice(
processManager: processManager,
fileSystem: fileSystem,
interfaceType: DeviceConnectionInterface.attached,
artifacts: artifacts,
isCoreDevice: true,
);
final bool wasInstalled = await device.installApp(iosApp);
expect(wasInstalled, true);
expect(processManager, hasNoRemainingExpectations);
});
testWithoutContext('IOSDevice.uninstallApp calls ios-deploy correctly', () async {
final IOSApp iosApp = PrebuiltIOSApp(
projectBundleId: 'app',
uncompressedBundle: bundleDirectory,
applicationPackage: bundleDirectory,
);
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(
command: <String>[
iosDeployPath,
'--id',
'1234',
'--uninstall_only',
'--bundle_id',
'app',
],
environment: const <String, String>{
'PATH': '/usr/bin:null',
...kDyLdLibEntry,
},
),
]);
final IOSDevice device = setUpIOSDevice(processManager: processManager, artifacts: artifacts);
final bool wasUninstalled = await device.uninstallApp(iosApp);
expect(wasUninstalled, true);
expect(processManager, hasNoRemainingExpectations);
});
testWithoutContext('IOSDevice.uninstallApp uses devicectl for CoreDevices', () async {
final IOSApp iosApp = PrebuiltIOSApp(
projectBundleId: 'app',
uncompressedBundle: fileSystem.currentDirectory,
applicationPackage: bundleDirectory,
);
final FakeProcessManager processManager = FakeProcessManager.empty();
final IOSDevice device = setUpIOSDevice(
processManager: processManager,
fileSystem: fileSystem,
interfaceType: DeviceConnectionInterface.attached,
artifacts: artifacts,
isCoreDevice: true,
);
final bool wasUninstalled = await device.uninstallApp(iosApp);
expect(wasUninstalled, true);
expect(processManager, hasNoRemainingExpectations);
});
group('isAppInstalled', () {
testWithoutContext('catches ProcessException from ios-deploy', () async {
final IOSApp iosApp = PrebuiltIOSApp(
projectBundleId: 'app',
uncompressedBundle: bundleDirectory,
applicationPackage: bundleDirectory,
);
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: <String>[
iosDeployPath,
'--id',
'1234',
'--exists',
'--timeout',
'10',
'--bundle_id',
'app',
], environment: const <String, String>{
'PATH': '/usr/bin:null',
...kDyLdLibEntry,
}, exception: const ProcessException('ios-deploy', <String>[])),
]);
final IOSDevice device = setUpIOSDevice(processManager: processManager, artifacts: artifacts);
final bool isAppInstalled = await device.isAppInstalled(iosApp);
expect(isAppInstalled, false);
expect(processManager, hasNoRemainingExpectations);
});
testWithoutContext('returns true when app is installed', () async {
final IOSApp iosApp = PrebuiltIOSApp(
projectBundleId: 'app',
uncompressedBundle: bundleDirectory,
applicationPackage: bundleDirectory,
);
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(
command: <String>[
iosDeployPath,
'--id',
'1234',
'--exists',
'--timeout',
'10',
'--bundle_id',
'app',
],
environment: const <String, String>{
'PATH': '/usr/bin:null',
...kDyLdLibEntry,
},
),
]);
final IOSDevice device = setUpIOSDevice(processManager: processManager, artifacts: artifacts);
final bool isAppInstalled = await device.isAppInstalled(iosApp);
expect(isAppInstalled, isTrue);
expect(processManager, hasNoRemainingExpectations);
});
testWithoutContext('returns false when app is not installed', () async {
final IOSApp iosApp = PrebuiltIOSApp(
projectBundleId: 'app',
uncompressedBundle: bundleDirectory,
applicationPackage: bundleDirectory,
);
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(
command: <String>[
iosDeployPath,
'--id',
'1234',
'--exists',
'--timeout',
'10',
'--bundle_id',
'app',
],
environment: const <String, String>{
'PATH': '/usr/bin:null',
...kDyLdLibEntry,
},
exitCode: 255,
),
]);
final BufferLogger logger = BufferLogger.test();
final IOSDevice device = setUpIOSDevice(processManager: processManager, logger: logger, artifacts: artifacts);
final bool isAppInstalled = await device.isAppInstalled(iosApp);
expect(isAppInstalled, isFalse);
expect(processManager, hasNoRemainingExpectations);
expect(logger.traceText, contains('${iosApp.id} not installed on ${device.id}'));
});
testWithoutContext('returns false on command timeout or other error', () async {
final IOSApp iosApp = PrebuiltIOSApp(
projectBundleId: 'app',
uncompressedBundle: bundleDirectory,
applicationPackage: bundleDirectory,
);
const String stderr = '2020-03-26 17:48:43.484 ios-deploy[21518:5501783] [ !! ] Timed out waiting for device';
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(
command: <String>[
iosDeployPath,
'--id',
'1234',
'--exists',
'--timeout',
'10',
'--bundle_id',
'app',
],
environment: const <String, String>{
'PATH': '/usr/bin:null',
...kDyLdLibEntry,
},
stderr: stderr,
exitCode: 253,
),
]);
final BufferLogger logger = BufferLogger.test();
final IOSDevice device = setUpIOSDevice(processManager: processManager, logger: logger, artifacts: artifacts);
final bool isAppInstalled = await device.isAppInstalled(iosApp);
expect(isAppInstalled, isFalse);
expect(processManager, hasNoRemainingExpectations);
expect(logger.traceText, contains(stderr));
});
testWithoutContext('uses devicectl for CoreDevices', () async {
final IOSApp iosApp = PrebuiltIOSApp(
projectBundleId: 'app',
uncompressedBundle: fileSystem.currentDirectory,
applicationPackage: bundleDirectory,
);
final FakeProcessManager processManager = FakeProcessManager.empty();
final IOSDevice device = setUpIOSDevice(
processManager: processManager,
fileSystem: fileSystem,
interfaceType: DeviceConnectionInterface.attached,
artifacts: artifacts,
isCoreDevice: true,
);
final bool wasInstalled = await device.isAppInstalled(iosApp);
expect(wasInstalled, true);
expect(processManager, hasNoRemainingExpectations);
});
});
testWithoutContext('IOSDevice.installApp catches ProcessException from ios-deploy', () async {
final IOSApp iosApp = PrebuiltIOSApp(
projectBundleId: 'app',
uncompressedBundle: fileSystem.currentDirectory,
applicationPackage: bundleDirectory,
);
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: <String>[
iosDeployPath,
'--id',
'1234',
'--bundle',
'/',
'--no-wifi',
], environment: const <String, String>{
'PATH': '/usr/bin:null',
...kDyLdLibEntry,
}, exception: const ProcessException('ios-deploy', <String>[])),
]);
final IOSDevice device = setUpIOSDevice(processManager: processManager, artifacts: artifacts);
final bool wasAppInstalled = await device.installApp(iosApp);
expect(wasAppInstalled, false);
});
testWithoutContext('IOSDevice.uninstallApp catches ProcessException from ios-deploy', () async {
final IOSApp iosApp = PrebuiltIOSApp(
projectBundleId: 'app',
uncompressedBundle: bundleDirectory,
applicationPackage: bundleDirectory,
);
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: <String>[
iosDeployPath,
'--id',
'1234',
'--uninstall_only',
'--bundle_id',
'app',
], environment: const <String, String>{
'PATH': '/usr/bin:null',
...kDyLdLibEntry,
}, exception: const ProcessException('ios-deploy', <String>[])),
]);
final IOSDevice device = setUpIOSDevice(processManager: processManager, artifacts: artifacts);
final bool wasAppUninstalled = await device.uninstallApp(iosApp);
expect(wasAppUninstalled, false);
});
}
IOSDevice setUpIOSDevice({
required ProcessManager processManager,
FileSystem? fileSystem,
Logger? logger,
DeviceConnectionInterface? interfaceType,
Artifacts? artifacts,
bool isCoreDevice = false,
}) {
logger ??= BufferLogger.test();
final FakePlatform platform = FakePlatform(
operatingSystem: 'macos',
environment: <String, String>{},
);
artifacts ??= Artifacts.test();
final Cache cache = Cache.test(
platform: platform,
artifacts: <ArtifactSet>[
FakeDyldEnvironmentArtifact(),
],
processManager: FakeProcessManager.any(),
);
return IOSDevice(
'1234',
name: 'iPhone 1',
logger: logger,
fileSystem: fileSystem ?? MemoryFileSystem.test(),
sdkVersion: '13.3',
cpuArchitecture: DarwinArch.arm64,
platform: platform,
iMobileDevice: IMobileDevice(
logger: logger,
processManager: processManager,
artifacts: artifacts,
cache: cache,
),
iosDeploy: IOSDeploy(
logger: logger,
platform: platform,
processManager: processManager,
artifacts: artifacts,
cache: cache,
),
coreDeviceControl: FakeIOSCoreDeviceControl(),
xcodeDebug: FakeXcodeDebug(),
iProxy: IProxy.test(logger: logger, processManager: processManager),
connectionInterface: interfaceType ?? DeviceConnectionInterface.attached,
isConnected: true,
isPaired: true,
devModeEnabled: true,
isCoreDevice: isCoreDevice,
);
}
class FakeXcodeDebug extends Fake implements XcodeDebug {}
class FakeIOSCoreDeviceControl extends Fake implements IOSCoreDeviceControl {
@override
Future<bool> installApp({
required String deviceId,
required String bundlePath,
}) async {
return true;
}
@override
Future<bool> uninstallApp({
required String deviceId,
required String bundleId,
}) async {
return true;
}
@override
Future<bool> isAppInstalled({
required String deviceId,
required String bundleId,
}) async {
return true;
}
}
| flutter/packages/flutter_tools/test/general.shard/ios/ios_device_install_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/ios/ios_device_install_test.dart",
"repo_id": "flutter",
"token_count": 5960
} | 777 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/isolated/native_assets/native_assets.dart';
import 'package:flutter_tools/src/resident_runner.dart';
import 'package:flutter_tools/src/run_hot.dart';
import 'package:native_assets_builder/native_assets_builder.dart'
as native_assets_builder;
import 'package:native_assets_cli/native_assets_cli_internal.dart';
import 'package:package_config/package_config_types.dart';
/// Mocks all logic instead of using `package:native_assets_builder`, which
/// relies on doing process calls to `pub` and the local file system.
class FakeNativeAssetsBuildRunner implements NativeAssetsBuildRunner {
FakeNativeAssetsBuildRunner({
this.hasPackageConfigResult = true,
this.packagesWithNativeAssetsResult = const <Package>[],
this.onBuild,
this.dryRunResult = const FakeNativeAssetsBuilderResult(),
this.buildResult = const FakeNativeAssetsBuilderResult(),
CCompilerConfig? cCompilerConfigResult,
CCompilerConfig? ndkCCompilerConfigResult,
}) : cCompilerConfigResult = cCompilerConfigResult ?? CCompilerConfig(),
ndkCCompilerConfigResult = ndkCCompilerConfigResult ?? CCompilerConfig();
final native_assets_builder.BuildResult Function(Target)? onBuild;
final native_assets_builder.BuildResult buildResult;
final native_assets_builder.DryRunResult dryRunResult;
final bool hasPackageConfigResult;
final List<Package> packagesWithNativeAssetsResult;
final CCompilerConfig cCompilerConfigResult;
final CCompilerConfig ndkCCompilerConfigResult;
int buildInvocations = 0;
int dryRunInvocations = 0;
int hasPackageConfigInvocations = 0;
int packagesWithNativeAssetsInvocations = 0;
BuildMode? lastBuildMode;
@override
Future<native_assets_builder.BuildResult> build({
required bool includeParentEnvironment,
required BuildMode buildMode,
required LinkModePreference linkModePreference,
required Target target,
required Uri workingDirectory,
CCompilerConfig? cCompilerConfig,
int? targetAndroidNdkApi,
IOSSdk? targetIOSSdk,
}) async {
buildInvocations++;
lastBuildMode = buildMode;
return onBuild?.call(target) ?? buildResult;
}
@override
Future<native_assets_builder.DryRunResult> dryRun({
required bool includeParentEnvironment,
required LinkModePreference linkModePreference,
required OS targetOS,
required Uri workingDirectory,
}) async {
dryRunInvocations++;
return dryRunResult;
}
@override
Future<bool> hasPackageConfig() async {
hasPackageConfigInvocations++;
return hasPackageConfigResult;
}
@override
Future<List<Package>> packagesWithNativeAssets() async {
packagesWithNativeAssetsInvocations++;
return packagesWithNativeAssetsResult;
}
@override
Future<CCompilerConfig> get cCompilerConfig async => cCompilerConfigResult;
@override
Future<CCompilerConfig> get ndkCCompilerConfig async => cCompilerConfigResult;
}
final class FakeNativeAssetsBuilderResult
implements native_assets_builder.BuildResult {
const FakeNativeAssetsBuilderResult({
this.assets = const <Asset>[],
this.dependencies = const <Uri>[],
this.success = true,
});
@override
final List<Asset> assets;
@override
final List<Uri> dependencies;
@override
final bool success;
}
class FakeHotRunnerNativeAssetsBuilder implements HotRunnerNativeAssetsBuilder {
FakeHotRunnerNativeAssetsBuilder(this.buildRunner);
final NativeAssetsBuildRunner buildRunner;
@override
Future<Uri?> dryRun({
required Uri projectUri,
required FileSystem fileSystem,
required List<FlutterDevice> flutterDevices,
required PackageConfig packageConfig,
required Logger logger,
}) {
return dryRunNativeAssets(
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: buildRunner,
flutterDevices: flutterDevices,
);
}
}
| flutter/packages/flutter_tools/test/general.shard/isolated/fake_native_assets_build_runner.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/isolated/fake_native_assets_build_runner.dart",
"repo_id": "flutter",
"token_count": 1291
} | 778 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/memory.dart';
import 'package:flutter_tools/src/application_package.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/os.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/desktop_device.dart';
import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/ios/application_package.dart';
import 'package:flutter_tools/src/ios/ios_workflow.dart';
import 'package:flutter_tools/src/macos/macos_ipad_device.dart';
import 'package:test/fake.dart';
import '../../src/common.dart';
import '../../src/fake_process_manager.dart';
import '../../src/fakes.dart';
void main() {
group('MacOSDesignedForIPadDevices', () {
testWithoutContext('does not support non-macOS platforms', () async {
final MacOSDesignedForIPadDevices discoverer = MacOSDesignedForIPadDevices(
platform: FakePlatform(operatingSystem: 'windows'),
logger: BufferLogger.test(),
processManager: FakeProcessManager.any(),
fileSystem: MemoryFileSystem.test(),
operatingSystemUtils: FakeOperatingSystemUtils(hostPlatform: HostPlatform.darwin_arm64),
iosWorkflow: FakeIOSWorkflow(canListDevices: true),
);
expect(discoverer.supportsPlatform, isFalse);
});
testWithoutContext('discovery is allowed', () async {
final MacOSDesignedForIPadDevices discoverer = MacOSDesignedForIPadDevices(
platform: FakePlatform(operatingSystem: 'macos'),
logger: BufferLogger.test(),
processManager: FakeProcessManager.any(),
fileSystem: MemoryFileSystem.test(),
operatingSystemUtils: FakeOperatingSystemUtils(hostPlatform: HostPlatform.darwin_arm64),
iosWorkflow: FakeIOSWorkflow(canListDevices: true),
);
expect(discoverer.supportsPlatform, isTrue);
final List<Device> devices = await discoverer.devices();
expect(devices, isNotNull);
expect(devices.first.id, 'mac-designed-for-ipad');
expect(devices.first is MacOSDesignedForIPadDevice, true);
});
testWithoutContext('no device on x86', () async {
final MacOSDesignedForIPadDevices discoverer = MacOSDesignedForIPadDevices(
platform: FakePlatform(operatingSystem: 'macos'),
logger: BufferLogger.test(),
processManager: FakeProcessManager.any(),
fileSystem: MemoryFileSystem.test(),
operatingSystemUtils: FakeOperatingSystemUtils(hostPlatform: HostPlatform.darwin_x64),
iosWorkflow: FakeIOSWorkflow(canListDevices: true),
);
expect(discoverer.supportsPlatform, isTrue);
final List<Device> devices = await discoverer.devices();
expect(devices, isEmpty);
});
testWithoutContext('no device on when iOS development off', () async {
final MacOSDesignedForIPadDevices discoverer = MacOSDesignedForIPadDevices(
platform: FakePlatform(operatingSystem: 'macos'),
logger: BufferLogger.test(),
processManager: FakeProcessManager.any(),
fileSystem: MemoryFileSystem.test(),
operatingSystemUtils: FakeOperatingSystemUtils(hostPlatform: HostPlatform.darwin_arm64),
iosWorkflow: FakeIOSWorkflow(canListDevices: false),
);
expect(discoverer.supportsPlatform, isTrue);
final List<Device> devices = await discoverer.devices();
expect(devices, isEmpty);
});
testWithoutContext('device discovery on arm', () async {
final MacOSDesignedForIPadDevices discoverer = MacOSDesignedForIPadDevices(
platform: FakePlatform(operatingSystem: 'macos'),
logger: BufferLogger.test(),
processManager: FakeProcessManager.any(),
fileSystem: MemoryFileSystem.test(),
operatingSystemUtils: FakeOperatingSystemUtils(hostPlatform: HostPlatform.darwin_arm64),
iosWorkflow: FakeIOSWorkflow(canListDevices: true),
);
expect(discoverer.supportsPlatform, isTrue);
List<Device> devices = await discoverer.devices();
expect(devices, hasLength(1));
final Device device = devices.single;
expect(device, isA<MacOSDesignedForIPadDevice>());
expect(device.id, 'mac-designed-for-ipad');
// Timeout ignored.
devices = await discoverer.discoverDevices(timeout: const Duration(seconds: 10));
expect(devices, hasLength(1));
});
});
testWithoutContext('MacOSDesignedForIPadDevice properties', () async {
final MacOSDesignedForIPadDevice device = MacOSDesignedForIPadDevice(
logger: BufferLogger.test(),
processManager: FakeProcessManager.any(),
fileSystem: MemoryFileSystem.test(),
operatingSystemUtils: FakeOperatingSystemUtils(hostPlatform: HostPlatform.darwin_arm64),
);
expect(device.id, 'mac-designed-for-ipad');
expect(await device.isLocalEmulator, isFalse);
expect(device.name, 'Mac Designed for iPad');
expect(device.portForwarder, isNot(isNull));
expect(await device.targetPlatform, TargetPlatform.darwin);
expect(await device.installApp(FakeApplicationPackage()), isTrue);
expect(await device.isAppInstalled(FakeApplicationPackage()), isTrue);
expect(await device.isLatestBuildInstalled(FakeApplicationPackage()), isTrue);
expect(await device.uninstallApp(FakeApplicationPackage()), isTrue);
expect(device.isSupported(), isTrue);
expect(device.getLogReader(), isA<DesktopLogReader>());
expect(await device.stopApp(FakeIOSApp()), isFalse);
await expectLater(
() => device.startApp(
FakeIOSApp(),
debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug),
),
throwsA(isA<UnimplementedError>()),
);
await expectLater(() => device.buildForDevice(buildInfo: BuildInfo.debug), throwsA(isA<UnimplementedError>()));
expect(device.executablePathForDevice(FakeIOSApp(), BuildInfo.debug), null);
});
}
class FakeIOSWorkflow extends Fake implements IOSWorkflow {
FakeIOSWorkflow({required this.canListDevices});
@override
final bool canListDevices;
}
class FakeApplicationPackage extends Fake implements ApplicationPackage {}
class FakeIOSApp extends Fake implements IOSApp {}
| flutter/packages/flutter_tools/test/general.shard/macos/macos_ipad_device_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/macos/macos_ipad_device_test.dart",
"repo_id": "flutter",
"token_count": 2258
} | 779 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:typed_data';
import 'package:fake_async/fake_async.dart';
import 'package:flutter_tools/src/proxied_devices/debounce_data_stream.dart';
import '../../src/common.dart';
void main() {
group('debounceDataStreams', () {
late FakeAsync fakeAsync;
late StreamController<Uint8List> source;
late Stream<Uint8List> output;
const Duration debounceDuration = Duration(seconds: 10);
const Duration smallDuration = Duration(milliseconds: 10);
void addToSource(int value) {
source.add(Uint8List.fromList(<int>[value]));
}
setUp(() {
fakeAsync = FakeAsync();
fakeAsync.run((FakeAsync time) {
source = StreamController<Uint8List>();
output = debounceDataStream(source.stream, debounceDuration);
});
});
testWithoutContext('does not listen if returned stream is not listened to', () {
expect(source.hasListener, false);
output.listen(dummy);
expect(source.hasListener, true);
});
testWithoutContext('forwards data normally is all data if longer than duration apart', () {
fakeAsync.run((FakeAsync time) {
final List<Uint8List> outputItems = <Uint8List>[];
output.listen(outputItems.add);
addToSource(1);
time.elapse(debounceDuration + smallDuration);
addToSource(2);
time.elapse(debounceDuration + smallDuration);
addToSource(3);
time.elapse(debounceDuration + smallDuration);
expect(outputItems, <List<int>>[
<int>[1],
<int>[2],
<int>[3],
]);
});
});
testWithoutContext('merge data after the first if sent within duration', () {
fakeAsync.run((FakeAsync time) {
final List<Uint8List> outputItems = <Uint8List>[];
output.listen(outputItems.add);
addToSource(1);
time.elapse(smallDuration);
addToSource(2);
time.elapse(smallDuration);
addToSource(3);
time.elapse(debounceDuration + smallDuration);
expect(outputItems, <List<int>>[
<int>[1],
<int>[2, 3],
]);
});
});
testWithoutContext('output data in separate chunks if time between them is longer than duration', () {
fakeAsync.run((FakeAsync time) {
final List<Uint8List> outputItems = <Uint8List>[];
output.listen(outputItems.add);
addToSource(1);
time.elapse(smallDuration);
addToSource(2);
time.elapse(smallDuration);
addToSource(3);
time.elapse(debounceDuration + smallDuration);
addToSource(4);
time.elapse(smallDuration);
addToSource(5);
time.elapse(debounceDuration + smallDuration);
expect(outputItems, <List<int>>[
<int>[1],
<int>[2, 3],
<int>[4, 5],
]);
});
});
testWithoutContext('sends the last chunk after debounce duration', () {
fakeAsync.run((FakeAsync time) {
final List<Uint8List> outputItems = <Uint8List>[];
output.listen(outputItems.add);
addToSource(1);
time.flushMicrotasks();
expect(outputItems, <List<int>>[<int>[1]]);
time.elapse(smallDuration);
addToSource(2);
time.elapse(smallDuration);
addToSource(3);
expect(outputItems, <List<int>>[<int>[1]]);
time.elapse(debounceDuration + smallDuration);
expect(outputItems, <List<int>>[
<int>[1],
<int>[2, 3],
]);
});
});
testWithoutContext('close if source stream is closed', () {
fakeAsync.run((FakeAsync time) {
bool isDone = false;
output.listen(dummy, onDone: () => isDone = true);
expect(isDone, false);
source.close();
time.flushMicrotasks();
expect(isDone, true);
});
});
testWithoutContext('delay close until after last chunk is sent', () {
fakeAsync.run((FakeAsync time) {
final List<Uint8List> outputItems = <Uint8List>[];
bool isDone = false;
output.listen(outputItems.add, onDone: () => isDone = true);
addToSource(1);
time.flushMicrotasks();
expect(outputItems, <List<int>>[<int>[1]]);
addToSource(2);
source.close();
time.elapse(smallDuration);
expect(isDone, false);
expect(outputItems, <List<int>>[<int>[1]]);
time.elapse(debounceDuration + smallDuration);
expect(outputItems, <List<int>>[
<int>[1],
<int>[2],
]);
expect(isDone, true);
});
});
testWithoutContext('close if returned stream is closed', () {
fakeAsync.run((FakeAsync time) {
bool isCancelled = false;
source.onCancel = () => isCancelled = true;
final StreamSubscription<Uint8List> subscription = output.listen(dummy);
expect(isCancelled, false);
subscription.cancel();
expect(isCancelled, true);
});
});
});
}
Uint8List dummy(Uint8List data) => data;
| flutter/packages/flutter_tools/test/general.shard/proxied_devices/debounce_data_stream_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/proxied_devices/debounce_data_stream_test.dart",
"repo_id": "flutter",
"token_count": 2246
} | 780 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/base/terminal.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/doctor.dart';
import 'package:flutter_tools/src/ios/devices.dart';
import 'package:flutter_tools/src/ios/ios_workflow.dart';
import 'package:flutter_tools/src/macos/xcdevice.dart';
import 'package:flutter_tools/src/project.dart';
import 'package:flutter_tools/src/runner/target_devices.dart';
import 'package:test/fake.dart';
import '../../src/common.dart';
import '../../src/context.dart';
void main() {
testWithoutContext('Ensure factory returns TargetDevicesWithExtendedWirelessDeviceDiscovery on MacOS', () async {
final BufferLogger logger = BufferLogger.test();
final Platform platform = FakePlatform(operatingSystem: 'macos');
final TestDeviceManager deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
final TargetDevices targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
);
expect(targetDevices is TargetDevicesWithExtendedWirelessDeviceDiscovery, true);
});
testWithoutContext('Ensure factory returns default when not on MacOS', () async {
final BufferLogger logger = BufferLogger.test();
final Platform platform = FakePlatform();
final TestDeviceManager deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
final TargetDevices targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
);
expect(targetDevices is TargetDevicesWithExtendedWirelessDeviceDiscovery, false);
});
group('findAllTargetDevices on non-MacOS platform', () {
late Platform platform;
final FakeDevice attachedAndroidDevice1 = FakeDevice(deviceName: 'target-device-1');
final FakeDevice attachedAndroidDevice2 = FakeDevice(deviceName: 'target-device-2');
final FakeDevice attachedUnsupportedAndroidDevice = FakeDevice(deviceName: 'target-device-3', deviceSupported: false);
final FakeDevice attachedUnsupportedForProjectAndroidDevice = FakeDevice(deviceName: 'target-device-4', deviceSupportForProject: false);
final FakeDevice wirelessAndroidDevice1 = FakeDevice.wireless(deviceName: 'target-device-5');
final FakeDevice wirelessAndroidDevice2 = FakeDevice.wireless(deviceName: 'target-device-6');
final FakeDevice wirelessUnsupportedAndroidDevice = FakeDevice.wireless(deviceName: 'target-device-7', deviceSupported: false);
final FakeDevice wirelessUnsupportedForProjectAndroidDevice = FakeDevice.wireless(deviceName: 'target-device-8', deviceSupportForProject: false);
final FakeDevice nonEphemeralDevice = FakeDevice(deviceName: 'target-device-9', ephemeral: false);
final FakeDevice fuchsiaDevice = FakeDevice.fuchsia(deviceName: 'target-device-10');
final FakeDevice exactMatchAndroidDevice = FakeDevice(deviceName: 'target-device');
final FakeDevice exactMatchWirelessAndroidDevice = FakeDevice.wireless(deviceName: 'target-device');
final FakeDevice exactMatchAttachedUnsupportedAndroidDevice = FakeDevice(deviceName: 'target-device', deviceSupported: false);
final FakeDevice exactMatchUnsupportedByProjectDevice = FakeDevice(deviceName: 'target-device', deviceSupportForProject: false);
setUp(() {
platform = FakePlatform();
});
group('when cannot launch anything', () {
late BufferLogger logger;
late FakeDoctor doctor;
setUp(() {
logger = BufferLogger.test();
doctor = FakeDoctor(canLaunchAnything: false);
});
testUsingContext('does not search for devices', () async {
final TestDeviceManager deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
deviceManager.androidDiscoverer.deviceList = <Device>[attachedAndroidDevice1];
final TargetDevices targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.errorText, equals('''
Unable to locate a development device; please run 'flutter doctor' for information about installing additional components.
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 0);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
}, overrides: <Type, Generator>{
Doctor: () => doctor,
});
});
testUsingContext('ensure refresh when deviceDiscoveryTimeout is provided', () async {
final BufferLogger logger = BufferLogger.test();
final TestDeviceManager deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
deviceManager.androidDiscoverer.deviceList = <Device>[attachedAndroidDevice1];
deviceManager.androidDiscoverer.refreshDeviceList = <Device>[attachedAndroidDevice1, wirelessAndroidDevice1];
deviceManager.hasSpecifiedAllDevices = true;
final TargetDevices targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices(
deviceDiscoveryTimeout: const Duration(seconds: 2),
);
expect(logger.statusText, equals(''));
expect(devices, <Device>[attachedAndroidDevice1, wirelessAndroidDevice1]);
expect(deviceManager.androidDiscoverer.devicesCalled, 2);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('ensure unsupported for projects are included when includeDevicesUnsupportedByProject is true', () async {
final BufferLogger logger = BufferLogger.test();
final TestDeviceManager deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
deviceManager.androidDiscoverer.deviceList = <Device>[attachedUnsupportedAndroidDevice, attachedUnsupportedForProjectAndroidDevice];
final TargetDevices targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices(
includeDevicesUnsupportedByProject: true,
);
expect(logger.statusText, equals(''));
expect(devices, <Device>[attachedUnsupportedForProjectAndroidDevice]);
expect(deviceManager.androidDiscoverer.devicesCalled, 2);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
group('finds no devices', () {
late BufferLogger logger;
late TestDeviceManager deviceManager;
late TargetDevices targetDevices;
setUp(() {
logger = BufferLogger.test();
deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
);
});
group('with device not specified', () {
testUsingContext('when no devices', () async {
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No supported devices connected.
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('when device is unsupported by flutter or project', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[
attachedUnsupportedAndroidDevice,
attachedUnsupportedForProjectAndroidDevice,
];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No supported devices connected.
The following devices were found, but are not supported by this project:
target-device-3 (mobile) • xxx • android • Android 10 (unsupported)
target-device-4 (mobile) • xxx • android • Android 10
If you would like your app to run on android, consider running `flutter create .` to generate projects for these platforms.
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
group('when deviceConnectionInterface does not match', () {
testUsingContext('filter of wireless', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[attachedAndroidDevice1];
final TargetDevices targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
deviceConnectionInterface: DeviceConnectionInterface.wireless,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No supported devices connected.
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 2);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('filter of attached', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[wirelessAndroidDevice1];
final TargetDevices targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
deviceConnectionInterface: DeviceConnectionInterface.attached,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No supported devices connected.
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 2);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
});
});
group('with hasSpecifiedDeviceId', () {
setUp(() {
deviceManager.specifiedDeviceId = 'target-device';
});
testUsingContext('when no devices', () async {
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No supported devices found with name or id matching 'target-device'.
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 4);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('when no devices match', () async {
final FakeDevice device1 = FakeDevice(deviceName: 'no-match-1');
final FakeDevice device2 = FakeDevice.wireless(deviceName: 'no-match-2');
deviceManager.androidDiscoverer.deviceList = <Device>[device1, device2];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No supported devices found with name or id matching 'target-device'.
The following devices were found:
no-match-1 (mobile) • xxx • android • Android 10
no-match-2 (mobile) • xxx • android • Android 10
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 4);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('when matching device is unsupported by flutter', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[exactMatchAttachedUnsupportedAndroidDevice];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No supported devices found with name or id matching 'target-device'.
The following devices were found:
target-device (mobile) • xxx • android • Android 10 (unsupported)
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 4);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
group('when deviceConnectionInterface does not match', () {
testUsingContext('filter of wireless', () async {
final FakeDevice device1 = FakeDevice(deviceName: 'not-a-match');
final FakeDevice device2 = FakeDevice.wireless(deviceName: 'not-a-match-2');
deviceManager.androidDiscoverer.deviceList = <Device>[exactMatchAndroidDevice, device1, device2];
final TargetDevices targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
deviceConnectionInterface: DeviceConnectionInterface.wireless,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No supported devices found with name or id matching 'target-device'.
The following devices were found:
not-a-match-2 (mobile) • xxx • android • Android 10
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('filter of attached', () async {
final FakeDevice device1 = FakeDevice(deviceName: 'not-a-match');
final FakeDevice device2 = FakeDevice.wireless(deviceName: 'not-a-match-2');
deviceManager.androidDiscoverer.deviceList = <Device>[exactMatchWirelessAndroidDevice, device1, device2];
final TargetDevices targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
deviceConnectionInterface: DeviceConnectionInterface.attached,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No supported devices found with name or id matching 'target-device'.
The following devices were found:
not-a-match (mobile) • xxx • android • Android 10
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
});
});
group('with hasSpecifiedAllDevices', () {
setUp(() {
deviceManager.hasSpecifiedAllDevices = true;
});
testUsingContext('when no devices', () async {
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found.
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('when devices are either unsupported by flutter or project or all', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[
attachedUnsupportedAndroidDevice,
attachedUnsupportedForProjectAndroidDevice,
];
deviceManager.otherDiscoverer.deviceList = <Device>[fuchsiaDevice];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found.
The following devices were found, but are not supported by this project:
target-device-3 (mobile) • xxx • android • Android 10 (unsupported)
target-device-4 (mobile) • xxx • android • Android 10
target-device-10 (mobile) • xxx • fuchsia-arm64 • tester
If you would like your app to run on android or fuchsia, consider running `flutter create .` to generate projects for these platforms.
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
});
});
group('finds single device', () {
late BufferLogger logger;
late TestDeviceManager deviceManager;
late TargetDevices targetDevices;
setUp(() {
logger = BufferLogger.test();
deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
);
});
group('with device not specified', () {
testUsingContext('when single attached device', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[attachedAndroidDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[attachedAndroidDevice1]);
expect(deviceManager.androidDiscoverer.devicesCalled, 2);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('when single wireless device', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[wirelessAndroidDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[wirelessAndroidDevice1]);
expect(deviceManager.androidDiscoverer.devicesCalled, 2);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('when multiple but only one ephemeral', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[nonEphemeralDevice, wirelessAndroidDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[wirelessAndroidDevice1]);
expect(deviceManager.androidDiscoverer.devicesCalled, 2);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
});
group('with hasSpecifiedDeviceId', () {
setUp(() {
deviceManager.specifiedDeviceId = 'target-device';
});
testUsingContext('when multiple matches but first is unsupported by flutter', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[
exactMatchAttachedUnsupportedAndroidDevice,
exactMatchAndroidDevice,
];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[exactMatchAndroidDevice]);
expect(deviceManager.androidDiscoverer.devicesCalled, 1);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('when matching device is unsupported by project', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[exactMatchUnsupportedByProjectDevice];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[exactMatchUnsupportedByProjectDevice]);
expect(deviceManager.androidDiscoverer.devicesCalled, 1);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('when matching attached device', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[exactMatchAndroidDevice];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[exactMatchAndroidDevice]);
expect(deviceManager.androidDiscoverer.devicesCalled, 1);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('when matching wireless device', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[exactMatchWirelessAndroidDevice];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[exactMatchWirelessAndroidDevice]);
expect(deviceManager.androidDiscoverer.devicesCalled, 1);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('when exact matching an attached device and partial matching a wireless device', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[exactMatchAndroidDevice, wirelessAndroidDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[exactMatchAndroidDevice]);
expect(deviceManager.androidDiscoverer.devicesCalled, 1);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
});
group('with hasSpecifiedAllDevices', () {
setUp(() {
deviceManager.hasSpecifiedAllDevices = true;
});
testUsingContext('when only one device', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[attachedAndroidDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[attachedAndroidDevice1]);
expect(deviceManager.androidDiscoverer.devicesCalled, 2);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
});
});
group('finds multiple devices', () {
late BufferLogger logger;
late TestDeviceManager deviceManager;
late TargetDevices targetDevices;
setUp(() {
logger = BufferLogger.test();
deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
);
});
group('with device not specified', () {
group('with stdinHasTerminal', () {
late FakeTerminal terminal;
setUp(() {
terminal = FakeTerminal();
});
testUsingContext('including attached, wireless, unsupported devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[
attachedAndroidDevice1,
attachedUnsupportedAndroidDevice,
attachedUnsupportedForProjectAndroidDevice,
wirelessAndroidDevice1,
wirelessUnsupportedAndroidDevice,
wirelessUnsupportedForProjectAndroidDevice,
];
terminal.setPrompt(<String>['1', '2', 'q', 'Q'], '2');
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Connected devices:
target-device-1 (mobile) • xxx • android • Android 10
Wirelessly connected devices:
target-device-5 (mobile) • xxx • android • Android 10
[1]: target-device-1 (xxx)
[2]: target-device-5 (xxx)
'''));
expect(devices, <Device>[wirelessAndroidDevice1]);
expect(deviceManager.androidDiscoverer.devicesCalled, 2);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only attached devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[attachedAndroidDevice1, attachedAndroidDevice2];
terminal.setPrompt(<String>['1', '2', 'q', 'Q'], '1');
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Connected devices:
target-device-1 (mobile) • xxx • android • Android 10
target-device-2 (mobile) • xxx • android • Android 10
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
'''));
expect(devices, <Device>[attachedAndroidDevice1]);
expect(deviceManager.androidDiscoverer.devicesCalled, 2);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only wireless devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[wirelessAndroidDevice1, wirelessAndroidDevice2];
terminal.setPrompt(<String>['1', '2', 'q', 'Q'], '1');
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Connected devices:
Wirelessly connected devices:
target-device-5 (mobile) • xxx • android • Android 10
target-device-6 (mobile) • xxx • android • Android 10
[1]: target-device-5 (xxx)
[2]: target-device-6 (xxx)
'''));
expect(devices, <Device>[wirelessAndroidDevice1]);
expect(deviceManager.androidDiscoverer.devicesCalled, 2);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
});
group('without stdinHasTerminal', () {
late FakeTerminal terminal;
setUp(() {
terminal = FakeTerminal(stdinHasTerminal: false);
});
testUsingContext('including attached, wireless, unsupported devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[
attachedAndroidDevice1,
attachedUnsupportedAndroidDevice,
attachedUnsupportedForProjectAndroidDevice,
wirelessAndroidDevice1,
wirelessUnsupportedAndroidDevice,
wirelessUnsupportedForProjectAndroidDevice,
];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.
target-device-1 (mobile) • xxx • android • Android 10
target-device-4 (mobile) • xxx • android • Android 10
Wirelessly connected devices:
target-device-5 (mobile) • xxx • android • Android 10
target-device-8 (mobile) • xxx • android • Android 10
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 4);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only attached devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[attachedAndroidDevice1, attachedAndroidDevice2];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.
target-device-1 (mobile) • xxx • android • Android 10
target-device-2 (mobile) • xxx • android • Android 10
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 4);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only wireless devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[wirelessAndroidDevice1, wirelessAndroidDevice2];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.
Wirelessly connected devices:
target-device-5 (mobile) • xxx • android • Android 10
target-device-6 (mobile) • xxx • android • Android 10
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 4);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
});
});
group('with hasSpecifiedDeviceId', () {
setUp(() {
deviceManager.specifiedDeviceId = 'target-device';
});
group('with stdinHasTerminal', () {
late FakeTerminal terminal;
setUp(() {
terminal = FakeTerminal();
});
testUsingContext('including attached, wireless, unsupported devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[
attachedAndroidDevice1,
attachedUnsupportedAndroidDevice,
attachedUnsupportedForProjectAndroidDevice,
wirelessAndroidDevice1,
wirelessUnsupportedAndroidDevice,
wirelessUnsupportedForProjectAndroidDevice,
];
terminal.setPrompt(<String>['1', '2', '3', '4', 'q', 'Q'], '2');
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Found 4 devices with name or id matching target-device:
target-device-1 (mobile) • xxx • android • Android 10
target-device-4 (mobile) • xxx • android • Android 10
Wirelessly connected devices:
target-device-5 (mobile) • xxx • android • Android 10
target-device-8 (mobile) • xxx • android • Android 10
[1]: target-device-1 (xxx)
[2]: target-device-4 (xxx)
[3]: target-device-5 (xxx)
[4]: target-device-8 (xxx)
'''));
expect(devices, <Device>[attachedUnsupportedForProjectAndroidDevice]);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only attached devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[attachedAndroidDevice1, attachedAndroidDevice2];
terminal.setPrompt(<String>['1', '2', 'q', 'Q'], '1');
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Found 2 devices with name or id matching target-device:
target-device-1 (mobile) • xxx • android • Android 10
target-device-2 (mobile) • xxx • android • Android 10
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
'''));
expect(devices, <Device>[attachedAndroidDevice1]);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only wireless devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[wirelessAndroidDevice1, wirelessAndroidDevice2];
terminal.setPrompt(<String>['1', '2', 'q', 'Q'], '1');
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Found 2 devices with name or id matching target-device:
Wirelessly connected devices:
target-device-5 (mobile) • xxx • android • Android 10
target-device-6 (mobile) • xxx • android • Android 10
[1]: target-device-5 (xxx)
[2]: target-device-6 (xxx)
'''));
expect(devices, <Device>[wirelessAndroidDevice1]);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
});
group('without stdinHasTerminal', () {
late FakeTerminal terminal;
setUp(() {
terminal = FakeTerminal(stdinHasTerminal: false);
});
testUsingContext('including only one ephemeral', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[nonEphemeralDevice, attachedAndroidDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Found 2 devices with name or id matching target-device:
target-device-9 (mobile) • xxx • android • Android 10
target-device-1 (mobile) • xxx • android • Android 10
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including matching attached, wireless, unsupported devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[
attachedAndroidDevice1,
attachedUnsupportedAndroidDevice,
attachedUnsupportedForProjectAndroidDevice,
wirelessAndroidDevice1,
wirelessUnsupportedAndroidDevice,
wirelessUnsupportedForProjectAndroidDevice,
];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Found 4 devices with name or id matching target-device:
target-device-1 (mobile) • xxx • android • Android 10
target-device-4 (mobile) • xxx • android • Android 10
Wirelessly connected devices:
target-device-5 (mobile) • xxx • android • Android 10
target-device-8 (mobile) • xxx • android • Android 10
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only attached devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[attachedAndroidDevice1, attachedAndroidDevice2];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Found 2 devices with name or id matching target-device:
target-device-1 (mobile) • xxx • android • Android 10
target-device-2 (mobile) • xxx • android • Android 10
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only wireless devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[wirelessAndroidDevice1, wirelessAndroidDevice2];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Found 2 devices with name or id matching target-device:
Wirelessly connected devices:
target-device-5 (mobile) • xxx • android • Android 10
target-device-6 (mobile) • xxx • android • Android 10
'''));
expect(devices, isNull);
expect(deviceManager.androidDiscoverer.devicesCalled, 3);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
});
});
group('with hasSpecifiedAllDevices', () {
setUp(() {
deviceManager.hasSpecifiedAllDevices = true;
});
testUsingContext('including attached, wireless, unsupported devices', () async {
deviceManager.androidDiscoverer.deviceList = <Device>[
attachedAndroidDevice1,
attachedUnsupportedAndroidDevice,
attachedUnsupportedForProjectAndroidDevice,
wirelessAndroidDevice1,
wirelessUnsupportedAndroidDevice,
wirelessUnsupportedForProjectAndroidDevice,
];
deviceManager.otherDiscoverer.deviceList = <Device>[fuchsiaDevice];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[attachedAndroidDevice1, wirelessAndroidDevice1]);
expect(deviceManager.androidDiscoverer.devicesCalled, 2);
expect(deviceManager.androidDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.androidDiscoverer.numberOfTimesPolled, 1);
});
});
});
});
group('findAllTargetDevices on mac platform', () {
late Platform platform;
final FakeIOSDevice attachedIOSDevice1 = FakeIOSDevice(deviceName: 'target-device-1');
final FakeIOSDevice attachedIOSDevice2 = FakeIOSDevice(deviceName: 'target-device-2');
final FakeIOSDevice attachedUnsupportedIOSDevice = FakeIOSDevice(deviceName: 'target-device-3', deviceSupported: false);
final FakeIOSDevice attachedUnsupportedForProjectIOSDevice = FakeIOSDevice(deviceName: 'target-device-4', deviceSupportForProject: false);
final FakeIOSDevice disconnectedWirelessIOSDevice1 = FakeIOSDevice.notConnectedWireless(deviceName: 'target-device-5');
final FakeIOSDevice connectedWirelessIOSDevice1 = FakeIOSDevice.connectedWireless(deviceName: 'target-device-5');
final FakeIOSDevice disconnectedWirelessIOSDevice2 = FakeIOSDevice.notConnectedWireless(deviceName: 'target-device-6');
final FakeIOSDevice connectedWirelessIOSDevice2 = FakeIOSDevice.connectedWireless(deviceName: 'target-device-6');
final FakeIOSDevice disconnectedWirelessUnsupportedIOSDevice = FakeIOSDevice.notConnectedWireless(deviceName: 'target-device-7', deviceSupported: false);
final FakeIOSDevice connectedWirelessUnsupportedIOSDevice = FakeIOSDevice.connectedWireless(deviceName: 'target-device-7', deviceSupported: false);
final FakeIOSDevice disconnectedWirelessUnsupportedForProjectIOSDevice = FakeIOSDevice.notConnectedWireless(deviceName: 'target-device-8', deviceSupportForProject: false);
final FakeIOSDevice connectedWirelessUnsupportedForProjectIOSDevice = FakeIOSDevice.connectedWireless(deviceName: 'target-device-8', deviceSupportForProject: false);
final FakeIOSDevice nonEphemeralDevice = FakeIOSDevice(deviceName: 'target-device-9', ephemeral: false);
final FakeDevice fuchsiaDevice = FakeDevice.fuchsia(deviceName: 'target-device-10');
final FakeIOSDevice exactMatchAttachedIOSDevice = FakeIOSDevice(deviceName: 'target-device');
final FakeIOSDevice exactMatchAttachedUnsupportedIOSDevice = FakeIOSDevice(deviceName: 'target-device', deviceSupported: false);
final FakeIOSDevice exactMatchUnsupportedByProjectDevice = FakeIOSDevice(deviceName: 'target-device', deviceSupportForProject: false);
setUp(() {
platform = FakePlatform(operatingSystem: 'macos');
});
group('when cannot launch anything', () {
late BufferLogger logger;
late FakeDoctor doctor;
setUp(() {
logger = BufferLogger.test();
doctor = FakeDoctor(canLaunchAnything: false);
});
testUsingContext('does not search for devices', () async {
final TestDeviceManager deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1];
final TargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices = TargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.errorText, equals('''
Unable to locate a development device; please run 'flutter doctor' for information about installing additional components.
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 0);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 0);
}, overrides: <Type, Generator>{
Doctor: () => doctor,
});
});
testUsingContext('ensure refresh when deviceDiscoveryTimeout is provided', () async {
final BufferLogger logger = BufferLogger.test();
final TestDeviceManager deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
deviceManager.iosDiscoverer.deviceList = <Device>[disconnectedWirelessIOSDevice1];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[connectedWirelessIOSDevice1];
final TargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices = TargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices(
deviceDiscoveryTimeout: const Duration(seconds: 2),
);
expect(logger.statusText, equals(''));
expect(devices, <Device>[connectedWirelessIOSDevice1]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('ensure no refresh when deviceConnectionInterface is attached', () async {
final BufferLogger logger = BufferLogger.test();
final TestDeviceManager deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1];
final TargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices = TargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
deviceConnectionInterface: DeviceConnectionInterface.attached,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[attachedIOSDevice1]);
expect(deviceManager.iosDiscoverer.devicesCalled, 1);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 0);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 1);
});
testUsingContext('ensure unsupported for projects are included when includeDevicesUnsupportedByProject is true', () async {
final BufferLogger logger = BufferLogger.test();
final TestDeviceManager deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
deviceManager.iosDiscoverer.deviceList = <Device>[attachedUnsupportedIOSDevice, attachedUnsupportedForProjectIOSDevice];
final TargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices = TargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices(
includeDevicesUnsupportedByProject: true,
);
expect(logger.statusText, equals(''));
expect(devices, <Device>[attachedUnsupportedForProjectIOSDevice]);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
group('finds no devices', () {
late BufferLogger logger;
late TestDeviceManager deviceManager;
late TargetDevices targetDevices;
setUp(() {
logger = BufferLogger.test();
deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
targetDevices = TargetDevices(
platform: platform,
deviceManager: deviceManager,
logger: logger,
);
});
group('with device not specified', () {
testUsingContext('when no devices', () async {
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
No supported devices connected.
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
testUsingContext('when device is unsupported by flutter or project', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
disconnectedWirelessUnsupportedIOSDevice,
disconnectedWirelessUnsupportedForProjectIOSDevice,
];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
connectedWirelessUnsupportedIOSDevice,
connectedWirelessUnsupportedForProjectIOSDevice,
];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
No supported devices connected.
The following devices were found, but are not supported by this project:
target-device-3 (mobile) • xxx • ios • iOS 16 (unsupported)
target-device-4 (mobile) • xxx • ios • iOS 16
target-device-7 (mobile) • xxx • ios • iOS 16 (unsupported)
target-device-8 (mobile) • xxx • ios • iOS 16
If you would like your app to run on ios, consider running `flutter create .` to generate projects for these platforms.
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
testUsingContext('when all found devices are not connected', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[
disconnectedWirelessIOSDevice1,
disconnectedWirelessIOSDevice2,
];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[
disconnectedWirelessIOSDevice1,
disconnectedWirelessIOSDevice2,
];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
No supported devices connected.
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
group('when deviceConnectionInterface does not match', () {
testUsingContext('filter of wireless', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[attachedIOSDevice1];
final TestTargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices = TestTargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
deviceConnectionInterface: DeviceConnectionInterface.wireless,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
No supported devices connected.
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 1);
});
});
});
group('with hasSpecifiedDeviceId', () {
setUp(() {
deviceManager.specifiedDeviceId = 'target-device';
});
testUsingContext('when no devices', () async {
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
No supported devices found with name or id matching 'target-device'.
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 4);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
});
testUsingContext('when no devices match', () async {
final FakeIOSDevice device1 = FakeIOSDevice(deviceName: 'no-match-1');
final FakeIOSDevice device2 = FakeIOSDevice.notConnectedWireless(deviceName: 'no-match-2');
final FakeIOSDevice device2Connected = FakeIOSDevice.connectedWireless(deviceName: 'no-match-2');
deviceManager.iosDiscoverer.deviceList = <Device>[device1, device2];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[device1,device2Connected];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
No supported devices found with name or id matching 'target-device'.
The following devices were found:
no-match-1 (mobile) • xxx • ios • iOS 16
no-match-2 (mobile) • xxx • ios • iOS 16
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 4);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
});
testUsingContext('when matching device is unsupported by flutter', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[exactMatchAttachedUnsupportedIOSDevice];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
No supported devices found with name or id matching 'target-device'.
The following devices were found:
target-device (mobile) • xxx • ios • iOS 16 (unsupported)
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 4);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
});
testUsingContext('when only matching device is dev mode disabled', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[FakeIOSDevice(deviceName: 'target-device', devModeEnabled: false)];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
To use 'target-device' for development, enable Developer Mode in Settings → Privacy & Security.
'''));
expect(devices, isNull);
});
testUsingContext('when one of the matching devices has dev mode disabled', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[FakeIOSDevice(deviceName: 'target-device-1', devModeEnabled: false, isConnected: false),
FakeIOSDevice(deviceName: 'target-device-2')];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
To use 'target-device-1' for development, enable Developer Mode in Settings → Privacy & Security.
Checking for wireless devices...
'''));
expect(devices, isNotNull);
});
testUsingContext('when all matching devices are dev mode disabled', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[FakeIOSDevice(deviceName: 'target-device-1', devModeEnabled: false, isConnected: false),
FakeIOSDevice(deviceName: 'target-device-2', devModeEnabled: false, isConnected: false)];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
To use 'target-device-1' for development, enable Developer Mode in Settings → Privacy & Security.
To use 'target-device-2' for development, enable Developer Mode in Settings → Privacy & Security.
No devices found yet. Checking for wireless devices...
No supported devices found with name or id matching 'target-device'.
'''));
expect(devices, isNull);
});
testUsingContext('when only matching device is unpaired', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[FakeIOSDevice(deviceName: 'target-device', isPaired: false)];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
'target-device' is not paired. Open Xcode and trust this computer when prompted.
'''));
expect(devices, isNull);
});
testUsingContext('when one of the matching devices is unpaired', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[FakeIOSDevice(deviceName: 'target-device-1', isPaired: false, isConnected: false),
FakeIOSDevice(deviceName: 'target-device-2')];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, contains('''
'target-device-1' is not paired. Open Xcode and trust this computer when prompted.
Checking for wireless devices...
'''));
expect(devices, isNotNull);
});
testUsingContext('when all matching devices are unpaired', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[FakeIOSDevice(deviceName: 'target-device-1', isPaired: false, isConnected: false),
FakeIOSDevice(deviceName: 'target-device-2', isPaired: false, isConnected: false)];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, contains('''
'target-device-1' is not paired. Open Xcode and trust this computer when prompted.
'target-device-2' is not paired. Open Xcode and trust this computer when prompted.
No devices found yet. Checking for wireless devices...
No supported devices found with name or id matching 'target-device'.
'''));
expect(devices, isNull);
});
group('when deviceConnectionInterface does not match', () {
testUsingContext('filter of wireless', () async {
final FakeIOSDevice device1 = FakeIOSDevice.notConnectedWireless(deviceName: 'not-a-match');
final FakeIOSDevice device1Connected = FakeIOSDevice.connectedWireless(deviceName: 'not-a-match');
deviceManager.iosDiscoverer.deviceList = <Device>[exactMatchAttachedIOSDevice, device1];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[exactMatchAttachedIOSDevice, device1Connected];
final TestTargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices = TestTargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
deviceConnectionInterface: DeviceConnectionInterface.wireless,
);
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
No supported devices found with name or id matching 'target-device'.
The following devices were found:
not-a-match (mobile) • xxx • ios • iOS 16
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
});
});
group('with hasSpecifiedAllDevices', () {
setUp(() {
deviceManager.hasSpecifiedAllDevices = true;
});
testUsingContext('when no devices', () async {
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
No devices found.
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
testUsingContext('when devices are either unsupported by flutter or project or all', () async {
deviceManager.otherDiscoverer.deviceList = <Device>[fuchsiaDevice];
deviceManager.iosDiscoverer.deviceList = <Device>[
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
disconnectedWirelessUnsupportedIOSDevice,
disconnectedWirelessUnsupportedForProjectIOSDevice,
];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
connectedWirelessUnsupportedIOSDevice,
connectedWirelessUnsupportedForProjectIOSDevice,
];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
No devices found.
The following devices were found, but are not supported by this project:
target-device-10 (mobile) • xxx • fuchsia-arm64 • tester
target-device-3 (mobile) • xxx • ios • iOS 16 (unsupported)
target-device-4 (mobile) • xxx • ios • iOS 16
target-device-7 (mobile) • xxx • ios • iOS 16 (unsupported)
target-device-8 (mobile) • xxx • ios • iOS 16
If you would like your app to run on fuchsia or ios, consider running `flutter create .` to generate projects for these platforms.
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
});
});
group('finds single device', () {
late TestBufferLogger logger;
late TestDeviceManager deviceManager;
late TargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices;
setUp(() {
logger = TestBufferLogger.test();
deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
targetDevices = TargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
});
group('with device not specified', () {
testUsingContext('when single ephemeral attached device', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[attachedIOSDevice1]);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
testUsingContext('when single wireless device', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[disconnectedWirelessIOSDevice1];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[connectedWirelessIOSDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
'''));
expect(devices, <Device>[connectedWirelessIOSDevice1]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
testUsingContext('when multiple but only one attached ephemeral', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[nonEphemeralDevice, attachedIOSDevice1, disconnectedWirelessIOSDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[attachedIOSDevice1]);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
group('with stdinHasTerminal', () {
late FakeTerminal terminal;
setUp(() {
terminal = FakeTerminal(supportsColor: true);
logger = TestBufferLogger.test(terminal: terminal);
});
testUsingContext('when single non-ephemeral attached device', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[nonEphemeralDevice];
final TestTargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices = TestTargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
targetDevices.waitForWirelessBeforeInput = true;
targetDevices.deviceSelection.input = <String>['1'];
logger.originalStatusText = '''
Connected devices:
target-device-9 (mobile) • xxx • ios • iOS 16
Checking for wireless devices...
[1]: target-device-9 (xxx)
''';
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Connected devices:
target-device-9 (mobile) • xxx • ios • iOS 16
No wireless devices were found.
[1]: target-device-9 (xxx)
Please choose one (or "q" to quit): '''));
expect(devices, <Device>[nonEphemeralDevice]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('handle invalid options for device', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[nonEphemeralDevice];
final TestTargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices = TestTargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
targetDevices.waitForWirelessBeforeInput = true;
// Having the '0' first is an invalid choice for a device, the second
// item in the list is a '2' which is out of range since we only have
// one item in the deviceList. The final item in the list, is '1'
// which is a valid option though which will return a valid device
//
// Important: if none of the values in the list are valid, the test will
// hang indefinitely since the [userSelectDevice()] method uses a while
// loop to listen for valid devices
targetDevices.deviceSelection.input = <String>['0', '2', '1'];
logger.originalStatusText = '''
Connected devices:
target-device-9 (mobile) • xxx • ios • iOS 16
Checking for wireless devices...
[1]: target-device-9 (xxx)
''';
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Connected devices:
target-device-9 (mobile) • xxx • ios • iOS 16
No wireless devices were found.
[1]: target-device-9 (xxx)
Please choose one (or "q" to quit): '''));
expect(devices, <Device>[nonEphemeralDevice]);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
});
group('without stdinHasTerminal', () {
late FakeTerminal terminal;
setUp(() {
terminal = FakeTerminal(stdinHasTerminal: false);
targetDevices = TargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
});
testUsingContext('when single non-ephemeral attached device', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[nonEphemeralDevice];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
'''));
expect(devices, <Device>[nonEphemeralDevice]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
});
});
group('with hasSpecifiedDeviceId', () {
setUp(() {
deviceManager.specifiedDeviceId = 'target-device';
});
testUsingContext('when multiple matches but first is unsupported by flutter', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[
exactMatchAttachedUnsupportedIOSDevice,
exactMatchAttachedIOSDevice,
];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[exactMatchAttachedIOSDevice]);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
});
testUsingContext('when matching device is unsupported by project', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[exactMatchUnsupportedByProjectDevice];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[exactMatchUnsupportedByProjectDevice]);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
});
testUsingContext('when matching attached device', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[exactMatchAttachedIOSDevice, disconnectedWirelessIOSDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[exactMatchAttachedIOSDevice]);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
});
testUsingContext('when exact matching wireless device', () async {
final FakeIOSDevice exactMatchWirelessDevice = FakeIOSDevice.notConnectedWireless(deviceName: 'target-device');
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1, exactMatchWirelessDevice];
deviceManager.setDeviceToWaitFor(exactMatchWirelessDevice, DeviceConnectionInterface.wireless);
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Waiting for target-device to connect...
'''));
expect(devices, <Device>[exactMatchWirelessDevice]);
expect(devices?.first.isConnected, true);
expect(devices?.first.connectionInterface, DeviceConnectionInterface.wireless);
expect(deviceManager.iosDiscoverer.devicesCalled, 1);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isTrue);
});
testUsingContext('when partially matching single wireless devices', () async {
final FakeIOSDevice partialMatchWirelessDevice = FakeIOSDevice.notConnectedWireless(deviceName: 'target-device-1');
deviceManager.iosDiscoverer.deviceList = <Device>[partialMatchWirelessDevice];
deviceManager.setDeviceToWaitFor(partialMatchWirelessDevice, DeviceConnectionInterface.wireless);
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Waiting for target-device-1 to connect...
'''));
expect(devices, <Device>[partialMatchWirelessDevice]);
expect(devices?.first.isConnected, true);
expect(devices?.first.connectionInterface, DeviceConnectionInterface.wireless);
expect(deviceManager.iosDiscoverer.devicesCalled, 1);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isTrue);
});
testUsingContext('when exact matching an attached device and partial matching a wireless device', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[exactMatchAttachedIOSDevice, connectedWirelessIOSDevice1];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[exactMatchAttachedIOSDevice, connectedWirelessIOSDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[exactMatchAttachedIOSDevice]);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
});
testUsingContext('when partially matching multiple device but only one is connected', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1, disconnectedWirelessIOSDevice1];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[attachedIOSDevice1, disconnectedWirelessIOSDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
'''));
expect(devices, <Device>[attachedIOSDevice1]);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
});
testUsingContext('when partially matching single attached device', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[attachedIOSDevice1]);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
});
testUsingContext('when partially matching wireless device and an attached device from different discoverer', () async {
final FakeDevice androidDevice = FakeDevice(deviceName: 'target-device-android');
deviceManager.androidDiscoverer.deviceList = <Device>[androidDevice];
deviceManager.iosDiscoverer.deviceList = <Device>[disconnectedWirelessIOSDevice1];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[disconnectedWirelessIOSDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
'''));
expect(devices, <Device>[androidDevice]);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
});
testUsingContext('when matching single non-ephemeral attached device', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[nonEphemeralDevice];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals(''));
expect(devices, <Device>[nonEphemeralDevice]);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
});
group('with hasSpecifiedAllDevices', () {
setUp(() {
deviceManager.hasSpecifiedAllDevices = true;
});
testUsingContext('when only one device', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
'''));
expect(devices, <Device>[attachedIOSDevice1]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
testUsingContext('when single non-ephemeral attached device', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[nonEphemeralDevice];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
'''));
expect(devices, <Device>[nonEphemeralDevice]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
});
});
group('finds multiple devices', () {
late TestBufferLogger logger;
late TestDeviceManager deviceManager;
setUp(() {
logger = TestBufferLogger.test();
deviceManager = TestDeviceManager(
logger: logger,
platform: platform,
);
});
group('with device not specified', () {
group('with stdinHasTerminal', () {
late FakeTerminal terminal;
late TestTargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices;
setUp(() {
terminal = FakeTerminal(supportsColor: true);
logger = TestBufferLogger.test(terminal: terminal);
targetDevices = TestTargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
});
testUsingContext('including attached, wireless, unsupported devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[
attachedIOSDevice1,
attachedIOSDevice2,
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
disconnectedWirelessIOSDevice1,
disconnectedWirelessUnsupportedIOSDevice,
disconnectedWirelessUnsupportedForProjectIOSDevice,
];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[
attachedIOSDevice1,
attachedIOSDevice2,
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
connectedWirelessIOSDevice1,
connectedWirelessUnsupportedIOSDevice,
connectedWirelessUnsupportedForProjectIOSDevice,
];
targetDevices.waitForWirelessBeforeInput = true;
targetDevices.deviceSelection.input = <String>['3'];
logger.originalStatusText = '''
Connected devices:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
Checking for wireless devices...
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
''';
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Connected devices:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
Wirelessly connected devices:
target-device-5 (mobile) • xxx • ios • iOS 16
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
[3]: target-device-5 (xxx)
Please choose one (or "q" to quit): '''));
expect(devices, <Device>[connectedWirelessIOSDevice1]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only attached devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1, attachedIOSDevice2];
targetDevices.waitForWirelessBeforeInput = true;
targetDevices.deviceSelection.input = <String>['2'];
logger.originalStatusText = '''
Connected devices:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
Checking for wireless devices...
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
''';
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Connected devices:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
No wireless devices were found.
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
Please choose one (or "q" to quit): '''));
expect(devices, <Device>[attachedIOSDevice2]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only wireless devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[disconnectedWirelessIOSDevice1, disconnectedWirelessIOSDevice2];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[connectedWirelessIOSDevice1, connectedWirelessIOSDevice2];
targetDevices.waitForWirelessBeforeInput = true;
targetDevices.deviceSelection.input = <String>['2'];
terminal.setPrompt(<String>['1', '2', 'q', 'Q'], '1');
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
Connected devices:
Wirelessly connected devices:
target-device-5 (mobile) • xxx • ios • iOS 16
target-device-6 (mobile) • xxx • ios • iOS 16
[1]: target-device-5 (xxx)
[2]: target-device-6 (xxx)
'''));
expect(devices, <Device>[connectedWirelessIOSDevice1]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
group('but no color support', () {
setUp(() {
terminal = FakeTerminal();
logger = TestBufferLogger.test(terminal: terminal);
targetDevices = TestTargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
});
testUsingContext('and waits for wireless devices to return', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1, attachedIOSDevice2, disconnectedWirelessIOSDevice1];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[attachedIOSDevice1, attachedIOSDevice2, connectedWirelessIOSDevice1];
terminal.setPrompt(<String>['1', '2', '3', 'q', 'Q'], '1');
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
Connected devices:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
Wirelessly connected devices:
target-device-5 (mobile) • xxx • ios • iOS 16
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
[3]: target-device-5 (xxx)
'''));
expect(devices, <Device>[attachedIOSDevice1]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
});
group('with verbose logging', () {
setUp(() {
logger = TestBufferLogger.test(terminal: terminal, verbose: true);
targetDevices = TestTargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
});
testUsingContext('including only attached devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1, attachedIOSDevice2];
targetDevices.waitForWirelessBeforeInput = true;
targetDevices.deviceSelection.input = <String>['2'];
logger.originalStatusText = '''
Connected devices:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
Checking for wireless devices...
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
''';
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Connected devices:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
Checking for wireless devices...
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
No wireless devices were found.
Connected devices:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
Please choose one (or "q" to quit): '''));
expect(devices, <Device>[attachedIOSDevice2]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including attached and wireless devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1, attachedIOSDevice2, disconnectedWirelessIOSDevice1];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[attachedIOSDevice1, attachedIOSDevice2, connectedWirelessIOSDevice1];
targetDevices.waitForWirelessBeforeInput = true;
targetDevices.deviceSelection.input = <String>['2'];
logger.originalStatusText = '''
Connected devices:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
Checking for wireless devices...
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
''';
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Connected devices:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
Checking for wireless devices...
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
Connected devices:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
Wirelessly connected devices:
target-device-5 (mobile) • xxx • ios • iOS 16
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
[3]: target-device-5 (xxx)
Please choose one (or "q" to quit): '''));
expect(devices, <Device>[attachedIOSDevice2]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
});
});
group('without stdinHasTerminal', () {
late FakeTerminal terminal;
late TargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices;
setUp(() {
terminal = FakeTerminal(stdinHasTerminal: false);
targetDevices = TargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
});
testUsingContext('including attached, wireless, unsupported devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[
attachedIOSDevice1,
attachedIOSDevice2,
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
disconnectedWirelessIOSDevice1,
disconnectedWirelessUnsupportedIOSDevice,
disconnectedWirelessUnsupportedForProjectIOSDevice,
];
deviceManager.iosDiscoverer.deviceList = <Device>[
attachedIOSDevice1,
attachedIOSDevice2,
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
connectedWirelessIOSDevice1,
connectedWirelessUnsupportedIOSDevice,
connectedWirelessUnsupportedForProjectIOSDevice,
];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
target-device-4 (mobile) • xxx • ios • iOS 16
Wirelessly connected devices:
target-device-5 (mobile) • xxx • ios • iOS 16
target-device-8 (mobile) • xxx • ios • iOS 16
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 4);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only attached devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1, attachedIOSDevice2];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 4);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only wireless devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[disconnectedWirelessIOSDevice1, disconnectedWirelessIOSDevice2];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[connectedWirelessIOSDevice1, connectedWirelessIOSDevice2];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.
Wirelessly connected devices:
target-device-5 (mobile) • xxx • ios • iOS 16
target-device-6 (mobile) • xxx • ios • iOS 16
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 4);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
});
});
group('with hasSpecifiedDeviceId', () {
setUp(() {
deviceManager.specifiedDeviceId = 'target-device';
});
group('with stdinHasTerminal', () {
late FakeTerminal terminal;
late TestTargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices;
setUp(() {
terminal = FakeTerminal(supportsColor: true);
logger = TestBufferLogger.test(terminal: terminal);
targetDevices = TestTargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
});
testUsingContext('including attached, wireless, unsupported devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[
attachedIOSDevice1,
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
disconnectedWirelessIOSDevice1,
disconnectedWirelessUnsupportedIOSDevice,
disconnectedWirelessUnsupportedForProjectIOSDevice,
];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[
attachedIOSDevice1,
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
connectedWirelessIOSDevice1,
connectedWirelessUnsupportedIOSDevice,
connectedWirelessUnsupportedForProjectIOSDevice,
];
targetDevices.waitForWirelessBeforeInput = true;
targetDevices.deviceSelection.input = <String>['3'];
logger.originalStatusText = '''
Found multiple devices with name or id matching target-device:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-4 (mobile) • xxx • ios • iOS 16
Checking for wireless devices...
[1]: target-device-1 (xxx)
[2]: target-device-4 (xxx)
''';
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Found multiple devices with name or id matching target-device:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-4 (mobile) • xxx • ios • iOS 16
Wirelessly connected devices:
target-device-5 (mobile) • xxx • ios • iOS 16
target-device-8 (mobile) • xxx • ios • iOS 16
[1]: target-device-1 (xxx)
[2]: target-device-4 (xxx)
[3]: target-device-5 (xxx)
[4]: target-device-8 (xxx)
Please choose one (or "q" to quit): '''));
expect(devices, <Device>[connectedWirelessIOSDevice1]);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only attached devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1, attachedIOSDevice2];
targetDevices.waitForWirelessBeforeInput = true;
targetDevices.deviceSelection.input = <String>['2'];
logger.originalStatusText = '''
Found multiple devices with name or id matching target-device:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
Checking for wireless devices...
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
''';
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Found multiple devices with name or id matching target-device:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
No wireless devices were found.
[1]: target-device-1 (xxx)
[2]: target-device-2 (xxx)
Please choose one (or "q" to quit): '''));
expect(devices, <Device>[attachedIOSDevice2]);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only wireless devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[disconnectedWirelessIOSDevice1, disconnectedWirelessIOSDevice2];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[connectedWirelessIOSDevice1, connectedWirelessIOSDevice2];
terminal.setPrompt(<String>['1', '2', 'q', 'Q'], '1');
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
Found 2 devices with name or id matching target-device:
Wirelessly connected devices:
target-device-5 (mobile) • xxx • ios • iOS 16
target-device-6 (mobile) • xxx • ios • iOS 16
[1]: target-device-5 (xxx)
[2]: target-device-6 (xxx)
'''));
expect(devices, <Device>[connectedWirelessIOSDevice1]);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
});
group('without stdinHasTerminal', () {
late FakeTerminal terminal;
late TargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices;
setUp(() {
terminal = FakeTerminal(stdinHasTerminal: false);
targetDevices = TargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
});
testUsingContext('including only one ephemeral', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[nonEphemeralDevice, attachedIOSDevice1];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
Found 2 devices with name or id matching target-device:
target-device-9 (mobile) • xxx • ios • iOS 16
target-device-1 (mobile) • xxx • ios • iOS 16
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including matching attached, wireless, unsupported devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[
attachedIOSDevice1,
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
disconnectedWirelessIOSDevice1,
disconnectedWirelessUnsupportedIOSDevice,
disconnectedWirelessUnsupportedForProjectIOSDevice,
];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[
attachedIOSDevice1,
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
connectedWirelessIOSDevice1,
connectedWirelessUnsupportedIOSDevice,
connectedWirelessUnsupportedForProjectIOSDevice,
];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
Found 4 devices with name or id matching target-device:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-4 (mobile) • xxx • ios • iOS 16
Wirelessly connected devices:
target-device-5 (mobile) • xxx • ios • iOS 16
target-device-8 (mobile) • xxx • ios • iOS 16
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only attached devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1, attachedIOSDevice2];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
Found 2 devices with name or id matching target-device:
target-device-1 (mobile) • xxx • ios • iOS 16
target-device-2 (mobile) • xxx • ios • iOS 16
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
testUsingContext('including only wireless devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[disconnectedWirelessIOSDevice1, disconnectedWirelessIOSDevice2];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[connectedWirelessIOSDevice1, connectedWirelessIOSDevice2];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
Found 2 devices with name or id matching target-device:
Wirelessly connected devices:
target-device-5 (mobile) • xxx • ios • iOS 16
target-device-6 (mobile) • xxx • ios • iOS 16
'''));
expect(devices, isNull);
expect(deviceManager.iosDiscoverer.devicesCalled, 3);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
expect(deviceManager.iosDiscoverer.xcdevice.waitedForDeviceToConnect, isFalse);
}, overrides: <Type, Generator>{
AnsiTerminal: () => terminal,
});
});
});
group('with hasSpecifiedAllDevices', () {
late TargetDevicesWithExtendedWirelessDeviceDiscovery targetDevices;
setUp(() {
deviceManager.hasSpecifiedAllDevices = true;
targetDevices = TargetDevicesWithExtendedWirelessDeviceDiscovery(
deviceManager: deviceManager,
logger: logger,
);
});
testUsingContext('including attached, wireless, unsupported devices', () async {
deviceManager.otherDiscoverer.deviceList = <Device>[fuchsiaDevice];
deviceManager.iosDiscoverer.deviceList = <Device>[
attachedIOSDevice1,
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
disconnectedWirelessIOSDevice1,
disconnectedWirelessUnsupportedIOSDevice,
disconnectedWirelessUnsupportedForProjectIOSDevice,
];
deviceManager.iosDiscoverer.deviceList = <Device>[
attachedIOSDevice1,
attachedUnsupportedIOSDevice,
attachedUnsupportedForProjectIOSDevice,
connectedWirelessIOSDevice1,
connectedWirelessUnsupportedIOSDevice,
connectedWirelessUnsupportedForProjectIOSDevice,
];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
'''));
expect(devices, <Device>[attachedIOSDevice1, connectedWirelessIOSDevice1]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
testUsingContext('including only attached devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[attachedIOSDevice1, attachedIOSDevice2];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
Checking for wireless devices...
'''));
expect(devices, <Device>[attachedIOSDevice1, attachedIOSDevice2]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
testUsingContext('including only wireless devices', () async {
deviceManager.iosDiscoverer.deviceList = <Device>[disconnectedWirelessIOSDevice1, disconnectedWirelessIOSDevice2];
deviceManager.iosDiscoverer.refreshDeviceList = <Device>[connectedWirelessIOSDevice1, connectedWirelessIOSDevice2];
final List<Device>? devices = await targetDevices.findAllTargetDevices();
expect(logger.statusText, equals('''
No devices found yet. Checking for wireless devices...
'''));
expect(devices, <Device>[connectedWirelessIOSDevice1, connectedWirelessIOSDevice2]);
expect(deviceManager.iosDiscoverer.devicesCalled, 2);
expect(deviceManager.iosDiscoverer.discoverDevicesCalled, 1);
expect(deviceManager.iosDiscoverer.numberOfTimesPolled, 2);
});
});
});
});
}
class TestTargetDevicesWithExtendedWirelessDeviceDiscovery extends TargetDevicesWithExtendedWirelessDeviceDiscovery {
TestTargetDevicesWithExtendedWirelessDeviceDiscovery({
required super.deviceManager,
required super.logger,
super.deviceConnectionInterface,
}) : _deviceSelection = TestTargetDeviceSelection(logger);
final TestTargetDeviceSelection _deviceSelection;
@override
TestTargetDeviceSelection get deviceSelection => _deviceSelection;
}
class TestTargetDeviceSelection extends TargetDeviceSelection {
TestTargetDeviceSelection(super.logger);
List<String> input = <String>[];
@override
Future<String> readUserInput() async {
// If only one value is provided for the input, continue
// to return that one input value without popping
//
// If more than one input values are provided, we are simulating
// the user selecting more than one option for a device, so we will pop
// them out from the front
if (input.length > 1) {
return input.removeAt(0);
}
return input[0];
}
}
class TestDeviceManager extends DeviceManager {
TestDeviceManager({
required this.logger,
required this.platform,
}) : super(logger: logger);
final Logger logger;
final Platform platform;
@override
String? specifiedDeviceId;
@override
bool hasSpecifiedAllDevices = false;
final TestPollingDeviceDiscovery androidDiscoverer = TestPollingDeviceDiscovery(
'android',
);
final TestPollingDeviceDiscovery otherDiscoverer = TestPollingDeviceDiscovery(
'other',
);
late final TestIOSDeviceDiscovery iosDiscoverer = TestIOSDeviceDiscovery(
platform: platform,
xcdevice: FakeXcdevice(),
iosWorkflow: FakeIOSWorkflow(),
logger: logger,
);
@override
List<DeviceDiscovery> get deviceDiscoverers {
return <DeviceDiscovery>[
androidDiscoverer,
otherDiscoverer,
iosDiscoverer,
];
}
void setDeviceToWaitFor(
IOSDevice device,
DeviceConnectionInterface connectionInterface,
) {
final XCDeviceEventInterface eventInterface =
connectionInterface == DeviceConnectionInterface.wireless
? XCDeviceEventInterface.wifi
: XCDeviceEventInterface.usb;
iosDiscoverer.xcdevice.waitForDeviceEvent = XCDeviceEventNotification(
XCDeviceEvent.attach,
eventInterface,
device.id,
);
}
}
class TestPollingDeviceDiscovery extends PollingDeviceDiscovery {
TestPollingDeviceDiscovery(super.name);
List<Device> deviceList = <Device>[];
List<Device> refreshDeviceList = <Device>[];
int devicesCalled = 0;
int discoverDevicesCalled = 0;
int numberOfTimesPolled = 0;
@override
bool get supportsPlatform => true;
@override
List<String> get wellKnownIds => const <String>[];
@override
Future<List<Device>> pollingGetDevices({Duration? timeout}) async {
numberOfTimesPolled++;
return deviceList;
}
@override
Future<List<Device>> devices({DeviceDiscoveryFilter? filter}) async {
devicesCalled += 1;
return super.devices(filter: filter);
}
@override
Future<List<Device>> discoverDevices({
Duration? timeout,
DeviceDiscoveryFilter? filter,
}) {
discoverDevicesCalled++;
if (refreshDeviceList.isNotEmpty) {
deviceList = refreshDeviceList;
}
return super.discoverDevices(timeout: timeout, filter: filter);
}
@override
bool get canListAnything => true;
}
class TestIOSDeviceDiscovery extends IOSDevices {
TestIOSDeviceDiscovery({
required super.platform,
required FakeXcdevice xcdevice,
required super.iosWorkflow,
required super.logger,
}) : _platform = platform,
_xcdevice = xcdevice,
super(xcdevice: xcdevice);
final Platform _platform;
List<Device> deviceList = <Device>[];
List<Device> refreshDeviceList = <Device>[];
int devicesCalled = 0;
int discoverDevicesCalled = 0;
int numberOfTimesPolled = 0;
final FakeXcdevice _xcdevice;
@override
FakeXcdevice get xcdevice => _xcdevice;
@override
Future<List<Device>> pollingGetDevices({Duration? timeout}) async {
numberOfTimesPolled++;
if (!_platform.isMacOS) {
throw UnsupportedError(
'Control of iOS devices or simulators only supported on macOS.',
);
}
return deviceList;
}
@override
Future<List<Device>> devices({DeviceDiscoveryFilter? filter}) async {
devicesCalled += 1;
return super.devices(filter: filter);
}
@override
Future<List<Device>> discoverDevices({
Duration? timeout,
DeviceDiscoveryFilter? filter,
}) {
discoverDevicesCalled++;
if (refreshDeviceList.isNotEmpty) {
deviceList = refreshDeviceList;
}
return super.discoverDevices(timeout: timeout, filter: filter);
}
@override
bool get canListAnything => true;
}
class FakeXcdevice extends Fake implements XCDevice {
XCDeviceEventNotification? waitForDeviceEvent;
bool waitedForDeviceToConnect = false;
@override
Future<XCDeviceEventNotification?> waitForDeviceToConnect(String deviceId) async {
final XCDeviceEventNotification? waitEvent = waitForDeviceEvent;
if (waitEvent != null) {
waitedForDeviceToConnect = true;
return XCDeviceEventNotification(waitEvent.eventType, waitEvent.eventInterface, waitEvent.deviceIdentifier);
} else {
return null;
}
}
@override
void cancelWaitForDeviceToConnect() {}
}
class FakeIOSWorkflow extends Fake implements IOSWorkflow {}
class FakeDevice extends Fake implements Device {
FakeDevice({
String? deviceId,
String? deviceName,
bool deviceSupported = true,
bool deviceSupportForProject = true,
this.ephemeral = true,
this.isConnected = true,
this.connectionInterface = DeviceConnectionInterface.attached,
this.platformType = PlatformType.android,
TargetPlatform deviceTargetPlatform = TargetPlatform.android,
}) : id = deviceId ?? 'xxx',
name = deviceName ?? 'test',
_isSupported = deviceSupported,
_isSupportedForProject = deviceSupportForProject,
_targetPlatform = deviceTargetPlatform;
FakeDevice.wireless({
String? deviceId,
String? deviceName,
bool deviceSupported = true,
bool deviceSupportForProject = true,
this.ephemeral = true,
this.isConnected = true,
this.connectionInterface = DeviceConnectionInterface.wireless,
this.platformType = PlatformType.android,
TargetPlatform deviceTargetPlatform = TargetPlatform.android,
}) : id = deviceId ?? 'xxx',
name = deviceName ?? 'test',
_isSupported = deviceSupported,
_isSupportedForProject = deviceSupportForProject,
_targetPlatform = deviceTargetPlatform;
FakeDevice.fuchsia({
String? deviceId,
String? deviceName,
bool deviceSupported = true,
bool deviceSupportForProject = true,
this.ephemeral = true,
this.isConnected = true,
this.connectionInterface = DeviceConnectionInterface.attached,
this.platformType = PlatformType.fuchsia,
TargetPlatform deviceTargetPlatform = TargetPlatform.fuchsia_arm64,
}) : id = deviceId ?? 'xxx',
name = deviceName ?? 'test',
_isSupported = deviceSupported,
_isSupportedForProject = deviceSupportForProject,
_targetPlatform = deviceTargetPlatform,
_sdkNameAndVersion = 'tester';
final bool _isSupported;
final bool _isSupportedForProject;
final TargetPlatform _targetPlatform;
String _sdkNameAndVersion = 'Android 10';
@override
String name;
@override
final bool ephemeral;
@override
String id;
@override
bool isSupported() => _isSupported;
@override
bool isSupportedForProject(FlutterProject project) => _isSupportedForProject;
@override
DeviceConnectionInterface connectionInterface;
@override
bool isConnected;
@override
Future<TargetPlatform> get targetPlatform async => _targetPlatform;
@override
final PlatformType? platformType;
@override
Future<String> get sdkNameAndVersion async => _sdkNameAndVersion;
@override
Future<bool> get isLocalEmulator async => false;
@override
Category? get category => Category.mobile;
@override
Future<String> get targetPlatformDisplayName async =>
getNameForTargetPlatform(await targetPlatform);
}
class FakeIOSDevice extends Fake implements IOSDevice {
FakeIOSDevice({
String? deviceId,
String? deviceName,
bool deviceSupported = true,
bool deviceSupportForProject = true,
this.ephemeral = true,
this.isConnected = true,
this.devModeEnabled = true,
this.isPaired = true,
this.platformType = PlatformType.ios,
this.connectionInterface = DeviceConnectionInterface.attached,
}) : id = deviceId ?? 'xxx',
name = deviceName ?? 'test',
_isSupported = deviceSupported,
_isSupportedForProject = deviceSupportForProject;
FakeIOSDevice.notConnectedWireless({
String? deviceId,
String? deviceName,
bool deviceSupported = true,
bool deviceSupportForProject = true,
this.ephemeral = true,
this.isConnected = false,
this.platformType = PlatformType.ios,
this.devModeEnabled = true,
this.isPaired = true,
this.connectionInterface = DeviceConnectionInterface.wireless,
}) : id = deviceId ?? 'xxx',
name = deviceName ?? 'test',
_isSupported = deviceSupported,
_isSupportedForProject = deviceSupportForProject;
FakeIOSDevice.connectedWireless({
String? deviceId,
String? deviceName,
bool deviceSupported = true,
bool deviceSupportForProject = true,
this.ephemeral = true,
this.isConnected = true,
this.devModeEnabled = true,
this.isPaired = true,
this.platformType = PlatformType.ios,
this.connectionInterface = DeviceConnectionInterface.wireless,
}) : id = deviceId ?? 'xxx',
name = deviceName ?? 'test',
_isSupported = deviceSupported,
_isSupportedForProject = deviceSupportForProject;
final bool _isSupported;
final bool _isSupportedForProject;
@override
String name;
@override
final bool ephemeral;
@override
final bool devModeEnabled;
@override
final bool isPaired;
@override
String id;
@override
bool isSupported() => _isSupported;
@override
bool isSupportedForProject(FlutterProject project) => _isSupportedForProject;
@override
DeviceConnectionInterface connectionInterface;
@override
bool isConnected;
@override
final PlatformType? platformType;
@override
Future<String> get sdkNameAndVersion async => 'iOS 16';
@override
Future<bool> get isLocalEmulator async => false;
@override
Category? get category => Category.mobile;
@override
Future<String> get targetPlatformDisplayName async => 'ios';
@override
Future<TargetPlatform> get targetPlatform async => TargetPlatform.tester;
}
class FakeTerminal extends Fake implements AnsiTerminal {
FakeTerminal({
this.stdinHasTerminal = true,
this.supportsColor = false,
});
@override
final bool stdinHasTerminal;
@override
final bool supportsColor;
@override
bool get isCliAnimationEnabled => supportsColor;
@override
bool usesTerminalUi = true;
@override
bool singleCharMode = false;
void setPrompt(List<String> characters, String result) {
_nextPrompt = characters;
_nextResult = result;
}
List<String>? _nextPrompt;
late String _nextResult;
@override
Future<String> promptForCharInput(
List<String> acceptedCharacters, {
Logger? logger,
String? prompt,
int? defaultChoiceIndex,
bool displayAcceptedCharacters = true,
}) async {
expect(acceptedCharacters, _nextPrompt);
return _nextResult;
}
@override
String clearLines(int numberOfLines) {
return 'CLEAR_LINES_$numberOfLines';
}
}
class TestBufferLogger extends BufferLogger {
TestBufferLogger.test({
super.terminal,
super.outputPreferences,
super.verbose,
}) : super.test();
String originalStatusText = '';
@override
void printStatus(
String message, {
bool? emphasis,
TerminalColor? color,
bool? newline,
int? indent,
int? hangingIndent,
bool? wrap,
}) {
if (message.startsWith('CLEAR_LINES_')) {
expect(statusText, equals(originalStatusText));
final int numberOfLinesToRemove =
int.parse(message.split('CLEAR_LINES_')[1]) - 1;
final List<String> lines = LineSplitter.split(statusText).toList();
// Clear string buffer and re-add lines not removed
clear();
for (int lineNumber = 0; lineNumber < lines.length - numberOfLinesToRemove; lineNumber++) {
super.printStatus(lines[lineNumber]);
}
} else {
super.printStatus(
message,
emphasis: emphasis,
color: color,
newline: newline,
indent: indent,
hangingIndent: hangingIndent,
wrap: wrap,
);
}
}
}
class FakeDoctor extends Fake implements Doctor {
FakeDoctor({
this.canLaunchAnything = true,
});
@override
bool canLaunchAnything;
}
| flutter/packages/flutter_tools/test/general.shard/runner/target_devices_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/runner/target_devices_test.dart",
"repo_id": "flutter",
"token_count": 45711
} | 781 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:fake_async/fake_async.dart';
import 'package:flutter_tools/src/base/io.dart' as io;
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/vmservice.dart';
import 'package:test/fake.dart';
import 'package:vm_service/vm_service.dart' as vm_service;
import '../src/common.dart';
import '../src/context.dart' hide testLogger;
import '../src/fake_vm_services.dart';
const String kExtensionName = 'ext.flutter.test.interestingExtension';
final vm_service.Isolate isolate = vm_service.Isolate(
id: '1',
pauseEvent: vm_service.Event(
kind: vm_service.EventKind.kResume,
timestamp: 0
),
breakpoints: <vm_service.Breakpoint>[],
libraries: <vm_service.LibraryRef>[
vm_service.LibraryRef(
id: '1',
uri: 'file:///hello_world/main.dart',
name: '',
),
],
livePorts: 0,
name: 'test',
number: '1',
pauseOnExit: false,
runnable: true,
startTime: 0,
isSystemIsolate: false,
isolateFlags: <vm_service.IsolateFlag>[],
extensionRPCs: <String>[kExtensionName],
);
final FlutterView fakeFlutterView = FlutterView(
id: 'a',
uiIsolate: isolate,
);
final FakeVmServiceRequest listViewsRequest = FakeVmServiceRequest(
method: kListViewsMethod,
jsonResponse: <String, Object>{
'views': <Object>[
fakeFlutterView.toJson(),
],
},
);
void main() {
testWithoutContext('VM Service registers reloadSources', () async {
Future<void> reloadSources(String isolateId, { bool? pause, bool? force}) async {}
final MockVMService mockVMService = MockVMService();
await setUpVmService(
reloadSources: reloadSources,
vmService: mockVMService,
);
expect(mockVMService.services, containsPair(kReloadSourcesServiceName, kFlutterToolAlias));
});
testWithoutContext('VM Service registers flutterMemoryInfo service', () async {
final FakeDevice mockDevice = FakeDevice();
final MockVMService mockVMService = MockVMService();
await setUpVmService(
device: mockDevice,
vmService: mockVMService,
);
expect(mockVMService.services, containsPair(kFlutterMemoryInfoServiceName, kFlutterToolAlias));
});
testWithoutContext('VM Service registers flutterGetSkSL service', () async {
final MockVMService mockVMService = MockVMService();
await setUpVmService(
skSLMethod: () async => 'hello',
vmService: mockVMService,
);
expect(mockVMService.services, containsPair(kFlutterGetSkSLServiceName, kFlutterToolAlias));
});
testWithoutContext('VM Service throws tool exit on service registration failure.', () async {
final MockVMService mockVMService = MockVMService()
..errorOnRegisterService = true;
await expectLater(() async => setUpVmService(
skSLMethod: () async => 'hello',
vmService: mockVMService,
), throwsToolExit());
});
testWithoutContext('VM Service throws tool exit on service registration failure with awaited future.', () async {
final MockVMService mockVMService = MockVMService()
..errorOnRegisterService = true;
await expectLater(() async => setUpVmService(
skSLMethod: () async => 'hello',
printStructuredErrorLogMethod: (vm_service.Event event) { },
vmService: mockVMService,
), throwsToolExit());
});
testWithoutContext('VM Service registers flutterPrintStructuredErrorLogMethod', () async {
final MockVMService mockVMService = MockVMService();
await setUpVmService(
printStructuredErrorLogMethod: (vm_service.Event event) async => 'hello',
vmService: mockVMService,
);
expect(mockVMService.listenedStreams, contains(vm_service.EventStreams.kExtension));
});
testWithoutContext('VM Service returns correct FlutterVersion', () async {
final MockVMService mockVMService = MockVMService();
await setUpVmService(
vmService: mockVMService,
);
expect(mockVMService.services, containsPair(kFlutterVersionServiceName, kFlutterToolAlias));
});
testUsingContext('VM Service prints messages for connection failures', () {
final BufferLogger logger = BufferLogger.test();
FakeAsync().run((FakeAsync time) {
final Uri uri = Uri.parse('ws://127.0.0.1:12345/QqL7EFEDNG0=/ws');
unawaited(connectToVmService(uri, logger: logger));
time.elapse(const Duration(seconds: 5));
expect(logger.statusText, isEmpty);
time.elapse(const Duration(minutes: 2));
final String statusText = logger.statusText;
expect(
statusText,
containsIgnoringWhitespace('Connecting to the VM Service is taking longer than expected...'),
);
expect(
statusText,
containsIgnoringWhitespace('try re-running with --host-vmservice-port'),
);
expect(
statusText,
containsIgnoringWhitespace('Exception attempting to connect to the VM Service:'),
);
expect(
statusText,
containsIgnoringWhitespace('This was attempt #50. Will retry'),
);
});
}, overrides: <Type, Generator>{
WebSocketConnector: () => failingWebSocketConnector,
});
testWithoutContext('setAssetDirectory forwards arguments correctly', () async {
final Completer<String> completer = Completer<String>();
final vm_service.VmService vmService = vm_service.VmService(
const Stream<String>.empty(),
completer.complete,
);
final FlutterVmService flutterVmService = FlutterVmService(vmService);
unawaited(flutterVmService.setAssetDirectory(
assetsDirectory: Uri(path: 'abc', scheme: 'file'),
viewId: 'abc',
uiIsolateId: 'def',
windows: false,
));
final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[
containsPair('method', kSetAssetBundlePathMethod),
containsPair('params', allOf(<Matcher>[
containsPair('viewId', 'abc'),
containsPair('assetDirectory', '/abc'),
containsPair('isolateId', 'def'),
])),
]));
});
testWithoutContext('setAssetDirectory forwards arguments correctly - windows', () async {
final Completer<String> completer = Completer<String>();
final vm_service.VmService vmService = vm_service.VmService(
const Stream<String>.empty(),
completer.complete,
);
final FlutterVmService flutterVmService = FlutterVmService(vmService);
unawaited(flutterVmService.setAssetDirectory(
assetsDirectory: Uri(path: 'C:/Users/Tester/AppData/Local/Temp/hello_worldb42a6da5/hello_world/build/flutter_assets', scheme: 'file'),
viewId: 'abc',
uiIsolateId: 'def',
// If windows is not set to `true`, then the file path below is incorrectly prepended with a `/` which
// causes the engine asset manager to interpret the file scheme as invalid.
windows: true,
));
final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[
containsPair('method', kSetAssetBundlePathMethod),
containsPair('params', allOf(<Matcher>[
containsPair('viewId', 'abc'),
containsPair('assetDirectory', r'C:\Users\Tester\AppData\Local\Temp\hello_worldb42a6da5\hello_world\build\flutter_assets'),
containsPair('isolateId', 'def'),
])),
]));
});
testWithoutContext('getSkSLs forwards arguments correctly', () async {
final Completer<String> completer = Completer<String>();
final vm_service.VmService vmService = vm_service.VmService(
const Stream<String>.empty(),
completer.complete,
);
final FlutterVmService flutterVmService = FlutterVmService(vmService);
unawaited(flutterVmService.getSkSLs(
viewId: 'abc',
));
final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[
containsPair('method', kGetSkSLsMethod),
containsPair('params', allOf(<Matcher>[
containsPair('viewId', 'abc'),
])),
]));
});
testWithoutContext('flushUIThreadTasks forwards arguments correctly', () async {
final Completer<String> completer = Completer<String>();
final vm_service.VmService vmService = vm_service.VmService(
const Stream<String>.empty(),
completer.complete,
);
final FlutterVmService flutterVmService = FlutterVmService(vmService);
unawaited(flutterVmService.flushUIThreadTasks(
uiIsolateId: 'def',
));
final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[
containsPair('method', kFlushUIThreadTasksMethod),
containsPair('params', allOf(<Matcher>[
containsPair('isolateId', 'def'),
])),
]));
});
testWithoutContext('runInView forwards arguments correctly', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(method: 'streamListen', args: <String, Object>{
'streamId': 'Isolate',
}),
const FakeVmServiceRequest(method: kRunInViewMethod, args: <String, Object>{
'viewId': '1234',
'mainScript': 'main.dart',
'assetDirectory': 'flutter_assets/',
}),
FakeVmServiceStreamResponse(
streamId: 'Isolate',
event: vm_service.Event(
kind: vm_service.EventKind.kIsolateRunnable,
timestamp: 1,
)
),
]
);
await fakeVmServiceHost.vmService.runInView(
viewId: '1234',
main: Uri.file('main.dart'),
assetsDirectory: Uri.file('flutter_assets/'),
);
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('flutterDebugDumpSemanticsTreeInTraversalOrder handles missing method', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpSemanticsTreeInTraversalOrder',
args: <String, Object>{
'isolateId': '1',
},
error: FakeRPCError(code: RPCErrorCodes.kMethodNotFound),
),
]
);
expect(await fakeVmServiceHost.vmService.flutterDebugDumpSemanticsTreeInTraversalOrder(
isolateId: '1',
), '');
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('flutterDebugDumpSemanticsTreeInInverseHitTestOrder handles missing method', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpSemanticsTreeInInverseHitTestOrder',
args: <String, Object>{
'isolateId': '1',
},
error: FakeRPCError(code: RPCErrorCodes.kMethodNotFound),
),
]
);
expect(await fakeVmServiceHost.vmService.flutterDebugDumpSemanticsTreeInInverseHitTestOrder(
isolateId: '1',
), '');
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('flutterDebugDumpLayerTree handles missing method', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpLayerTree',
args: <String, Object>{
'isolateId': '1',
},
error: FakeRPCError(code: RPCErrorCodes.kMethodNotFound),
),
]
);
expect(await fakeVmServiceHost.vmService.flutterDebugDumpLayerTree(
isolateId: '1',
), '');
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('flutterDebugDumpRenderTree handles missing method', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpRenderTree',
args: <String, Object>{
'isolateId': '1',
},
error: FakeRPCError(code: RPCErrorCodes.kMethodNotFound),
),
]
);
expect(await fakeVmServiceHost.vmService.flutterDebugDumpRenderTree(
isolateId: '1',
), '');
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('flutterDebugDumpApp handles missing method', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpApp',
args: <String, Object>{
'isolateId': '1',
},
error: FakeRPCError(code: RPCErrorCodes.kMethodNotFound),
),
]
);
expect(await fakeVmServiceHost.vmService.flutterDebugDumpApp(
isolateId: '1',
), '');
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('flutterDebugDumpFocusTree handles missing method', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpFocusTree',
args: <String, Object>{
'isolateId': '1',
},
error: FakeRPCError(code: RPCErrorCodes.kMethodNotFound),
),
]
);
expect(await fakeVmServiceHost.vmService.flutterDebugDumpFocusTree(
isolateId: '1',
), '');
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('flutterDebugDumpFocusTree returns data', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpFocusTree',
args: <String, Object>{
'isolateId': '1',
},
jsonResponse: <String, Object> {
'data': 'Hello world',
},
),
]
);
expect(await fakeVmServiceHost.vmService.flutterDebugDumpFocusTree(
isolateId: '1',
), 'Hello world');
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('Framework service extension invocations return null if service disappears ', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: kGetSkSLsMethod,
args: <String, Object>{
'viewId': '1234',
},
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
const FakeVmServiceRequest(
method: kListViewsMethod,
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
const FakeVmServiceRequest(
method: kScreenshotSkpMethod,
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
const FakeVmServiceRequest(
method: 'setVMTimelineFlags',
args: <String, dynamic>{
'recordedStreams': <String>['test'],
},
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
const FakeVmServiceRequest(
method: 'getVMTimeline',
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
const FakeVmServiceRequest(
method: kRenderFrameWithRasterStatsMethod,
args: <String, dynamic>{
'viewId': '1',
'isolateId': '12',
},
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
]
);
final Map<String, Object?>? skSLs = await fakeVmServiceHost.vmService.getSkSLs(
viewId: '1234',
);
expect(skSLs, isNull);
final List<FlutterView> views = await fakeVmServiceHost.vmService.getFlutterViews();
expect(views, isEmpty);
final vm_service.Response? screenshotSkp = await fakeVmServiceHost.vmService.screenshotSkp();
expect(screenshotSkp, isNull);
// Checking that this doesn't throw.
await fakeVmServiceHost.vmService.setTimelineFlags(<String>['test']);
final vm_service.Response? timeline = await fakeVmServiceHost.vmService.getTimeline();
expect(timeline, isNull);
final Map<String, Object?>? rasterStats =
await fakeVmServiceHost.vmService.renderFrameWithRasterStats(viewId: '1', uiIsolateId: '12');
expect(rasterStats, isNull);
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('getIsolateOrNull returns null if service disappears ', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'getIsolate',
args: <String, Object>{
'isolateId': 'isolate/123',
},
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
]
);
final vm_service.Isolate? isolate = await fakeVmServiceHost.vmService.getIsolateOrNull(
'isolate/123',
);
expect(isolate, null);
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('renderWithStats forwards stats correctly', () async {
// ignore: always_specify_types
const Map<String, dynamic> response = {
'type': 'RenderFrameWithRasterStats',
'snapshots':<dynamic>[
// ignore: always_specify_types
{
'layer_unique_id':1512,
'duration_micros':477,
'snapshot':'',
},
],
};
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(method: kRenderFrameWithRasterStatsMethod, args: <String, Object>{
'isolateId': 'isolate/123',
'viewId': 'view/1',
}, jsonResponse: response),
]
);
final Map<String, Object?>? rasterStats =
await fakeVmServiceHost.vmService.renderFrameWithRasterStats(viewId: 'view/1', uiIsolateId: 'isolate/123');
expect(rasterStats, equals(response));
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('getFlutterViews polls until a view is returned', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: kListViewsMethod,
jsonResponse: <String, Object>{
'views': <Object>[],
},
),
const FakeVmServiceRequest(
method: kListViewsMethod,
jsonResponse: <String, Object>{
'views': <Object>[],
},
),
listViewsRequest,
]
);
expect(
await fakeVmServiceHost.vmService.getFlutterViews(
delay: Duration.zero,
),
isNotEmpty,
);
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('getFlutterViews does not poll if returnEarly is true', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: kListViewsMethod,
jsonResponse: <String, Object>{
'views': <Object>[],
},
),
]
);
expect(
await fakeVmServiceHost.vmService.getFlutterViews(
returnEarly: true,
),
isEmpty,
);
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
group('findExtensionIsolate', () {
testWithoutContext('returns an isolate with the registered extensionRPC', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'streamListen',
args: <String, Object>{
'streamId': 'Isolate',
},
),
listViewsRequest,
FakeVmServiceRequest(
method: 'getIsolate',
jsonResponse: isolate.toJson(),
args: <String, Object>{
'isolateId': '1',
},
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
]);
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(kExtensionName);
expect(isolateRef.id, '1');
});
testWithoutContext('returns the isolate with the registered extensionRPC when there are multiple FlutterViews', () async {
const String otherExtensionName = 'ext.flutter.test.otherExtension';
// Copy the other isolate and change a few fields.
final vm_service.Isolate isolate2 = vm_service.Isolate.parse(
isolate.toJson()
..['id'] = '2'
..['extensionRPCs'] = <String>[otherExtensionName],
)!;
final FlutterView fakeFlutterView2 = FlutterView(
id: '2',
uiIsolate: isolate2,
);
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'streamListen',
args: <String, Object>{
'streamId': 'Isolate',
},
),
FakeVmServiceRequest(
method: kListViewsMethod,
jsonResponse: <String, Object>{
'views': <Object>[
fakeFlutterView.toJson(),
fakeFlutterView2.toJson(),
],
},
),
FakeVmServiceRequest(
method: 'getIsolate',
jsonResponse: isolate.toJson(),
args: <String, Object>{
'isolateId': '1',
},
),
FakeVmServiceRequest(
method: 'getIsolate',
jsonResponse: isolate2.toJson(),
args: <String, Object>{
'isolateId': '2',
},
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
]);
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(otherExtensionName);
expect(isolateRef.id, '2');
});
testWithoutContext('does not rethrow a sentinel exception if the initially queried flutter view disappears', () async {
const String otherExtensionName = 'ext.flutter.test.otherExtension';
final vm_service.Isolate? isolate2 = vm_service.Isolate.parse(
isolate.toJson()
..['id'] = '2'
..['extensionRPCs'] = <String>[otherExtensionName],
);
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'streamListen',
args: <String, Object>{
'streamId': 'Isolate',
},
),
FakeVmServiceRequest(
method: kListViewsMethod,
jsonResponse: <String, Object>{
'views': <Object>[
fakeFlutterView.toJson(),
],
},
),
const FakeVmServiceRequest(
method: 'getIsolate',
args: <String, Object>{
'isolateId': '1',
},
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
// Assume a different isolate returns.
FakeVmServiceStreamResponse(
streamId: 'Isolate',
event: vm_service.Event(
kind: vm_service.EventKind.kServiceExtensionAdded,
extensionRPC: otherExtensionName,
timestamp: 1,
isolate: isolate2,
),
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
]);
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(otherExtensionName);
expect(isolateRef.id, '2');
});
testWithoutContext('when the isolate stream is already subscribed, returns an isolate with the registered extensionRPC', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'streamListen',
args: <String, Object>{
'streamId': 'Isolate',
},
// Stream already subscribed - https://github.com/dart-lang/sdk/blob/main/runtime/vm/service/service.md#streamlisten
error: FakeRPCError(code: 103),
),
listViewsRequest,
FakeVmServiceRequest(
method: 'getIsolate',
jsonResponse: isolate.toJson()..['extensionRPCs'] = <String>[kExtensionName],
args: <String, Object>{
'isolateId': '1',
},
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
]);
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(kExtensionName);
expect(isolateRef.id, '1');
});
testWithoutContext('returns an isolate with a extensionRPC that is registered later', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'streamListen',
args: <String, Object>{
'streamId': 'Isolate',
},
),
listViewsRequest,
FakeVmServiceRequest(
method: 'getIsolate',
jsonResponse: isolate.toJson(),
args: <String, Object>{
'isolateId': '1',
},
),
FakeVmServiceStreamResponse(
streamId: 'Isolate',
event: vm_service.Event(
kind: vm_service.EventKind.kServiceExtensionAdded,
extensionRPC: kExtensionName,
timestamp: 1,
),
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
]);
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(kExtensionName);
expect(isolateRef.id, '1');
});
testWithoutContext('throws when the service disappears', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
const FakeVmServiceRequest(
method: 'streamListen',
args: <String, Object>{
'streamId': 'Isolate',
},
),
const FakeVmServiceRequest(
method: kListViewsMethod,
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
]);
expect(
() => fakeVmServiceHost.vmService.findExtensionIsolate(kExtensionName),
throwsA(isA<VmServiceDisappearedException>()),
);
});
});
testWithoutContext('Can process log events from the vm service', () {
final vm_service.Event event = vm_service.Event(
bytes: base64.encode(utf8.encode('Hello There\n')),
timestamp: 0,
kind: vm_service.EventKind.kLogging,
);
expect(processVmServiceMessage(event), 'Hello There');
});
testUsingContext('WebSocket URL construction uses correct URI join primitives', () async {
final Completer<String> completer = Completer<String>();
openChannelForTesting = (String url, {io.CompressionOptions compression = io.CompressionOptions.compressionDefault, required Logger logger}) async {
completer.complete(url);
throw Exception('');
};
// Construct a URL that does not end in a `/`.
await expectLater(() => connectToVmService(Uri.parse('http://localhost:8181/foo'), logger: BufferLogger.test()), throwsException);
expect(await completer.future, 'ws://localhost:8181/foo/ws');
openChannelForTesting = null;
});
}
class MockVMService extends Fake implements vm_service.VmService {
final Map<String, String> services = <String, String>{};
final Map<String, vm_service.ServiceCallback> serviceCallBacks = <String, vm_service.ServiceCallback>{};
final Set<String> listenedStreams = <String>{};
bool errorOnRegisterService = false;
@override
void registerServiceCallback(String service, vm_service.ServiceCallback cb) {
serviceCallBacks[service] = cb;
}
@override
Future<vm_service.Success> registerService(String service, String alias) async {
services[service] = alias;
if (errorOnRegisterService) {
throw vm_service.RPCError('registerService', 1234, 'error');
}
return vm_service.Success();
}
@override
Stream<vm_service.Event> get onExtensionEvent => const Stream<vm_service.Event>.empty();
@override
Future<vm_service.Success> streamListen(String streamId) async {
listenedStreams.add(streamId);
return vm_service.Success();
}
}
class FakeDevice extends Fake implements Device { }
/// A [WebSocketConnector] that always throws an [io.SocketException].
Future<io.WebSocket> failingWebSocketConnector(
String url, {
io.CompressionOptions? compression,
Logger? logger,
}) {
throw const io.SocketException('Failed WebSocket connection');
}
| flutter/packages/flutter_tools/test/general.shard/vmservice_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/vmservice_test.dart",
"repo_id": "flutter",
"token_count": 12381
} | 782 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/web_template.dart';
import '../src/common.dart';
const String htmlSample1 = '''
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="/foo/222/">
<meta charset="utf-8">
<link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
<div></div>
<script src="main.dart.js"></script>
</body>
</html>
''';
const String htmlSample2 = '''
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="$kBaseHrefPlaceholder">
<meta charset="utf-8">
<link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
<div></div>
<script src="main.dart.js"></script>
<script>
const serviceWorkerVersion = null;
</script>
<script>
navigator.serviceWorker.register('flutter_service_worker.js');
</script>
</body>
</html>
''';
const String htmlSampleInlineFlutterJsBootstrap = '''
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="/foo/222/">
<meta charset="utf-8">
<link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
<div></div>
<script>
{{flutter_js}}
{{flutter_build_config}}
_flutter.loader.load({
serviceWorker: {
serviceWorkerVersion: {{flutter_service_worker_version}},
},
});
</script>
</body>
</html>
''';
const String htmlSampleInlineFlutterJsBootstrapOutput = '''
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="/foo/222/">
<meta charset="utf-8">
<link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
<div></div>
<script>
(flutter.js content)
(build config)
_flutter.loader.load({
serviceWorker: {
serviceWorkerVersion: "(service worker version)",
},
});
</script>
</body>
</html>
''';
const String htmlSampleFullFlutterBootstrapReplacement = '''
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="/foo/222/">
<meta charset="utf-8">
<link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
<div></div>
<script>
{{flutter_bootstrap_js}}
</script>
</body>
</html>
''';
const String htmlSampleFullFlutterBootstrapReplacementOutput = '''
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="/foo/222/">
<meta charset="utf-8">
<link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
<div></div>
<script>
(flutter bootstrap script)
</script>
</body>
</html>
''';
const String htmlSampleLegacyVar = '''
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="$kBaseHrefPlaceholder">
<meta charset="utf-8">
<link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
<div></div>
<script src="main.dart.js"></script>
<script>
var serviceWorkerVersion = null;
</script>
<script>
navigator.serviceWorker.register('flutter_service_worker.js');
</script>
</body>
</html>
''';
const String htmlSampleLegacyLoadEntrypoint = '''
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="$kBaseHrefPlaceholder">
<meta charset="utf-8">
<link rel="icon" type="image/png" href="favicon.png"/>
<script src="flutter.js" defer></script>
</head>
<body>
<div></div>
<script>
window.addEventListener('load', function(ev) {
_flutter.loader.loadEntrypoint({
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.initializeEngine().then(function(appRunner) {
appRunner.runApp();
});
});
});
</script>
</body>
</html>
''';
String htmlSample2Replaced({
required String baseHref,
required String serviceWorkerVersion,
}) =>
'''
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="$baseHref">
<meta charset="utf-8">
<link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
<div></div>
<script src="main.dart.js"></script>
<script>
const serviceWorkerVersion = "$serviceWorkerVersion";
</script>
<script>
navigator.serviceWorker.register('flutter_service_worker.js?v=$serviceWorkerVersion');
</script>
</body>
</html>
''';
const String htmlSample3 = '''
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
<div></div>
<script src="main.dart.js"></script>
</body>
</html>
''';
void main() {
final MemoryFileSystem fs = MemoryFileSystem();
final File flutterJs = fs.file('flutter.js');
flutterJs.writeAsStringSync('(flutter.js content)');
test('can parse baseHref', () {
expect(WebTemplate('<base href="/foo/111/">').getBaseHref(), 'foo/111');
expect(WebTemplate(htmlSample1).getBaseHref(), 'foo/222');
expect(WebTemplate(htmlSample2).getBaseHref(), ''); // Placeholder base href.
});
test('handles missing baseHref', () {
expect(WebTemplate('').getBaseHref(), '');
expect(WebTemplate('<base>').getBaseHref(), '');
expect(WebTemplate(htmlSample3).getBaseHref(), '');
});
test('throws on invalid baseHref', () {
expect(() => WebTemplate('<base href>').getBaseHref(), throwsToolExit());
expect(() => WebTemplate('<base href="">').getBaseHref(), throwsToolExit());
expect(() => WebTemplate('<base href="foo/111">').getBaseHref(), throwsToolExit());
expect(
() => WebTemplate('<base href="foo/111/">').getBaseHref(),
throwsToolExit(),
);
expect(
() => WebTemplate('<base href="/foo/111">').getBaseHref(),
throwsToolExit(),
);
});
test('applies substitutions', () {
final WebTemplate indexHtml = WebTemplate(htmlSample2);
indexHtml.applySubstitutions(
baseHref: '/foo/333/',
serviceWorkerVersion: 'v123xyz',
flutterJsFile: flutterJs,
);
expect(
indexHtml.content,
htmlSample2Replaced(
baseHref: '/foo/333/',
serviceWorkerVersion: 'v123xyz',
),
);
});
test('applies substitutions with legacy var version syntax', () {
final WebTemplate indexHtml = WebTemplate(htmlSampleLegacyVar);
indexHtml.applySubstitutions(
baseHref: '/foo/333/',
serviceWorkerVersion: 'v123xyz',
flutterJsFile: flutterJs,
);
expect(
indexHtml.content,
htmlSample2Replaced(
baseHref: '/foo/333/',
serviceWorkerVersion: 'v123xyz',
),
);
});
test('applies substitutions to inline flutter.js bootstrap script', () {
final WebTemplate indexHtml = WebTemplate(htmlSampleInlineFlutterJsBootstrap);
expect(indexHtml.getWarnings(), isEmpty);
indexHtml.applySubstitutions(
baseHref: '/',
serviceWorkerVersion: '(service worker version)',
flutterJsFile: flutterJs,
buildConfig: '(build config)',
);
expect(indexHtml.content, htmlSampleInlineFlutterJsBootstrapOutput);
});
test('applies substitutions to full flutter_bootstrap.js replacement', () {
final WebTemplate indexHtml = WebTemplate(htmlSampleFullFlutterBootstrapReplacement);
expect(indexHtml.getWarnings(), isEmpty);
indexHtml.applySubstitutions(
baseHref: '/',
serviceWorkerVersion: '(service worker version)',
flutterJsFile: flutterJs,
buildConfig: '(build config)',
flutterBootstrapJs: '(flutter bootstrap script)',
);
expect(indexHtml.content, htmlSampleFullFlutterBootstrapReplacementOutput);
});
test('re-parses after substitutions', () {
final WebTemplate indexHtml = WebTemplate(htmlSample2);
expect(indexHtml.getBaseHref(), ''); // Placeholder base href.
indexHtml.applySubstitutions(
baseHref: '/foo/333/',
serviceWorkerVersion: 'v123xyz',
flutterJsFile: flutterJs,
);
// The parsed base href should be updated after substitutions.
expect(indexHtml.getBaseHref(), 'foo/333');
});
test('warns on legacy service worker patterns', () {
final WebTemplate indexHtml = WebTemplate(htmlSampleLegacyVar);
final List<WebTemplateWarning> warnings = indexHtml.getWarnings();
expect(warnings.length, 2);
expect(warnings.where((WebTemplateWarning warning) => warning.lineNumber == 13), isNotEmpty);
expect(warnings.where((WebTemplateWarning warning) => warning.lineNumber == 16), isNotEmpty);
});
test('warns on legacy FlutterLoader.loadEntrypoint', () {
final WebTemplate indexHtml = WebTemplate(htmlSampleLegacyLoadEntrypoint);
final List<WebTemplateWarning> warnings = indexHtml.getWarnings();
expect(warnings.length, 1);
expect(warnings.single.lineNumber, 14);
});
}
| flutter/packages/flutter_tools/test/general.shard/web_template_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/general.shard/web_template_test.dart",
"repo_id": "flutter",
"token_count": 3314
} | 783 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
import '../src/common.dart';
import '../src/context.dart';
import '../src/test_flutter_command_runner.dart';
import 'test_utils.dart';
void main() {
group('pass analyze template:', () {
final List<String> templates = <String>[
'app',
'module',
'package',
'plugin',
'plugin_ffi',
'skeleton',
];
late Directory tempDir;
setUp(() {
tempDir = globals.fs.systemTempDirectory
.createTempSync('flutter_tools_analyze_all_template.');
});
tearDown(() {
tryToDelete(tempDir);
});
for (final String template in templates) {
testUsingContext('analysis for $template', () async {
final String projectPath = await createProject(tempDir,
arguments: <String>['--no-pub', '--template', template]);
final ProcessResult result = await globals.processManager
.run(<String>['flutter', 'analyze'], workingDirectory: projectPath);
expect(result, const ProcessResultMatcher());
});
}
});
}
| flutter/packages/flutter_tools/test/integration.shard/analyze_all_templates_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/integration.shard/analyze_all_templates_test.dart",
"repo_id": "flutter",
"token_count": 503
} | 784 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:file/file.dart';
import '../src/common.dart';
import 'test_data/background_project.dart';
import 'test_driver.dart';
import 'test_utils.dart';
void main() {
late Directory tempDir;
setUp(() async {
tempDir = createResolvedTempDirectorySync('hot_reload_test.');
});
tearDown(() async {
tryToDelete(tempDir);
});
testWithoutContext('Hot restart kills background isolates', () async {
final BackgroundProject project = BackgroundProject();
await project.setUpIn(tempDir);
final FlutterRunTestDriver flutter = FlutterRunTestDriver(tempDir);
const String newBackgroundMessage = 'New Background';
final Completer<void> sawForegroundMessage = Completer<void>.sync();
final Completer<void> sawBackgroundMessage = Completer<void>.sync();
final Completer<void> sawNewBackgroundMessage = Completer<void>.sync();
final StreamSubscription<String> subscription = flutter.stdout.listen((String line) {
printOnFailure('[LOG]:"$line"');
if (line.contains('Main thread') && !sawForegroundMessage.isCompleted) {
sawForegroundMessage.complete();
}
if (line.contains('Isolate thread')) {
sawBackgroundMessage.complete();
}
if (line.contains(newBackgroundMessage)) {
sawNewBackgroundMessage.complete();
}
},
);
await flutter.run();
await sawForegroundMessage.future;
await sawBackgroundMessage.future;
project.updateTestIsolatePhrase(newBackgroundMessage);
await flutter.hotRestart();
await sawNewBackgroundMessage.future;
// Wait a tiny amount of time in case we did not kill the background isolate.
await Future<void>.delayed(const Duration(milliseconds: 10));
await subscription.cancel();
await flutter.stop();
});
testWithoutContext('Hot reload updates background isolates', () async {
final RepeatingBackgroundProject project = RepeatingBackgroundProject();
await project.setUpIn(tempDir);
final FlutterRunTestDriver flutter = FlutterRunTestDriver(tempDir);
const String newBackgroundMessage = 'New Background';
final Completer<void> sawBackgroundMessage = Completer<void>.sync();
final Completer<void> sawNewBackgroundMessage = Completer<void>.sync();
final StreamSubscription<String> subscription = flutter.stdout.listen((String line) {
printOnFailure('[LOG]:"$line"');
if (line.contains('Isolate thread') && !sawBackgroundMessage.isCompleted) {
sawBackgroundMessage.complete();
}
if (line.contains(newBackgroundMessage) && !sawNewBackgroundMessage.isCompleted) {
sawNewBackgroundMessage.complete();
}
},
);
await flutter.run();
await sawBackgroundMessage.future;
project.updateTestIsolatePhrase(newBackgroundMessage);
await flutter.hotReload();
await sawNewBackgroundMessage.future;
await subscription.cancel();
await flutter.stop();
});
}
| flutter/packages/flutter_tools/test/integration.shard/background_isolate_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/integration.shard/background_isolate_test.dart",
"repo_id": "flutter",
"token_count": 1055
} | 785 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/file.dart';
import '../src/common.dart';
import 'test_data/stepping_project.dart';
import 'test_driver.dart';
import 'test_utils.dart';
void main() {
late Directory tempDir;
setUp(() async {
tempDir = createResolvedTempDirectorySync('debugger_stepping_test.');
});
tearDown(() async {
tryToDelete(tempDir);
});
testWithoutContext('can step over statements', () async {
final SteppingProject project = SteppingProject();
await project.setUpIn(tempDir);
final FlutterRunTestDriver flutter = FlutterRunTestDriver(tempDir);
await flutter.run(withDebugger: true, startPaused: true);
await flutter.addBreakpoint(project.breakpointUri, project.breakpointLine);
await flutter.resume(waitForNextPause: true); // Now we should be on the breakpoint.
expect((await flutter.getSourceLocation())?.line, equals(project.breakpointLine));
// Issue 5 steps, ensuring that we end up on the annotated lines each time.
for (int i = 1; i <= project.numberOfSteps; i += 1) {
await flutter.stepOverOrOverAsyncSuspension();
final SourcePosition? location = await flutter.getSourceLocation();
final int? actualLine = location?.line;
// Get the line we're expected to stop at by searching for the comment
// within the source code.
final int expectedLine = project.lineForStep(i);
expect(actualLine, equals(expectedLine),
reason: 'After $i steps, debugger should stop at $expectedLine but stopped at $actualLine'
);
}
await flutter.stop();
});
}
| flutter/packages/flutter_tools/test/integration.shard/debugger_stepping_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/integration.shard/debugger_stepping_test.dart",
"repo_id": "flutter",
"token_count": 564
} | 786 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:file/file.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:vm_service/vm_service.dart';
import 'package:vm_service/vm_service_io.dart';
import '../src/common.dart';
import 'test_data/project_with_early_error.dart';
import 'test_driver.dart';
import 'test_utils.dart';
void main() {
late Directory tempDir;
final ProjectWithEarlyError project = ProjectWithEarlyError();
const String exceptionStart = '══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞══════════════════';
late FlutterRunTestDriver flutter;
setUp(() async {
tempDir = createResolvedTempDirectorySync('run_test.');
await project.setUpIn(tempDir);
flutter = FlutterRunTestDriver(tempDir);
});
tearDown(() async {
tryToDelete(tempDir);
});
testWithoutContext('flutter run in non-machine mode reports an early error in an application', () async {
final String flutterBin = fileSystem.path.join(
getFlutterRoot(),
'bin',
'flutter',
);
final StringBuffer stdout = StringBuffer();
final Process process = await processManager.start(<String>[
flutterBin,
'run',
'--disable-service-auth-codes',
'--show-test-device',
'-dflutter-tester',
'--start-paused',
'--dart-define=flutter.inspector.structuredErrors=true',
], workingDirectory: tempDir.path);
transformToLines(process.stdout).listen((String line) async {
stdout.writeln(line);
if (line.startsWith('A Dart VM Service on')) {
final RegExp exp = RegExp(r'http://127.0.0.1:(\d+)/');
final RegExpMatch match = exp.firstMatch(line)!;
final String port = match.group(1)!;
final VmService vmService =
await vmServiceConnectUri('ws://localhost:$port/ws');
final VM vm = await vmService.getVM();
for (final IsolateRef isolate in vm.isolates!) {
await vmService.resume(isolate.id!);
}
}
if (line.startsWith('Another exception was thrown')) {
process.kill();
}
});
await process.exitCode;
expect(stdout.toString(), contains(exceptionStart));
});
testWithoutContext('flutter run in machine mode does not print an error', () async {
final StringBuffer stdout = StringBuffer();
await flutter.run(
startPaused: true,
withDebugger: true,
structuredErrors: true,
);
await flutter.resume();
final Completer<void> completer = Completer<void>();
await Future<void>(() async {
flutter.stdout.listen((String line) {
stdout.writeln(line);
});
await completer.future;
}).timeout(const Duration(seconds: 5), onTimeout: () {
// We don't expect to see any output but want to write to stdout anyway.
completer.complete();
});
await flutter.stop();
expect(stdout.toString(), isNot(contains(exceptionStart)));
});
}
| flutter/packages/flutter_tools/test/integration.shard/flutter_run_with_error_test.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/integration.shard/flutter_run_with_error_test.dart",
"repo_id": "flutter",
"token_count": 1163
} | 787 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'project.dart';
class BasicProject extends Project {
@override
final String pubspec = '''
name: test
environment:
sdk: '>=3.2.0-0 <4.0.0'
dependencies:
flutter:
sdk: flutter
''';
@override
final String main = r'''
import 'dart:async';
import 'package:flutter/material.dart';
Future<void> main() async {
while (true) {
runApp(MyApp());
await Future.delayed(const Duration(milliseconds: 50));
}
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
topLevelFunction();
return MaterialApp( // BUILD BREAKPOINT
title: 'Flutter Demo',
home: Container(),
);
}
}
topLevelFunction() {
print("topLevelFunction"); // TOP LEVEL BREAKPOINT
}
''';
Uri get buildMethodBreakpointUri => mainDart;
int get buildMethodBreakpointLine => lineContaining(main, '// BUILD BREAKPOINT');
Uri get topLevelFunctionBreakpointUri => mainDart;
int get topLevelFunctionBreakpointLine => lineContaining(main, '// TOP LEVEL BREAKPOINT');
}
/// A project that throws multiple exceptions during Widget builds.
///
/// A repro for the issue at https://github.com/Dart-Code/Dart-Code/issues/3448
/// where Hot Restart could become stuck on exceptions and never complete.
class BasicProjectThatThrows extends Project {
@override
final String pubspec = '''
name: test
environment:
sdk: '>=3.2.0-0 <4.0.0'
dependencies:
flutter:
sdk: flutter
''';
@override
final String main = r'''
import 'package:flutter/material.dart';
void a() {
throw Exception('a');
}
void b() {
try {
a();
} catch (e) {
throw Exception('b');
}
}
void c() {
try {
b();
} catch (e) {
throw Exception('c');
}
}
void main() {
runApp(App());
}
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
c();
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Study Flutter',
theme: ThemeData(
primarySwatch: Colors.green,
),
home: Container(),
);
}
}
''';
}
class BasicProjectWithTimelineTraces extends Project {
@override
final String pubspec = '''
name: test
environment:
sdk: '>=3.2.0-0 <4.0.0'
dependencies:
flutter:
sdk: flutter
''';
@override
final String main = r'''
import 'dart:async';
import 'dart:developer';
import 'package:flutter/material.dart';
Future<void> main() async {
while (true) {
runApp(MyApp());
await Future.delayed(const Duration(milliseconds: 50));
Timeline.instantSync('main');
}
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
topLevelFunction();
return MaterialApp( // BUILD BREAKPOINT
title: 'Flutter Demo',
home: Container(),
);
}
}
topLevelFunction() {
print("topLevelFunction"); // TOP LEVEL BREAKPOINT
}
''';
}
class BasicProjectWithFlutterGen extends Project {
@override
final String generatedFile = '''
String x = "a";
''';
@override
final String pubspec = '''
name: test
environment:
sdk: '>=3.2.0-0 <4.0.0'
dependencies:
flutter:
sdk: flutter
flutter:
generate: true
''';
@override
final String main = r'''
import 'dart:async';
import 'package:flutter_gen/flutter_gen.dart';
void main() {}
''';
}
class BasicProjectWithUnaryMain extends Project {
@override
final String pubspec = '''
name: test
environment:
sdk: '>=3.2.0-0 <4.0.0'
dependencies:
flutter:
sdk: flutter
''';
@override
final String main = r'''
import 'dart:async';
import 'package:flutter/material.dart';
Future<void> main(List<String> args) async {
while (true) {
runApp(MyApp());
await Future.delayed(const Duration(milliseconds: 50));
}
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
topLevelFunction();
return MaterialApp( // BUILD BREAKPOINT
title: 'Flutter Demo',
home: Container(),
);
}
}
topLevelFunction() {
print("topLevelFunction"); // TOP LEVEL BREAKPOINT
}
''';
}
| flutter/packages/flutter_tools/test/integration.shard/test_data/basic_project.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/integration.shard/test_data/basic_project.dart",
"repo_id": "flutter",
"token_count": 1741
} | 788 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import '../test_utils.dart';
import 'project.dart';
class HotReloadProject extends Project {
@override
final String pubspec = '''
name: test
environment:
sdk: '>=3.2.0-0 <4.0.0'
dependencies:
flutter:
sdk: flutter
''';
@override
final String main = getCode(false);
static String getCode(bool stateful) {
return '''
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.resumed')!;
await ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: Child(),
);
}
}
class ${stateful ? 'Other' : 'Child'} extends StatelessWidget {
@override
Widget build(BuildContext context) {
print('STATELESS');
return Container();
}
}
class ${stateful ? 'Child' : 'Other'} extends StatefulWidget {
State createState() => _State();
}
class _State extends State<${stateful ? 'Child' : 'Other'}>{
@override
Widget build(BuildContext context) {
print('STATEFUL');
return Container();
}
}
''';
}
/// Whether the template is currently stateful.
bool stateful = false;
void toggleState() {
stateful = !stateful;
writeFile(
fileSystem.path.join(dir.path, 'lib', 'main.dart'),
getCode(stateful),
writeFutureModifiedDate: true,
);
}
}
| flutter/packages/flutter_tools/test/integration.shard/test_data/stateless_stateful_project.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/integration.shard/test_data/stateless_stateful_project.dart",
"repo_id": "flutter",
"token_count": 706
} | 789 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_tools/src/android/android_builder.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:flutter_tools/src/project.dart';
/// A fake implementation of [AndroidBuilder].
class FakeAndroidBuilder implements AndroidBuilder {
@override
Future<void> buildAar({
required FlutterProject project,
required Set<AndroidBuildInfo> androidBuildInfo,
required String target,
String? outputDirectoryPath,
required String buildNumber,
}) async {}
@override
Future<void> buildApk({
required FlutterProject project,
required AndroidBuildInfo androidBuildInfo,
required String target,
bool configOnly = false,
}) async {}
@override
Future<void> buildAab({
required FlutterProject project,
required AndroidBuildInfo androidBuildInfo,
required String target,
bool validateDeferredComponents = true,
bool deferredComponentsEnabled = false,
bool configOnly = false,
}) async {}
@override
Future<List<String>> getBuildVariants({required FlutterProject project}) async => const <String>[];
@override
Future<String> outputsAppLinkSettings(
String buildVariant, {
required FlutterProject project,
}) async => '/';
}
/// Creates a [FlutterProject] in a directory named [flutter_project]
/// within [directoryOverride].
class FakeFlutterProjectFactory extends FlutterProjectFactory {
FakeFlutterProjectFactory(this.directoryOverride) :
super(
fileSystem: globals.fs,
logger: globals.logger,
);
final Directory directoryOverride;
@override
FlutterProject fromDirectory(Directory _) {
projects.clear();
return super.fromDirectory(directoryOverride.childDirectory('flutter_project'));
}
}
| flutter/packages/flutter_tools/test/src/android_common.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/src/android_common.dart",
"repo_id": "flutter",
"token_count": 609
} | 790 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_tools/src/dart/pub.dart';
import 'package:flutter_tools/src/project.dart';
class ThrowingPub implements Pub {
@override
Future<void> batch(List<String> arguments, {
PubContext? context,
String? directory,
MessageFilter? filter,
String? failureMessage = 'pub failed',
}) {
throw UnsupportedError('Attempted to invoke pub during test.');
}
@override
Future<void> get({
PubContext? context,
required FlutterProject project,
bool upgrade = false,
bool offline = false,
bool checkLastModified = true,
bool skipPubspecYamlCheck = false,
bool generateSyntheticPackage = false,
bool generateSyntheticPackageForExample = false,
String? flutterRootOverride,
bool checkUpToDate = false,
bool shouldSkipThirdPartyGenerator = true,
PubOutputMode outputMode = PubOutputMode.all,
}) {
throw UnsupportedError('Attempted to invoke pub during test.');
}
@override
Future<void> interactively(
List<String> arguments, {
FlutterProject? project,
required PubContext context,
required String command,
bool touchesPackageConfig = false,
bool generateSyntheticPackage = false,
PubOutputMode outputMode = PubOutputMode.all,
}) {
throw UnsupportedError('Attempted to invoke pub during test.');
}
}
| flutter/packages/flutter_tools/test/src/throwing_pub.dart/0 | {
"file_path": "flutter/packages/flutter_tools/test/src/throwing_pub.dart",
"repo_id": "flutter",
"token_count": 473
} | 791 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:ui_web' as ui_web;
import 'utils.dart';
export 'dart:ui_web'
show
BrowserPlatformLocation,
EventListener,
HashUrlStrategy,
PlatformLocation,
UrlStrategy,
urlStrategy;
/// Change the strategy to use for handling browser URL.
///
/// Setting this to null disables all integration with the browser history.
void setUrlStrategy(ui_web.UrlStrategy? strategy) {
ui_web.urlStrategy = strategy;
}
/// Use the [PathUrlStrategy] to handle the browser URL.
void usePathUrlStrategy() {
setUrlStrategy(PathUrlStrategy());
}
/// Uses the browser URL's pathname to represent Flutter's route name.
///
/// In order to use [PathUrlStrategy] for an app, it needs to be set like this:
///
/// ```dart
/// import 'package:flutter_web_plugins/flutter_web_plugins.dart';
///
/// void main() {
/// // Somewhere before calling `runApp()` do:
/// setUrlStrategy(PathUrlStrategy());
/// }
/// ```
class PathUrlStrategy extends ui_web.HashUrlStrategy {
/// Creates an instance of [PathUrlStrategy].
///
/// The [ui_web.PlatformLocation] parameter is useful for testing to mock out browser
/// interactions.
PathUrlStrategy([
super.platformLocation,
this.includeHash = false,
]) : _platformLocation = platformLocation,
_basePath = stripTrailingSlash(extractPathname(checkBaseHref(
platformLocation.getBaseHref(),
)));
final ui_web.PlatformLocation _platformLocation;
final String _basePath;
/// There were an issue with url #hash which disappears from URL on first start of the web application
/// This flag allows to preserve that hash and was introduced mainly to preserve backward compatibility
/// with existing applications that rely on a full match on the path. If someone navigates to
/// /profile or /profile#foo, they both will work without this flag otherwise /profile#foo won't match
/// with the /profile route name anymore because the hash became part of the path.
///
/// This flag solves the edge cases when using auth provider which redirects back to the app with
/// token in redirect URL as /#access_token=bla_bla_bla
final bool includeHash;
@override
String getPath() {
final String? hash = includeHash ? _platformLocation.hash : null;
final String path = _platformLocation.pathname + _platformLocation.search + (hash ?? '');
if (_basePath.isNotEmpty && path.startsWith(_basePath)) {
return ensureLeadingSlash(path.substring(_basePath.length));
}
return ensureLeadingSlash(path);
}
@override
String prepareExternalUrl(String internalUrl) {
if (internalUrl.isEmpty) {
internalUrl = '/';
}
assert(
internalUrl.startsWith('/'),
"When using PathUrlStrategy, all route names must start with '/' because "
"the browser's pathname always starts with '/'. "
"Found route name: '$internalUrl'",
);
return '$_basePath$internalUrl';
}
}
| flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart/0 | {
"file_path": "flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart",
"repo_id": "flutter",
"token_count": 988
} | 792 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:core';
import 'dart:io';
/// Determines the level of logging.
///
/// Verbosity is increasing from one (none) to five (fine). The sixth level
/// (all) logs everything.
enum LoggingLevel {
/// Logs no logs.
none,
/// Logs severe messages at the most (severe messages are always logged).
///
/// Severe means that the process has encountered a critical level of failure
/// in which it cannot recover and will terminate as a result.
severe,
/// Logs warning messages at the most.
///
/// Warning implies that an error was encountered, but the process will
/// attempt to continue, and may/may not succeed.
warning,
/// Logs info messages at the most.
///
/// An info message is for determining information about the state of the
/// application as it runs through execution.
info,
/// Logs fine logs at the most.
///
/// A fine message is one that is not important for logging outside of
/// debugging potential issues in the application.
fine,
/// Logs everything.
all,
}
/// Signature of a function that logs a [LogMessage].
typedef LoggingFunction = void Function(LogMessage log);
/// The default logging function.
///
/// Runs the [print] function using the format string:
/// '[${log.levelName}]::${log.tag}--${log.time}: ${log.message}'
///
/// Exits with status code 1 if the `log` is [LoggingLevel.severe].
void defaultLoggingFunction(LogMessage log) {
// ignore: avoid_print
print('[${log.levelName}]::${log.tag}--${log.time}: ${log.message}');
if (log.level == LoggingLevel.severe) {
exit(1);
}
}
/// Represents a logging message created by the logger.
///
/// Includes a message, the time the message was created, the level of the log
/// as an enum, the name of the level as a string, and a tag. This class is used
/// to print from the global logging function defined in
/// [Logger.loggingFunction] (a function that can be user-defined).
class LogMessage {
/// Creates a log, including the level of the log, the time it was created,
/// and the actual log message.
///
/// When this message is created, it sets its [time] to [DateTime.now].
LogMessage(this.message, this.tag, this.level)
: levelName = level.toString().substring(level.toString().indexOf('.') + 1),
time = DateTime.now();
/// The actual log message.
final String message;
/// The time the log message was created.
final DateTime time;
/// The level of this log.
final LoggingLevel level;
/// The human readable level of this log.
final String levelName;
/// The tag associated with the message. This is set to [Logger.tag] when
/// emitted by a [Logger] object.
final String tag;
}
/// Logs messages using the global [LoggingFunction] and logging level.
///
/// Example of setting log level to [LoggingLevel.warning] and creating a
/// logging function:
///
/// ```dart
/// Logger.globalLevel = LoggingLevel.warning;
/// ```
class Logger {
/// Creates a logger with the given [tag].
Logger(this.tag);
/// The tag associated with the log message (usable in the logging function).
/// [LogMessage] objects emitted by this class will have [LogMessage.tag] set
/// to this value.
final String tag;
/// Determines what to do when the [Logger] creates and attempts to log a
/// [LogMessage] object.
///
/// This function can be reassigned to whatever functionality of your
/// choosing, so long as it has the same signature of [LoggingFunction] (it
/// can also be an asynchronous function, if doing file I/O, for
/// example).
static LoggingFunction loggingFunction = defaultLoggingFunction;
/// Determines the logging level all [Logger] instances use.
static LoggingLevel globalLevel = LoggingLevel.none;
/// Logs a [LoggingLevel.severe] level `message`.
///
/// Severe messages are always logged, regardless of what level is set.
void severe(String message) {
loggingFunction(LogMessage(message, tag, LoggingLevel.severe));
}
/// Logs a [LoggingLevel.warning] level `message`.
void warning(String message) {
if (globalLevel.index >= LoggingLevel.warning.index) {
loggingFunction(LogMessage(message, tag, LoggingLevel.warning));
}
}
/// Logs a [LoggingLevel.info] level `message`.
void info(String message) {
if (globalLevel.index >= LoggingLevel.info.index) {
loggingFunction(LogMessage(message, tag, LoggingLevel.info));
}
}
/// Logs a [LoggingLevel.fine] level `message`.
void fine(String message) {
if (globalLevel.index >= LoggingLevel.fine.index) {
loggingFunction(LogMessage(message, tag, LoggingLevel.fine));
}
}
}
| flutter/packages/fuchsia_remote_debug_protocol/lib/src/common/logging.dart/0 | {
"file_path": "flutter/packages/fuchsia_remote_debug_protocol/lib/src/common/logging.dart",
"repo_id": "flutter",
"token_count": 1398
} | 793 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'dart:io' show Platform;
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:integration_test_example/main.dart' as app;
void main() {
final IntegrationTestWidgetsFlutterBinding binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets('verify text', (WidgetTester tester) async {
// Build our app and trigger a frame.
app.main();
// Trace the timeline of the following operation. The timeline result will
// be written to `build/integration_response_data.json` with the key
// `timeline`.
await binding.traceAction(() async {
// Trigger a frame.
await tester.pumpAndSettle();
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) =>
widget is Text &&
widget.data!.startsWith('Platform: ${Platform.operatingSystem}'),
),
findsOneWidget,
);
});
});
}
| flutter/packages/integration_test/example/integration_test/_example_test_io.dart/0 | {
"file_path": "flutter/packages/integration_test/example/integration_test/_example_test_io.dart",
"repo_id": "flutter",
"token_count": 514
} | 794 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_driver/flutter_driver.dart';
import 'package:integration_test/integration_test_driver_extended.dart';
Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
await integrationDriver(
driver: driver,
onScreenshot: (
String screenshotName,
List<int> screenshotBytes, [
Map<String, Object?>? args,
]) async {
// Return false if the screenshot is invalid.
// TODO(yjbanov): implement, see https://github.com/flutter/flutter/issues/86120
// Here is an example of using an argument that was passed in via the
// optional 'args' Map.
if (args != null) {
final String? someArgumentValue = args['someArgumentKey'] as String?;
return someArgumentValue != null;
}
return true;
},
writeResponseOnFailure: true);
}
| flutter/packages/integration_test/example/test_driver/extended_integration_test.dart/0 | {
"file_path": "flutter/packages/integration_test/example/test_driver/extended_integration_test.dart",
"repo_id": "flutter",
"token_count": 350
} | 795 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import '../common.dart';
/// The dart:html implementation of [CallbackManager].
///
/// See also:
///
/// * `_callback_io.dart`, which has the dart:io implementation
CallbackManager get callbackManager => _singletonWebDriverCommandManager;
/// WebDriverCommandManager singleton.
final _WebCallbackManager _singletonWebDriverCommandManager =
_WebCallbackManager();
/// Manages communication between `integration_tests` and the `driver_tests`.
///
/// Along with responding to callbacks from the driver side this calls enables
/// usage of Web Driver commands by sending [WebDriverCommand]s to driver side.
///
/// Tests can execute an Web Driver commands such as `screenshot` using browsers'
/// WebDriver APIs.
///
/// See: https://www.w3.org/TR/webdriver/
class _WebCallbackManager implements CallbackManager {
/// App side tests will put the command requests from WebDriver to this pipe.
Completer<WebDriverCommand> _webDriverCommandPipe =
Completer<WebDriverCommand>();
/// Updated when WebDriver completes the request by the test method.
///
/// For example, a test method will ask for a screenshot by calling
/// `takeScreenshot`. When this screenshot is taken [_driverCommandComplete]
/// will complete.
Completer<bool> _driverCommandComplete = Completer<bool>();
/// Takes screenshot using WebDriver screenshot command.
///
/// Only works on Web when tests are run via `flutter driver` command.
///
/// See: https://www.w3.org/TR/webdriver/#screen-capture.
@override
Future<Map<String, dynamic>> takeScreenshot(String screenshotName, [Map<String, Object?>? args]) async {
await _sendWebDriverCommand(WebDriverCommand.screenshot(screenshotName, args));
return <String, dynamic>{
'screenshotName': screenshotName,
// Flutter Web doesn't provide the bytes.
'bytes': <int>[]
};
}
@override
Future<void> convertFlutterSurfaceToImage() async {
// Noop on Web.
}
Future<void> _sendWebDriverCommand(WebDriverCommand command) async {
try {
_webDriverCommandPipe.complete(command);
final bool awaitCommand = await _driverCommandComplete.future;
if (!awaitCommand) {
throw Exception(
'Web Driver Command ${command.type} failed while waiting for '
'driver side');
}
} catch (exception) {
throw Exception('Web Driver Command failed: ${command.type} with exception $exception');
} finally {
// Reset the completer.
_driverCommandComplete = Completer<bool>();
}
}
/// The callback function to response the driver side input.
///
/// Provides a handshake mechanism for executing [WebDriverCommand]s on the
/// driver side.
@override
Future<Map<String, dynamic>> callback(
Map<String, String> params, IntegrationTestResults testRunner) async {
final String command = params['command']!;
Map<String, String> response;
switch (command) {
case 'request_data':
return params['message'] == null
? _requestData(testRunner)
: _requestDataWithMessage(params['message']!, testRunner);
case 'get_health':
response = <String, String>{'status': 'ok'};
default:
throw UnimplementedError('$command is not implemented');
}
return <String, dynamic>{
'isError': false,
'response': response,
};
}
Future<Map<String, dynamic>> _requestDataWithMessage(
String extraMessage, IntegrationTestResults testRunner) async {
Map<String, String> response;
// Driver side tests' status is added as an extra message.
final DriverTestMessage message =
DriverTestMessage.fromString(extraMessage);
// If driver side tests are pending send the first command in the
// `commandPipe` to the tests.
if (message.isPending) {
final WebDriverCommand command = await _webDriverCommandPipe.future;
switch (command.type) {
case WebDriverCommandType.screenshot:
final Map<String, dynamic> data = Map<String, dynamic>.from(command.values);
data.addAll(
WebDriverCommand.typeToMap(WebDriverCommandType.screenshot));
response = <String, String>{
'message': Response.webDriverCommand(data: data).toJson(),
};
case WebDriverCommandType.noop:
final Map<String, dynamic> data = <String, dynamic>{};
data.addAll(WebDriverCommand.typeToMap(WebDriverCommandType.noop));
response = <String, String>{
'message': Response.webDriverCommand(data: data).toJson(),
};
case WebDriverCommandType.ack:
throw UnimplementedError('${command.type} is not implemented');
}
} else {
final Map<String, dynamic> data = <String, dynamic>{};
data.addAll(WebDriverCommand.typeToMap(WebDriverCommandType.ack));
response = <String, String>{
'message': Response.webDriverCommand(data: data).toJson(),
};
_driverCommandComplete.complete(message.isSuccess);
_webDriverCommandPipe = Completer<WebDriverCommand>();
}
return <String, dynamic>{
'isError': false,
'response': response,
};
}
Future<Map<String, dynamic>> _requestData(IntegrationTestResults testRunner) async {
final bool allTestsPassed = await testRunner.allTestsPassed.future;
final Map<String, String> response = <String, String>{
'message': allTestsPassed
? Response.allTestsPassed(data: testRunner.reportData).toJson()
: Response.someTestsFailed(
testRunner.failureMethodsDetails,
data: testRunner.reportData,
).toJson(),
};
return <String, dynamic>{
'isError': false,
'response': response,
};
}
@override
void cleanup() {
if (!_webDriverCommandPipe.isCompleted) {
_webDriverCommandPipe
.complete(Future<WebDriverCommand>.value(WebDriverCommand.noop()));
}
if (!_driverCommandComplete.isCompleted) {
_driverCommandComplete.complete(Future<bool>.value(false));
}
}
}
| flutter/packages/integration_test/lib/src/_callback_web.dart/0 | {
"file_path": "flutter/packages/integration_test/lib/src/_callback_web.dart",
"repo_id": "flutter",
"token_count": 2168
} | 796 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@Tags(<String>['web'])
library;
import 'dart:js' as js;
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
void main() {
IntegrationTestWidgetsFlutterBinding();
test('IntegrationTestWidgetsFlutterBinding on the web should register certain global properties', () {
expect(js.context.hasProperty(r'$flutterDriver'), true);
expect(js.context[r'$flutterDriver'], isNotNull);
expect(js.context.hasProperty(r'$flutterDriverResult'), true);
expect(js.context[r'$flutterDriverResult'], isNull);
});
}
| flutter/packages/integration_test/test/web_extension_test.dart/0 | {
"file_path": "flutter/packages/integration_test/test/web_extension_test.dart",
"repo_id": "flutter",
"token_count": 242
} | 797 |
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
/// A base class for an analog clock hand-drawing widget.
///
/// This only draws one hand of the analog clock. Put it in a [Stack] to have
/// more than one hand.
abstract class Hand extends StatelessWidget {
/// Create a const clock [Hand].
///
/// All of the parameters are required and must not be null.
const Hand({
@required this.color,
@required this.size,
@required this.angleRadians,
}) : assert(color != null),
assert(size != null),
assert(angleRadians != null);
/// Hand color.
final Color color;
/// Hand length, as a percentage of the smaller side of the clock's parent
/// container.
final double size;
/// The angle, in radians, at which the hand is drawn.
///
/// This angle is measured from the 12 o'clock position.
final double angleRadians;
}
| flutter_clock/analog_clock/lib/hand.dart/0 | {
"file_path": "flutter_clock/analog_clock/lib/hand.dart",
"repo_id": "flutter_clock",
"token_count": 303
} | 798 |
name: digital_clock
description: Digital clock.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_clock_helper:
path: ../flutter_clock_helper
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
fonts:
- family: PressStart2P
fonts:
- asset: third_party/PressStart2P-Regular.ttf
| flutter_clock/digital_clock/pubspec.yaml/0 | {
"file_path": "flutter_clock/digital_clock/pubspec.yaml",
"repo_id": "flutter_clock",
"token_count": 188
} | 799 |
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:android)
platform :android do
desc "Runs all the tests"
lane :test do
gradle(task: "test")
end
desc "Submit a new beta build to Google Play"
lane :beta do
# TODO: Re-enable deferred components once https://github.com/flutter/gallery/issues/926 is fixed
sh "flutter build appbundle -v --no-deferred-components"
upload_to_play_store(
track: 'beta',
aab: '../build/app/outputs/bundle/release/app-release.aab',
json_key_data: ENV['PLAY_STORE_CONFIG_JSON'],
)
end
desc "Promote beta track to prod"
lane :promote_to_production do
upload_to_play_store(
track: 'beta',
track_promote_to: 'production',
skip_upload_changelogs: true,
json_key_data: ENV['PLAY_STORE_CONFIG_JSON'],
)
end
end
| gallery/android/fastlane/Fastfile/0 | {
"file_path": "gallery/android/fastlane/Fastfile",
"repo_id": "gallery",
"token_count": 442
} | 800 |
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
| gallery/android/gradle.properties/0 | {
"file_path": "gallery/android/gradle.properties",
"repo_id": "gallery",
"token_count": 31
} | 801 |
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;
import 'package:flutter/services.dart' show SystemUiOverlayStyle;
import 'package:gallery/constants.dart';
enum CustomTextDirection {
localeBased,
ltr,
rtl,
}
// See http://en.wikipedia.org/wiki/Right-to-left
const List<String> rtlLanguages = <String>[
'ar', // Arabic
'fa', // Farsi
'he', // Hebrew
'ps', // Pashto
'ur', // Urdu
];
// Fake locale to represent the system Locale option.
const systemLocaleOption = Locale('system');
Locale? _deviceLocale;
Locale? get deviceLocale => _deviceLocale;
set deviceLocale(Locale? locale) {
_deviceLocale ??= locale;
}
class GalleryOptions {
const GalleryOptions({
required this.themeMode,
required double? textScaleFactor,
required this.customTextDirection,
required Locale? locale,
required this.timeDilation,
required this.platform,
required this.isTestMode,
}) : _textScaleFactor = textScaleFactor ?? 1.0,
_locale = locale;
final ThemeMode themeMode;
final double _textScaleFactor;
final CustomTextDirection customTextDirection;
final Locale? _locale;
final double timeDilation;
final TargetPlatform? platform;
final bool isTestMode; // True for integration tests.
// We use a sentinel value to indicate the system text scale option. By
// default, return the actual text scale factor, otherwise return the
// sentinel value.
double textScaleFactor(BuildContext context, {bool useSentinel = false}) {
if (_textScaleFactor == systemTextScaleFactorOption) {
return useSentinel
? systemTextScaleFactorOption
// ignore: deprecated_member_use
: MediaQuery.of(context).textScaleFactor;
} else {
return _textScaleFactor;
}
}
Locale? get locale => _locale ?? deviceLocale;
/// Returns a text direction based on the [CustomTextDirection] setting.
/// If it is based on locale and the locale cannot be determined, returns
/// null.
TextDirection? resolvedTextDirection() {
switch (customTextDirection) {
case CustomTextDirection.localeBased:
final language = locale?.languageCode.toLowerCase();
if (language == null) return null;
return rtlLanguages.contains(language)
? TextDirection.rtl
: TextDirection.ltr;
case CustomTextDirection.rtl:
return TextDirection.rtl;
default:
return TextDirection.ltr;
}
}
/// Returns a [SystemUiOverlayStyle] based on the [ThemeMode] setting.
/// In other words, if the theme is dark, returns light; if the theme is
/// light, returns dark.
SystemUiOverlayStyle resolvedSystemUiOverlayStyle() {
Brightness brightness;
switch (themeMode) {
case ThemeMode.light:
brightness = Brightness.light;
break;
case ThemeMode.dark:
brightness = Brightness.dark;
break;
default:
brightness =
WidgetsBinding.instance.platformDispatcher.platformBrightness;
}
final overlayStyle = brightness == Brightness.dark
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark;
return overlayStyle;
}
GalleryOptions copyWith({
ThemeMode? themeMode,
double? textScaleFactor,
CustomTextDirection? customTextDirection,
Locale? locale,
double? timeDilation,
TargetPlatform? platform,
bool? isTestMode,
}) {
return GalleryOptions(
themeMode: themeMode ?? this.themeMode,
textScaleFactor: textScaleFactor ?? _textScaleFactor,
customTextDirection: customTextDirection ?? this.customTextDirection,
locale: locale ?? this.locale,
timeDilation: timeDilation ?? this.timeDilation,
platform: platform ?? this.platform,
isTestMode: isTestMode ?? this.isTestMode,
);
}
@override
bool operator ==(Object other) =>
other is GalleryOptions &&
themeMode == other.themeMode &&
_textScaleFactor == other._textScaleFactor &&
customTextDirection == other.customTextDirection &&
locale == other.locale &&
timeDilation == other.timeDilation &&
platform == other.platform &&
isTestMode == other.isTestMode;
@override
int get hashCode => Object.hash(
themeMode,
_textScaleFactor,
customTextDirection,
locale,
timeDilation,
platform,
isTestMode,
);
static GalleryOptions of(BuildContext context) {
final scope =
context.dependOnInheritedWidgetOfExactType<_ModelBindingScope>()!;
return scope.modelBindingState.currentModel;
}
static void update(BuildContext context, GalleryOptions newModel) {
final scope =
context.dependOnInheritedWidgetOfExactType<_ModelBindingScope>()!;
scope.modelBindingState.updateModel(newModel);
}
}
// Applies text GalleryOptions to a widget
class ApplyTextOptions extends StatelessWidget {
const ApplyTextOptions({
super.key,
required this.child,
});
final Widget child;
@override
Widget build(BuildContext context) {
final options = GalleryOptions.of(context);
final textDirection = options.resolvedTextDirection();
final textScaleFactor = options.textScaleFactor(context);
Widget widget = MediaQuery(
data: MediaQuery.of(context).copyWith(
// ignore: deprecated_member_use
textScaleFactor: textScaleFactor,
),
child: child,
);
return textDirection == null
? widget
: Directionality(
textDirection: textDirection,
child: widget,
);
}
}
// Everything below is boilerplate except code relating to time dilation.
// See https://medium.com/flutter/managing-flutter-application-state-with-inheritedwidgets-1140452befe1
class _ModelBindingScope extends InheritedWidget {
const _ModelBindingScope({
required this.modelBindingState,
required super.child,
});
final _ModelBindingState modelBindingState;
@override
bool updateShouldNotify(_ModelBindingScope oldWidget) => true;
}
class ModelBinding extends StatefulWidget {
const ModelBinding({
super.key,
required this.initialModel,
required this.child,
});
final GalleryOptions initialModel;
final Widget child;
@override
State<ModelBinding> createState() => _ModelBindingState();
}
class _ModelBindingState extends State<ModelBinding> {
late GalleryOptions currentModel;
Timer? _timeDilationTimer;
@override
void initState() {
super.initState();
currentModel = widget.initialModel;
}
@override
void dispose() {
_timeDilationTimer?.cancel();
_timeDilationTimer = null;
super.dispose();
}
void handleTimeDilation(GalleryOptions newModel) {
if (currentModel.timeDilation != newModel.timeDilation) {
_timeDilationTimer?.cancel();
_timeDilationTimer = null;
if (newModel.timeDilation > 1) {
// We delay the time dilation change long enough that the user can see
// that UI has started reacting and then we slam on the brakes so that
// they see that the time is in fact now dilated.
_timeDilationTimer = Timer(const Duration(milliseconds: 150), () {
timeDilation = newModel.timeDilation;
});
} else {
timeDilation = newModel.timeDilation;
}
}
}
void updateModel(GalleryOptions newModel) {
if (newModel != currentModel) {
handleTimeDilation(newModel);
setState(() {
currentModel = newModel;
});
}
}
@override
Widget build(BuildContext context) {
return _ModelBindingScope(
modelBindingState: this,
child: widget.child,
);
}
}
| gallery/lib/data/gallery_options.dart/0 | {
"file_path": "gallery/lib/data/gallery_options.dart",
"repo_id": "gallery",
"token_count": 2803
} | 802 |
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart';
// BEGIN cupertinoTextFieldDemo
class CupertinoTextFieldDemo extends StatelessWidget {
const CupertinoTextFieldDemo({super.key});
@override
Widget build(BuildContext context) {
final localizations = GalleryLocalizations.of(context)!;
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
automaticallyImplyLeading: false,
middle: Text(localizations.demoCupertinoTextFieldTitle),
),
child: SafeArea(
child: ListView(
restorationId: 'text_field_demo_list_view',
padding: const EdgeInsets.all(16),
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: CupertinoTextField(
textInputAction: TextInputAction.next,
restorationId: 'email_address_text_field',
placeholder: localizations.demoTextFieldEmail,
keyboardType: TextInputType.emailAddress,
clearButtonMode: OverlayVisibilityMode.editing,
autocorrect: false,
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: CupertinoTextField(
textInputAction: TextInputAction.next,
restorationId: 'login_password_text_field',
placeholder: localizations.rallyLoginPassword,
clearButtonMode: OverlayVisibilityMode.editing,
obscureText: true,
autocorrect: false,
),
),
// Disabled text field
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: CupertinoTextField(
enabled: false,
textInputAction: TextInputAction.next,
restorationId: 'login_password_text_field_disabled',
placeholder: localizations.rallyLoginPassword,
clearButtonMode: OverlayVisibilityMode.editing,
obscureText: true,
autocorrect: false,
),
),
CupertinoTextField(
textInputAction: TextInputAction.done,
restorationId: 'pin_number_text_field',
prefix: const Icon(
CupertinoIcons.padlock_solid,
size: 28,
),
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 12),
clearButtonMode: OverlayVisibilityMode.editing,
keyboardType: TextInputType.number,
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
width: 0,
color: CupertinoColors.inactiveGray,
),
),
),
placeholder: localizations.demoCupertinoTextFieldPIN,
),
],
),
),
);
}
}
// END
| gallery/lib/demos/cupertino/cupertino_text_field_demo.dart/0 | {
"file_path": "gallery/lib/demos/cupertino/cupertino_text_field_demo.dart",
"repo_id": "gallery",
"token_count": 1586
} | 803 |
export 'package:gallery/demos/material/app_bar_demo.dart';
export 'package:gallery/demos/material/banner_demo.dart';
export 'package:gallery/demos/material/bottom_app_bar_demo.dart';
export 'package:gallery/demos/material/bottom_navigation_demo.dart';
export 'package:gallery/demos/material/bottom_sheet_demo.dart';
export 'package:gallery/demos/material/button_demo.dart';
export 'package:gallery/demos/material/cards_demo.dart';
export 'package:gallery/demos/material/chip_demo.dart';
export 'package:gallery/demos/material/data_table_demo.dart';
export 'package:gallery/demos/material/dialog_demo.dart';
export 'package:gallery/demos/material/divider_demo.dart';
export 'package:gallery/demos/material/grid_list_demo.dart';
export 'package:gallery/demos/material/list_demo.dart';
export 'package:gallery/demos/material/menu_demo.dart';
export 'package:gallery/demos/material/navigation_drawer.dart';
export 'package:gallery/demos/material/navigation_rail_demo.dart';
export 'package:gallery/demos/material/picker_demo.dart';
export 'package:gallery/demos/material/progress_indicator_demo.dart';
export 'package:gallery/demos/material/selection_controls_demo.dart';
export 'package:gallery/demos/material/sliders_demo.dart';
export 'package:gallery/demos/material/snackbar_demo.dart';
export 'package:gallery/demos/material/tabs_demo.dart';
export 'package:gallery/demos/material/text_field_demo.dart';
export 'package:gallery/demos/material/tooltip_demo.dart';
| gallery/lib/demos/material/material_demos.dart/0 | {
"file_path": "gallery/lib/demos/material/material_demos.dart",
"repo_id": "gallery",
"token_count": 516
} | 804 |
// Copyright 2019 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:animations/animations.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart';
// BEGIN sharedXAxisTransitionDemo
class SharedXAxisTransitionDemo extends StatefulWidget {
const SharedXAxisTransitionDemo({super.key});
@override
State<SharedXAxisTransitionDemo> createState() =>
_SharedXAxisTransitionDemoState();
}
class _SharedXAxisTransitionDemoState extends State<SharedXAxisTransitionDemo> {
bool _isLoggedIn = false;
void _toggleLoginStatus() {
setState(() {
_isLoggedIn = !_isLoggedIn;
});
}
@override
Widget build(BuildContext context) {
final localizations = GalleryLocalizations.of(context)!;
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
automaticallyImplyLeading: false,
title: Column(
children: [
Text(localizations.demoSharedXAxisTitle),
Text(
'(${localizations.demoSharedXAxisDemoInstructions})',
style: Theme.of(context)
.textTheme
.titleSmall!
.copyWith(color: Colors.white),
),
],
),
),
body: SafeArea(
child: Column(
children: [
Expanded(
child: PageTransitionSwitcher(
duration: const Duration(milliseconds: 300),
reverse: !_isLoggedIn,
transitionBuilder: (
child,
animation,
secondaryAnimation,
) {
return SharedAxisTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
transitionType: SharedAxisTransitionType.horizontal,
child: child,
);
},
child: _isLoggedIn ? const _CoursePage() : const _SignInPage(),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TextButton(
onPressed: _isLoggedIn ? _toggleLoginStatus : null,
child: Text(localizations.demoSharedXAxisBackButtonText),
),
ElevatedButton(
onPressed: _isLoggedIn ? null : _toggleLoginStatus,
child: Text(localizations.demoSharedXAxisNextButtonText),
),
],
),
),
],
),
),
);
}
}
class _CoursePage extends StatelessWidget {
const _CoursePage();
@override
Widget build(BuildContext context) {
final localizations = GalleryLocalizations.of(context)!;
return ListView(
children: [
const SizedBox(height: 16),
Text(
localizations.demoSharedXAxisCoursePageTitle,
style: Theme.of(context).textTheme.headlineSmall,
textAlign: TextAlign.center,
),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
localizations.demoSharedXAxisCoursePageSubtitle,
style: const TextStyle(
fontSize: 12,
color: Colors.grey,
),
textAlign: TextAlign.center,
),
),
_CourseSwitch(
course: localizations.demoSharedXAxisArtsAndCraftsCourseTitle),
_CourseSwitch(course: localizations.demoSharedXAxisBusinessCourseTitle),
_CourseSwitch(
course: localizations.demoSharedXAxisIllustrationCourseTitle),
_CourseSwitch(course: localizations.demoSharedXAxisDesignCourseTitle),
_CourseSwitch(course: localizations.demoSharedXAxisCulinaryCourseTitle),
],
);
}
}
class _CourseSwitch extends StatefulWidget {
const _CourseSwitch({
this.course,
});
final String? course;
@override
_CourseSwitchState createState() => _CourseSwitchState();
}
class _CourseSwitchState extends State<_CourseSwitch> {
bool _isCourseBundled = true;
@override
Widget build(BuildContext context) {
final localizations = GalleryLocalizations.of(context);
final subtitle = _isCourseBundled
? localizations!.demoSharedXAxisBundledCourseSubtitle
: localizations!.demoSharedXAxisIndividualCourseSubtitle;
return SwitchListTile(
title: Text(widget.course!),
subtitle: Text(subtitle),
value: _isCourseBundled,
onChanged: (newValue) {
setState(() {
_isCourseBundled = newValue;
});
},
);
}
}
class _SignInPage extends StatelessWidget {
const _SignInPage();
@override
Widget build(BuildContext context) {
final localizations = GalleryLocalizations.of(context);
return LayoutBuilder(
builder: (context, constraints) {
final maxHeight = constraints.maxHeight;
const spacing = SizedBox(height: 10);
return Container(
constraints: const BoxConstraints(maxWidth: 400),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: maxHeight / 10),
Image.asset(
'placeholders/avatar_logo.png',
package: 'flutter_gallery_assets',
width: 80,
height: 80,
),
spacing,
Text(
localizations!.demoSharedXAxisSignInWelcomeText,
style: Theme.of(context).textTheme.headlineSmall,
),
spacing,
Text(
localizations.demoSharedXAxisSignInSubtitleText,
style: const TextStyle(
fontSize: 12,
color: Colors.grey,
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsetsDirectional.only(
top: 40,
start: 10,
end: 10,
bottom: 10,
),
child: TextField(
decoration: InputDecoration(
suffixIcon: const Icon(
Icons.visibility,
size: 20,
color: Colors.black54,
),
labelText:
localizations.demoSharedXAxisSignInTextFieldLabel,
border: const OutlineInputBorder(),
),
),
),
TextButton(
onPressed: () {},
child: Text(
localizations.demoSharedXAxisForgotEmailButtonText,
),
),
spacing,
TextButton(
onPressed: () {},
child: Text(
localizations.demoSharedXAxisCreateAccountButtonText,
),
),
],
),
],
),
);
},
);
}
}
// END sharedXAxisTransitionDemo
| gallery/lib/demos/reference/motion_demo_shared_x_axis_transition.dart/0 | {
"file_path": "gallery/lib/demos/reference/motion_demo_shared_x_axis_transition.dart",
"repo_id": "gallery",
"token_count": 3989
} | 805 |
{
"loading": "Բեռնում",
"deselect": "Ապընտրել",
"select": "Ընտրել",
"selectable": "Կարելի է ընտրել (երկար սեղմել)",
"selected": "Ընտրված է",
"demo": "Դեմո",
"bottomAppBar": "Հավելվածների ստորին գոտի",
"notSelected": "Ընտրված չէ",
"demoCupertinoSearchTextFieldTitle": "Որոնման տեքստի վանդակ",
"demoCupertinoPicker": "Ընտրիչ",
"demoCupertinoSearchTextFieldSubtitle": "iOS-ի ոճով որոնման տեքստի վանդակ",
"demoCupertinoSearchTextFieldDescription": "Որոնման տեքստի վանդակ, որի միջոցով օգտատերերը կարող են որոնում կատարել՝ մուտքագրելով տեքստ, և որը կարող է տրամադրել և զտել առաջարկներ։",
"demoCupertinoSearchTextFieldPlaceholder": "Մուտքագրեք տեքստ",
"demoCupertinoScrollbarTitle": "Ոլորագոտի",
"demoCupertinoScrollbarSubtitle": "iOS-ի ոճով ոլորագոտի",
"demoCupertinoScrollbarDescription": "Ոլորագոտի, որը դարձում է ենթավիջեթը",
"demoTwoPaneItem": "Տարր {value}",
"demoTwoPaneList": "Ցանկ",
"demoTwoPaneFoldableLabel": "Ծալվող",
"demoTwoPaneSmallScreenLabel": "Փոքր էկրան",
"demoTwoPaneSmallScreenDescription": "Ահա թե ինչպես է TwoPane-ը աշխատում փոքր էկրանով սարքում։",
"demoTwoPaneTabletLabel": "Պլանշետ կամ համակարգիչ",
"demoTwoPaneTabletDescription": "Ահա թե ինչպես է TwoPane-ը աշխատում ավելի մեծ էկրանով սարքում, օրինակ՝ պլանշետում կամ համակարգչում։",
"demoTwoPaneTitle": "TwoPane",
"demoTwoPaneSubtitle": "Ադապտիվ դասավորություններ ծալվող սարքերում, ինչպես նաև մեծ և փոքր էկրաններով սարքերում",
"splashSelectDemo": "Ընտրեք դեմո տարբերակ",
"demoTwoPaneFoldableDescription": "Ահա թե ինչպես է TwoPane-ը աշխատում ծալվող սարքում։",
"demoTwoPaneDetails": "Մանրամասներ",
"demoTwoPaneSelectItem": "Ընտրեք տարր",
"demoTwoPaneItemDetails": "Տարր {value}-ի մանրամասներ",
"demoCupertinoContextMenuActionText": "Հպեք Flutter-ի լոգոյին և պահեք՝ տեղային ընտրացանկը տեսնելու համար։",
"demoCupertinoContextMenuDescription": "Լիաէկրան տեղային ընտրացանկ՝ iOS-ի ոճով, որը բացվում է՝ տարրը երկար սեղմելիս։",
"demoAppBarTitle": "Հավելվածի գոտի",
"demoAppBarDescription": "Հավելվածի գոտում ցուցադրված են ընթացիկ էկրանին առնչվող բովանդակությունն ու գործողությունները։ Այն օգտագործվում է բրենդինգի, էկրանների վերնագրերի, նավիգացիայի և գործողությունների համար։",
"demoDividerTitle": "Բաժանիչ",
"demoDividerSubtitle": "Բաժանիչը բարակ գիծ է, որը բովանդակությունը խմբավորում է ցանկերում և մակետներում։",
"demoDividerDescription": "Բաժանիչները կարող են օգտագործվել ցանկերում, դարակներում և այլ տեղերում՝ բովանդակությունն առանձնացնելու համար։",
"demoVerticalDividerTitle": "Ուղղաձիգ բաժանիչ",
"demoCupertinoContextMenuTitle": "Տեղային ընտրացանկ",
"demoCupertinoContextMenuSubtitle": "iOS-ի ոճով տեղային ընտրացանկ",
"demoAppBarSubtitle": "Ցուցադրում է ընթացիկ էկրանին առնչվող տեղեկություններն ու գործողությունները",
"demoCupertinoContextMenuActionOne": "Գործողություն 1",
"demoCupertinoContextMenuActionTwo": "Գործողություն 2",
"demoDateRangePickerDescription": "Ցուցադրում է երկխոսության պատուհան, որը պարունակում է Material Design-ի ոճով ամսաթվերի միջակայքի ընտրիչ։",
"demoDateRangePickerTitle": "Ամսաթվերի միջակայքի ընտրիչ",
"demoNavigationDrawerUserName": "Օգտանուն",
"demoNavigationDrawerUserEmail": "[email protected]",
"demoNavigationDrawerText": "Դարակը բացելու համար մատը սահեցրեք եզրից կամ հպեք վերևի ձախ անկյունի պատկերակին։",
"demoNavigationRailTitle": "Նավիգացիայի գոտի",
"demoNavigationRailSubtitle": "Նավիգացիայի գոտու ցուցադրում հավելվածում",
"demoNavigationRailDescription": "Material Design ոճի վիջեթ, որը ցուցադրվում է հավելվածի աջ կամ ձախ մասում և պարունակում է քիչ թվով պատկերակներ (սովորաբար երեքից հինգ)։",
"demoNavigationRailFirst": "Առաջին",
"demoNavigationDrawerTitle": "Նավիգացիայի դարակ",
"demoNavigationRailThird": "Երրորդ",
"replyStarredLabel": "Աստղանշված",
"demoTextButtonDescription": "Սեղմելու դեպքում տեքստային կոճակը չի բարձրանում։ Դրա փոխարեն էկրանին հայտնվում է թանաքի հետք։ Այսպիսի կոճակներն օգտագործեք գործիքագոտիներում, երկխոսության պատուհաններում և տեղադրեք դրանք դաշտերում։",
"demoElevatedButtonTitle": "Բարձրացված կոճակ",
"demoElevatedButtonDescription": "Բարձրացված կոճակները թույլ են տալիս հարթ մակերեսները դարձնել ավելի ծավալային, իսկ հագեցած և լայն էջերի գործառույթները՝ ավելի տեսանելի։",
"demoOutlinedButtonTitle": "Ուրվագծային կոճակ",
"demoOutlinedButtonDescription": "Ուրվագծային կոճակները սեղմելիս դառնում են անթափանց և բարձրանում են։ Դրանք հաճախ օգտագործվում են բարձրացված կոճակների հետ՝ որևէ լրացուցիչ, այլընտրանքային գործողություն ընդգծելու համար։",
"demoContainerTransformDemoInstructions": "Քարտեր, ցանկեր և գործողության լողացող կոճակներ",
"demoNavigationDrawerSubtitle": "Դարակի ցուցադրում հավելվածի գոտում",
"replyDescription": "Փոստային հավելված` արդյունավետ հաղորդակցման համար",
"demoNavigationDrawerDescription": "Material Design ոճի հորիզոնական վահանակ, որը սահում է էկրանի եզրից և պարունակում է հավելվածում նավիգացիայի հղումներ։",
"replyDraftsLabel": "Սևագրեր",
"demoNavigationDrawerToPageOne": "Կետ մեկ",
"replyInboxLabel": "Մուտքային",
"demoSharedXAxisDemoInstructions": "«Առաջ» և «Հետ» կոճակներ",
"replySpamLabel": "Սպամ",
"replyTrashLabel": "Աղբարկղ",
"replySentLabel": "Ուղարկված",
"demoNavigationRailSecond": "Երկրորդ",
"demoNavigationDrawerToPageTwo": "Կետ երկու",
"demoFadeScaleDemoInstructions": "Մոդալ և լողացող կոճակներ",
"demoFadeThroughDemoInstructions": "Նավիգացիա էկրանի ներքևի հատվածում",
"demoSharedZAxisDemoInstructions": "«Կարգավորումներ» կոճակ",
"demoSharedYAxisDemoInstructions": "Տեսակավորել ըստ «Վերջերս նվագարկված» պարամետրի",
"demoTextButtonTitle": "Տեքստային կոճակ",
"demoSharedZAxisBeefSandwichRecipeTitle": "Տավարի մսով սենդվիչ",
"demoSharedZAxisDessertRecipeDescription": "Աղանդերի բաղադրատոմս",
"demoSharedYAxisAlbumTileSubtitle": "Կատարող",
"demoSharedYAxisAlbumTileTitle": "Ալբոմ",
"demoSharedYAxisRecentSortTitle": "Վերջերս նվագարկվածները",
"demoSharedYAxisAlphabeticalSortTitle": "A–Z",
"demoSharedYAxisAlbumCount": "268 ալբոմ",
"demoSharedYAxisTitle": "Ընդհանուր Y առանցք",
"demoSharedXAxisCreateAccountButtonText": "ՍՏԵՂԾԵԼ ՀԱՇԻՎ",
"demoFadeScaleAlertDialogDiscardButton": "ՉԵՂԱՐԿԵԼ",
"demoSharedXAxisSignInTextFieldLabel": "Էլ․ հասցե կամ հեռախոսահամար",
"demoSharedXAxisSignInSubtitleText": "Մտեք ձեր հաշիվ",
"demoSharedXAxisSignInWelcomeText": "Ողջույն, David Park",
"demoSharedXAxisIndividualCourseSubtitle": "Ցուցադրված է առանձին",
"demoSharedXAxisBundledCourseSubtitle": "Փաթեթով",
"demoFadeThroughAlbumsDestination": "Ալբոմներ",
"demoSharedXAxisDesignCourseTitle": "Դիզայն",
"demoSharedXAxisIllustrationCourseTitle": "Պատկերազարդում",
"demoSharedXAxisBusinessCourseTitle": "Բիզնես",
"demoSharedXAxisArtsAndCraftsCourseTitle": "Արվեստ և արհեստներ",
"demoMotionPlaceholderSubtitle": "Լրացուցիչ տեքստ",
"demoFadeScaleAlertDialogCancelButton": "ՉԵՂԱՐԿԵԼ",
"demoFadeScaleAlertDialogHeader": "Երկխոսության պատուհան՝ ծանուցումով",
"demoFadeScaleHideFabButton": "ԹԱՔՑՆԵԼ ԳՈՐԾՈՂՈՒԹՅԱՆ ԼՈՂԱՑՈՂ ԿՈՃԱԿԸ",
"demoFadeScaleShowFabButton": "ՑՈՒՑԱԴՐԵԼ ԳՈՐԾՈՂՈՒԹՅԱՆ ԼՈՂԱՑՈՂ ԿՈՃԱԿԸ",
"demoFadeScaleShowAlertDialogButton": "ՑՈՒՑԱԴՐԵԼ ՄՈԴԱԼ ՊԱՏՈՒՀԱՆԸ",
"demoFadeScaleDescription": "Այս էֆեկտն օգտագործվում է միջերեսի այն տարրերի համար, որոնք հայտնվում կամ անհետանում են էկրանի սահմաններում։ Օրինակ՝ երկխոսության պատուհանը, որը հայտնվում, այնուհետև անհետանում է էկրանի կենտրոնում։",
"demoFadeScaleTitle": "Սահուն հայտնվում կամ անհետացում",
"demoFadeThroughTextPlaceholder": "123 լուսանկար",
"demoFadeThroughSearchDestination": "Որոնում",
"demoFadeThroughPhotosDestination": "Լուսանկարներ",
"demoSharedXAxisCoursePageSubtitle": "Կատեգորիաների փաթեթները ֆիդում հայտնվում են խմբերի տեսքով։ Դուք ցանկացած ժամանակ կարող եք փոխել սա։",
"demoFadeThroughDescription": "Սահուն անցումն օգտագործվում է միջերեսի այն տարրերի միջև անցում կատարելու համար, որոնց միջև սերտ կապ չկա։",
"demoFadeThroughTitle": "Սահուն անցում",
"demoSharedZAxisHelpSettingLabel": "Օգնություն",
"demoMotionSubtitle": "Բոլոր ստանդարտ անցումները",
"demoSharedZAxisNotificationSettingLabel": "Ծանուցումներ",
"demoSharedZAxisProfileSettingLabel": "Պրոֆիլ",
"demoSharedZAxisSavedRecipesListTitle": "Պահված բաղադրատոմսեր",
"demoSharedZAxisBeefSandwichRecipeDescription": "Տավարի մսով սենդվիչի բաղադրատոմս",
"demoSharedZAxisCrabPlateRecipeDescription": "Խաչափառով ուտեստի բաղադրատոմս",
"demoSharedXAxisCoursePageTitle": "Կանոնակարգեք ձեր դասընթացները",
"demoSharedZAxisCrabPlateRecipeTitle": "Խաչափառ",
"demoSharedZAxisShrimpPlateRecipeDescription": "Ծովախեցգետնով ուտեստի բաղադրատոմս",
"demoSharedZAxisShrimpPlateRecipeTitle": "Ծովախեցգետին",
"demoContainerTransformTypeFadeThrough": "ՍԱՀՈՒՆ ԱՆՑՈՒՄ",
"demoSharedZAxisDessertRecipeTitle": "Աղանդեր",
"demoSharedZAxisSandwichRecipeDescription": "Սենդվիչի բաղադրատոմս",
"demoSharedZAxisSandwichRecipeTitle": "Սենդվիչ",
"demoSharedZAxisBurgerRecipeDescription": "Բուրգերի բաղադրատոմս",
"demoSharedZAxisBurgerRecipeTitle": "Բուրգեր",
"demoSharedZAxisSettingsPageTitle": "Կարգավորումներ",
"demoSharedZAxisTitle": "Ընդհանուր Z առանցք",
"demoSharedZAxisPrivacySettingLabel": "Գաղտնիություն",
"demoMotionTitle": "Շարժում",
"demoContainerTransformTitle": "Զետեղարանի փոխակերպում",
"demoContainerTransformDescription": "Զետեղարանի փոխակերպումը նախատեսված է միջերեսի՝ զետեղարան պարունակող տարրերի միջև անցումների համար։ Այս էֆեկտը տեսանելի կապ է հաստատում միջերեսի երկու տարրերի միջև։",
"demoContainerTransformModalBottomSheetTitle": "Սահուն հայտնվելու կամ անհետանալու ռեժիմ",
"demoContainerTransformTypeFade": "ՍԱՀՈՒՆ ՀԱՅՏՆՎՈՒՄ ԿԱՄ ԱՆՀԵՏԱՑՈՒՄ",
"demoSharedYAxisAlbumTileDurationUnit": "ր",
"demoMotionPlaceholderTitle": "Անվանում",
"demoSharedXAxisForgotEmailButtonText": "ԷԼ․ ՀԱՍՑԵՆ ՄՈՌԱՑԵ՞Լ ԵՔ",
"demoMotionSmallPlaceholderSubtitle": "Լրացուցիչ",
"demoMotionDetailsPageTitle": "Մանրամասների էջ",
"demoMotionListTileTitle": "Ցանկի կետ",
"demoSharedAxisDescription": "Ընդհանուր առանցքի էֆեկտը օգտագործվում է միջերեսի այն տարրերի միջև անցում կատարելու ամար, որոնք կարծես թե տեղակայված են մեկ առանցքի վրա։ Տարրերի միջև կապն ամրապնդելու համար օգտագործվում է համատեղ փոխակերպումը X, Y կամ Z առանցքներով։",
"demoSharedXAxisTitle": "Ընդհանուր X առանցք",
"demoSharedXAxisBackButtonText": "ՀԵՏ",
"demoSharedXAxisNextButtonText": "ԱՌԱՋ",
"demoSharedXAxisCulinaryCourseTitle": "Խոհարարություն",
"githubRepo": "{repoName} GitHub-ի շտեմարան",
"fortnightlyMenuUS": "ԱՄՆ",
"fortnightlyMenuBusiness": "Բիզնես",
"fortnightlyMenuScience": "Գիտություն",
"fortnightlyMenuSports": "Սպորտ",
"fortnightlyMenuTravel": "Ճանապարհորդություն",
"fortnightlyMenuCulture": "Մշակույթ",
"fortnightlyTrendingTechDesign": "TechDesign",
"rallyBudgetDetailAmountLeft": "Մնացած գումարը",
"fortnightlyHeadlineArmy": "Կանաչ բանակի ներքին բարեփոխումներ",
"fortnightlyDescription": "Նորությունների հավելված, որում կարևորը բովանդակությունն է",
"rallyBillDetailAmountDue": "Վճարման ենթակա գումարը",
"rallyBudgetDetailTotalCap": "Ընդհանուր սահմանաչափ",
"rallyBudgetDetailAmountUsed": "Օգտագործված գումարը",
"fortnightlyTrendingHealthcareRevolution": "HealthcareRevolution",
"fortnightlyMenuFrontPage": "Առաջին էջ",
"fortnightlyMenuWorld": "Աշխարհ",
"rallyBillDetailAmountPaid": "Վճարված գումարը",
"fortnightlyMenuPolitics": "Քաղաքականություն",
"fortnightlyHeadlineBees": "Գյուղատնտեսության մեջ մեղուների պակաս է գրանցվել",
"fortnightlyHeadlineGasoline": "Բենզինի ապագան",
"fortnightlyTrendingGreenArmy": "GreenArmy",
"fortnightlyHeadlineFeminists": "Ֆեմինիստները պարտիզանական պատերազմի են պատրաստվում",
"fortnightlyHeadlineFabrics": "Դիզայներներն օգտագործում են նոր տեխնոլոգիաները՝ ֆուտուրիստական գործվածքներ ստեղծելու համար",
"fortnightlyHeadlineStocks": "Բաժնետոմսերի փոխարժեքի ստագնացիայի պատճառով շատերը նախընտրությունը տալիս են արժույթին",
"fortnightlyTrendingReform": "Reform",
"fortnightlyMenuTech": "Տեխնոլոգիաներ",
"fortnightlyHeadlineWar": "Պատերազմի հետևանքով բաժանված ամերիկացիների կյանքը",
"fortnightlyHeadlineHealthcare": "Առողջապահության համակարգի հանգիստ, բայց լուրջ հետևանքներով հեղափոխություն",
"fortnightlyLatestUpdates": "Վերջին թարմացումները",
"fortnightlyTrendingStocks": "Stocks",
"rallyBillDetailTotalAmount": "Ընդհանուր գումարը",
"demoCupertinoPickerDateTime": "Ամսաթիվ և ժամ",
"signIn": "ՄՈՒՏՔ",
"dataTableRowWithSugar": "{value} շաքարով",
"dataTableRowApplePie": "Խնձորի կարկանդակ",
"dataTableRowDonut": "Օղաբլիթ",
"dataTableRowHoneycomb": "Մեղրաբջիջ",
"dataTableRowLollipop": "Սառնաշաքար",
"dataTableRowJellyBean": "Ժելե-կոնֆետներ",
"dataTableRowGingerbread": "Կոճապղպեղի անուշահաց",
"dataTableRowCupcake": "Կեքս",
"dataTableRowEclair": "Էկլեր",
"dataTableRowIceCreamSandwich": "Պաղպաղակի սենդվիչ",
"dataTableRowFrozenYogurt": "Սառեցված յոգուրտ",
"dataTableColumnIron": "Երկաթ (%)",
"dataTableColumnCalcium": "Կալցիում (%)",
"dataTableColumnSodium": "Նատրիում (մգ)",
"demoTimePickerTitle": "Ժամի ընտրիչ",
"demo2dTransformationsResetTooltip": "Վերակայել փոխակերպումները",
"dataTableColumnFat": "Ճարպեր (գ)",
"dataTableColumnCalories": "Կալորիաներ",
"dataTableColumnDessert": "Աղանդեր (1 բաժին)",
"cardsDemoTravelDestinationLocation1": "Թանջավուր, Թամիլ Նադու",
"demoTimePickerDescription": "Ցուցադրում է երկխոսության պատուհան, որը պարունակում է Material Design-ի ոճով ժամի ընտրիչ։",
"demoPickersShowPicker": "ՑՈՒՑԱԴՐԵԼ ԸՆՏՐԻՉԸ",
"demoTabsScrollingTitle": "Ոլորում",
"demoTabsNonScrollingTitle": "Առանց ոլորման",
"craneHours": "{hours,plural,=1{1 ժ}other{{hours} ժ}}",
"craneMinutes": "{minutes,plural,=1{1 ր}other{{minutes} ր}}",
"craneFlightDuration": "{hoursShortForm} {minutesShortForm}",
"dataTableHeader": "Սնունդ",
"demoDatePickerTitle": "Ամսաթվի ընտրիչ",
"demoPickersSubtitle": "Ամսաթվի և ժամի ընտրություն",
"demoPickersTitle": "Ընտրիչներ",
"demo2dTransformationsEditTooltip": "Փոփոխել սալիկը",
"demoDataTableDescription": "Տվյալների աղյուսակները ցուցադրում են տեղեկություններ տողերի և սյունակների ցանցի տեսքով։ Դրանք դասավորում են տեղեկություններն այնպես, որ հեշտ լինի որոնում կատարելը, ինչպես նաև նմուշներ և վիճակագրություն գտնելը։",
"demo2dTransformationsDescription": "Հպեք՝ սալիկները փոփոխելու համար։ Համայնապատկերումը կառավարեք ժեստերի միջոցով։ Մասշտաբը կարգավորելու համար կարող եք մոտեցնել կամ հեռացնել մատները։ Երկու մատների օգնությամբ կարող եք նաև պտտել օբյեկտը։ Սկզբնական պարամետրերին վերադառնալու համար սեղմեք վերակայման կոճակը։",
"demo2dTransformationsSubtitle": "Համայնապատկերում, մասշտաբավորում, պտտում",
"demo2dTransformationsTitle": "2D փոխակերպումներ",
"demoCupertinoTextFieldPIN": "PIN կոդ",
"demoCupertinoTextFieldDescription": "Տեքստային դաշտը օգտատիրոջը թույլ է տալիս մուտքագրել տեքստ սովորական կամ էկրանային ստեղնաշարի օգնությամբ։",
"demoCupertinoTextFieldSubtitle": "iOS-ի ոճով տեքստային դաշտեր",
"demoCupertinoTextFieldTitle": "Տեքստային դաշտեր",
"demoDatePickerDescription": "Ցուցադրում է երկխոսության պատուհան, որը պարունակում է Material Design-ի ոճով ամսաթվի ընտրիչ։",
"demoCupertinoPickerTime": "Ժամ",
"demoCupertinoPickerDate": "Ամսաթիվ",
"demoCupertinoPickerTimer": "Ժամաչափ",
"demoCupertinoPickerDescription": "iOS-ի ոճով ընտրիչի վիջեթ, որի միջոցով կարելի է ընտրել տողեր, ամսաթվեր, ժամեր կամ ամսաթիվն ու ժամը միասին։",
"demoCupertinoPickerSubtitle": "iOS-ի ոճով ընտրիչներ",
"demoCupertinoPickerTitle": "Ընտրիչներ",
"dataTableRowWithHoney": "{value} մեղրով",
"cardsDemoTravelDestinationCity2": "Չետինադ",
"bannerDemoResetText": "Վերակայել ազդերիզը",
"bannerDemoMultipleText": "Մի քանի գործողություն",
"bannerDemoLeadingText": "Առաջատար պատկերակ",
"dismiss": "ՓԱԿԵԼ",
"cardsDemoTappable": "Հպելի",
"cardsDemoSelectable": "Ընտրելի (երկար սեղմել)",
"cardsDemoExplore": "Իմանալ ավելին",
"cardsDemoExploreSemantics": "{destinationName}․ իմանալ ավելին",
"cardsDemoShareSemantics": "{destinationName}․ կիսվել",
"cardsDemoTravelDestinationTitle1": "Այցելելու լավագույն 10 քաղաքները Թամիլ Նադուում",
"cardsDemoTravelDestinationDescription1": "Համար 10",
"cardsDemoTravelDestinationCity1": "Թանջավուր",
"dataTableColumnProtein": "Սպիտակուցներ (գ)",
"cardsDemoTravelDestinationTitle2": "Հարավային Հնդկաստանի արհեստավորները",
"cardsDemoTravelDestinationDescription2": "Մետաքսագործներ",
"bannerDemoText": "Ձեր գաղտնաբառը թարմացվել է ձեր մյուս սարքում։ Նորից մուտք գործեք հաշիվ։",
"cardsDemoTravelDestinationLocation2": "Շիվագանգա, Թամիլ Նադու",
"cardsDemoTravelDestinationTitle3": "Բրիհադիշվարա տաճար",
"cardsDemoTravelDestinationDescription3": "Տաճարներ",
"demoBannerTitle": "Ազդերիզ",
"demoBannerSubtitle": "Ազդերիզի ցուցադրում ցանկում",
"demoBannerDescription": "Ազդերիզը ցուցադրում է կարևոր, համառոտ հաղորդագրություն և գործողությունների ցանկ, որոնք պետք է կատարեն օգտատերերը (նրանք կարող են նաև փակել ազդերիզը)։ Առանց օգտատիրոջ գործողության հնարավոր չէ փակել ազդերիզը։",
"demoCardTitle": "Քարտեր",
"demoCardSubtitle": "Հիմնական քարտեր՝ կլորացված անկյուններով",
"demoCardDescription": "Քարտը մի թերթիկ է, որը պարունակում է առչնվող տեղեկություններ որևէ բանի (օր․՝ ալբոմի, գտնվելու վայրի, ճաշատեսակի, կոնտակտային տվյալների) մասին։",
"demoDataTableTitle": "Տվյալների աղյուսակներ",
"demoDataTableSubtitle": "Տեղեկություններ պարունակող տողեր և սյունակներ",
"dataTableColumnCarbs": "Ածխաջրեր (գ)",
"placeTanjore": "Թանջավուր",
"demoGridListsTitle": "Ցանցաձև ցանկեր",
"placeFlowerMarket": "Ծաղիկների շուկա",
"placeBronzeWorks": "Բրոնզե աշխատանքներ",
"placeMarket": "Շուկա",
"placeThanjavurTemple": "Թանջավուրի տաճար",
"placeSaltFarm": "Աղի հանք",
"placeScooters": "Մոտոցիկլետներ",
"placeSilkMaker": "Մետաքսագործ",
"placeLunchPrep": "Ճաշի պատրաստում",
"placeBeach": "Ծովափ",
"placeFisherman": "Ձկնորս",
"demoMenuSelected": "Ընտրված է՝ {value}",
"demoMenuRemove": "Ջնջել",
"demoMenuGetLink": "Ստանալ հղումը",
"demoMenuShare": "Կիսվել",
"demoBottomAppBarSubtitle": "Էկրանի ներքևի հատվածում ցուցադրում է նավիգացիայի տարրերն ու հասանելի գործողությունները",
"demoMenuAnItemWithASectionedMenu": "Բաժիններ պարունակող ընտրացանկով տարր",
"demoMenuADisabledMenuItem": "Ընտրացանկի ոչ ակտիվ տարր",
"demoLinearProgressIndicatorTitle": "Ընթացքի գծային ցուցիչ",
"demoMenuContextMenuItemOne": "Տեղային ընտրացանկի տարր 1",
"demoMenuAnItemWithASimpleMenu": "Պարզ ընտրացանկով տարր",
"demoCustomSlidersTitle": "Հատուկ սահիչներ",
"demoMenuAnItemWithAChecklistMenu": "Ստուգաթերթ պարունակող ընտրացանկով տարր",
"demoCupertinoActivityIndicatorTitle": "Գործողությունների ցուցիչ",
"demoCupertinoActivityIndicatorSubtitle": "Գործողությունների՝ iOS-ի ոճով ցուցիչներ",
"demoCupertinoActivityIndicatorDescription": "Գործողությունների՝ iOS-ի ոճով ցուցիչ, որը պտտվում է ժամացույցի սլաքի ուղղությամբ։",
"demoCupertinoNavigationBarTitle": "Նավիգացիայի գոտի",
"demoCupertinoNavigationBarSubtitle": "iOS-ի ոճով նավիգացիայի գոտի",
"demoCupertinoNavigationBarDescription": "iOS-ի ոճով նավիգացիայի գոտի։ Նավիգացիայի գոտին գտնվում է գործիքագոտու մեջտեղում և հնարավորինս փոքր տարբերակով պարունակում է էջի վերնագիրը։",
"demoCupertinoPullToRefreshTitle": "Քաշել՝ թարմացնելու համար",
"demoCupertinoPullToRefreshSubtitle": "iOS-ի ոճով «Քաշել՝ թարմացնելու համար» կառավար",
"demoCupertinoPullToRefreshDescription": "Վիջեթ, որը կառավարում է iOS-ի ոճով «Քաշել՝ թարմացնելու համար» բովանդակությունը։",
"demoProgressIndicatorTitle": "Ընթացքի ցուցիչներ",
"demoProgressIndicatorSubtitle": "Գծային, շրջանաձև և անորոշ",
"demoCircularProgressIndicatorTitle": "Ընթացքի շրջանաձև ցուցիչ",
"demoCircularProgressIndicatorDescription": "Ընթացքի՝ Material Design-ի ոճով շրջանաձև ցուցիչը ցույց է տալիս, որ հավելվածը մշակում է օգտատիրոջ հարցումը։",
"demoMenuFour": "չորս",
"demoLinearProgressIndicatorDescription": "Ընթացքի՝ Material Design-ի ոճով գծային ցուցիչ, որը նաև անվանում են ընթացագոտի։",
"demoTooltipTitle": "Հուշումներ",
"demoTooltipSubtitle": "Կարճ հաղորդագրություն, որը ցուցադրվում է երկար սեղմման կամ նշորդն անցկացնելու դեպքում",
"demoTooltipDescription": "Հուշումները տեքստային պիտակների օգնությամբ նկարագրում են կոճակի գործառույթը և միջերեսի մյուս գործողությունները։ Հուշումներում ցուցադրվում են տեքստ պարունակող տեղեկություններ, երբ օգտատերը նշորդն անց է կացնում տարրի վրայով, պահում կամ երկար սեղմում դրա վրա։",
"demoTooltipInstructions": "Երկար սեղմեք կամ նշորդն անցկացրեք՝ հուշումները ցուցադրելու համար։",
"placeChennai": "Չեննայ",
"demoMenuChecked": "Նշված է՝ {value}",
"placeChettinad": "Չետինադ",
"demoMenuPreview": "Դիտել",
"demoBottomAppBarTitle": "Հավելվածների ստորին գոտի",
"demoBottomAppBarDescription": "Հավելվածների ստորին գոտում կարելի է տեղակայել նավիգացիայի դարակը և մինչև չորս գործողություն, այդ թվում գործողության լողացող կոճակը։",
"bottomAppBarNotch": "Կտրվածք",
"bottomAppBarPosition": "Գործողության լողացող կոճակի դիրքը",
"bottomAppBarPositionDockedEnd": "Վահանակի վրա՝ վերջում",
"bottomAppBarPositionDockedCenter": "Վահանակի վրա՝ կենտրոնում",
"bottomAppBarPositionFloatingEnd": "Վահանակի վերևում՝ վերջում",
"bottomAppBarPositionFloatingCenter": "Վահանակի վերևում՝ կենտրոնում",
"demoSlidersEditableNumericalValue": "Թվային արժեք",
"demoGridListsSubtitle": "Տողերի և սյունակների դասավորությունը",
"demoGridListsDescription": "Ցանցաձև ցանկերը հարմարեցված են միատեսակ տվյալների (սովորաբար պատկերների) ցուցադրման համար։ Ցանցաձև ցանկի տարրերը կոչվում են սալիկներ։",
"demoGridListsImageOnlyTitle": "Միայն պատկերներ",
"demoGridListsHeaderTitle": "Էջագլխով",
"demoGridListsFooterTitle": "Էջատակով",
"demoSlidersTitle": "Սահիչներ",
"demoSlidersSubtitle": "Որոշակի արժեք ընտրելու համար օգտատերը պետք է մատն էկրանի վրայով սահեցնի",
"demoSlidersDescription": "Սահիչները թույլ են տալիս ընտրել անհրաժեշտ արժեքը տրված միջակայքում։ Սահիչների օգնությամբ հեշտությամբ կարող եք կարգավորել ձայնի մակարդակը, պայծառությունն ու պատկերների զտիչները։",
"demoRangeSlidersTitle": "Միջակայքի սահիչներ",
"demoRangeSlidersDescription": "Սահիչները թույլ են տալիս ընտրել անհրաժեշտ արժեքը տրված միջակայքում։ Պարզության համար, միջակայքի եզրերով կարող եք տեղակայել պատկերակներ։ Սահիչների օգնությամբ հեշտությամբ կարող եք կարգավորել ձայնի մակարդակը, պայծառությունն ու պատկերների զտիչները։",
"demoMenuAnItemWithAContextMenuButton": "Տեղային ընտրացանկով տարր",
"demoCustomSlidersDescription": "Սահիչները թույլ են տալիս ընտրել արժեքներից որևէ մեկը կամ նշել արժեքների միջակայքը։ Սահիչները կարելի է անհատականացնել սեփական թեմայով և կարգավորումներով։",
"demoSlidersContinuousWithEditableNumericalValue": "Շարունակական սահիչ՝ թվային արժեքը խմբագրելու հնարավորությամբ",
"demoSlidersDiscrete": "Դիսկրետ",
"demoSlidersDiscreteSliderWithCustomTheme": "Դիսկրետ սահիչ՝ անհատականացված թեմայով",
"demoSlidersContinuousRangeSliderWithCustomTheme": "Միջակայքի շարունակական սահիչ՝ անհատականացված թեմայով",
"demoSlidersContinuous": "Շարունակական",
"placePondicherry": "Պոնդիչերի",
"demoMenuTitle": "Ընտրացանկ",
"demoContextMenuTitle": "Տեղային ընտրացանկ",
"demoSectionedMenuTitle": "Բաժիններ պարունակող ընտրացանկ",
"demoSimpleMenuTitle": "Պարզ ընտրացանկ",
"demoChecklistMenuTitle": "Ստուգաթերթ պարունակող ընտրացանկ",
"demoMenuSubtitle": "Ընտրացանկի կոճակներ և պարզ ընտրացանկեր",
"demoMenuDescription": "Ընտրացանկը ցուցադրում է ընտրանքների ցանկ ժամանակավոր մակերեսին։ Դրանք ցուցադրվում են, երբ օգտատերերը սեղմում են կոճակին կամ այլ գործողություն են կատարում։",
"demoMenuItemValueOne": "Ընտրացանկի տարր 1",
"demoMenuItemValueTwo": "Ընտրացանկի տարր 2",
"demoMenuItemValueThree": "Ընտրացանկի տարր 3",
"demoMenuOne": "մեկ",
"demoMenuTwo": "երկու",
"demoMenuThree": "երեք",
"demoMenuContextMenuItemThree": "Տեղային ընտրացանկի տարր 2",
"demoCupertinoSwitchSubtitle": "iOS-ի ոճով փոխանջատիչ",
"demoSnackbarsText": "Սա ծանուցումների տող է։",
"demoCupertinoSliderSubtitle": "iOS-ի ոճով սահիչ",
"demoCupertinoSliderDescription": "Սահիչի միջոցով նշված միջակայքում կարելի է որոշակի արժեք ընտրել։",
"demoCupertinoSliderContinuous": "Շարունակական՝ {value}",
"demoCupertinoSliderDiscrete": "Դիսկրետ՝ {value}",
"demoSnackbarsAction": "Դուք սեղմեցիք ծանուցումների տողի կոճակին։",
"backToGallery": "Վերադառնալ ցուցասրահ",
"demoCupertinoTabBarTitle": "Ներդիրների գոտի",
"demoCupertinoSwitchDescription": "Փոխանջատիչի միջոցով կարելի է միացնել կամ անջատել առանձին կարգավորումներ։",
"demoSnackbarsActionButtonLabel": "ԿՈՃԱԿ",
"cupertinoTabBarProfileTab": "Պրոֆիլ",
"demoSnackbarsButtonLabel": "ՑՈՒՑԱԴՐԵԼ ԾԱՆՈՒՑՈՒՄՆԵՐԻ ՏՈՂԸ",
"demoSnackbarsDescription": "Ծանուցումների տողերը օգտատերերին տեղեկացնում են հավելվածում կատարված կամ կատարվելիք գործողությունների մասին։ Դրանք հայտնվում են կարճ ժամանակով էկրանի ներքևի հատվածում։ Ծանուցումների տողերը չեն շեղում օգտատերերին, և դրանք փակելու կարիք չկա։",
"demoSnackbarsSubtitle": "Ծանուցումների տողերի հաղորդագրությունները ցուցադրվում են էկրանի ներքևի հատվածում",
"demoSnackbarsTitle": "Ծանուցումների տողեր",
"demoCupertinoSliderTitle": "Սահիչ",
"cupertinoTabBarChatTab": "Զրույց",
"cupertinoTabBarHomeTab": "Գլխավոր էջ",
"demoCupertinoTabBarDescription": "iOS-ի ոճի ստորին նավիգացիայի ներդիրի գոտի։ Ցուցադրում է մի քանի ներդիրներ, որոնցից մեկն ակտիվ է։ Ըստ կանխադրման՝ ակտիվ է համարվում առաջին ներդիրը։",
"demoCupertinoTabBarSubtitle": "iOS-ի ոճով ստորին ներդիրի գոտի",
"demoOptionsFeatureTitle": "Դիտեք ընտրանքները",
"demoOptionsFeatureDescription": "Հպեք այստեղ և դիտեք հնարավոր ընտրանքները ցուցադրական տարբերակի համար։",
"demoCodeViewerCopyAll": "ՊԱՏՃԵՆԵԼ ԱՄԲՈՂՋԸ",
"shrineScreenReaderRemoveProductButton": "{product}՝ հեռացնել",
"shrineScreenReaderProductAddToCart": "Ավելացնել զամբյուղում",
"shrineScreenReaderCart": "{quantity,plural,=0{Զամբյուղը դատարկ է}=1{Զամբյուղում 1 ապրանք կա}other{Զամբյուղում {quantity} ապրանք կա}}",
"demoCodeViewerFailedToCopyToClipboardMessage": "Չհաջողվեց պատճենել սեղմատախտակին՝ {error}",
"demoCodeViewerCopiedToClipboardMessage": "Պատճենվեց սեղմատախտակին։",
"craneSleep8SemanticLabel": "Մայաների ավերակները լողափից վեր՝ ժայռի վրա",
"craneSleep4SemanticLabel": "Լճամերձ հյուրանոց՝ լեռների ֆոնի վրա",
"craneSleep2SemanticLabel": "Մաչու Պիչու ամրոց",
"craneSleep1SemanticLabel": "Շալե՝ փշատերև ծառերով ձյունե լանդշաֆտի ֆոնի վրա",
"craneSleep0SemanticLabel": "Բունգալոներ ջրի վրա",
"craneFly13SemanticLabel": "Արմավենիներով շրջապատված ծովափնյա լողավազան",
"craneFly12SemanticLabel": "Արմավենիներով շրջապատված լողավազան",
"craneFly11SemanticLabel": "Աղյուսե փարոս՝ ծովի ֆոնի վրա",
"craneFly10SemanticLabel": "Ալ-Ազհարի մզկիթի մինարեթները մայրամուտին",
"craneFly9SemanticLabel": "Կապույտ ռետրո մեքենայի վրա հենված տղամարդ",
"craneFly8SemanticLabel": "Գերծառերի պուրակ",
"craneEat9SemanticLabel": "Թխվածքներով վաճառասեղան սրճարանում",
"craneEat2SemanticLabel": "Բուրգեր",
"craneFly5SemanticLabel": "Լճամերձ հյուրանոց՝ լեռների ֆոնի վրա",
"demoSelectionControlsSubtitle": "Նշավանդակներ, կետակոճակներ և փոխանջատիչներ",
"craneEat10SemanticLabel": "Պաստրամիով հսկայական սենդվիչ բռնած կին",
"craneFly4SemanticLabel": "Բունգալոներ ջրի վրա",
"craneEat7SemanticLabel": "Փռի մուտք",
"craneEat6SemanticLabel": "Ծովախեցգետնից ուտեստ",
"craneEat5SemanticLabel": "Ռեստորանի նորաձև սրահ",
"craneEat4SemanticLabel": "Շոկոլադե աղանդեր",
"craneEat3SemanticLabel": "Կորեական տակո",
"craneFly3SemanticLabel": "Մաչու Պիչու ամրոց",
"craneEat1SemanticLabel": "Բարձր աթոռներով դատարկ բառ",
"craneEat0SemanticLabel": "Պիցցա՝ փայտի վառարանում",
"craneSleep11SemanticLabel": "Թայբեյ 101 երկնաքեր",
"craneSleep10SemanticLabel": "Ալ-Ազհարի մզկիթի մինարեթները մայրամուտին",
"craneSleep9SemanticLabel": "Աղյուսե փարոս՝ ծովի ֆոնի վրա",
"craneEat8SemanticLabel": "Խեցգետինների ափսե",
"craneSleep7SemanticLabel": "Վառ տներ Ռիբեյրա հրապարակում",
"craneSleep6SemanticLabel": "Արմավենիներով շրջապատված լողավազան",
"craneSleep5SemanticLabel": "Վրան դաշտում",
"settingsButtonCloseLabel": "Փակել կարգավորումները",
"demoSelectionControlsCheckboxDescription": "Նշավանդակների միջոցով օգտատերը կարող է ցանկից ընտրել մի քանի կարգավորումներ։ Նշավանդակը սովորաբար ունենում է true կամ false կարգավիճակը, և որոշ դեպքերում երրորդ արժեքը՝ null։",
"settingsButtonLabel": "Կարգավորումներ",
"demoListsTitle": "Ցանկեր",
"demoListsSubtitle": "Ոլորման ցանկի դասավորություններ",
"demoListsDescription": "Ֆիքսված բարձրությամբ մեկ տող, որը սովորաբար պարունակում է տեքստ, ինչպես նաև պատկերակ՝ տեքստի սկզբում կամ վերջում։",
"demoOneLineListsTitle": "Մեկ գիծ",
"demoTwoLineListsTitle": "Երկու գիծ",
"demoListsSecondary": "Երկրորդական տեքստ",
"demoSelectionControlsTitle": "Ընտրության կառավարման տարրեր",
"craneFly7SemanticLabel": "Ռաշմոր լեռ",
"demoSelectionControlsCheckboxTitle": "Նշավանդակ",
"craneSleep3SemanticLabel": "Կապույտ ռետրո մեքենայի վրա հենված տղամարդ",
"demoSelectionControlsRadioTitle": "Ռադիո",
"demoSelectionControlsRadioDescription": "Կետակոճակների միջոցով օգտատերը կարող է ընտրել մեկ կարգավորում ցանկից։ Օգտագործեք կետակոճակները, եթե կարծում եք, որ օգտատիրոջն անհրաժեշտ է տեսնել բոլոր հասանելի կարգավորումներն իրար կողքի։",
"demoSelectionControlsSwitchTitle": "Փոխանջատիչ",
"demoSelectionControlsSwitchDescription": "Փոխանջատիչի միջոցով կարելի է միացնել կամ անջատել առանձին կարգավորումներ։ Կարգավորման անվանումը և կարգավիճակը պետք է պարզ երևան փոխանջատիչի կողքին։",
"craneFly0SemanticLabel": "Շալե՝ փշատերև ծառերով ձյունե լանդշաֆտի ֆոնի վրա",
"craneFly1SemanticLabel": "Վրան դաշտում",
"craneFly2SemanticLabel": "Աղոթքի դրոշներ՝ ձյունապատ լեռների ֆոնի վրա",
"craneFly6SemanticLabel": "Օդից տեսարան դեպի Գեղարվեստի պալատ",
"rallySeeAllAccounts": "Դիտել բոլոր հաշիվները",
"rallyBillAmount": "{amount} գումարի {billName} հաշիվը պետք է վճարվի՝ {date}։",
"shrineTooltipCloseCart": "Փակել զամբյուղը",
"shrineTooltipCloseMenu": "Փակել ընտրացանկը",
"shrineTooltipOpenMenu": "Բացել ընտրացանկը",
"shrineTooltipSettings": "Կարգավորումներ",
"shrineTooltipSearch": "Որոնել",
"demoTabsDescription": "Ներդիրները թույլ են տալիս դասավորել էկրանների, տվյալակազմերի բովանդակությունը և այլն։",
"demoTabsSubtitle": "Առանձին ոլորվող ներդիրներ",
"demoTabsTitle": "Ներդիրներ",
"rallyBudgetAmount": "Բյուջե՝ {budgetName}։ Ծախսվել է {amountUsed}՝ {amountTotal}-ից։ Մնացել է՝ {amountLeft}։",
"shrineTooltipRemoveItem": "Հեռացնել ապրանքը",
"rallyAccountAmount": "{amount} գումարի {accountName} հաշիվ ({accountNumber})։",
"rallySeeAllBudgets": "Դիտել բոլոր բյուջեները",
"rallySeeAllBills": "Դիտել բոլոր վճարումները",
"craneFormDate": "Ընտրել ամսաթիվ",
"craneFormOrigin": "Ընտրել սկզբնակետ",
"craneFly2": "Կհումբու հովիտ, Նեպալ",
"craneFly3": "Մաչու Պիկչու, Պերու",
"craneFly4": "Մալե, Մալդիվներ",
"craneFly5": "Վիցնաու, Շվեյցարիա",
"craneFly6": "Մեխիկո, Մեքսիկա",
"craneFly7": "Ռաշմոր լեռ, ԱՄՆ",
"settingsTextDirectionLocaleBased": "Տարածաշրջանային կարգավորումներ",
"craneFly9": "Հավանա, Կուբա",
"craneFly10": "Կահիրե, Եգիպտոս",
"craneFly11": "Լիսաբոն, Պորտուգալիա",
"craneFly12": "Նապա, ԱՄՆ",
"craneFly13": "Բալի, Ինդոնեզիա",
"craneSleep0": "Մալե, Մալդիվներ",
"craneSleep1": "Ասպեն, ԱՄՆ",
"craneSleep2": "Մաչու Պիկչու, Պերու",
"demoCupertinoSegmentedControlTitle": "Կառավարման սեգմենտավորված տարր",
"craneSleep4": "Վիցնաու, Շվեյցարիա",
"craneSleep5": "Բիգ Սուր, ԱՄՆ",
"craneSleep6": "Նապա, ԱՄՆ",
"craneSleep7": "Պորտու, Պորտուգալիք",
"craneSleep8": "Տուլում, Մեքսիկա",
"craneEat5": "Սեուլ, Հարավային Կորեա",
"demoChipTitle": "Չիպեր",
"demoChipSubtitle": "Կոմպակտ տարրեր, որոնք ներկայացնում են մուտքագրում, հատկանիշ կամ գործողություն",
"demoActionChipTitle": "Գործողության չիպ",
"demoActionChipDescription": "Գործողությունների ինտերակտիվ չիպերը կարգավորումների խումբ են, որոնք ակտիվացնում են հիմնական բովանդակության հետ կապված գործողություններ։ Այս չիպերը պետք է հայտնվեն դինամիկ կերպով և լրացնեն միջերեսը։",
"demoChoiceChipTitle": "Ընտրության չիպ",
"demoChoiceChipDescription": "Ընտրության ինտերակտիվ չիպերը ներկայացնում են հավաքածուից ընտրված մեկ տարբերակ։ Այս չիպերը պարունակում են առնչվող նկարագրական տեքստ կամ կատեգորիաներ։",
"demoFilterChipTitle": "Զտիչի չիպ",
"demoFilterChipDescription": "Զտիչների ինտերակտիվ չիպերը պիտակներ կամ նկարագրող բառեր են օգտագործում՝ բովանդակությունը զտելու համար։",
"demoInputChipTitle": "Մուտքագրման չիպ",
"demoInputChipDescription": "Մուտքագրման ինտերակտիվ չիպերը հակիրճ ձևով ընդհանուր տեղեկություններ են տալիս օբյեկտի (օր․՝ անձի, վայրի, առարկայի) կամ նամակագրության տեքստի մասին։",
"craneSleep9": "Լիսաբոն, Պորտուգալիա",
"craneEat10": "Լիսաբոն, Պորտուգալիա",
"demoCupertinoSegmentedControlDescription": "Թույլ է տալիս ընտրություն անել մի քանի իրար բացառող տարբերակների միջև։ Երբ սեգմենտավորված կառավարման տարրում մեկ տարբերակ է ընտրված, մյուս տարբերակները չեն ընդծգվում։",
"chipTurnOnLights": "Միացնել լույսերը",
"chipSmall": "Փոքր",
"chipMedium": "Միջին",
"chipLarge": "Մեծ",
"chipElevator": "Վերելակ",
"chipWasher": "Լվացքի մեքենա",
"chipFireplace": "Բուխարի",
"chipBiking": "Հեծանվավարություն",
"craneFormDiners": "Խորտկարաններ",
"rallyAlertsMessageUnassignedTransactions": "{count,plural,=1{Ավելացրեք հարկային հնարավոր նվազեցման գումարը։ Նշանակեք կատեգորիաներ 1 չբաշխված գործարքի համար։}other{Ավելացրեք հարկային հնարավոր նվազեցման գումարը։ Նշանակեք կատեգորիաներ {count} չբաշխված գործարքի համար։}}",
"craneFormTime": "Ընտրել ժամը",
"craneFormLocation": "Ընտրել վայր",
"craneFormTravelers": "Ճանապարհորդներ",
"craneEat8": "Ատլանտա, ԱՄՆ",
"craneFormDestination": "Ընտրել նպատակակետ",
"craneFormDates": "Ընտրել ամսաթվեր",
"craneFly": "ՉՎԵՐԹՆԵՐ",
"craneSleep": "ՔՈՒՆ",
"craneEat": "ՍՆՈՒՆԴ",
"craneFlySubhead": "Դիտեք չվերթներն ըստ նպատակակետի",
"craneSleepSubhead": "Դիտեք հյուրանոցներն ըստ նպատակակետի",
"craneEatSubhead": "Դիտեք ռեստորաններն ըստ նպատակակետի",
"craneFlyStops": "{numberOfStops,plural,=0{Առանց կանգառի}=1{1 կանգառ}other{{numberOfStops} կանգառ}}",
"craneSleepProperties": "{totalProperties,plural,=0{Հասանելի հյուրանոցներ չկան}=1{1 հասանելի հյուրանոց}other{{totalProperties} հասանելի հյուրանոց}}",
"craneEatRestaurants": "{totalRestaurants,plural,=0{Ռեստորաններ չկան}=1{1 ռեստորան}other{{totalRestaurants} ռեստորան}}",
"craneFly0": "Ասպեն, ԱՄՆ",
"demoCupertinoSegmentedControlSubtitle": "iOS-ի ոճով սեգմենտավորված կառավարման տարր",
"craneSleep10": "Կահիրե, Եգիպտոս",
"craneEat9": "Մադրիդ, Իսպանիա",
"craneFly1": "Բիգ Սուր, ԱՄՆ",
"craneEat7": "Նեշվիլ, ԱՄՆ",
"craneEat6": "Սիեթլ, ԱՄՆ",
"craneFly8": "Սինգապուր",
"craneEat4": "Փարիզ, Ֆրանսիա",
"craneEat3": "Փորթլենդ, ԱՄՆ",
"craneEat2": "Կորդոբա, արգենտինա",
"craneEat1": "Դալաս, ԱՄՆ",
"craneEat0": "Նեապոլ, Իտալիա",
"craneSleep11": "Թայփեյ, Թայվան",
"craneSleep3": "Հավանա, Կուբա",
"shrineLogoutButtonCaption": "ԵԼՔ",
"rallyTitleBills": "ՀԱՇԻՎՆԵՐ",
"rallyTitleAccounts": "ՀԱՇԻՎՆԵՐ",
"shrineProductVagabondSack": "Թիկնապայուսակ",
"rallyAccountDetailDataInterestYtd": "Տոկոսադրույքը տարեսկզբից",
"shrineProductWhitneyBelt": "Կաշվե գոտի",
"shrineProductGardenStrand": "Այգու ճոպաններ",
"shrineProductStrutEarrings": "Ականջօղեր",
"shrineProductVarsitySocks": "Սպորտային գուլպաներ",
"shrineProductWeaveKeyring": "Բանալու հյուսածո կախազարդ",
"shrineProductGatsbyHat": "Գետսբի գլխարկ",
"shrineProductShrugBag": "Հոբո պայուսակ",
"shrineProductGiltDeskTrio": "Սեղանի հավաքածու",
"shrineProductCopperWireRack": "Պղնձե մետաղալարերից պատրաստված զամբյուղ",
"shrineProductSootheCeramicSet": "Կերամիկական սպասքի հավաքածու",
"shrineProductHurrahsTeaSet": "Hurrahs թեյի սպասքի հավաքածու",
"shrineProductBlueStoneMug": "Կապույտ գավաթ",
"shrineProductRainwaterTray": "Ջրհորդան",
"shrineProductChambrayNapkins": "Բամբակյա անձեռոցիկներ",
"shrineProductSucculentPlanters": "Սուկուլենտների տնկարկներ",
"shrineProductQuartetTable": "Կլոր սեղան",
"shrineProductKitchenQuattro": "Խոհանոցային հավաքածու",
"shrineProductClaySweater": "Բեժ սվիտեր",
"shrineProductSeaTunic": "Թեթև սվիտեր",
"shrineProductPlasterTunic": "Մարմնագույն տունիկա",
"rallyBudgetCategoryRestaurants": "Ռեստորաններ",
"shrineProductChambrayShirt": "Բամբակյա վերնաշապիկ",
"shrineProductSeabreezeSweater": "Ծովի ալիքների գույնի սվիտեր",
"shrineProductGentryJacket": "Ջենթրի ոճի բաճկոն",
"shrineProductNavyTrousers": "Մուգ կապույտ տաբատ",
"shrineProductWalterHenleyWhite": "Սպիտակ թեթև բաճկոն",
"shrineProductSurfAndPerfShirt": "Ծովի ալիքների գույնի շապիկ",
"shrineProductGingerScarf": "Կոճապղպեղի գույնի շարֆ",
"shrineProductRamonaCrossover": "Ramona բլուզ",
"shrineProductClassicWhiteCollar": "Դասական սպիտակ բլուզ",
"shrineProductSunshirtDress": "Ամառային զգեստ",
"rallyAccountDetailDataInterestRate": "Տոկոսադրույք",
"rallyAccountDetailDataAnnualPercentageYield": "Տարեկան տոկոսային եկամտաբերությունը",
"rallyAccountDataVacation": "Արձակուրդ",
"shrineProductFineLinesTee": "Զոլավոր շապիկ",
"rallyAccountDataHomeSavings": "Խնայողություններ տան համար",
"rallyAccountDataChecking": "Բանկային հաշիվ",
"rallyAccountDetailDataInterestPaidLastYear": "Անցած տարի վճարված տոկոսներ",
"rallyAccountDetailDataNextStatement": "Հաջորդ քաղվածքը",
"rallyAccountDetailDataAccountOwner": "Հաշվի սեփականատեր",
"rallyBudgetCategoryCoffeeShops": "Սրճարաններ",
"rallyBudgetCategoryGroceries": "Մթերք",
"shrineProductCeriseScallopTee": "Դեղձագույն շապիկ",
"rallyBudgetCategoryClothing": "Հագուստ",
"rallySettingsManageAccounts": "Հաշիվների կառավարում",
"rallyAccountDataCarSavings": "Խնայողություններ ավտոմեքենայի համար",
"rallySettingsTaxDocuments": "Հարկային փաստաթղթեր",
"rallySettingsPasscodeAndTouchId": "Անցակոդ և Touch ID",
"rallySettingsNotifications": "Ծանուցումներ",
"rallySettingsPersonalInformation": "Անձնական տվյալներ",
"rallySettingsPaperlessSettings": "Վիրտուալ կարգավորումներ",
"rallySettingsFindAtms": "Գտնել բանկոմատներ",
"rallySettingsHelp": "Օգնություն",
"rallySettingsSignOut": "Դուրս գալ",
"rallyAccountTotal": "Ընդամենը",
"rallyBillsDue": "Վերջնաժամկետ",
"rallyBudgetLeft": "Մնացել է",
"rallyAccounts": "Հաշիվներ",
"rallyBills": "Հաշիվներ",
"rallyBudgets": "Բյուջեներ",
"rallyAlerts": "Ծանուցումներ",
"rallySeeAll": "ՏԵՍՆԵԼ ԲՈԼՈՐԸ",
"rallyFinanceLeft": "ՄՆԱՑԵԼ Է",
"rallyTitleOverview": "ՀԱՄԱՏԵՍՔ",
"shrineProductShoulderRollsTee": "Ազատ թևքով շապիկ",
"shrineNextButtonCaption": "ԱՌԱՋ",
"rallyTitleBudgets": "ԲՅՈՒՋԵՆԵՐ",
"rallyTitleSettings": "ԿԱՐԳԱՎՈՐՈՒՄՆԵՐ",
"rallyLoginLoginToRally": "Մուտք Rally",
"rallyLoginNoAccount": "Չունե՞ք հաշիվ",
"rallyLoginSignUp": "ԳՐԱՆՑՎԵԼ",
"rallyLoginUsername": "Օգտանուն",
"rallyLoginPassword": "Գաղտնաբառ",
"rallyLoginLabelLogin": "Մուտք",
"rallyLoginRememberMe": "Հիշել ինձ",
"rallyLoginButtonLogin": "ՄՈՒՏՔ",
"rallyAlertsMessageHeadsUpShopping": "Ուշադրությո՛ւն։ Դուք ծախսել եք այս ամսվա բյուջեի {percent}-ը։",
"rallyAlertsMessageSpentOnRestaurants": "Դուք այս շաբաթ ռեստորաններում ծախսել եք {amount}։",
"rallyAlertsMessageATMFees": "Այս ամիս դուք բանկոմատների միջնորդավճարների վրա ծախսել եք {amount}։",
"rallyAlertsMessageCheckingAccount": "Հրաշալի է։ Անցած ամսվա համեմատ՝ այս ամիս ձեր հաշվին {percent}-ով ավել գումար կա։",
"shrineMenuCaption": "ԸՆՏՐԱՑԱՆԿ",
"shrineCategoryNameAll": "ԲՈԼՈՐԸ",
"shrineCategoryNameAccessories": "ԼՐԱՍԱՐՔԵՐ",
"shrineCategoryNameClothing": "ՀԱԳՈՒՍՏ",
"shrineCategoryNameHome": "ՏՈՒՆ",
"shrineLoginUsernameLabel": "Օգտանուն",
"shrineLoginPasswordLabel": "Գաղտնաբառ",
"shrineCancelButtonCaption": "ՉԵՂԱՐԿԵԼ",
"shrineCartTaxCaption": "Հարկ՝",
"shrineCartPageCaption": "ԶԱՄԲՅՈՒՂ",
"shrineProductQuantity": "Քանակը՝ {quantity}",
"shrineProductPrice": "x {price}",
"shrineCartItemCount": "{quantity,plural,=0{ԱՊՐԱՆՔՆԵՐ ՉԿԱՆ}=1{1 ԱՊՐԱՆՔ}other{{quantity} ԱՊՐԱՆՔ}}",
"shrineCartClearButtonCaption": "ԴԱՏԱՐԿԵԼ ԶԱՄԲՅՈՒՂԸ",
"shrineCartTotalCaption": "ԸՆԴԱՄԵՆԸ",
"shrineCartSubtotalCaption": "Ենթագումար՝",
"shrineCartShippingCaption": "Առաքում՝",
"shrineProductGreySlouchTank": "Մոխրագույն շապիկ",
"shrineProductStellaSunglasses": "Stella արևային ակնոց",
"shrineProductWhitePinstripeShirt": "Սպիտակ գծավոր վերնաշապիկ",
"demoTextFieldWhereCanWeReachYou": "Ի՞նչ համարով կարելի է կապվել ձեզ հետ",
"settingsTextDirectionLTR": "Ձախից աջ",
"settingsTextScalingLarge": "Մեծ",
"demoBottomSheetHeader": "Էջագլուխ",
"demoBottomSheetItem": "{value}",
"demoBottomTextFieldsTitle": "Տեքստային դաշտեր",
"demoTextFieldTitle": "Տեքստային դաշտեր",
"demoTextFieldSubtitle": "Տեքստի և թվերի խմբագրման մեկ տող",
"demoTextFieldDescription": "Տեքստային դաշտերի օգնությամբ օգտատերերը կարող են լրացնել ձևեր և մուտքագրել տվյալներ երկխոսության պատուհաններում։",
"demoTextFieldShowPasswordLabel": "Ցույց տալ գաղտնաբառը",
"demoTextFieldHidePasswordLabel": "Թաքցնել գաղտնաբառը",
"demoTextFieldFormErrors": "Նախքան ձևն ուղարկելը շտկեք կարմիր գույնով նշված սխալները։",
"demoTextFieldNameRequired": "Մուտքագրեք անունը (պարտադիր է)։",
"demoTextFieldOnlyAlphabeticalChars": "Օգտագործեք միայն տառեր։",
"demoTextFieldEnterUSPhoneNumber": "Մուտքագրեք ԱՄՆ հեռախոսահամար հետևյալ ձևաչափով՝ (###) ###-####։",
"demoTextFieldEnterPassword": "Մուտքագրեք գաղտնաբառը։",
"demoTextFieldPasswordsDoNotMatch": "Գաղտնաբառերը չեն համընկնում",
"demoTextFieldWhatDoPeopleCallYou": "Ի՞նչ է ձեր անունը",
"demoTextFieldNameField": "Անուն*",
"demoBottomSheetButtonText": "ՑՈՒՑԱԴՐԵԼ ՆԵՐՔԵՎԻ ԹԵՐԹԸ",
"demoTextFieldPhoneNumber": "Հեռախոսահամար*",
"demoBottomSheetTitle": "Ներքևի թերթ",
"demoTextFieldEmail": "Էլ․ հասցե",
"demoTextFieldTellUsAboutYourself": "Պատմեք ձեր մասին (օր․՝ ինչ հոբբի ունեք)",
"demoTextFieldKeepItShort": "Երկար-բարակ պետք չէ գրել, սա ընդամենը տեքստի նմուշ է։",
"starterAppGenericButton": "ԿՈՃԱԿ",
"demoTextFieldLifeStory": "Կենսագրություն",
"demoTextFieldSalary": "Աշխատավարձ",
"demoTextFieldUSD": "USD",
"demoTextFieldNoMoreThan": "Առավելագույնը 8 նիշ։",
"demoTextFieldPassword": "Գաղտնաբառ*",
"demoTextFieldRetypePassword": "Կրկին մուտքագրեք գաղտնաբառը*",
"demoTextFieldSubmit": "ՈՒՂԱՐԿԵԼ",
"demoBottomNavigationSubtitle": "Նավիգացիա էկրանի ներքևի հատվածում՝ սահուն անցումով",
"demoBottomSheetAddLabel": "Ավելացնել",
"demoBottomSheetModalDescription": "Ներքևի մոդալ թերթը կարելի է օգտագործել ընտրացանկի կամ երկխոսության պատուհանի փոխարեն։ Այսպիսի թերթն օգտատիրոջն օգնում է ավելի արագ անցնել անհրաժեշտ բաժիններ։",
"demoBottomSheetModalTitle": "Ներքևի մոդալ թերթ",
"demoBottomSheetPersistentDescription": "Ներքևի ստատիկ թերթը ցույց է տալիս հավելվածի հիմնական բաժինները։ Այսպիսի թերթը միշտ կլինի էկրանի ներքևի հատվածում (նույնիսկ այն դեպքերում, երբ օգտատերը անցնում է մեկ բաժնից մյուսը)։",
"demoBottomSheetPersistentTitle": "Ներքևի ստատիկ թերթ",
"demoBottomSheetSubtitle": "Ներքևի ստատիկ և մոդալ թերթեր",
"demoTextFieldNameHasPhoneNumber": "{name}՝ {phoneNumber}",
"buttonText": "ԿՈՃԱԿ",
"demoTypographyDescription": "Սահմանումներ Material Design-ում առկա տարբեր տառատեսակների համար։",
"demoTypographySubtitle": "Տեքստի բոլոր ստանդարտ ոճերը",
"demoTypographyTitle": "Տառատեսակներ",
"demoFullscreenDialogDescription": "fullscreenDialog պարամետրը հատկորոշում է, թե արդյոք հաջորդ էկրանը պետք է լինի լիաէկրան մոդալ երկխոսության պատուհան։",
"demoFlatButtonDescription": "Սեղմելու դեպքում հարթ կոճակը չի բարձրանում։ Դրա փոխարեն էկրանին հայտնվում է թանաքի հետք։ Այսպիսի կոճակներն օգտագործեք գործիքագոտիներում, երկխոսության պատուհաններում և տեղադրեք դրանք դաշտերում։",
"demoBottomNavigationDescription": "Էկրանի ներքևի հատվածի նավիգացիայի գոտում կարող է տեղավորվել ծառայության երեքից հինգ բաժին։ Ընդ որում դրանցից յուրաքանչյուրը կունենա առանձին պատկերակ և տեքստ (պարտադիր չէ)։ Եթե օգտատերը սեղմի պատկերակներից որևէ մեկի վրա, ապա կանցնի համապատասխան բաժին։",
"demoBottomNavigationSelectedLabel": "Ընտրված պիտակ",
"demoBottomNavigationPersistentLabels": "Ստատիկ պիտակներ",
"starterAppDrawerItem": "{value}",
"demoTextFieldRequiredField": "* պարտադիր դաշտ",
"demoBottomNavigationTitle": "Նավիգացիա էկրանի ներքևի հատվածում",
"settingsLightTheme": "Բաց",
"settingsTheme": "Թեմա",
"settingsPlatformIOS": "iOS",
"settingsPlatformAndroid": "Android",
"settingsTextDirectionRTL": "Աջից ձախ",
"settingsTextScalingHuge": "Շատ մեծ",
"cupertinoButton": "Կոճակ",
"settingsTextScalingNormal": "Սովորական",
"settingsTextScalingSmall": "Փոքր",
"settingsSystemDefault": "Համակարգ",
"settingsTitle": "Կարգավորումներ",
"rallyDescription": "Բյուջեի պլանավորման հավելված",
"aboutDialogDescription": "Այս հավելվածի կոդը տեսնելու համար բացեք {repoLink} էջը։",
"bottomNavigationCommentsTab": "Մեկնաբանություններ",
"starterAppGenericBody": "Հիմնական տեքստ",
"starterAppGenericHeadline": "Խորագիր",
"starterAppGenericSubtitle": "Ենթավերնագիր",
"starterAppGenericTitle": "Անուն",
"starterAppTooltipSearch": "Որոնում",
"starterAppTooltipShare": "Կիսվել",
"starterAppTooltipFavorite": "Ընտրանի",
"starterAppTooltipAdd": "Ավելացնել",
"bottomNavigationCalendarTab": "Օրացույց",
"starterAppDescription": "Հարմարվողական մոդել",
"starterAppTitle": "Գործարկման հավելված",
"aboutFlutterSamplesRepo": "Flutter-ի նմուշներ GitHub շտեմարանից",
"bottomNavigationContentPlaceholder": "Տեղապահ «{title}» ներդիրի համար",
"bottomNavigationCameraTab": "Տեսախցիկ",
"bottomNavigationAlarmTab": "Զարթուցիչ",
"bottomNavigationAccountTab": "Հաշիվ",
"demoTextFieldYourEmailAddress": "Ձեր էլ. հասցեն",
"demoToggleButtonDescription": "Փոխարկման կոճակների օգնությամբ հնարավոր է խմբավորել նմանատիպ ընտրանքները։ Մեկը մյուսի հետ կապ ունեցող փոխարկման կոճակները պետք է ունենան ընդհանուր զետեղարան։",
"colorsGrey": "ՄՈԽՐԱԳՈՒՅՆ",
"colorsBrown": "ԴԱՐՉՆԱԳՈՒՅՆ",
"colorsDeepOrange": "ՄՈՒԳ ՆԱՐՆՋԱԳՈՒՅՆ",
"colorsOrange": "ՆԱՐՆՋԱԳՈՒՅՆ",
"colorsAmber": "ՍԱԹ",
"colorsYellow": "ԴԵՂԻՆ",
"colorsLime": "ԼԱՅՄ",
"colorsLightGreen": "ԲԱՑ ԿԱՆԱՉ",
"colorsGreen": "ԿԱՆԱՉ",
"homeHeaderGallery": "Պատկերասրահ",
"homeHeaderCategories": "Կատեգորիաներ",
"shrineDescription": "Ոճային իրեր գնելու հավելված",
"craneDescription": "Անհատականացված հավելված ճամփորդությունների համար",
"homeCategoryReference": "ՈՃԵՐ ԵՎ ԱՅԼՆ",
"demoInvalidURL": "Չհաջողվեց ցուցադրել URL-ը՝",
"demoOptionsTooltip": "Ընտրանքներ",
"demoInfoTooltip": "Տեղեկություններ",
"demoCodeTooltip": "Դեմո կոդ",
"demoDocumentationTooltip": "API-ների փաստաթղթեր",
"demoFullscreenTooltip": "Լիաէկրան ռեժիմ",
"settingsTextScaling": "Տեքստի մասշտաբավորում",
"settingsTextDirection": "Տեքստի ուղղությունը",
"settingsLocale": "Տարածաշրջանային կարգավորումներ",
"settingsPlatformMechanics": "Հարթակ",
"settingsDarkTheme": "Մուգ",
"settingsSlowMotion": "Դանդաղեցում",
"settingsAbout": "Flutter Gallery-ի մասին",
"settingsFeedback": "Կարծիք հայտնել",
"settingsAttribution": "Դիզայնը՝ TOASTER (Լոնդոն)",
"demoButtonTitle": "Կոճակներ",
"demoButtonSubtitle": "Տեքստային, բարձրացված, ուրվագծային և այլ",
"demoFlatButtonTitle": "Հարթ կոճակ",
"demoRaisedButtonDescription": "Բարձրացված կոճակները թույլ են տալիս հարթ մակերեսները դարձնել ավելի ծավալային, իսկ հագեցած և լայն էջերի գործառույթները՝ ավելի տեսանելի։",
"demoRaisedButtonTitle": "Բարձրացված կոճակ",
"demoOutlineButtonTitle": "Ուրվագծային կոճակ",
"demoOutlineButtonDescription": "Ուրվագծային կոճակները սեղմելիս դառնում են անթափանց և բարձրանում են։ Դրանք հաճախ օգտագործվում են բարձրացված կոճակների հետ՝ որևէ լրացուցիչ, այլընտրանքային գործողություն ընդգծելու համար։",
"demoToggleButtonTitle": "Փոխարկման կոճակներ",
"colorsTeal": "ՓԻՐՈՒԶԱԳՈՒՅՆ",
"demoFloatingButtonTitle": "Գործողության լողացող կոճակ",
"demoFloatingButtonDescription": "Լողացող գործողության կոճակը շրճանաձև պատկերակով կոճակ է, որը ցուցադրվում է բովանդակության վրա և թույլ է տալիս ընդգծել ամենակարևոր գործողությունը հավելվածում։",
"demoDialogTitle": "Երկխոսության պատուհաններ",
"demoDialogSubtitle": "Պարզ, ծանուցումներով և լիաէկրան",
"demoAlertDialogTitle": "Ծանուցում",
"demoAlertDialogDescription": "Ծանուցումների երկխոսության պատուհանը տեղեկացնում է օգտատիրոջը ուշադրության արժանի իրադարձությունների մասին։ Այն կարող է ունենալ վերնագիր, ինչպես նաև հասանելի գործողությունների ցանկ։",
"demoAlertTitleDialogTitle": "Ծանուցում վերնագրով",
"demoSimpleDialogTitle": "Պարզ",
"demoSimpleDialogDescription": "Սովորական երկխոսության պատուհանում օգտատիրոջն առաջարկվում է ընտրության մի քանի տարբերակ։ Եթե պատուհանն ունի վերնագիր, այն ցուցադրվում է տարբերակների վերևում։",
"demoFullscreenDialogTitle": "Լիաէկրան",
"demoCupertinoButtonsTitle": "Կոճակներ",
"demoCupertinoButtonsSubtitle": "iOS-ի ոճով կոճակներ",
"demoCupertinoButtonsDescription": "iOS-ի ոճով կոճակ։ Պարունակում է տեքստ և/կամ պատկերակ, որը հայտնվում և անհետանում է սեղմելու դեպքում։ Կարող է նաև ֆոն ունենալ։",
"demoCupertinoAlertsTitle": "Ծանուցումներ",
"demoCupertinoAlertsSubtitle": "iOS-ի ոճով ծանուցումների երկխոսության պատուհաններ",
"demoCupertinoAlertTitle": "Ծանուցում",
"demoCupertinoAlertDescription": "Ծանուցումների երկխոսության պատուհանը տեղեկացնում է օգտատիրոջը ուշադրության արժանի իրադարձությունների մասին։ Այն կարող է ունենալ վերնագիր և բովանդակություն, ինչպես նաև հասանելի գործողությունների ցանկ։ Վերնագիրը ցուցադրվում է բովանդակության վերևում, իսկ գործողությունները՝ ներքևում։",
"demoCupertinoAlertWithTitleTitle": "Վերնագրով ծանուցում",
"demoCupertinoAlertButtonsTitle": "Ծանուցում կոճակներով",
"demoCupertinoAlertButtonsOnlyTitle": "Միայն ծանուցումներով կոճակներ",
"demoCupertinoActionSheetTitle": "Գործողությունների ցանկ",
"demoCupertinoActionSheetDescription": "Գործողությունների ցանկը ծանուցման հատուկ տեսակ է, որում օգտատիրոջն առաջարկվում է գործողությունների առնվազն երկու տարբերակ՝ կախված կոնտեքստից։ Ցանկը կարող է ունենալ վերնագիր, լրացուցիչ հաղորդագրություն, ինչպես նաև հասանելի գործողությունների ցանկ։",
"demoColorsTitle": "Գույներ",
"demoColorsSubtitle": "Բոլոր նախասահմանված գույները",
"demoColorsDescription": "Գույների և երանգների հաստատուն պարամետրեր, որոնք ներկայացնում են Material Design-ի գունապնակը։",
"buttonTextEnabled": "ENABLED",
"buttonTextDisabled": "DISABLED",
"buttonTextCreate": "Ստեղծել",
"dialogSelectedOption": "Դուք ընտրել եք՝ «{value}»",
"dialogDiscardTitle": "Հեռացնե՞լ սևագիրը:",
"dialogLocationTitle": "Օգտագործե՞լ Google-ի տեղորոշման ծառայությունը",
"dialogLocationDescription": "Google-ին տեղադրության անանուն տվյալների ուղարկումը թույլ է տալիս հավելվածներին ավելի ճշգրիտ որոշել ձեր գտնվելու վայրը։ Տվյալները կուղարկվեն, նույնիսկ երբ ոչ մի հավելված գործարկված չէ։",
"dialogCancel": "ՉԵՂԱՐԿԵԼ",
"dialogDiscard": "ՀԵՌԱՑՆԵԼ",
"dialogDisagree": "ՉԵՂԱՐԿԵԼ",
"dialogAgree": "ԸՆԴՈՒՆԵԼ",
"dialogSetBackup": "Պահուստավորման հաշվի կարգավորում",
"colorsBlueGrey": "ԿԱՊՏԱՄՈԽՐԱԳՈՒՅՆ",
"dialogShow": "ՑՈՒՑԱԴՐԵԼ ԵՐԿԽՈՍՈՒԹՅԱՆ ՊԱՏՈՒՀԱՆԸ",
"dialogFullscreenTitle": "Լիաէկրան երկխոսության պատուհան",
"dialogFullscreenSave": "ՊԱՀԵԼ",
"dialogFullscreenDescription": "Երկխոսության լիաէկրան պատուհանի դեմո",
"cupertinoButtonEnabled": "Enabled",
"cupertinoButtonDisabled": "Disabled",
"cupertinoButtonWithBackground": "Ֆոնով",
"cupertinoAlertCancel": "Չեղարկել",
"cupertinoAlertDiscard": "Հեռացնել",
"cupertinoAlertLocationTitle": "Քարտեզներին հասանելի դարձնե՞լ ձեր տեղադրությանը, երբ օգտագործում եք հավելվածը",
"cupertinoAlertLocationDescription": "Ձեր ընթացիկ գտնվելու վայրը կցուցադրվի քարտեզի վրա և կօգտագործվի երթուղիների, ճշգրիտ որոնման արդյունքների և ճանապարհի տևողության համար։",
"cupertinoAlertAllow": "Թույլատրել",
"cupertinoAlertDontAllow": "Չթույլատրել",
"cupertinoAlertFavoriteDessert": "Ընտրեք սիրած աղանդերը",
"cupertinoAlertDessertDescription": "Ընտրեք ձեր սիրած աղանդերը ստորև ցանկից։ Ձեր ընտրությունը կօգտագործվի մոտակայքում գտնվող օբյետկտները կարգավորելու համար։",
"cupertinoAlertCheesecake": "Չիզքեյք",
"cupertinoAlertTiramisu": "Տիրամիսու",
"cupertinoAlertApplePie": "Խնձորի կարկանդակ",
"cupertinoAlertChocolateBrownie": "Շոկոլադե բրաունի",
"cupertinoShowAlert": "Ցուցադրել ծանուցումը",
"colorsRed": "ԿԱՐՄԻՐ",
"colorsPink": "ՎԱՐԴԱԳՈՒՅՆ",
"colorsPurple": "ՄԱՆՈՒՇԱԿԱԳՈՒՅՆ",
"colorsDeepPurple": "ՄՈՒԳ ՄԱՆՈՒՇԱԿԱԳՈՒՅՆ",
"colorsIndigo": "ԻՆԴԻԳՈ",
"colorsBlue": "ԿԱՊՈՒՅՏ",
"colorsLightBlue": "ԲԱՑ ԿԱՊՈՒՅՏ",
"colorsCyan": "ԵՐԿՆԱԳՈՒՅՆ",
"dialogAddAccount": "Ավելացնել հաշիվ",
"Gallery": "Պատկերասրահ",
"Categories": "Կատեգորիաներ",
"SHRINE": "SHRINE",
"Basic shopping app": "Գնումների հիմնական հավելված",
"RALLY": "RALLY",
"CRANE": "CRANE",
"Travel app": "Ճամփորդական հավելված",
"MATERIAL": "MATERIAL",
"CUPERTINO": "CUPERTINO",
"REFERENCE STYLES & MEDIA": "ՏԵՂԵԿԱՏՈՒՆԵՐ ԵՎ ՄԵԴԻԱ"
}
| gallery/lib/l10n/intl_hy.arb/0 | {
"file_path": "gallery/lib/l10n/intl_hy.arb",
"repo_id": "gallery",
"token_count": 55676
} | 806 |
{
"loading": "Ачаалж байна",
"deselect": "Сонголтыг цуцлах",
"select": "Сонгох",
"selectable": "Сонгох боломжтой (удаан дарах)",
"selected": "Сонгосон",
"demo": "Демо",
"bottomAppBar": "Доод талын аппын талбар",
"notSelected": "Сонгоогүй",
"demoCupertinoSearchTextFieldTitle": "Хайлтын текстийн талбар",
"demoCupertinoPicker": "Сонгогч",
"demoCupertinoSearchTextFieldSubtitle": "iOS загварын хайлтын текстийн талбар",
"demoCupertinoSearchTextFieldDescription": "Хэрэглэгч текст оруулах замаар хайлт хийх боломжийг олгодог хайлтын текстийн талбар бөгөөд зөвлөмж санал болгож мөн шүүх боломжтой.",
"demoCupertinoSearchTextFieldPlaceholder": "Ямар нэгэн текст оруулна уу",
"demoCupertinoScrollbarTitle": "Гүйлгэгч",
"demoCupertinoScrollbarSubtitle": "iOS-загварын гүйлгэгч",
"demoCupertinoScrollbarDescription": "Өгөгдсөн дэд элементийг нэг эгнээнд хураах гүйлгэгч",
"demoTwoPaneItem": "Зүйл {value}",
"demoTwoPaneList": "Жагсаалт",
"demoTwoPaneFoldableLabel": "Эвхэгддэг",
"demoTwoPaneSmallScreenLabel": "Жижиг дэлгэц",
"demoTwoPaneSmallScreenDescription": "TwoPane нь жижиг дэлгэцтэй төхөөрөмж дээр ингэж ажилладаг.",
"demoTwoPaneTabletLabel": "Таблет / Компьютер",
"demoTwoPaneTabletDescription": "TwoPane нь таблет болон компьютер зэрэг том дэлгэц дээр ингэж ажилладаг.",
"demoTwoPaneTitle": "TwoPane",
"demoTwoPaneSubtitle": "Эвхэгддэг, том болон жижиг дэлгэц дээрх хариу үйлдэлт бүдүүвч",
"splashSelectDemo": "Демо сонгоно уу",
"demoTwoPaneFoldableDescription": "TwoPane нь эвхэгддэг төхөөрөмж дээр ингэж ажилладаг.",
"demoTwoPaneDetails": "Дэлгэрэнгүй",
"demoTwoPaneSelectItem": "Зүйл сонгоно уу",
"demoTwoPaneItemDetails": "Зүйлийн {value} дэлгэрэнгүй",
"demoCupertinoContextMenuActionText": "Хам сэдэв цэсийг харахын тулд Flutter-н логог товшоод удаан дарна уу.",
"demoCupertinoContextMenuDescription": "Элементийг удаан дарах үед харагддаг iOS загвартай бүтэн дэлгэцийн хам сэдэв цэс.",
"demoAppBarTitle": "Аппын талбар",
"demoAppBarDescription": "Аппын талбар нь одоогийн дэлгэцтэй холбоотой контент болон үйлдлүүдийг үзүүлнэ. Үүнийг брендинг, дэлгэцийн нэрс, навигац болон үйлдлүүдэд ашигладаг",
"demoDividerTitle": "Хуваагч",
"demoDividerSubtitle": "Хуваагч нь контентыг жагсаалт болон бүдүүвчид бүлэглэдэг нарийн шугам юм.",
"demoDividerDescription": "Хуваагчдыг жагсаалт, шургуулга болон бусад газарт контентыг тусгаарлахад ашиглах боломжтой.",
"demoVerticalDividerTitle": "Босоо хуваагч",
"demoCupertinoContextMenuTitle": "Хам сэдэв цэс",
"demoCupertinoContextMenuSubtitle": "iOS загварын хам сэдэв цэс",
"demoAppBarSubtitle": "Одоогийн дэлгэцтэй холбоотой мэдээлэл болон үйлдлүүдийг үзүүлнэ",
"demoCupertinoContextMenuActionOne": "Нэгдүгээр үйлдэл",
"demoCupertinoContextMenuActionTwo": "Хоёрдугаар үйлдэл",
"demoDateRangePickerDescription": "Материалын загварын хугацааны интервал сонгогчийг агуулсан харилцах цонхыг харуулна.",
"demoDateRangePickerTitle": "Хугацааны интервал сонгогч",
"demoNavigationDrawerUserName": "Хэрэглэгчийн нэр:",
"demoNavigationDrawerUserEmail": "[email protected]",
"demoNavigationDrawerText": "Шургуулгыг харахын тулд захаас шудрах эсвэл зүүн дээд дүрс тэмдэг дээр товшино уу",
"demoNavigationRailTitle": "Навигацын төмөр зам",
"demoNavigationRailSubtitle": "Апп дахь навигацын төмөр замыг харуулж байна",
"demoNavigationRailDescription": "Цөөн тоотой үзэлтийн хооронд, ихэвчлэн гурваас тавын хооронд шилжихийн тулд аппын зүүн эсвэл баруун талд харагдах зориулалттай материалын жижиг хэрэгсэл юм.",
"demoNavigationRailFirst": "Эхний",
"demoNavigationDrawerTitle": "Навигацын шургуулга",
"demoNavigationRailThird": "Гурав дахь",
"replyStarredLabel": "Одтой",
"demoTextButtonDescription": "Текстийн товчлуур дээр дарахад бэх цацарч харагдах боловч өргөгдөхгүй. Текстийн товчлуурыг самбар дээр, харилцах цонхонд болон мөрөнд доторх зайтайгаар ашиглана уу",
"demoElevatedButtonTitle": "Товгор товчлуур",
"demoElevatedButtonDescription": "Товгор товчлуур нь ихэвчлэн хавтгай бүдүүвчид хэмжээс нэмдэг. Тэдгээр нь шигүү эсвэл өргөн зайтай функцийг онцолдог.",
"demoOutlinedButtonTitle": "Хүрээтэй товчлуур",
"demoOutlinedButtonDescription": "Хүрээтэй товчлуурыг дарсан үед тодорч, дээшилдэг. Нэмэлт сонголт болон хоёрдогч үйлдлийг заахын тулд тэдгээрийг ихэвчлэн өргөгдсөн товчлууртай хослуулдаг.",
"demoContainerTransformDemoInstructions": "Карт, Жагсаалт болон FAB",
"demoNavigationDrawerSubtitle": "Appbar дахь шургуулгыг харуулж байна",
"replyDescription": "Үр өгөөжтэй, төвлөрсөн имэйлийн апп",
"demoNavigationDrawerDescription": "Аппликэйшн дахь навигацын холбоосыг харуулахын тулд дэлгэцийн захаас хөндлөнгөөр гулсуулдаг Материалын загварын түр зуурын самбар юм.",
"replyDraftsLabel": "Ноорог",
"demoNavigationDrawerToPageOne": "Нэгдүгээр зүйл",
"replyInboxLabel": "Ирсэн имэйл",
"demoSharedXAxisDemoInstructions": "Дараах болон буцах товчлуур",
"replySpamLabel": "Спам",
"replyTrashLabel": "Хогийн сав",
"replySentLabel": "Илгээсэн",
"demoNavigationRailSecond": "Хоёр дахь",
"demoNavigationDrawerToPageTwo": "Хоёрдугаар зүйл",
"demoFadeScaleDemoInstructions": "Зайлшгүй харилцах цонх болон FAB",
"demoFadeThroughDemoInstructions": "Доод навигац",
"demoSharedZAxisDemoInstructions": "Дүрс тэмдгийн товчлуурын тохиргоо",
"demoSharedYAxisDemoInstructions": "\"Хамгийн сүүлд тоглуулснаар\" эрэмбэлэх",
"demoTextButtonTitle": "Текстийн товчлуур",
"demoSharedZAxisBeefSandwichRecipeTitle": "Үхрийн махтай хачиртай талх",
"demoSharedZAxisDessertRecipeDescription": "Амттаны жор",
"demoSharedYAxisAlbumTileSubtitle": "Уран бүтээлч",
"demoSharedYAxisAlbumTileTitle": "Цомог",
"demoSharedYAxisRecentSortTitle": "Хамгийн сүүлд тоглуулсан",
"demoSharedYAxisAlphabeticalSortTitle": "А-Я",
"demoSharedYAxisAlbumCount": "268 цомог",
"demoSharedYAxisTitle": "Хуваалцсан y-тэнхлэг",
"demoSharedXAxisCreateAccountButtonText": "БҮРТГЭЛ ҮҮСГЭХ",
"demoFadeScaleAlertDialogDiscardButton": "БОЛИХ",
"demoSharedXAxisSignInTextFieldLabel": "Имэйл эсвэл утасны дугаар",
"demoSharedXAxisSignInSubtitleText": "Бүртгэлээрээ нэвтрэх",
"demoSharedXAxisSignInWelcomeText": "Сайн уу, Дэвид Парк",
"demoSharedXAxisIndividualCourseSubtitle": "Тусад нь харуулсан",
"demoSharedXAxisBundledCourseSubtitle": "Багцалсан",
"demoFadeThroughAlbumsDestination": "Цомгууд",
"demoSharedXAxisDesignCourseTitle": "Дизайн",
"demoSharedXAxisIllustrationCourseTitle": "Зурагт тайлбар",
"demoSharedXAxisBusinessCourseTitle": "Бизнес",
"demoSharedXAxisArtsAndCraftsCourseTitle": "Урлаг, гар урлал",
"demoMotionPlaceholderSubtitle": "Хоёр дахь мөрний текст",
"demoFadeScaleAlertDialogCancelButton": "ЦУЦЛАХ",
"demoFadeScaleAlertDialogHeader": "Сэрэмжлүүлгийн харилцах цонх",
"demoFadeScaleHideFabButton": "FAB-Г НУУХ",
"demoFadeScaleShowFabButton": "FAB-Г ХАРУУЛАХ",
"demoFadeScaleShowAlertDialogButton": "ЗАЙЛШГҮЙ ХАРИЛЦАХ ЦОНХЫГ ХАРУУЛАХ",
"demoFadeScaleDescription": "Уусах загварыг дэлгэцийн төвд уусдаг харилцах цонх зэрэг дэлгэцийн хүрээ хооронд орж, гардаг UI элементүүдэд ашигладаг.",
"demoFadeScaleTitle": "Уусах",
"demoFadeThroughTextPlaceholder": "123 зураг",
"demoFadeThroughSearchDestination": "Хайх",
"demoFadeThroughPhotosDestination": "Зургууд",
"demoSharedXAxisCoursePageSubtitle": "Багцалсан ангиллууд нь таны хангамж дээр бүлгээр харагдана. Та үүнийг дараа нь үргэлж өөрчлөх боломжтой.",
"demoFadeThroughDescription": "Нэвт уусах загварыг бие биетэйгээ хүчтэй харилцаагүй UI элементүүдийн хоорондын шилжилтэд ашигладаг.",
"demoFadeThroughTitle": "Нэвт уусах",
"demoSharedZAxisHelpSettingLabel": "Тусламж",
"demoMotionSubtitle": "Бүх урьдчилан тодорхойлсон шилжилтийн загвар",
"demoSharedZAxisNotificationSettingLabel": "Мэдэгдлүүд",
"demoSharedZAxisProfileSettingLabel": "Профайл",
"demoSharedZAxisSavedRecipesListTitle": "Хадгалсан жорууд",
"demoSharedZAxisBeefSandwichRecipeDescription": "Үхрийн махтай хачиртай талхны жор",
"demoSharedZAxisCrabPlateRecipeDescription": "Хавчтай хоолны жор",
"demoSharedXAxisCoursePageTitle": "Курсээ оновчтой болгох",
"demoSharedZAxisCrabPlateRecipeTitle": "Хавч",
"demoSharedZAxisShrimpPlateRecipeDescription": "Сам хорхойтой хоолны жор",
"demoSharedZAxisShrimpPlateRecipeTitle": "Сам хорхой",
"demoContainerTransformTypeFadeThrough": "НЭВТ УУСАХ",
"demoSharedZAxisDessertRecipeTitle": "Амттан",
"demoSharedZAxisSandwichRecipeDescription": "Хачиртай талхны жор",
"demoSharedZAxisSandwichRecipeTitle": "Хачиртай талх",
"demoSharedZAxisBurgerRecipeDescription": "Бургерын жор",
"demoSharedZAxisBurgerRecipeTitle": "Бургер",
"demoSharedZAxisSettingsPageTitle": "Тохиргоо",
"demoSharedZAxisTitle": "Хуваалцсан z-тэнхлэг",
"demoSharedZAxisPrivacySettingLabel": "Нууцлал",
"demoMotionTitle": "Хөдөлгөөнт",
"demoContainerTransformTitle": "Контейнерын хэлбэр өөрчлөх",
"demoContainerTransformDescription": "Контейнерын хэлбэр өөрчлөх загварыг контейнерыг багтаадаг UI элементүүдийн хоорондын шилжилтэд зориулан бүтээсэн. Энэ загвар нь хоёр UI элементийн хооронд харагдахуйц холболт үүсгэдэг",
"demoContainerTransformModalBottomSheetTitle": "Уусах горим",
"demoContainerTransformTypeFade": "УУСАХ",
"demoSharedYAxisAlbumTileDurationUnit": "минут",
"demoMotionPlaceholderTitle": "Нэр",
"demoSharedXAxisForgotEmailButtonText": "ИМЭЙЛЭЭ МАРТСАН УУ?",
"demoMotionSmallPlaceholderSubtitle": "Хоёр дахь мөр",
"demoMotionDetailsPageTitle": "Дэлгэрэнгүй мэдээллийн хуудас",
"demoMotionListTileTitle": "Жагсаалтын зүйл",
"demoSharedAxisDescription": "Хуваалцсан тэнхлэгийн загварыг орон зайн эсвэл навигацын харилцаатай UI элементүүдийн хоорондын шилжилтэд ашигладаг. Энэ загвар нь элементүүдийн хоорондын харилцааг бэхжүүлэхийн тулд x, y, эсвэл z тэнхлэг дээр хуваалцсан өөрлөлтийг ашигладаг.",
"demoSharedXAxisTitle": "Хуваалцсан x-тэнхлэг",
"demoSharedXAxisBackButtonText": "БУЦАХ",
"demoSharedXAxisNextButtonText": "ДАРААХ",
"demoSharedXAxisCulinaryCourseTitle": "Хоол",
"githubRepo": "{repoName} GitHub хадгалах газар",
"fortnightlyMenuUS": "АНУ",
"fortnightlyMenuBusiness": "Бизнес",
"fortnightlyMenuScience": "Шинжлэх ухаан",
"fortnightlyMenuSports": "Спорт",
"fortnightlyMenuTravel": "Аялал",
"fortnightlyMenuCulture": "Соёл",
"fortnightlyTrendingTechDesign": "TechDesign",
"rallyBudgetDetailAmountLeft": "Ашиглаагүй дүн",
"fortnightlyHeadlineArmy": "Ногоон армийг дотроос нь шинэчлэх нь",
"fortnightlyDescription": "Контентод төвлөрсөн мэдээний апп",
"rallyBillDetailAmountDue": "Төлөх дүн",
"rallyBudgetDetailTotalCap": "Нийт капитализац",
"rallyBudgetDetailAmountUsed": "Ашигласан дүн",
"fortnightlyTrendingHealthcareRevolution": "HealthcareRevolution",
"fortnightlyMenuFrontPage": "Нүүр хуудас",
"fortnightlyMenuWorld": "Дэлхий",
"rallyBillDetailAmountPaid": "Төлсөн дүн",
"fortnightlyMenuPolitics": "Улс төр",
"fortnightlyHeadlineBees": "Богино хангамжийн фермийн зөгийнүүд",
"fortnightlyHeadlineGasoline": "Бензиний ирээдүй",
"fortnightlyTrendingGreenArmy": "GreenArmy",
"fortnightlyHeadlineFeminists": "Феминистүүд хүчээ авч байна",
"fortnightlyHeadlineFabrics": "Загвар зохион бүтээгчид футурист даавуу хийхдээ технологи ашиглаж байна",
"fortnightlyHeadlineStocks": "Хувьцааны ханш зогсонги байдалд орсноор олон хүн мөнгөн гүйлгээ рүү хийж байна",
"fortnightlyTrendingReform": "Шинэчлэл",
"fortnightlyMenuTech": "Технологи",
"fortnightlyHeadlineWar": "Дайны үед хуваагдсан Америкийн амьдрал",
"fortnightlyHeadlineHealthcare": "Чимээгүй боловч хүчирхэг эрүүл мэндийн хувьсгал",
"fortnightlyLatestUpdates": "Хамгийн сүүлийн шинэчлэлт",
"fortnightlyTrendingStocks": "Хувьцаа",
"rallyBillDetailTotalAmount": "Нийт дүн",
"demoCupertinoPickerDateTime": "Огноо ба цаг",
"signIn": "НЭВТРЭХ",
"dataTableRowWithSugar": "Чихэртэй {value}",
"dataTableRowApplePie": "Алимны бялуу",
"dataTableRowDonut": "Цагираган боов",
"dataTableRowHoneycomb": "Зөгийн балны сархинаг",
"dataTableRowLollipop": "Иштэй чихэр",
"dataTableRowJellyBean": "Шош хэлбэртэй царцмаг",
"dataTableRowGingerbread": "Цагаан гаа, бурамтай талх",
"dataTableRowCupcake": "Аяган бялуу",
"dataTableRowEclair": "Эклер",
"dataTableRowIceCreamSandwich": "Жигнэмэгтэй зайрмаг",
"dataTableRowFrozenYogurt": "Хөлдөөсөн тараг",
"dataTableColumnIron": "Төмөр (%)",
"dataTableColumnCalcium": "Кальци (%)",
"dataTableColumnSodium": "Натри (мг)",
"demoTimePickerTitle": "Цаг сонгогч",
"demo2dTransformationsResetTooltip": "Хэлбэр өөрчлөлтийг шинэчлэх",
"dataTableColumnFat": "Өөх тос (гр)",
"dataTableColumnCalories": "Илчлэг",
"dataTableColumnDessert": "Амттан (1 удаагийн)",
"cardsDemoTravelDestinationLocation1": "Тамилнаду муж, Танжавур хот",
"demoTimePickerDescription": "Материалын загварын цаг сонгогчийг агуулсан харилцах цонхыг харуулдаг.",
"demoPickersShowPicker": "СОНГОГЧИЙГ ХАРУУЛАХ",
"demoTabsScrollingTitle": "Гүйлгэх",
"demoTabsNonScrollingTitle": "Гүйлгэх боломжгүй",
"craneHours": "{hours,plural,=1{1 цаг}other{{hours}h}}",
"craneMinutes": "{minutes,plural,=1{1m}other{{minutes}m}}",
"craneFlightDuration": "{hoursShortForm} {minutesShortForm}",
"dataTableHeader": "Тэжээллэг чанар",
"demoDatePickerTitle": "Огноо сонгогч",
"demoPickersSubtitle": "Огноо болон цагийн сонголт",
"demoPickersTitle": "Сонгогч",
"demo2dTransformationsEditTooltip": "Хавтан засах",
"demoDataTableDescription": "Өгөгдлийн хүснэгт нь мэдээллийг мөр, баганууд бүхий сүлжээсэн форматаар үзүүлдэг. Тэдгээр нь мэдээллийг хайхад хялбар байдлаар цэгцэлснээр хэрэглэгч загвар, статистикийг харах боломжтой.",
"demo2dTransformationsDescription": "Хавтанг засахын тулд товшиж, үзэгдлийг нааш цааш нь зөөхийн тулд зангаа ашиглана уу. Чиглүүлэхийн тулд чирч, томруулахын тулд чимхэж, хоёр хуруугаараа эргүүлнэ үү. Эхэлж буй чиглэл рүү буцахын тулд шинэчлэх товчлуурыг дарна уу.",
"demo2dTransformationsSubtitle": "Чиглүүлэх, томруулах, эргүүлэх",
"demo2dTransformationsTitle": "2D хэлбэр өөрчлөлт",
"demoCupertinoTextFieldPIN": "ПИН",
"demoCupertinoTextFieldDescription": "Текстийн талбар нь хэрэглэгчид техник хангамжийн гар эсвэл дэлгэц дээрх гарын тусламжтай текст оруулах боломж олгодог.",
"demoCupertinoTextFieldSubtitle": "iOS загварын текстийн талбар",
"demoCupertinoTextFieldTitle": "Текстийн талбар",
"demoDatePickerDescription": "Материалын загварын огноо сонгогчийг агуулсан харилцах цонхыг харуулдаг.",
"demoCupertinoPickerTime": "Цаг",
"demoCupertinoPickerDate": "Огноо",
"demoCupertinoPickerTimer": "Цаг хэмжигч",
"demoCupertinoPickerDescription": "Мөр, огноо, цаг эсвэл огноо, цагийг хамтад нь сонгоход ашиглаж болох iOS-загвар сонгогч виджет.",
"demoCupertinoPickerSubtitle": "iOS-загварын сонгогчид",
"demoCupertinoPickerTitle": "Сонгогч",
"dataTableRowWithHoney": "Зөгийн балтай {value}",
"cardsDemoTravelDestinationCity2": "Четтинад хот",
"bannerDemoResetText": "Баннерыг шинэчлэх",
"bannerDemoMultipleText": "Олон үйлдэл",
"bannerDemoLeadingText": "Эхлэх дүрс тэмдэг",
"dismiss": "ҮЛ ХЭРЭГСЭХ",
"cardsDemoTappable": "Товших боломжтой",
"cardsDemoSelectable": "Сонгох боломжтой (удаан дарах)",
"cardsDemoExplore": "Судлах",
"cardsDemoExploreSemantics": "{destinationName}-г судлах",
"cardsDemoShareSemantics": "{destinationName}-г хуваалцах",
"cardsDemoTravelDestinationTitle1": "Тамилнаду мужид зочлох шилдэг 10 хот",
"cardsDemoTravelDestinationDescription1": "Дугаар 10",
"cardsDemoTravelDestinationCity1": "Танжавур хот",
"dataTableColumnProtein": "Уураг (гр)",
"cardsDemoTravelDestinationTitle2": "Энэтхэгийн өмнөд хэсгээс гаралтай уран бүтээлчид",
"cardsDemoTravelDestinationDescription2": "Торго нэхэгчид",
"bannerDemoText": "Таны нууц үгийг таны өөр төхөөрөмж дээр шинэчилсэн байна. Дахин нэвтэрнэ үү.",
"cardsDemoTravelDestinationLocation2": "Тамилнаду муж, Шиваганга хот",
"cardsDemoTravelDestinationTitle3": "Брихадисвара сүм",
"cardsDemoTravelDestinationDescription3": "Сүмүүд",
"demoBannerTitle": "Баннер",
"demoBannerSubtitle": "Жагсаалтын доторх баннерыг үзүүлэх",
"demoBannerDescription": "Баннер нь чухал, хураангуй мессеж үзүүлж, хэрэглэгчдэд зориулан хаяглах (эсвэл баннерыг үл хэрэгсэх) үйлдэл хийдэг. Үүнийг үл хэрэгсэхийн тулд хэрэглэгчийн үйлдэл шаардлагатай.",
"demoCardTitle": "Картууд",
"demoCardSubtitle": "Дугуй өнцгүүдтэй үндсэн картууд",
"demoCardDescription": "Карт нь цомог, газарзүйн байршил, хоол, харилцах дэлгэрэнгүй мэдээлэл гэх мэт зарим холбоотой мэдээллийг харуулахад ашигладаг цаасан материал юм.",
"demoDataTableTitle": "Өгөгдлийн хүснэгт",
"demoDataTableSubtitle": "Мэдээллийн мөр болон баганууд",
"dataTableColumnCarbs": "Нүүрс ус (гр)",
"placeTanjore": "Танжор",
"demoGridListsTitle": "Торон жагсаалт",
"placeFlowerMarket": "Цэцгийн зах",
"placeBronzeWorks": "Хүрэл эдлэлийн урлан",
"placeMarket": "Маркет",
"placeThanjavurTemple": "Танжавүр сүм",
"placeSaltFarm": "Давсны ферм",
"placeScooters": "Скүтер",
"placeSilkMaker": "Торго нэхэгч",
"placeLunchPrep": "Үдийн хоолны бэлтгэл",
"placeBeach": "Далайн эрэг",
"placeFisherman": "Загасчин",
"demoMenuSelected": "Сонгосон: {value}\n",
"demoMenuRemove": "Хасах",
"demoMenuGetLink": "Холбоос авах",
"demoMenuShare": "Хуваалцах",
"demoBottomAppBarSubtitle": "Навигац болон үйлдлийг доод талд үзүүлдэг",
"demoMenuAnItemWithASectionedMenu": "Хэсэгчилсэн цэстэй зүйл",
"demoMenuADisabledMenuItem": "Цэсийн идэвхгүй болгосон зүйл",
"demoLinearProgressIndicatorTitle": "Шугаман үйл явцын заалт",
"demoMenuContextMenuItemOne": "Хадам сэдэв цэсийн нэгдүгээр зүйл",
"demoMenuAnItemWithASimpleMenu": "Энгийн цэстэй зүйл",
"demoCustomSlidersTitle": "Захиалгат слайдер",
"demoMenuAnItemWithAChecklistMenu": "Шалгах хуудасны цэстэй зүйл",
"demoCupertinoActivityIndicatorTitle": "Үйл ажиллагааны заалт",
"demoCupertinoActivityIndicatorSubtitle": "iOS загварын үйл ажиллагааны заалт",
"demoCupertinoActivityIndicatorDescription": "Цагийн зүүний дагуу эргэдэг iOS загварын үйл ажиллагааны заалт.",
"demoCupertinoNavigationBarTitle": "Навигацын самбар",
"demoCupertinoNavigationBarSubtitle": "iOS загварын навигацын самбар",
"demoCupertinoNavigationBarDescription": "iOS загварын навигацын самбар. Навигацын самбар нь хамгийн багадаа хуудасны гарчгаас бүрддэг самбар бөгөөд энэ нь самбарын дунд хэсэгт байдаг.",
"demoCupertinoPullToRefreshTitle": "Сэргээхийн тулд татах",
"demoCupertinoPullToRefreshSubtitle": "iOS загварын татаж сэргээдэг хяналт",
"demoCupertinoPullToRefreshDescription": "iOS загварын татаж сэргээдэг хяналтыг хэрэгжүүлдэг жижиг хэрэгсэл",
"demoProgressIndicatorTitle": "Үйл явцын заалт",
"demoProgressIndicatorSubtitle": "Шугаман, эргэлтийн, тогтоогоогүй",
"demoCircularProgressIndicatorTitle": "Эргэлтийн үйл явцын заалт",
"demoCircularProgressIndicatorDescription": "Материалын загварын эргэлтийн үйл явцын заалт нь аппликэйшн ажиллаж байгаа гэдгийг зааж эргэлддэг.",
"demoMenuFour": "Дөрөв",
"demoLinearProgressIndicatorDescription": "Материалын загварын шугаман үйл явцын заалт нь мөн явцын заалт гэж танигдсан.",
"demoTooltipTitle": "Зөвлөмж",
"demoTooltipSubtitle": "Удаан дарах эсвэл зөөхөд үзүүлдэг богино мессеж",
"demoTooltipDescription": "Зөвлөмж нь товчлуурын функц эсвэл хэрэглэгчийн бусад харилцан үйлдлийн талаар тайлбарлахад тусалдаг текстийн шошгыг үзүүлдэг. Зөвлөмж нь хэрэглэгчид элемент дээр зөөх, сонгох эсвэл удаан дарах үед мэдээллийн текстийг үзүүлдэг.",
"demoTooltipInstructions": "Зөвлөмжийг үзүүлэхийн тулд удаан дарах эсвэл зөөнө үү.",
"placeChennai": "Ченнай",
"demoMenuChecked": "Шалгасан: {value}\n",
"placeChettinad": "Четтинад",
"demoMenuPreview": "Урьдчилан үзэх",
"demoBottomAppBarTitle": "Доод талд байрлах аппын самбар",
"demoBottomAppBarDescription": "Доод талд байрлах аппын самбар нь доод талын навигацын шургуулга болон үйлдлийн хөвөгч товчлуурыг оролцуулаад дөрөв хүртэлх үйлдэлд хандах боломжийг олгодог.",
"bottomAppBarNotch": "Хэрчлээс",
"bottomAppBarPosition": "Үйлдлийн хөвөгч товчлуурын байршил",
"bottomAppBarPositionDockedEnd": "Суурилуулсан - төгсгөлд",
"bottomAppBarPositionDockedCenter": "Суурилуулсан - төвд",
"bottomAppBarPositionFloatingEnd": "Хөвөгч - төгсгөлд",
"bottomAppBarPositionFloatingCenter": "Хөвөгч - төвд",
"demoSlidersEditableNumericalValue": "Засаж болдог тоон утга",
"demoGridListsSubtitle": "Мөр болон баганын байршил",
"demoGridListsDescription": "Торон жагсаалт нь ихэвчлэн зураг зэрэг жигд тархацтай өгөгдлийг үзүүлэхэд хамгийн тохиромжтой. Торон жагсаалтын зүйл бүрийг дөрвөлж гэж нэрлэдэг.",
"demoGridListsImageOnlyTitle": "Зөвхөн зураг",
"demoGridListsHeaderTitle": "Толгой хэсэгтэй",
"demoGridListsFooterTitle": "Хөл хэсэгтэй",
"demoSlidersTitle": "Слайдер",
"demoSlidersSubtitle": "Шудрах замаар утга сонгоход зориулсан жижиг хэрэгсэл",
"demoSlidersDescription": "Слайдер нь самбар дагуух утгын мужийг илэрхийлдэг бөгөөд хэрэглэгчид тэндээс дан утгыг сонгож болно. Энэ нь дууны түвшин, гэрэлтүүлэг зэрэг тохиргоог тохируулах эсвэл зургийн шүүлтүүрийг хэрэгжүүлэхэд яг таг тохирдог.",
"demoRangeSlidersTitle": "Мужийн слайдер",
"demoRangeSlidersDescription": "Слайдер нь самбар дагуух утгын мужийг илэрхийлдэг. Энэ нь самбарын төгсгөлийн аль алинд утгын мужийг илэрхийлдэг дүрс тэмдэгтэй байх боломжтой. Энэ нь дууны түвшин, гэрэлтүүлэг зэрэг тохиргоог тохируулах эсвэл зургийн шүүлтүүрийг хэрэгжүүлэхэд яг таг тохирдог.",
"demoMenuAnItemWithAContextMenuButton": "Хам сэдэв цэстэй зүйл",
"demoCustomSlidersDescription": "Слайдер нь самбар дагуух утгын мужийг илэрхийлдэг бөгөөд хэрэглэгчид тэндээс дан утга эсвэл утгын мужийг сонгож болно. Слайдерыг загвартай болгох, өөрчлөх боломжтой.",
"demoSlidersContinuousWithEditableNumericalValue": "Засаж болдог тоон утгатай тасралтгүй",
"demoSlidersDiscrete": "Салангид",
"demoSlidersDiscreteSliderWithCustomTheme": "Захиалгат загвар болон салангид утгатай слайдер",
"demoSlidersContinuousRangeSliderWithCustomTheme": "Захиалгат загвар болон тасралтгүй утгатай мужийн слайдер",
"demoSlidersContinuous": "Тасралтгүй",
"placePondicherry": "Пондичерри",
"demoMenuTitle": "Цэс",
"demoContextMenuTitle": "Хам сэдэв цэс",
"demoSectionedMenuTitle": "Хэсэглэсэн цэс",
"demoSimpleMenuTitle": "Энгийн цэс",
"demoChecklistMenuTitle": "Шалгах хуудасны цэс",
"demoMenuSubtitle": "Цэсийн товчлуур болон энгийн цэс",
"demoMenuDescription": "Цэс нь түр зуурын гадаргуу дээр сонголтын жагсаалтыг үзүүлдэг. Энэ нь хэрэглэгчид товчлуур, үйлдэл эсвэл бусад хяналттай харилцах үед харагддаг.",
"demoMenuItemValueOne": "Цэсийн нэгдүгээр зүйл",
"demoMenuItemValueTwo": "Цэсийн хоёрдугаар зүйл",
"demoMenuItemValueThree": "Цэсийн гуравдугаар зүйл",
"demoMenuOne": "Нэг",
"demoMenuTwo": "Хоёр",
"demoMenuThree": "Гурав",
"demoMenuContextMenuItemThree": "Хадам сэдэв цэсийн гуравдугаар зүйл",
"demoCupertinoSwitchSubtitle": "iOS загварын сэлгүүр",
"demoSnackbarsText": "Энэ бол snackbar.",
"demoCupertinoSliderSubtitle": "iOS загварын слайдер",
"demoCupertinoSliderDescription": "Утгын тасралтгүй эсвэл салангид олонлогийн аль нэгээс сонгохын тулд слайдерыг ашиглах боломжтой.",
"demoCupertinoSliderContinuous": "Тасралтгүй: {value}\n",
"demoCupertinoSliderDiscrete": "Салангид: {value}\n",
"demoSnackbarsAction": "Та snackbar-н үйлдлийг дарлаа.",
"backToGallery": "Галерей руу буцах",
"demoCupertinoTabBarTitle": "Табын самбар",
"demoCupertinoSwitchDescription": "Дан тохиргооны төлөвийг асаах/унтраахын тулд сэлгүүрийг ашигладаг.",
"demoSnackbarsActionButtonLabel": "ҮЙЛДЭЛ",
"cupertinoTabBarProfileTab": "Профайл",
"demoSnackbarsButtonLabel": "SNACKBAR-Г ХАРУУЛАХ",
"demoSnackbarsDescription": "Snackbar нь аппын гүйцэтгэсэн эсвэл гүйцэтгэх процессын тухай хэрэглэгчдэд мэдээлдэг. Энэ нь дэлгэцийн доод талд түр хугацаанд харагддаг. Энэ нь хэрэглэгчийн туршлагад саад болох ёсгүй бөгөөд алга болохын тулд хэрэглэгчээс оролт шаарддаггүй.",
"demoSnackbarsSubtitle": "Snackbar нь дэлгэцийн доод талд мессежийг харуулдаг",
"demoSnackbarsTitle": "Snackbar",
"demoCupertinoSliderTitle": "Слайдер",
"cupertinoTabBarChatTab": "Чат",
"cupertinoTabBarHomeTab": "Нүүр хуудас",
"demoCupertinoTabBarDescription": "iOS загварын доод навигацын табын самбар. Олон табыг үзүүлэх бөгөөд өгөгдмөл тохиргоогоор эхнийх нь идэвхтэй байдаг.",
"demoCupertinoTabBarSubtitle": "iOS загварын доод табын самбар",
"demoOptionsFeatureTitle": "Сонголтуудыг харах",
"demoOptionsFeatureDescription": "Энэ демо хувилбарын боломжит сонголтуудыг харахын тулд энд товшино уу.",
"demoCodeViewerCopyAll": "БҮГДИЙГ ХУУЛАХ",
"shrineScreenReaderRemoveProductButton": "Хасах {product}",
"shrineScreenReaderProductAddToCart": "Сагсанд нэмэх",
"shrineScreenReaderCart": "{quantity,plural,=0{Худалдан авах сагс, зүйлс алга}=1{Худалдан авах сагс, 1 зүйл}other{Худалдан авах сагс, {quantity} зүйл}}",
"demoCodeViewerFailedToCopyToClipboardMessage": "Түр санах ойд хуулж чадсанүй: {error}",
"demoCodeViewerCopiedToClipboardMessage": "Түр санах ойд хуулсан.",
"craneSleep8SemanticLabel": "Далайн эрэг дээрх хадан цохионы Майягийн балгас туурь",
"craneSleep4SemanticLabel": "Уулын урдах нуурын эргийн зочид буудал",
"craneSleep2SemanticLabel": "Мачу Пикчу хэрэм",
"craneSleep1SemanticLabel": "Мөнх ногоон модтой, цастай байгаль дахь модон байшин",
"craneSleep0SemanticLabel": "Усан дээрх бунгало",
"craneFly13SemanticLabel": "Далдуу модтой далайн эргийн усан сан",
"craneFly12SemanticLabel": "Далдуу модтой усан сан",
"craneFly11SemanticLabel": "Далай дахь тоосгон гэрэлт цамхаг",
"craneFly10SemanticLabel": "Нар жаргах үеийн Аль-Азхар сүмийн цамхгууд",
"craneFly9SemanticLabel": "Хуучны цэнхэр өнгийн машин налж буй эр",
"craneFly8SemanticLabel": "Supertree төгөл",
"craneEat9SemanticLabel": "Гурилан бүтээгдэхүүнүүд өрсөн кафены лангуу",
"craneEat2SemanticLabel": "Бургер",
"craneFly5SemanticLabel": "Уулын урдах нуурын эргийн зочид буудал",
"demoSelectionControlsSubtitle": "Checkboxes, радио товчлуур болон сэлгүүр",
"craneEat10SemanticLabel": "Асар том пастрами сэндвич барьж буй эмэгтэй",
"craneFly4SemanticLabel": "Усан дээрх бунгало",
"craneEat7SemanticLabel": "Талх нарийн боовны газрын хаалга",
"craneEat6SemanticLabel": "Сам хорхойтой хоол",
"craneEat5SemanticLabel": "Уран чамин рестораны суух хэсэг",
"craneEat4SemanticLabel": "Шоколадтай амттан",
"craneEat3SemanticLabel": "Солонгос тако",
"craneFly3SemanticLabel": "Мачу Пикчу хэрэм",
"craneEat1SemanticLabel": "Хоолны сандалтай хоосон уушийн газар",
"craneEat0SemanticLabel": "Модоор галласан зуухан дахь пицца",
"craneSleep11SemanticLabel": "Тайбэй 101 тэнгэр баганадсан барилга",
"craneSleep10SemanticLabel": "Нар жаргах үеийн Аль-Азхар сүмийн цамхгууд",
"craneSleep9SemanticLabel": "Далай дахь тоосгон гэрэлт цамхаг",
"craneEat8SemanticLabel": "Хавчны таваг",
"craneSleep7SemanticLabel": "Riberia Square дахь өнгөлөг орон сууцууд",
"craneSleep6SemanticLabel": "Далдуу модтой усан сан",
"craneSleep5SemanticLabel": "Талбай дээрх майхан",
"settingsButtonCloseLabel": "Тохиргоог хаах",
"demoSelectionControlsCheckboxDescription": "Checkboxes нь хэрэглэгчид багцаас олон сонголт сонгохыг зөвшөөрдөг. Энгийн тэмдэглэх нүдний утга нь үнэн эсвэл худал, tristate тэмдэглэх нүдний утга нь мөн тэг байж болно.",
"settingsButtonLabel": "Тохиргоо",
"demoListsTitle": "Жагсаалтууд",
"demoListsSubtitle": "Жагсаалтын бүдүүвчийг гүйлгэх",
"demoListsDescription": "Тогтмол өндөртэй ганц мөр нь ихэвчлэн зарим текст болон эхлэх эсвэл төгсгөх дүрс тэмдэг агуулдаг.",
"demoOneLineListsTitle": "Нэг шугам",
"demoTwoLineListsTitle": "Хоёр шугам",
"demoListsSecondary": "Хоёр дахь мөрний текст",
"demoSelectionControlsTitle": "Хяналтын сонголт",
"craneFly7SemanticLabel": "Рашмор уул",
"demoSelectionControlsCheckboxTitle": "Checkbox",
"craneSleep3SemanticLabel": "Хуучны цэнхэр өнгийн машин налж буй эр",
"demoSelectionControlsRadioTitle": "Радио",
"demoSelectionControlsRadioDescription": "Радио товчлуур нь хэрэглэгчид багцаас нэг сонголт сонгохийг зөвшөөрдөг. Хэрэв та хэрэглэгч бүх боломжит сонголтыг зэрэгцүүлэн харах шаардлагатай гэж бодож байвал онцгой сонголтод зориулсан радио товчлуурыг ашиглана уу.",
"demoSelectionControlsSwitchTitle": "Сэлгэх",
"demoSelectionControlsSwitchDescription": "Асаах/унтраах сэлгүүр нь дан тохиргооны сонголтын төлөвийг асаана/унтраана. Сэлгэх хяналтын сонголт болон үүний байгаа төлөвийг харгалзах мөрийн шошгоос тодорхой болгох шаардлагатай.",
"craneFly0SemanticLabel": "Мөнх ногоон модтой, цастай байгаль дахь модон байшин",
"craneFly1SemanticLabel": "Талбай дээрх майхан",
"craneFly2SemanticLabel": "Цастай уулын урдах залбирлын тугууд",
"craneFly6SemanticLabel": "Palacio de Bellas Artes-н агаараас харагдах байдал",
"rallySeeAllAccounts": "Бүх бүртгэлийг харах",
"rallyBillAmount": "{billName}-н {amount}-н тооцоог {date}-с өмнө хийх ёстой.",
"shrineTooltipCloseCart": "Сагсыг хаах",
"shrineTooltipCloseMenu": "Цэсийг хаах",
"shrineTooltipOpenMenu": "Цэсийг нээх",
"shrineTooltipSettings": "Тохиргоо",
"shrineTooltipSearch": "Хайх",
"demoTabsDescription": "Табууд нь өөр дэлгэцүүд, өгөгдлийн багц болон бусад харилцан үйлдэл хооронд контентыг цэгцэлдэг.",
"demoTabsSubtitle": "Чөлөөтэй гүйлгэх харагдацтай табууд",
"demoTabsTitle": "Табууд",
"rallyBudgetAmount": "{budgetName} төсвийн {amountTotal}-с {amountUsed}-г ашигласан, {amountLeft} үлдсэн",
"shrineTooltipRemoveItem": "Зүйлийг хасах",
"rallyAccountAmount": "{amount}-тай {accountName}-н {accountNumber} дугаартай данс.",
"rallySeeAllBudgets": "Бүх төсвийг харах",
"rallySeeAllBills": "Бүх тооцоог харах",
"craneFormDate": "Огноо сонгох",
"craneFormOrigin": "Эхлэх цэг сонгох",
"craneFly2": "Балба, Хумбу хөндий",
"craneFly3": "Перу, Мачу Пикчу",
"craneFly4": "Мальдив, Мале",
"craneFly5": "Швейцар, Вицнау",
"craneFly6": "Мексик улс, Мексик хот",
"craneFly7": "Америкийн Нэгдсэн Улс, Рашмор",
"settingsTextDirectionLocaleBased": "Хэл болон улсын код дээр суурилсан",
"craneFly9": "Куба, Хавана",
"craneFly10": "Египет, Каир",
"craneFly11": "Португал, Лисбон",
"craneFly12": "Америкийн Нэгдсэн Улс, Напа",
"craneFly13": "Индонез, Бали",
"craneSleep0": "Мальдив, Мале",
"craneSleep1": "Америкийн Нэгдсэн Улс, Аспен",
"craneSleep2": "Перу, Мачу Пикчу",
"demoCupertinoSegmentedControlTitle": "Хэсэгчилсэн хяналт",
"craneSleep4": "Швейцар, Вицнау",
"craneSleep5": "Америкийн Нэгдсэн Улс, Биг Сур",
"craneSleep6": "Америкийн Нэгдсэн Улс, Напа",
"craneSleep7": "Португал, Порту",
"craneSleep8": "Мексик, Тулум",
"craneEat5": "Өмнөд Солонгос, Сөүл",
"demoChipTitle": "Чипүүд",
"demoChipSubtitle": "Оруулга, атрибут эсвэл үйлдлийг илэрхийлдэг товч тодорхой элемент",
"demoActionChipTitle": "Үйлдлийн чип",
"demoActionChipDescription": "Үйлдлийн чип нь үндсэн контенттой хамааралтай үйлдлийг өдөөдөг сонголтын багц юм. Үйлдлийн чип нь UI-д динамикаар болон хам сэдэвтэй уялдсан байдлаар гарч ирэх ёстой.",
"demoChoiceChipTitle": "Сонголтын чип",
"demoChoiceChipDescription": "Сонголтын чип нь багцаас нэг сонголтыг илэрхийлдэг. Сонголтын чип нь контенттой холбоотой тайлбарласан текст эсвэл ангиллыг агуулдаг.",
"demoFilterChipTitle": "Шүүлтүүрийн чип",
"demoFilterChipDescription": "Шүүлтүүрийн чип нь шошго эсвэл тайлбарласан үгийг контентыг шүүх арга болгон ашигладаг.",
"demoInputChipTitle": "Оруулгын чип",
"demoInputChipDescription": "Оруулгын чип нь нэгж (хүн, газар эсвэл зүйл) эсвэл харилцан ярианы текст зэрэг цогц мэдээллийг товч тодорхой хэлбэрээр илэрхийлдэг.",
"craneSleep9": "Португал, Лисбон",
"craneEat10": "Португал, Лисбон",
"demoCupertinoSegmentedControlDescription": "Хэд хэдэн харилцан адилгүй сонголтоос сонгоход ашигладаг. Хэсэгчилсэн хяналтын нэг сонголтыг сонгосон үед үүний бусад сонголтыг сонгохоо болино.",
"chipTurnOnLights": "Гэрэл асаах",
"chipSmall": "Жижиг",
"chipMedium": "Дундaж",
"chipLarge": "Том",
"chipElevator": "Цахилгаан шат",
"chipWasher": "Угаалгын машин",
"chipFireplace": "Ил зуух",
"chipBiking": "Дугуй унах",
"craneFormDiners": "Зоог барих хүний тоо",
"rallyAlertsMessageUnassignedTransactions": "{count,plural,=1{Татварын боломжит суутгалаа нэмэгдүүлээрэй! 1 оноогоогүй гүйлгээнд ангилал оноогоорой.}other{Татварын боломжит суутгалаа нэмэгдүүлээрэй! {count} оноогоогүй гүйлгээнд ангилал оноогоорой.}}",
"craneFormTime": "Цаг сонгох",
"craneFormLocation": "Байршил сонгох",
"craneFormTravelers": "Аялагчид",
"craneEat8": "Америкийн Нэгдсэн улс, Атланта",
"craneFormDestination": "Очих газар сонгох",
"craneFormDates": "Огноо сонгох",
"craneFly": "НИСЭХ",
"craneSleep": "ХОНОГЛОХ",
"craneEat": "ЗООГЛОХ",
"craneFlySubhead": "Нислэгийг очих газраар нь судлах",
"craneSleepSubhead": "Үл хөдлөх хөрөнгийг очих газраар нь судлах",
"craneEatSubhead": "Рестораныг очих газраар нь судлах",
"craneFlyStops": "{numberOfStops,plural,=0{Шууд}=1{1 зогсолт}other{{numberOfStops} зогсолт}}",
"craneSleepProperties": "{totalProperties,plural,=0{Боломжтой үл хөдлөх хөрөнгө алга}=1{1 боломжтой үл хөдлөх хөрөнгө байна}other{{totalProperties} боломжтой үл хөдлөх хөрөнгө байна}}",
"craneEatRestaurants": "{totalRestaurants,plural,=0{Ресторан алга}=1{1 ресторан}other{{totalRestaurants} ресторан}}",
"craneFly0": "Америкийн Нэгдсэн Улс, Аспен",
"demoCupertinoSegmentedControlSubtitle": "iOS загварын хэсэгчилсэн хяналт",
"craneSleep10": "Египет, Каир",
"craneEat9": "Испани, Мадрид",
"craneFly1": "Америкийн Нэгдсэн Улс, Биг Сур",
"craneEat7": "Америкийн Нэгдсэн Улс, Нашвилл",
"craneEat6": "Америкийн Нэгдсэн Улс, Сиэтл",
"craneFly8": "Сингапур",
"craneEat4": "Франц, Парис",
"craneEat3": "Америкийн Нэгдсэн Улс, Портланд",
"craneEat2": "Аргентин, Кордова",
"craneEat1": "Америкийн Нэгдсэн Улс, Даллас",
"craneEat0": "Итали, Неаполь",
"craneSleep11": "Тайвань, Тайбэй",
"craneSleep3": "Куба, Хавана",
"shrineLogoutButtonCaption": "ГАРАХ",
"rallyTitleBills": "ТООЦОО",
"rallyTitleAccounts": "ДАНСНУУД",
"shrineProductVagabondSack": "Vagabond-н даавуун тор",
"rallyAccountDetailDataInterestYtd": "Оны эхнээс өнөөдрийг хүртэлх хүү",
"shrineProductWhitneyBelt": "Уитни бүс",
"shrineProductGardenStrand": "Гарден странд",
"shrineProductStrutEarrings": "Strut-н ээмэг",
"shrineProductVarsitySocks": "Түрийгээрээ судалтай оймс",
"shrineProductWeaveKeyring": "Түлхүүрийн сүлжмэл бүл",
"shrineProductGatsbyHat": "Гэтсби малгай",
"shrineProductShrugBag": "Нэг мөртэй цүнх",
"shrineProductGiltDeskTrio": "Алтан шаргал оруулгатай гурван хос ширээ",
"shrineProductCopperWireRack": "Зэс утсан тавиур",
"shrineProductSootheCeramicSet": "Тайвшруулах керамик иж бүрдэл",
"shrineProductHurrahsTeaSet": "Hurrahs цайны иж бүрдэл",
"shrineProductBlueStoneMug": "Цэнхэр чулуун аяга",
"shrineProductRainwaterTray": "Борооны усны тосгуур",
"shrineProductChambrayNapkins": "Тааран даавуун амны алчуур",
"shrineProductSucculentPlanters": "Шүүслэг ургамлын сав",
"shrineProductQuartetTable": "Квадрат ширээ",
"shrineProductKitchenQuattro": "Гал тогооны куватро",
"shrineProductClaySweater": "Шаврын өнгөтэй цамц",
"shrineProductSeaTunic": "Нимгэн даашинз",
"shrineProductPlasterTunic": "Нимгэн урт цамц",
"rallyBudgetCategoryRestaurants": "Ресторан",
"shrineProductChambrayShirt": "Тааран даавуун цамц",
"shrineProductSeabreezeSweater": "Сүлжмэл цамц",
"shrineProductGentryJacket": "Жентри хүрэм",
"shrineProductNavyTrousers": "Цэнхэр өмд",
"shrineProductWalterHenleyWhite": "Вальтер хэнли (цагаан)",
"shrineProductSurfAndPerfShirt": "Бэлтгэлийн цамц",
"shrineProductGingerScarf": "Шаргал өнгийн ороолт",
"shrineProductRamonaCrossover": "Рамона кроссовер",
"shrineProductClassicWhiteCollar": "Сонгодог цагаан зах",
"shrineProductSunshirtDress": "Нарны хамгаалалттай даашинз",
"rallyAccountDetailDataInterestRate": "Хүүгийн хэмжээ",
"rallyAccountDetailDataAnnualPercentageYield": "Жилийн өгөөжийн хувь",
"rallyAccountDataVacation": "Амралт",
"shrineProductFineLinesTee": "Нарийн судалтай футболк",
"rallyAccountDataHomeSavings": "Гэрийн хадгаламж",
"rallyAccountDataChecking": "Чекийн",
"rallyAccountDetailDataInterestPaidLastYear": "Өнгөрсөн жил төлсөн хүү",
"rallyAccountDetailDataNextStatement": "Дараагийн мэдэгдэл",
"rallyAccountDetailDataAccountOwner": "Данс эзэмшигч",
"rallyBudgetCategoryCoffeeShops": "Кофе шопууд",
"rallyBudgetCategoryGroceries": "Хүнсний бүтээгдэхүүн",
"shrineProductCeriseScallopTee": "Долгиолсон захтай ягаан цамц",
"rallyBudgetCategoryClothing": "Хувцас",
"rallySettingsManageAccounts": "Бүртгэл удирдах",
"rallyAccountDataCarSavings": "Автомашины хадгаламж",
"rallySettingsTaxDocuments": "Татварын документ",
"rallySettingsPasscodeAndTouchId": "Нууц код болон Хүрэх ID",
"rallySettingsNotifications": "Мэдэгдэл",
"rallySettingsPersonalInformation": "Хувийн мэдээлэл",
"rallySettingsPaperlessSettings": "Цаасгүй тохиргоо",
"rallySettingsFindAtms": "ATM хайх",
"rallySettingsHelp": "Тусламж",
"rallySettingsSignOut": "Гарах",
"rallyAccountTotal": "Нийт",
"rallyBillsDue": "Эцсийн хугацаа",
"rallyBudgetLeft": "Үлдсэн",
"rallyAccounts": "Данснууд",
"rallyBills": "Тооцоо",
"rallyBudgets": "Төсөв",
"rallyAlerts": "Сэрэмжлүүлэг",
"rallySeeAll": "БҮГДИЙГ ХАРАХ",
"rallyFinanceLeft": "ҮЛДСЭН",
"rallyTitleOverview": "ТОЙМ",
"shrineProductShoulderRollsTee": "Эргүүлдэг мөртэй футболк",
"shrineNextButtonCaption": "ДАРААХ",
"rallyTitleBudgets": "ТӨСӨВ",
"rallyTitleSettings": "ТОХИРГОО",
"rallyLoginLoginToRally": "Rally-д нэвтрэх",
"rallyLoginNoAccount": "Та бүртгэлгүй юу?",
"rallyLoginSignUp": "БҮРТГҮҮЛЭХ",
"rallyLoginUsername": "Хэрэглэгчийн нэр",
"rallyLoginPassword": "Нууц үг",
"rallyLoginLabelLogin": "Нэвтрэх",
"rallyLoginRememberMe": "Намайг сануул",
"rallyLoginButtonLogin": "НЭВТРЭХ",
"rallyAlertsMessageHeadsUpShopping": "Анхаараарай, та энэ сарын худалдан авалтынхаа төсвийн {percent}-г ашигласан байна.",
"rallyAlertsMessageSpentOnRestaurants": "Та энэ сар ресторанд {amount} зарцуулсан байна.",
"rallyAlertsMessageATMFees": "Та энэ сар ATM-н хураамжид {amount} зарцуулсан байна",
"rallyAlertsMessageCheckingAccount": "Сайн ажиллалаа! Таны чекийн данс өнгөрсөн сарынхаас {percent}-р илүү байна.",
"shrineMenuCaption": "ЦЭС",
"shrineCategoryNameAll": "БҮХ",
"shrineCategoryNameAccessories": "ГОЁЛ ЧИМЭГЛЭЛ",
"shrineCategoryNameClothing": "ХУВЦАС",
"shrineCategoryNameHome": "ГЭРИЙН",
"shrineLoginUsernameLabel": "Хэрэглэгчийн нэр",
"shrineLoginPasswordLabel": "Нууц үг",
"shrineCancelButtonCaption": "ЦУЦЛАХ",
"shrineCartTaxCaption": "Татвар:",
"shrineCartPageCaption": "САГС",
"shrineProductQuantity": "Тоо хэмжээ: {quantity}",
"shrineProductPrice": "x {price}",
"shrineCartItemCount": "{quantity,plural,=0{ЗҮЙЛС АЛГА}=1{1 ЗҮЙЛ}other{{quantity} ЗҮЙЛ}}",
"shrineCartClearButtonCaption": "САГСЫГ ЦЭВЭРЛЭХ",
"shrineCartTotalCaption": "НИЙТ",
"shrineCartSubtotalCaption": "Нийлбэр дүн:",
"shrineCartShippingCaption": "Тээвэрлэлт:",
"shrineProductGreySlouchTank": "Саарал сул мак",
"shrineProductStellaSunglasses": "Стелла нарны шил",
"shrineProductWhitePinstripeShirt": "Босоо судалтай цагаан цамц",
"demoTextFieldWhereCanWeReachYou": "Бид тантай ямар дугаараар холбогдох боломжтой вэ?",
"settingsTextDirectionLTR": "Зүүнээс баруун",
"settingsTextScalingLarge": "Том",
"demoBottomSheetHeader": "Толгой хэсэг",
"demoBottomSheetItem": "Зүйл {value}",
"demoBottomTextFieldsTitle": "Текстийн талбар",
"demoTextFieldTitle": "Текстийн талбар",
"demoTextFieldSubtitle": "Засах боломжтой текст болон дугаарын нэг мөр",
"demoTextFieldDescription": "Текстийн талбар нь хэрэглэгчид UI-д текст оруулах боломжийг олгодог. Эдгээр нь ихэвчлэн маягт болон харилцах цонхонд гарч ирдэг.",
"demoTextFieldShowPasswordLabel": "Нууц үгийг харуулах",
"demoTextFieldHidePasswordLabel": "Нууц үгийг нуух",
"demoTextFieldFormErrors": "Илгээхээсээ өмнө улаанаар тэмдэглэсэн алдаануудыг засна уу.",
"demoTextFieldNameRequired": "Нэр оруулах шаардлагатай.",
"demoTextFieldOnlyAlphabeticalChars": "Зөвхөн цагаан толгойн үсэг оруулна уу.",
"demoTextFieldEnterUSPhoneNumber": "(###) ###-#### - АНУ-ын утасны дугаар оруулна уу.",
"demoTextFieldEnterPassword": "Нууц үгээ оруулна уу.",
"demoTextFieldPasswordsDoNotMatch": "Нууц үг таарахгүй байна",
"demoTextFieldWhatDoPeopleCallYou": "Таныг хүмүүс хэн гэж дууддаг вэ?",
"demoTextFieldNameField": "Нэр*",
"demoBottomSheetButtonText": "ДООД ХҮСНЭГТИЙГ ХАРУУЛАХ",
"demoTextFieldPhoneNumber": "Утасны дугаар*",
"demoBottomSheetTitle": "Доод хүснэгт",
"demoTextFieldEmail": "Имэйл",
"demoTextFieldTellUsAboutYourself": "Бидэнд өөрийнхөө талаар хэлнэ үү (ж.нь, та ямар ажил хийдэг эсвэл та ямар хоббитой талаараа бичнэ үү)",
"demoTextFieldKeepItShort": "Энэ нь ердөө демо тул үүнийг товч байлгаарай.",
"starterAppGenericButton": "ТОВЧЛУУР",
"demoTextFieldLifeStory": "Амьдралын түүх",
"demoTextFieldSalary": "Цалин",
"demoTextFieldUSD": "Ам.доллар",
"demoTextFieldNoMoreThan": "8-с дээшгүй тэмдэгт оруулна.",
"demoTextFieldPassword": "Нууц үг*",
"demoTextFieldRetypePassword": "Нууц үгийг дахин оруулна уу*",
"demoTextFieldSubmit": "ИЛГЭЭХ",
"demoBottomNavigationSubtitle": "Харилцан бүдгэрэх харагдах байдалтай доод навигац",
"demoBottomSheetAddLabel": "Нэмэх",
"demoBottomSheetModalDescription": "Зайлшгүй харилцах доод хүснэгт нь цэс эсвэл харилцах цонхны өөр хувилбар бөгөөд хэрэглэгчийг аппын бусад хэсэгтэй харилцахаас сэргийлдэг.",
"demoBottomSheetModalTitle": "Зайлшгүй харилцах доод хүснэгт",
"demoBottomSheetPersistentDescription": "Тогтмол доод хүснэгт нь аппын үндсэн контентыг дэмждэг мэдээллийг харуулдаг. Тогтмол доод хүснэгт нь хэрэглэгчийг аппын бусад хэсэгтэй харилцаж байхад ч харагдсаар байдаг.",
"demoBottomSheetPersistentTitle": "Тогтмол доод хүснэгт",
"demoBottomSheetSubtitle": "Тогтмол болон зайлшгүй харилцах доод хүснэгт",
"demoTextFieldNameHasPhoneNumber": "{name}-н утасны дугаар {phoneNumber}",
"buttonText": "ТОВЧЛУУР",
"demoTypographyDescription": "Материалын загварт байх төрөл бүрийн үсгийн урлагийн загварын тодорхойлолт.",
"demoTypographySubtitle": "Бүх урьдчилан тодорхойлсон текстийн загвар",
"demoTypographyTitle": "Үсгийн урлаг",
"demoFullscreenDialogDescription": "Бүтэн дэлгэцийн харилцах цонхны шинж чанар нь тухайн ирж буй хуудас бүтэн дэлгэцийн зайлшгүй харилцах цонх мөн эсэхийг тодорхойлдог",
"demoFlatButtonDescription": "Хавтгай товчлуур дээр дарахад бэх цацарч үзэгдэх хэдий ч өргөгдөхгүй. Хавтгай товчлуурыг самбар дээр, харилцах цонхонд болон мөрөнд доторх зайтайгаар ашиглана уу",
"demoBottomNavigationDescription": "Доод навигацын самбар нь дэлгэцийн доод хэсэгт 3-5 очих газар үзүүлдэг. Очих газар бүрийг дүрс тэмдэг болон нэмэлт текстэн шошгоор илэрхийлдэг. Доод навигацын дүрс тэмдэг дээр товшсон үед хэрэглэгчийг тухайн дүрс тэмдэгтэй холбоотой дээд түвшний навигацын очих газарт аваачна.",
"demoBottomNavigationSelectedLabel": "Сонгосон шошго",
"demoBottomNavigationPersistentLabels": "Тогтмол шошго",
"starterAppDrawerItem": "Зүйл {value}",
"demoTextFieldRequiredField": "* заавал бөглөх хэсгийг илэрхийлнэ",
"demoBottomNavigationTitle": "Доод навигац",
"settingsLightTheme": "Цайвар",
"settingsTheme": "Загвар",
"settingsPlatformIOS": "iOS",
"settingsPlatformAndroid": "Андройд",
"settingsTextDirectionRTL": "Баруунаас зүүн",
"settingsTextScalingHuge": "Асар том",
"cupertinoButton": "Товчлуур",
"settingsTextScalingNormal": "Энгийн",
"settingsTextScalingSmall": "Жижиг",
"settingsSystemDefault": "Систем",
"settingsTitle": "Тохиргоо",
"rallyDescription": "Хувийн санхүүгийн апп",
"aboutDialogDescription": "Энэ аппын эх кодыг харахын тулд {repoLink} хаягаар зочилно уу.",
"bottomNavigationCommentsTab": "Сэтгэгдлүүд",
"starterAppGenericBody": "Үндсэн хэсэг",
"starterAppGenericHeadline": "Толгой гарчиг",
"starterAppGenericSubtitle": "Дэд гарчиг",
"starterAppGenericTitle": "Гарчиг",
"starterAppTooltipSearch": "Хайлт",
"starterAppTooltipShare": "Хуваалцах",
"starterAppTooltipFavorite": "Дуртай",
"starterAppTooltipAdd": "Нэмэх",
"bottomNavigationCalendarTab": "Календарь",
"starterAppDescription": "Хариу үйлдэл сайтай гарааны бүдүүвч",
"starterAppTitle": "Гарааны апп",
"aboutFlutterSamplesRepo": "GitHub агуулахад хадгалсан Flutter-н дээж",
"bottomNavigationContentPlaceholder": "Табын {title} орлуулагч",
"bottomNavigationCameraTab": "Камер",
"bottomNavigationAlarmTab": "Сэрүүлэг",
"bottomNavigationAccountTab": "Данс",
"demoTextFieldYourEmailAddress": "Таны имэйл хаяг",
"demoToggleButtonDescription": "Асаах товчийг холбоотой сонголтыг бүлэглэхэд ашиглаж болно. Асаах товчтой холбоотой бүлгийг онцлохын тулд тухайн бүлэг нийтлэг контэйнер хуваалцсан байх шаардлагатай",
"colorsGrey": "СААРАЛ",
"colorsBrown": "БОР",
"colorsDeepOrange": "ГҮН УЛБАР ШАР",
"colorsOrange": "УЛБАР ШАР",
"colorsAmber": "УЛБАР ШАР",
"colorsYellow": "ШАР",
"colorsLime": "НИМБЭГНИЙ НОГООН",
"colorsLightGreen": "ЦАЙВАР НОГООН",
"colorsGreen": "НОГООН",
"homeHeaderGallery": "Галерей",
"homeHeaderCategories": "Ангилал",
"shrineDescription": "Хувцас загварын жижиглэн борлуулах апп",
"craneDescription": "Хувийн болгосон аяллын апп",
"homeCategoryReference": "ЗАГВАР БОЛОН БУСАД",
"demoInvalidURL": "URL-г үзүүлж чадсангүй:",
"demoOptionsTooltip": "Сонголт",
"demoInfoTooltip": "Мэдээлэл",
"demoCodeTooltip": "Демо код",
"demoDocumentationTooltip": "API-н баримтжуулалт",
"demoFullscreenTooltip": "Бүтэн дэлгэц",
"settingsTextScaling": "Текст томруулах",
"settingsTextDirection": "Текстийн чиглэл",
"settingsLocale": "Хэл болон улсын код",
"settingsPlatformMechanics": "Платформын механик",
"settingsDarkTheme": "Бараан",
"settingsSlowMotion": "Удаашруулсан",
"settingsAbout": "Flutter Gallery-н тухай",
"settingsFeedback": "Санал хүсэлт илгээх",
"settingsAttribution": "Лондон дахь TOASTER зохион бүтээсэн",
"demoButtonTitle": "Товчлуур",
"demoButtonSubtitle": "Текст, товгор, хүрээтэй болон бусад",
"demoFlatButtonTitle": "Хавтгай товчлуур",
"demoRaisedButtonDescription": "Товгор товчлуур нь ихэвчлэн хавтгай бүдүүвчид хэмжээс нэмдэг. Тэд шигүү эсвэл өргөн зайтай функцийг онцолдог.",
"demoRaisedButtonTitle": "Товгор товчлуур",
"demoOutlineButtonTitle": "Гадна хүрээтэй товчлуур",
"demoOutlineButtonDescription": "Гадна хүрээтэй товчлуурыг дарсан үед тодорч, дээшилдэг. Нэмэлт сонголт болон хоёрдогч үйлдлийг заахын тулд тэдгээрийг ихэвчлэн товгор товчлууртай хослуулдаг.",
"demoToggleButtonTitle": "Асаах товч",
"colorsTeal": "УСАН ЦЭНХЭР",
"demoFloatingButtonTitle": "Үйлдлийн хөвөгч товчлуур",
"demoFloatingButtonDescription": "Үйлдлийн хөвөгч товчлуур нь аппын үндсэн үйлдлийг дэмжих зорилгоор контентын дээр гүйх тойрог хэлбэрийн дүрс тэмдэг бүхий товчлуур юм.",
"demoDialogTitle": "Харилцах цонх",
"demoDialogSubtitle": "Энгийн, сэрэмжлүүлэг болон бүтэн дэлгэц",
"demoAlertDialogTitle": "Сэрэмжлүүлэг",
"demoAlertDialogDescription": "Сэрэмжлүүлгийн харилцах цонх нь хэрэглэгчид батламж шаардлагатай нөхцөл байдлын талаар мэдээлдэг. Сэрэмжлүүлгийн харилцах цонхонд сонгох боломжтой гарчиг болон үйлдлийн жагсаалт байдаг.",
"demoAlertTitleDialogTitle": "Гарчигтай сэрэмжлүүлэг",
"demoSimpleDialogTitle": "Энгийн",
"demoSimpleDialogDescription": "Энгийн харилцах цонх нь хэрэглэгчид хэд хэдэн сонголтыг санал болгодог. Энгийн харилцах цонх нь сонголтын дээр үзэгдэх сонгох боломжтой гарчигтай байна.",
"demoFullscreenDialogTitle": "Бүтэн дэлгэц",
"demoCupertinoButtonsTitle": "Товчлуур",
"demoCupertinoButtonsSubtitle": "iOS загварын товчлуурууд",
"demoCupertinoButtonsDescription": "iOS загварын товчлуур. Үүнийг текстэд болон/эсвэл хүрэх үед гадагшаа болон дотогшоо уусдаг дүрс тэмдэгт ашиглана. Сонгох боломжтой арын дэвсгэртэй байж магадгүй.",
"demoCupertinoAlertsTitle": "Сэрэмжлүүлэг",
"demoCupertinoAlertsSubtitle": "iOS загварын сэрэмжлүүлгийн харилцах цонх",
"demoCupertinoAlertTitle": "Сэрэмжлүүлэг",
"demoCupertinoAlertDescription": "Сэрэмжлүүлгийн харилцах цонх нь хэрэглэгчид батламж шаардлагатай нөхцөл байдлын талаар мэдээлдэг. Сэрэмжлүүлгийн харилцах цонх нь сонгох боломжтой гарчиг, контент болон үйлдлийн жагсаалттай байдаг. Гарчиг контентын дээр харагдах бөгөөд үйлдлүүд нь контентын доор харагдана.",
"demoCupertinoAlertWithTitleTitle": "Гарчигтай сэрэмжлүүлэг",
"demoCupertinoAlertButtonsTitle": "Товчлууртай сэрэмжлүүлэг",
"demoCupertinoAlertButtonsOnlyTitle": "Зөвхөн сэрэмжлүүлгийн товчлуур",
"demoCupertinoActionSheetTitle": "Үйлдлийн хүснэгт",
"demoCupertinoActionSheetDescription": "Үйлдлийн хүснэгт нь хэрэглэгчид одоогийн хам сэдэвтэй холбоотой хоёр эсвэл түүнээс дээш сонголтын багцыг харуулах тодорхой загварын сэрэмжлүүлэг юм. Үйлдлийн хүснэгт нь гарчиг, нэмэлт мессеж болон үйлдлийн жагсаалттай байж болно.",
"demoColorsTitle": "Өнгө",
"demoColorsSubtitle": "Урьдчилан тодорхойлсон бүх өнгө",
"demoColorsDescription": "Материалын загварын өнгөний нийлүүрийг төлөөлдөг өнгө болон өнгөний цуглуулгын хэмжигдэхүүн.",
"buttonTextEnabled": "ENABLED",
"buttonTextDisabled": "DISABLED",
"buttonTextCreate": "Үүсгэх",
"dialogSelectedOption": "Та дараахыг сонгосон: \"{value}\"",
"dialogDiscardTitle": "Нооргийг устгах уу?",
"dialogLocationTitle": "Google-н байршлын үйлчилгээг ашиглах уу?",
"dialogLocationDescription": "Google-д аппуудад байршлыг тодорхойлоход туслахыг зөвшөөрнө үү. Ингэснээр ямар ч апп ажиллаагүй байсан ч байршлын өгөгдлийг үл мэдэгдэх байдлаар Google-д илгээнэ.",
"dialogCancel": "ЦУЦЛАХ",
"dialogDiscard": "БОЛИХ",
"dialogDisagree": "ЗӨВШӨӨРӨХГҮЙ",
"dialogAgree": "ЗӨВШӨӨРӨХ",
"dialogSetBackup": "Нөөц бүртгэл тохируулна уу",
"colorsBlueGrey": "ХӨХ СААРАЛ",
"dialogShow": "ХАРИЛЦАХ ЦОНХЫГ ХАРУУЛАХ",
"dialogFullscreenTitle": "Бүтэн дэлгэцийн харилцах цонх",
"dialogFullscreenSave": "ХАДГАЛАХ",
"dialogFullscreenDescription": "Бүтэн дэлгэцийн харилцах цонхны демо",
"cupertinoButtonEnabled": "Enabled",
"cupertinoButtonDisabled": "Disabled",
"cupertinoButtonWithBackground": "Арын дэвсгэртэй",
"cupertinoAlertCancel": "Цуцлах",
"cupertinoAlertDiscard": "Болих",
"cupertinoAlertLocationTitle": "Та \"Газрын зураг\" аппыг ашиглах явцад үүнд таны байршилд хандахыг зөвшөөрөх үү?",
"cupertinoAlertLocationDescription": "Таны одоогийн байршил газрын зураг дээр үзэгдэх бөгөөд үүнийг чиглэл, ойролцоох хайлтын илэрц болон очих хугацааг тооцоолоход ашиглана.",
"cupertinoAlertAllow": "Зөвшөөрөх",
"cupertinoAlertDontAllow": "Зөвшөөрөхгүй",
"cupertinoAlertFavoriteDessert": "Дуртай амттанаа сонгоно уу",
"cupertinoAlertDessertDescription": "Доорх жагсаалтаас дуртай амттаныхаа төрлийг сонгоно уу. Таны сонголтыг танай бүсэд байгаа санал болгож буй хоолны газруудын жагсаалтыг өөрчлөхөд ашиглах болно.",
"cupertinoAlertCheesecake": "Бяслагтай бялуу",
"cupertinoAlertTiramisu": "Тирамисү",
"cupertinoAlertApplePie": "Алимны бялуу",
"cupertinoAlertChocolateBrownie": "Шоколадтай брауни",
"cupertinoShowAlert": "Сэрэмжлүүлэг харуулах",
"colorsRed": "УЛААН",
"colorsPink": "ЯГААН",
"colorsPurple": "НИЛ ЯГААН",
"colorsDeepPurple": "ГҮН НИЛ ЯГААН",
"colorsIndigo": "ХӨХӨВТӨР НИЛ ЯГААН",
"colorsBlue": "ЦЭНХЭР",
"colorsLightBlue": "ЦАЙВАР ЦЭНХЭР",
"colorsCyan": "НОГООН ЦЭНХЭР",
"dialogAddAccount": "Бүртгэл нэмэх",
"Gallery": "Галерей",
"Categories": "Ангилал",
"SHRINE": "ШҮТЭЭН",
"Basic shopping app": "Дэлгүүр хэсэх үндсэн апп",
"RALLY": "ЭСЭРГҮҮЦЭЛ",
"CRANE": "КРАН",
"Travel app": "Аяллын апп",
"MATERIAL": "МАТЕРИАЛ",
"CUPERTINO": "КУПЕРТИНО",
"REFERENCE STYLES & MEDIA": "ЛАВЛАХ ЗАГВАР, МЕДИА"
}
| gallery/lib/l10n/intl_mn.arb/0 | {
"file_path": "gallery/lib/l10n/intl_mn.arb",
"repo_id": "gallery",
"token_count": 41134
} | 807 |
{
"loading": "Načítava sa",
"deselect": "Zrušiť výber",
"select": "Vybrať",
"selectable": "Môžete vybrať (dlhým stlačením)",
"selected": "Vybrané",
"demo": "Ukážka",
"bottomAppBar": "Dolný panel aplikácií",
"notSelected": "Nevybrané",
"demoCupertinoSearchTextFieldTitle": "Textové pole vyhľadávania",
"demoCupertinoPicker": "Výber",
"demoCupertinoSearchTextFieldSubtitle": "Textové pole vyhľadávania v štýle systému iOS",
"demoCupertinoSearchTextFieldDescription": "Pomocou textového poľa môže používateľ vyhľadávať zadaním textu. Následne sa mu môžu zobraziť návrhy ponúk a filtrovania.",
"demoCupertinoSearchTextFieldPlaceholder": "Zadajte nejaký text",
"demoCupertinoScrollbarTitle": "Posúvač",
"demoCupertinoScrollbarSubtitle": "Posúvač v štýle systému iOS",
"demoCupertinoScrollbarDescription": "Posúvač okolo príslušnej podradenej položky",
"demoTwoPaneItem": "Položka {value}",
"demoTwoPaneList": "Zoznam",
"demoTwoPaneFoldableLabel": "Skladacie",
"demoTwoPaneSmallScreenLabel": "Malá obrazovka",
"demoTwoPaneSmallScreenDescription": "Takto sa TwoPane správa v zariadení s malou obrazovkou.",
"demoTwoPaneTabletLabel": "Tablet a počítač",
"demoTwoPaneTabletDescription": "Takto sa TwoPane správa na väčšej obrazovke, napríklad v tablete alebo počítači",
"demoTwoPaneTitle": "TwoPane",
"demoTwoPaneSubtitle": "Responzívne rozloženia v skladacích zariadeniach a zariadeniach s veľkými a malými obrazovkami",
"splashSelectDemo": "Vyberte demo",
"demoTwoPaneFoldableDescription": "Takto sa TwoPane správa v skladacom zariadení.",
"demoTwoPaneDetails": "Podrobnosti",
"demoTwoPaneSelectItem": "Vyberte položku",
"demoTwoPaneItemDetails": "Podrobnosti položky {value}",
"demoCupertinoContextMenuActionText": "Kontextovú ponuku zobrazíte pridržaním loga Flutter.",
"demoCupertinoContextMenuDescription": "Kontextová ponuka typu iOS sa zobrazí na celej obrazovke, keď dlho stlačíte určitý prvok.",
"demoAppBarTitle": "Panel aplikácie",
"demoAppBarDescription": "Panel aplikácie zobrazuje kontext a akcie súvisiace s aktuálnou obrazovkou. Môžete ho využiť pri budovaní značky, pomenúvaní obrazoviek, navigácii a rôznych akciách.",
"demoDividerTitle": "Rozdeľovač",
"demoDividerSubtitle": "Rozdeľovač je tenká čiara umožňujúca zoskupiť obsah v zoznamoch a rozloženiach.",
"demoDividerDescription": "Pomocou rozdeľovačov môžete oddeliť obsah v zoznamoch, vysúvacích paneloch a inde.",
"demoVerticalDividerTitle": "Vertikálny rozdeľovač",
"demoCupertinoContextMenuTitle": "Kontextová ponuka",
"demoCupertinoContextMenuSubtitle": "Kontextová ponuka typu iOS",
"demoAppBarSubtitle": "Zobrazuje informácie a akcie súvisiace s aktuálnou obrazovkou",
"demoCupertinoContextMenuActionOne": "Prvá akcia",
"demoCupertinoContextMenuActionTwo": "Druhá akcia",
"demoDateRangePickerDescription": "Zobrazuje dialógové okno výberu dátumu so vzhľadom Material Design.",
"demoDateRangePickerTitle": "Výber obdobia",
"demoNavigationDrawerUserName": "Meno používateľa",
"demoNavigationDrawerUserEmail": "[email protected]",
"demoNavigationDrawerText": "Vysúvací panel zobrazíte potiahnutím smerom od okraja alebo klepnutím na hornú ľavú ikonu.",
"demoNavigationRailTitle": "Navigačný pruh",
"demoNavigationRailSubtitle": "Zobrazenie navigačného pruhu v aplikácii",
"demoNavigationRailDescription": "Miniaplikácia so vzhľadom Material Design, ktorá sa má zobrazovať na ľavej alebo pravej strane aplikácie a umožňovať navigáciu medzi menším počtom zobrazení (zvyčajne troma až piatimi).",
"demoNavigationRailFirst": "Prvý",
"demoNavigationDrawerTitle": "Navigačný vysúvací panel",
"demoNavigationRailThird": "Tretí",
"replyStarredLabel": "S hviezdičkou",
"demoTextButtonDescription": "Textové tlačidlo po stlačení zobrazí atramentovú škvrnu, ale nezvýši sa. Textové tlačidlá používajte v paneloch s nástrojmi, dialógových oknách a texte s odsadením",
"demoElevatedButtonTitle": "Zvýšené tlačidlo",
"demoElevatedButtonDescription": "Zvýšené tlačidlá pridávajú rozmery do prevažne plochých rozložení. Zvýrazňujú funkcie v neprehľadných alebo širokých priestoroch.",
"demoOutlinedButtonTitle": "Tlačidlo s obrysom",
"demoOutlinedButtonDescription": "Tlačidlá s obrysom sa po stlačení zmenia na nepriehľadné a zvýšia sa. Často sú spárované so zvýšenými tlačidlami na označenie alternatívnej sekundárnej akcie.",
"demoContainerTransformDemoInstructions": "Karty, zoznamy a plávajúce tlačidlo akcie",
"demoNavigationDrawerSubtitle": "Zobrazuje sa vysúvací panel v rámci panela aplikácií",
"replyDescription": "Efektívna vyhradená e‑mailová aplikácia",
"demoNavigationDrawerDescription": "Panel so vzhľadom Material Design, ktorý sa vysúva vodorovne smerom od okraja obrazovky a zobrazuje odkazy na navigáciu v aplikácii.",
"replyDraftsLabel": "Koncepty",
"demoNavigationDrawerToPageOne": "Prvá položka",
"replyInboxLabel": "Doručené",
"demoSharedXAxisDemoInstructions": "Tlačidlá Ďalej a Späť",
"replySpamLabel": "Spam",
"replyTrashLabel": "Kôš",
"replySentLabel": "Odoslané",
"demoNavigationRailSecond": "Druhý",
"demoNavigationDrawerToPageTwo": "Druhá položka",
"demoFadeScaleDemoInstructions": "Modálne a plávajúce tlačidlo akcie",
"demoFadeThroughDemoInstructions": "Dolná navigácia",
"demoSharedZAxisDemoInstructions": "Tlačidlo ikony nastavení",
"demoSharedYAxisDemoInstructions": "Zoradiť podľa nedávno počúvaných",
"demoTextButtonTitle": "Textové tlačidlo",
"demoSharedZAxisBeefSandwichRecipeTitle": "Hovädzí sendvič",
"demoSharedZAxisDessertRecipeDescription": "Recept na dezert",
"demoSharedYAxisAlbumTileSubtitle": "Interpret",
"demoSharedYAxisAlbumTileTitle": "Album",
"demoSharedYAxisRecentSortTitle": "Nedávno počúvané",
"demoSharedYAxisAlphabeticalSortTitle": "A – Z",
"demoSharedYAxisAlbumCount": "268 albumov",
"demoSharedYAxisTitle": "Zdieľaná os y",
"demoSharedXAxisCreateAccountButtonText": "VYTVORIŤ ÚČET",
"demoFadeScaleAlertDialogDiscardButton": "ZAHODIŤ",
"demoSharedXAxisSignInTextFieldLabel": "E‑mail alebo telefónne číslo",
"demoSharedXAxisSignInSubtitleText": "Prihláste sa svojím účtom",
"demoSharedXAxisSignInWelcomeText": "Dobrý deň, David Park",
"demoSharedXAxisIndividualCourseSubtitle": "Zobrazené samostatne",
"demoSharedXAxisBundledCourseSubtitle": "V balíku",
"demoFadeThroughAlbumsDestination": "Albumy",
"demoSharedXAxisDesignCourseTitle": "Dizajn",
"demoSharedXAxisIllustrationCourseTitle": "Ilustrácia",
"demoSharedXAxisBusinessCourseTitle": "Firma",
"demoSharedXAxisArtsAndCraftsCourseTitle": "Umenie a remeslá",
"demoMotionPlaceholderSubtitle": "Sekundárny text",
"demoFadeScaleAlertDialogCancelButton": "ZRUŠIŤ",
"demoFadeScaleAlertDialogHeader": "Dialógové okno upozornenia",
"demoFadeScaleHideFabButton": "SKRYŤ PLÁVAJÚCE TLAČIDLO AKCIE",
"demoFadeScaleShowFabButton": "ZOBRAZIŤ PLÁVAJÚCE TLAČIDLO AKCIE",
"demoFadeScaleShowAlertDialogButton": "ZOBRAZIŤ MODÁLNE DIALÓGOVÉ OKNO",
"demoFadeScaleDescription": "Vzor miznutia sa používa v prípade prvkov používateľského rozhrania, ktoré sa zobrazujú alebo miznú niekde na obrazovke. Môže to byť napríklad dialógové okno, ktoré postupne zmizne v strede obrazovky.",
"demoFadeScaleTitle": "Miznutie",
"demoFadeThroughTextPlaceholder": "123 fotiek",
"demoFadeThroughSearchDestination": "Hľadať",
"demoFadeThroughPhotosDestination": "Fotky",
"demoSharedXAxisCoursePageSubtitle": "Kategórie v balíkoch sa v informačnom kanáli zobrazujú ako skupiny. Toto nastavenie môžete neskôr zmeniť.",
"demoFadeThroughDescription": "Vzor postupného miznutia sa používa v prípade prechodov medzi prvkami používateľského rozhrania, ktoré nie sú v silnom vzájomnom vzťahu.",
"demoFadeThroughTitle": "Postupné miznutie",
"demoSharedZAxisHelpSettingLabel": "Pomocník",
"demoMotionSubtitle": "Všetky preddefinované vzory prechodov",
"demoSharedZAxisNotificationSettingLabel": "Upozornenia",
"demoSharedZAxisProfileSettingLabel": "Profil",
"demoSharedZAxisSavedRecipesListTitle": "Uložené recepty",
"demoSharedZAxisBeefSandwichRecipeDescription": "Recept na hovädzí sendvič",
"demoSharedZAxisCrabPlateRecipeDescription": "Recept na krabí tanier",
"demoSharedXAxisCoursePageTitle": "Zjednodušte svoje kurzy",
"demoSharedZAxisCrabPlateRecipeTitle": "Krab",
"demoSharedZAxisShrimpPlateRecipeDescription": "Recept na krevetový tanier",
"demoSharedZAxisShrimpPlateRecipeTitle": "Kreveta",
"demoContainerTransformTypeFadeThrough": "POSTUPNÉ MIZNUTIE",
"demoSharedZAxisDessertRecipeTitle": "Dezert",
"demoSharedZAxisSandwichRecipeDescription": "Recept na sendvič",
"demoSharedZAxisSandwichRecipeTitle": "Sendvič",
"demoSharedZAxisBurgerRecipeDescription": "Recept na hamburger",
"demoSharedZAxisBurgerRecipeTitle": "Hamburger",
"demoSharedZAxisSettingsPageTitle": "Nastavenia",
"demoSharedZAxisTitle": "Zdieľaná os z",
"demoSharedZAxisPrivacySettingLabel": "Ochrana súkromia",
"demoMotionTitle": "Pohyb",
"demoContainerTransformTitle": "Transformácia kontajnera",
"demoContainerTransformDescription": "Vzor transformácie kontajnera je určený pre prechody medzi prvkami používateľského rozhrania, ktoré obsahujú kontajner. Tento vzor vytvára viditeľné spojenie medzi dvoma prvkami používateľského rozhrania",
"demoContainerTransformModalBottomSheetTitle": "Režim miznutia",
"demoContainerTransformTypeFade": "MIZNUTIE",
"demoSharedYAxisAlbumTileDurationUnit": "min",
"demoMotionPlaceholderTitle": "Názov",
"demoSharedXAxisForgotEmailButtonText": "ZABUDLI STE E‑MAIL?",
"demoMotionSmallPlaceholderSubtitle": "Sekundárne",
"demoMotionDetailsPageTitle": "Podrobná stránka",
"demoMotionListTileTitle": "Položka zoznamu",
"demoSharedAxisDescription": "Vzor zdieľanej osi sa používa v prípade prechodov medzi prvkami používateľského rozhrania, ktoré sú v priestorovom alebo navigačnom vzájomnom vzťahu. Tento vzor používa zdieľanú transformáciu na osiach x, y alebo z na upevnenie vzťahov medzi prvkami.",
"demoSharedXAxisTitle": "Zdieľaná os x",
"demoSharedXAxisBackButtonText": "SPÄŤ",
"demoSharedXAxisNextButtonText": "ĎALEJ",
"demoSharedXAxisCulinaryCourseTitle": "Kulinárstvo",
"githubRepo": "Odkladací priestor GitHub {repoName}",
"fortnightlyMenuUS": "USA",
"fortnightlyMenuBusiness": "Biznis",
"fortnightlyMenuScience": "Veda",
"fortnightlyMenuSports": "Šport",
"fortnightlyMenuTravel": "Cestovanie",
"fortnightlyMenuCulture": "Kultúra",
"fortnightlyTrendingTechDesign": "Technologický dizajn",
"rallyBudgetDetailAmountLeft": "Zostatok",
"fortnightlyHeadlineArmy": "Reforma Zelenej armády zvnútra",
"fortnightlyDescription": "Spravodajská aplikácia zameraná na obsah",
"rallyBillDetailAmountDue": "Dlžná suma",
"rallyBudgetDetailTotalCap": "Celkový limit",
"rallyBudgetDetailAmountUsed": "Minutá suma",
"fortnightlyTrendingHealthcareRevolution": "Revolúcia v zdravotníctve",
"fortnightlyMenuFrontPage": "Titulná strana",
"fortnightlyMenuWorld": "Svet",
"rallyBillDetailAmountPaid": "Zaplatená suma",
"fortnightlyMenuPolitics": "Politika",
"fortnightlyHeadlineBees": "Nedostatok poľnohospodárskych včiel",
"fortnightlyHeadlineGasoline": "Budúcnosť benzínu",
"fortnightlyTrendingGreenArmy": "Zelená armáda",
"fortnightlyHeadlineFeminists": "Feministky sa vrhli na partizánstvo",
"fortnightlyHeadlineFabrics": "Pomocou technológií vyrábajú návrhári futuristické látky",
"fortnightlyHeadlineStocks": "V čase stagnácie akcií sa mnohí sústreďujú na menu",
"fortnightlyTrendingReform": "Reforma",
"fortnightlyMenuTech": "Technológie",
"fortnightlyHeadlineWar": "Rozdelené životy američanov počas vojny",
"fortnightlyHeadlineHealthcare": "Tichá, ale zároveň účinná revolúcia v zdravotníctve",
"fortnightlyLatestUpdates": "Posledné novinky",
"fortnightlyTrendingStocks": "Akcie",
"rallyBillDetailTotalAmount": "Celková suma",
"demoCupertinoPickerDateTime": "Dátum a čas",
"signIn": "PRIHLÁSIŤ SA",
"dataTableRowWithSugar": "{value} s cukrom",
"dataTableRowApplePie": "Apple pie",
"dataTableRowDonut": "Donut",
"dataTableRowHoneycomb": "Honeycomb",
"dataTableRowLollipop": "Lollipop",
"dataTableRowJellyBean": "Jelly bean",
"dataTableRowGingerbread": "Gingerbread",
"dataTableRowCupcake": "Cupcake",
"dataTableRowEclair": "Eclair",
"dataTableRowIceCreamSandwich": "Ice cream sandwich",
"dataTableRowFrozenYogurt": "Frozen yogurt",
"dataTableColumnIron": "Železo (%)",
"dataTableColumnCalcium": "Vápnik",
"dataTableColumnSodium": "Sodík (mg)",
"demoTimePickerTitle": "Výber času",
"demo2dTransformationsResetTooltip": "Resetovať transformácie",
"dataTableColumnFat": "Tuky (g)",
"dataTableColumnCalories": "Kalórie",
"dataTableColumnDessert": "Dezert (1 porcia)",
"cardsDemoTravelDestinationLocation1": "Thanjavur, Tamil Nadu",
"demoTimePickerDescription": "Zobrazuje dialógové okno s výberom času so vzhľadom Material Design.",
"demoPickersShowPicker": "ZOBRAZIŤ VÝBER",
"demoTabsScrollingTitle": "Posúvací",
"demoTabsNonScrollingTitle": "Neposúvací",
"craneHours": "{hours,plural,=1{1 h}few{{hours} h}many{{hours} h}other{{hours} h}}",
"craneMinutes": "{minutes,plural,=1{1 min}few{{minutes} min}many{{minutes} min}other{{minutes} min}}",
"craneFlightDuration": "{hoursShortForm} {minutesShortForm}",
"dataTableHeader": "Výživa",
"demoDatePickerTitle": "Výber dátumu",
"demoPickersSubtitle": "Výber dátumu a času",
"demoPickersTitle": "Výbery",
"demo2dTransformationsEditTooltip": "Upraviť dlaždicu",
"demoDataTableDescription": "Tabuľky údajov zobrazujú informácie vo formáte pripomínajúcom mriežku riadkov a stĺpcov. Usporiadavajú informácie tak, že sa dajú ľahko vyhľadať, takže používatelia môžu hľadať vzory a štatistiky.",
"demo2dTransformationsDescription": "Klepnutím upavujte dlaždice a gestami sa pohybujte po okolí. Posúvajte presunutím, približujte stiahnutím prstov a otáčajte dvoma prstami. Na začiatočnú orientáciu sa vrátite stlačením tlačidla Resetovať.",
"demo2dTransformationsSubtitle": "Posunutie, priblíženie a otočenie",
"demo2dTransformationsTitle": "2D transformácie",
"demoCupertinoTextFieldPIN": "PIN",
"demoCupertinoTextFieldDescription": "Textové pole umožňuje používateľovi zadávať text, či už pomocou hardvérovej klávesnice, alebo tej na obrazovke.",
"demoCupertinoTextFieldSubtitle": "Textové polia v štýle systému iOS",
"demoCupertinoTextFieldTitle": "Textové polia",
"demoDatePickerDescription": "Zobrazuje dialógové okno s výberom dátumu so vzhľadom Material Design.",
"demoCupertinoPickerTime": "Čas",
"demoCupertinoPickerDate": "Dátum",
"demoCupertinoPickerTimer": "Časovač",
"demoCupertinoPickerDescription": "Pomocou miniaplikácie výberu v štýle systému iOS môžete vybrať reťazce, dátumy, časy, alebo dátumy aj časy súčasne.",
"demoCupertinoPickerSubtitle": "Výbery v štýle systému iOS",
"demoCupertinoPickerTitle": "Výbery",
"dataTableRowWithHoney": "{value} s medom",
"cardsDemoTravelDestinationCity2": "Chettinad",
"bannerDemoResetText": "Resetovať banner",
"bannerDemoMultipleText": "Viacero akcií",
"bannerDemoLeadingText": "Začiatočná ikona",
"dismiss": "ZAVRIEŤ",
"cardsDemoTappable": "Môžete klepnúť",
"cardsDemoSelectable": "Môžete vybrať (dlhým stlačením)",
"cardsDemoExplore": "Preskúmať",
"cardsDemoExploreSemantics": "Preskúmať {destinationName}",
"cardsDemoShareSemantics": "Zdieľať {destinationName}",
"cardsDemoTravelDestinationTitle1": "10 naj miest v štáte Tamil Nadu, ktoré by ste mali navštíviť",
"cardsDemoTravelDestinationDescription1": "Číslo 10",
"cardsDemoTravelDestinationCity1": "Thanjavur",
"dataTableColumnProtein": "Bielkoviny (g)",
"cardsDemoTravelDestinationTitle2": "Umelci južnej Indie",
"cardsDemoTravelDestinationDescription2": "Pradenie hodvábu",
"bannerDemoText": "Vaše heslo bolo aktualizované v druhom zariadení. Prihláste sa znova.",
"cardsDemoTravelDestinationLocation2": "Sivaganga, Tamil Nadu",
"cardsDemoTravelDestinationTitle3": "Chrám Brihadisvara Temple",
"cardsDemoTravelDestinationDescription3": "Chrámy",
"demoBannerTitle": "Banner",
"demoBannerSubtitle": "Zobrazovanie bannera v zozname",
"demoBannerDescription": "Banner zobrazuje dôležitú nadväzujúcu správu a poskytuje akcie, pomocou ktorých môžu používatelia vybrať možnosti v ňom (alebo ho zavrieť). Na jeho zavretie sa vyžaduje akcia používateľa.",
"demoCardTitle": "Karty",
"demoCardSubtitle": "Základné karty s oblými rohmi",
"demoCardDescription": "Karta je hárok vzhľadu Material, ktorá predstavuje niektoré súvisiace informácie, napríklad album, zemepisnú polohu, jedlo, kontaktné údaje a podobne.",
"demoDataTableTitle": "Tabuľky údajov",
"demoDataTableSubtitle": "Riadky a stĺpce informácií",
"dataTableColumnCarbs": "Sacharidy (g)",
"placeTanjore": "Thanjavur",
"demoGridListsTitle": "Mriežkové zoznamy",
"placeFlowerMarket": "Trh s kvetmi",
"placeBronzeWorks": "Bronzová zlievareň",
"placeMarket": "Trh",
"placeThanjavurTemple": "Chrám v Thanjavure",
"placeSaltFarm": "Soľná farma",
"placeScooters": "Skútre",
"placeSilkMaker": "Výrobca hodvábu",
"placeLunchPrep": "Príprava obeda",
"placeBeach": "Pláž",
"placeFisherman": "Rybár",
"demoMenuSelected": "Vybrané: {value}",
"demoMenuRemove": "Odstrániť",
"demoMenuGetLink": "Získať odkaz",
"demoMenuShare": "Zdieľať",
"demoBottomAppBarSubtitle": "Zobrazuje v dolnej časti navigáciu a akcie",
"demoMenuAnItemWithASectionedMenu": "Položka s rozdelenou ponukou",
"demoMenuADisabledMenuItem": "Deaktivovaná položka ponuky",
"demoLinearProgressIndicatorTitle": "Lineárny indikátor priebehu",
"demoMenuContextMenuItemOne": "Prvá položka kontextovej ponuky",
"demoMenuAnItemWithASimpleMenu": "Položka s jednoduchou ponukou",
"demoCustomSlidersTitle": "Vlastné posúvače",
"demoMenuAnItemWithAChecklistMenu": "Položka s ponukou kontrolného zoznamu",
"demoCupertinoActivityIndicatorTitle": "Indikátor aktivity",
"demoCupertinoActivityIndicatorSubtitle": "Indikátory aktivity v štýle systému iOS",
"demoCupertinoActivityIndicatorDescription": "Indikátor aktivity v štýle systému iOS, ktorý sa otáča v smere hodinových ručičiek.",
"demoCupertinoNavigationBarTitle": "Navigačný panel",
"demoCupertinoNavigationBarSubtitle": "Navigačný panel v štýle systému iOS",
"demoCupertinoNavigationBarDescription": "Ide o navigačný panel v štýle systému iOS. Navigačný panel je panel s nástrojmi, ktorý vo svojom strede minimálne obsahuje názov stránky.",
"demoCupertinoPullToRefreshTitle": "Obnovenie potiahnutím",
"demoCupertinoPullToRefreshSubtitle": "Potiahnutie v štýle systému iOS na obnovenie riadenia",
"demoCupertinoPullToRefreshDescription": "Miniaplikácia s implementovaným potiahnutím v štýle systému iOS, ktoré umožňuje obnoviť riadenie obsahu.",
"demoProgressIndicatorTitle": "Indikátory priebehu",
"demoProgressIndicatorSubtitle": "Lineárne, kruhové, neurčené",
"demoCircularProgressIndicatorTitle": "Kruhový indikátor priebehu",
"demoCircularProgressIndicatorDescription": "Kruhový indikátor priebehu so vzhľadom Material Design, ktorý sa otáča, keď je aplikácia zaneprázdnená.",
"demoMenuFour": "Štyri",
"demoLinearProgressIndicatorDescription": "Lineárny indikátor priebehu so vzhľadom Material Design, ktorý sa nazýva aj ukazovateľ priebehu.",
"demoTooltipTitle": "Popisy",
"demoTooltipSubtitle": "Krátka správa zobrazujúca sa po dlhom stlačení alebo umiestnení kurzora myši",
"demoTooltipDescription": "Popisy poskytujú textové štítky, ktoré pomáhajú vysvetliť funkciu tlačidla alebo inej akcie v používateľskom rozhraní. Zobrazujú informatívny text, keď používatelia umiestnia kurzor myši na prvok, označia ho alebo ho dlho stlačia.",
"demoTooltipInstructions": "Popis zobrazíte dlhým stlačením alebo umiestnením kurzora myši.",
"placeChennai": "Chennai",
"demoMenuChecked": "Začiarknuté: {value}",
"placeChettinad": "Chettinad",
"demoMenuPreview": "Zobraziť ukážku",
"demoBottomAppBarTitle": "Dolný panel aplikácií",
"demoBottomAppBarDescription": "Dolné panely aplikácií poskytujú prístup k dolnému navigačnému vysúvaciemu panelu a až štyrom akciám (vrátane plávajúceho tlačidla akcie).",
"bottomAppBarNotch": "Výrez",
"bottomAppBarPosition": "Pozícia plávajúceho tlačidla akcie",
"bottomAppBarPositionDockedEnd": "Ukotvené – na konci",
"bottomAppBarPositionDockedCenter": "Ukotvené – v strede",
"bottomAppBarPositionFloatingEnd": "Plávajúce – na konci",
"bottomAppBarPositionFloatingCenter": "Plávajúce – v strede",
"demoSlidersEditableNumericalValue": "Upraviteľná číselná hodnota",
"demoGridListsSubtitle": "Rozloženie riadkov a stĺpcov",
"demoGridListsDescription": "Mriežkové zoznamy sú najvhodnejšie na prezentáciu homogénnych dát, zvyčajne obrázkov. Jednotlivé položky v mriežkovom zozname sa nazývajú dlaždice.",
"demoGridListsImageOnlyTitle": "Iba obrázky",
"demoGridListsHeaderTitle": "S hlavičkou",
"demoGridListsFooterTitle": "S pätou",
"demoSlidersTitle": "Posúvače",
"demoSlidersSubtitle": "Miniaplikácie na výber hodnoty potiahnutím",
"demoSlidersDescription": "Posúvače predstavujú rozsah hodnôt na pruhu, z ktorých si môžu používatelia jednu vybrať. Sú ideálne na úpravu nastavení, ako je napríklad hlasitosť, jas alebo použitie filtrov obrázkov.",
"demoRangeSlidersTitle": "Posúvače s rozsahom",
"demoRangeSlidersDescription": "Posúvače predstavujú rozsah hodnôt na pruhu. Môžu mať na oboch koncoch pruhu ikony označujúce rozsah hodnôt. Sú ideálne na úpravu nastavení, ako je napríklad hlasitosť, jas alebo použitie filtrov obrázkov.",
"demoMenuAnItemWithAContextMenuButton": "Položka s kontextovou ponukou",
"demoCustomSlidersDescription": "Posúvače predstavujú rozsah hodnôt na pruhu, z ktorých si môžu používatelia vybrať jednu hodnotu alebo určitý rozsah. Môžete im pridať motív alebo si ich prispôsobiť.",
"demoSlidersContinuousWithEditableNumericalValue": "Neobmedzený s upraviteľnou číselnou hodnotou",
"demoSlidersDiscrete": "Diskrétny",
"demoSlidersDiscreteSliderWithCustomTheme": "Diskrétny posúvač s vlastným motívom",
"demoSlidersContinuousRangeSliderWithCustomTheme": "Neobmedzený posúvač rozsahu a vlastným motívom",
"demoSlidersContinuous": "Neobmedzený",
"placePondicherry": "Pondicherry",
"demoMenuTitle": "Ponuka",
"demoContextMenuTitle": "Kontextová ponuka",
"demoSectionedMenuTitle": "Rozdelená ponuka",
"demoSimpleMenuTitle": "Jednoduchá ponuka",
"demoChecklistMenuTitle": "Ponuka kontrolného zoznamu",
"demoMenuSubtitle": "Tlačidlá ponuky a jednoduché ponuky",
"demoMenuDescription": "Ponuka zobrazuje zoznam možností v dočasnom okne. Spustí sa pri interakcii používateľov s tlačidlom, akciou alebo iným ovládacím prvkom.",
"demoMenuItemValueOne": "Prvá položka ponuky",
"demoMenuItemValueTwo": "Druhá položka ponuky",
"demoMenuItemValueThree": "Tretia položka ponuky",
"demoMenuOne": "Jedna",
"demoMenuTwo": "Dve",
"demoMenuThree": "Tri",
"demoMenuContextMenuItemThree": "Tretia položka kontextovej ponuky",
"demoCupertinoSwitchSubtitle": "Prepínač v štýle systému iOS",
"demoSnackbarsText": "Toto je oznámenie.",
"demoCupertinoSliderSubtitle": "Posúvač v štýle systému iOS",
"demoCupertinoSliderDescription": "Posúvačom je možné vyberať hodnoty zo súvislej aj nesúvislej skupiny.",
"demoCupertinoSliderContinuous": "Súvislá: {value}",
"demoCupertinoSliderDiscrete": "Nesúvislá: {value}",
"demoSnackbarsAction": "Stlačili ste tlačidlo akcie oznámenia.",
"backToGallery": "Späť do služby Gallery",
"demoCupertinoTabBarTitle": "Panel kariet",
"demoCupertinoSwitchDescription": "Prepínačom je možné prepínať stav zapnuté alebo vypnuté pre jedno nastavenie.",
"demoSnackbarsActionButtonLabel": "AKCIA",
"cupertinoTabBarProfileTab": "Profil",
"demoSnackbarsButtonLabel": "ZOBRAZIŤ OZNÁMENIE",
"demoSnackbarsDescription": "Oznámenia informujú používateľov o procese, ktorý aplikácia vykonáva alebo bude vykonávať. Zobrazujú sa dočasne v dolnej časti obrazovky. Nemali by rušiť dojem používateľov a na zrušenie ich zobrazovania nie je zo strany používateľa potrebná žiadna akcia.",
"demoSnackbarsSubtitle": "Oznámenia zobrazujú správy v dolnej časti obrazovky",
"demoSnackbarsTitle": "Oznámenia",
"demoCupertinoSliderTitle": "Posúvač",
"cupertinoTabBarChatTab": "Čet",
"cupertinoTabBarHomeTab": "Domov",
"demoCupertinoTabBarDescription": "Spodný navigačný panel kariet v štýle systému iOS. Zobrazuje viacero kariet, z ktorých je jedna aktívna. Predvolene je to prvá karta.",
"demoCupertinoTabBarSubtitle": "Spodný panel kariet v štýle systému iOS",
"demoOptionsFeatureTitle": "Zobraziť možnosti",
"demoOptionsFeatureDescription": "Klepnutím sem zobrazíte dostupné možnosti pre túto ukážku.",
"demoCodeViewerCopyAll": "KOPÍROVAŤ VŠETKO",
"shrineScreenReaderRemoveProductButton": "Odstrániť výrobok {product}",
"shrineScreenReaderProductAddToCart": "Pridať do košíka",
"shrineScreenReaderCart": "{quantity,plural,=0{Nákupný košík, žiadne položky}=1{Nákupný košík, 1 položka}few{Nákupný košík, {quantity} položky}many{Shopping cart, {quantity} items}other{Nákupný košík, {quantity} položiek}}",
"demoCodeViewerFailedToCopyToClipboardMessage": "Kopírovanie do schránky sa nepodarilo: {error}",
"demoCodeViewerCopiedToClipboardMessage": "Skopírované do schránky.",
"craneSleep8SemanticLabel": "Mayské ruiny na útese nad plážou",
"craneSleep4SemanticLabel": "Hotel na brehu jazera s horami v pozadí",
"craneSleep2SemanticLabel": "Citadela Machu Picchu",
"craneSleep1SemanticLabel": "Chata v zasneženej krajine s ihličnatými stromami",
"craneSleep0SemanticLabel": "Bungalovy nad vodou",
"craneFly13SemanticLabel": "Bazén pri mori s palmami",
"craneFly12SemanticLabel": "Bazén s palmami",
"craneFly11SemanticLabel": "Tehlový maják pri mori",
"craneFly10SemanticLabel": "Veže mešity Al-Azhar pri západe slnka",
"craneFly9SemanticLabel": "Muž opierajúci sa o starodávne modré auto",
"craneFly8SemanticLabel": "Háj superstromov",
"craneEat9SemanticLabel": "Kaviarenský pult s múčnikmi",
"craneEat2SemanticLabel": "Hamburger",
"craneFly5SemanticLabel": "Hotel na brehu jazera s horami v pozadí",
"demoSelectionControlsSubtitle": "Začiarkavacie políčka a prepínače",
"craneEat10SemanticLabel": "Žena s obrovským pastrami sendvičom",
"craneFly4SemanticLabel": "Bungalovy nad vodou",
"craneEat7SemanticLabel": "Vstup do pekárne",
"craneEat6SemanticLabel": "Pokrm z kreviet",
"craneEat5SemanticLabel": "Priestor na sedenie v umeleckej reštaurácii",
"craneEat4SemanticLabel": "Čokoládový dezert",
"craneEat3SemanticLabel": "Kórejské taco",
"craneFly3SemanticLabel": "Citadela Machu Picchu",
"craneEat1SemanticLabel": "Prázdny bar so stoličkami v bufetovom štýle",
"craneEat0SemanticLabel": "Pizza v peci na drevo",
"craneSleep11SemanticLabel": "Mrakodrap Taipei 101",
"craneSleep10SemanticLabel": "Veže mešity Al-Azhar pri západe slnka",
"craneSleep9SemanticLabel": "Tehlový maják pri mori",
"craneEat8SemanticLabel": "Tanier s rakmi",
"craneSleep7SemanticLabel": "Pestrofarebné byty na námestí Riberia",
"craneSleep6SemanticLabel": "Bazén s palmami",
"craneSleep5SemanticLabel": "Stan na poli",
"settingsButtonCloseLabel": "Zavrieť nastavenia",
"demoSelectionControlsCheckboxDescription": "Začiarkavacie políčka umožňujú používateľovi vybrať viacero možností zo skupiny možností. Hodnota bežného začiarkavacieho políčka je pravda alebo nepravda. Hodnota začiarkavacieho políčka s troma stavmi môže byť tiež nulová.",
"settingsButtonLabel": "Nastavenia",
"demoListsTitle": "Zoznamy",
"demoListsSubtitle": "Rozloženia posúvacích zoznamov",
"demoListsDescription": "Jeden riadok s pevnou výškou, ktorý obvykle obsahuje text a ikonu na začiatku alebo na konci.",
"demoOneLineListsTitle": "Jeden riadok",
"demoTwoLineListsTitle": "Dva riadky",
"demoListsSecondary": "Sekundárny text",
"demoSelectionControlsTitle": "Ovládacie prvky výberu",
"craneFly7SemanticLabel": "Mount Rushmore",
"demoSelectionControlsCheckboxTitle": "Začiarkavacie políčko",
"craneSleep3SemanticLabel": "Muž opierajúci sa o starodávne modré auto",
"demoSelectionControlsRadioTitle": "Prepínač",
"demoSelectionControlsRadioDescription": "Prepínače umožňujú používateľovi vybrať jednu položku zo skupiny možností. Prepínače použite na výhradný výber, ak sa domnievate, že používateľ by mal vidieť všetky dostupné možnosti vedľa seba.",
"demoSelectionControlsSwitchTitle": "Prepínač",
"demoSelectionControlsSwitchDescription": "Prepínače na zapnutie alebo vypnutie stavu jednej možnosti nastavení. Príslušná možnosť, ktorú prepínač ovláda, ako aj stav, v ktorom sa nachádza, by mali jasne vyplývať zo zodpovedajúceho vloženého štítka.",
"craneFly0SemanticLabel": "Chata v zasneženej krajine s ihličnatými stromami",
"craneFly1SemanticLabel": "Stan na poli",
"craneFly2SemanticLabel": "Modlitebné vlajky so zasneženou horou v pozadí",
"craneFly6SemanticLabel": "Letecký pohľad na palác Palacio de Bellas Artes",
"rallySeeAllAccounts": "Zobraziť všetky účty",
"rallyBillAmount": "Termín splatnosti faktúry za {billName} vo výške {amount} je {date}.",
"shrineTooltipCloseCart": "Zavrieť košík",
"shrineTooltipCloseMenu": "Zavrieť ponuku",
"shrineTooltipOpenMenu": "Otvoriť ponuku",
"shrineTooltipSettings": "Nastavenia",
"shrineTooltipSearch": "Hľadať",
"demoTabsDescription": "Karty usporiadajú obsah z rôznych obrazoviek, množín údajov a ďalších interakcií.",
"demoTabsSubtitle": "Karty so samostatne posúvateľnými zobrazeniami",
"demoTabsTitle": "Karty",
"rallyBudgetAmount": "Rozpočet {budgetName} s minutou sumou {amountUsed} z {amountTotal} a zostatkom {amountLeft}",
"shrineTooltipRemoveItem": "Odstrániť položku",
"rallyAccountAmount": "Účet {accountName} {accountNumber} má zostatok {amount}.",
"rallySeeAllBudgets": "Zobraziť všetky rozpočty",
"rallySeeAllBills": "Zobraziť všetky faktúry",
"craneFormDate": "Vyberte dátum",
"craneFormOrigin": "Vyberte východiskové miesto",
"craneFly2": "Dolina Khumbu, Nepál",
"craneFly3": "Machu Picchu, Peru",
"craneFly4": "Malé, Maldivy",
"craneFly5": "Vitznau, Švajčiarsko",
"craneFly6": "Mexiko (mesto), Mexiko",
"craneFly7": "Mount Rushmore, USA",
"settingsTextDirectionLocaleBased": "Na základe miestneho nastavenia",
"craneFly9": "Havana, Kuba",
"craneFly10": "Káhira, Egypt",
"craneFly11": "Lisabon, Portugalsko",
"craneFly12": "Napa, USA",
"craneFly13": "Bali, Indonézia",
"craneSleep0": "Malé, Maldivy",
"craneSleep1": "Aspen, USA",
"craneSleep2": "Machu Picchu, Peru",
"demoCupertinoSegmentedControlTitle": "Segmentované ovládanie",
"craneSleep4": "Vitznau, Švajčiarsko",
"craneSleep5": "Big Sur, USA",
"craneSleep6": "Napa, USA",
"craneSleep7": "Porto, Portugalsko",
"craneSleep8": "Tulum, Mexiko",
"craneEat5": "Soul, Južná Kórea",
"demoChipTitle": "Prvky",
"demoChipSubtitle": "Kompaktné prvky predstavujúce vstup, atribút alebo akciu",
"demoActionChipTitle": "Prvok akcie",
"demoActionChipDescription": "Prvky akcie sú skupina možností spúšťajúcich akcie súvisiace s hlavným obsahom. V používateľskom rozhraní by sa mali zobrazovať dynamicky a v kontexte.",
"demoChoiceChipTitle": "Prvok výberu",
"demoChoiceChipDescription": "Prvky výberu predstavujú jednotlivé možnosti z určitej skupiny. Obsahujú súvisiaci popisný text alebo kategórie.",
"demoFilterChipTitle": "Prvok filtra",
"demoFilterChipDescription": "Prvky filtra odfiltrujú obsah pomocou značiek alebo popisných slov.",
"demoInputChipTitle": "Prvok vstupu",
"demoInputChipDescription": "Prvky vstupu sú komplexné informácie, napríklad subjekt (osoba, miesto, vec) alebo text konverzácie, uvedené v kompaktnej podobe.",
"craneSleep9": "Lisabon, Portugalsko",
"craneEat10": "Lisabon, Portugalsko",
"demoCupertinoSegmentedControlDescription": "Pomocou tejto funkcie môžete vyberať medzi viacerými navzájom sa vylučujúcimi možnosťami. Po vybraní jednej možnosti v segmentovanom ovládaní sa výber ostatných zruší.",
"chipTurnOnLights": "Zapnúť svetlá",
"chipSmall": "Malé",
"chipMedium": "Stredné",
"chipLarge": "Veľké",
"chipElevator": "Výťah",
"chipWasher": "Práčka",
"chipFireplace": "Krb",
"chipBiking": "Cyklistika",
"craneFormDiners": "Reštaurácie",
"rallyAlertsMessageUnassignedTransactions": "{count,plural,=1{Zvýšte svoj potenciálny odpočet dane. Prideľte kategórie 1 nepridelenej transakcii.}few{Zvýšte svoj potenciálny odpočet dane. Prideľte kategórie {count} neprideleným transakciám.}many{Zvýšte svoj potenciálny odpočet dane. Assign categories to {count} unassigned transactions.}other{Zvýšte svoj potenciálny odpočet dane. Prideľte kategórie {count} neprideleným transakciám.}}",
"craneFormTime": "Vyberte čas",
"craneFormLocation": "Vyberte miesto",
"craneFormTravelers": "Cestujúci",
"craneEat8": "Atlanta, USA",
"craneFormDestination": "Vyberte cieľ",
"craneFormDates": "Vyberte dátumy",
"craneFly": "LETY",
"craneSleep": "REŽIM SPÁNKU",
"craneEat": "JEDLO",
"craneFlySubhead": "Prieskum letov podľa cieľa",
"craneSleepSubhead": "Prieskum objektov podľa cieľa",
"craneEatSubhead": "Prieskum reštaurácií podľa cieľa",
"craneFlyStops": "{numberOfStops,plural,=0{Priamy let}=1{1 medzipristátie}few{{numberOfStops} medzipristátia}many{{numberOfStops} stops}other{{numberOfStops} medzipristátí}}",
"craneSleepProperties": "{totalProperties,plural,=0{Žiadne dostupné objekty}=1{1 dostupný objekt}few{{totalProperties} dostupné objekty}many{{totalProperties} Available Properties}other{{totalProperties} dostupných objektov}}",
"craneEatRestaurants": "{totalRestaurants,plural,=0{Žiadne reštaurácie}=1{1 reštaurácia}few{{totalRestaurants} reštaurácie}many{{totalRestaurants} Restaurants}other{{totalRestaurants} reštaurácií}}",
"craneFly0": "Aspen, USA",
"demoCupertinoSegmentedControlSubtitle": "Segmentované ovládanie v štýle systému iOS",
"craneSleep10": "Káhira, Egypt",
"craneEat9": "Madrid, Španielsko",
"craneFly1": "Big Sur, USA",
"craneEat7": "Nashville, USA",
"craneEat6": "Seattle, USA",
"craneFly8": "Singapur",
"craneEat4": "Paríž, Francúzsko",
"craneEat3": "Portland, USA",
"craneEat2": "Córdoba, Argentína",
"craneEat1": "Dallas, USA",
"craneEat0": "Neapol, Taliansko",
"craneSleep11": "Taipei, Taiwan",
"craneSleep3": "Havana, Kuba",
"shrineLogoutButtonCaption": "ODHLÁSIŤ SA",
"rallyTitleBills": "FAKTÚRY",
"rallyTitleAccounts": "ÚČTY",
"shrineProductVagabondSack": "Taška Vagabond",
"rallyAccountDetailDataInterestYtd": "Úrok od začiatku roka dodnes",
"shrineProductWhitneyBelt": "Opasok Whitney",
"shrineProductGardenStrand": "Záhradný pás",
"shrineProductStrutEarrings": "Náušnice Strut",
"shrineProductVarsitySocks": "Ponožky Varsity",
"shrineProductWeaveKeyring": "Kľúčenka Weave",
"shrineProductGatsbyHat": "Klobúk Gatsby",
"shrineProductShrugBag": "Kabelka na plece",
"shrineProductGiltDeskTrio": "Trio pozlátených stolíkov",
"shrineProductCopperWireRack": "Medený drôtený stojan",
"shrineProductSootheCeramicSet": "Keramická súprava Soothe",
"shrineProductHurrahsTeaSet": "Čajová súprava Hurrahs",
"shrineProductBlueStoneMug": "Modrý keramický pohár",
"shrineProductRainwaterTray": "Zberná nádoba na dažďovú vodu",
"shrineProductChambrayNapkins": "Obrúsky Chambray",
"shrineProductSucculentPlanters": "Sukulenty",
"shrineProductQuartetTable": "Štvorcový stôl",
"shrineProductKitchenQuattro": "Kuchynská skrinka",
"shrineProductClaySweater": "Terakotový sveter",
"shrineProductSeaTunic": "Plážová tunika",
"shrineProductPlasterTunic": "Tunika",
"rallyBudgetCategoryRestaurants": "Reštaurácie",
"shrineProductChambrayShirt": "Košeľa Chambray",
"shrineProductSeabreezeSweater": "Sveter na chladný vánok",
"shrineProductGentryJacket": "Kabátik",
"shrineProductNavyTrousers": "Námornícke nohavice",
"shrineProductWalterHenleyWhite": "Tričko bez límca so zapínaním Walter (biele)",
"shrineProductSurfAndPerfShirt": "Surferské tričko",
"shrineProductGingerScarf": "Zázvorový šál",
"shrineProductRamonaCrossover": "Prechodné šaty Ramona",
"shrineProductClassicWhiteCollar": "Klasická košeľa s bielym límcom",
"shrineProductSunshirtDress": "Slnečné šaty",
"rallyAccountDetailDataInterestRate": "Úroková sadzba",
"rallyAccountDetailDataAnnualPercentageYield": "Ročný percentuálny výnos",
"rallyAccountDataVacation": "Dovolenka",
"shrineProductFineLinesTee": "Tričko s tenkými pásikmi",
"rallyAccountDataHomeSavings": "Úspory na dom",
"rallyAccountDataChecking": "Bežný",
"rallyAccountDetailDataInterestPaidLastYear": "Úroky zaplatené minulý rok",
"rallyAccountDetailDataNextStatement": "Ďalší výpis",
"rallyAccountDetailDataAccountOwner": "Vlastník účtu",
"rallyBudgetCategoryCoffeeShops": "Kaviarne",
"rallyBudgetCategoryGroceries": "Potraviny",
"shrineProductCeriseScallopTee": "Tričko s lemom Cerise",
"rallyBudgetCategoryClothing": "Oblečenie",
"rallySettingsManageAccounts": "Spravovať účty",
"rallyAccountDataCarSavings": "Úspory na auto",
"rallySettingsTaxDocuments": "Daňové dokumenty",
"rallySettingsPasscodeAndTouchId": "Vstupný kód a Touch ID",
"rallySettingsNotifications": "Upozornenia",
"rallySettingsPersonalInformation": "Osobné údaje",
"rallySettingsPaperlessSettings": "Nastavenia bez papiera",
"rallySettingsFindAtms": "Nájsť bankomaty",
"rallySettingsHelp": "Pomocník",
"rallySettingsSignOut": "Odhlásiť sa",
"rallyAccountTotal": "Celkove",
"rallyBillsDue": "Termín",
"rallyBudgetLeft": "Zostatok:",
"rallyAccounts": "Účty",
"rallyBills": "Faktúry",
"rallyBudgets": "Rozpočty",
"rallyAlerts": "Upozornenia",
"rallySeeAll": "ZOBRAZIŤ VŠETKO",
"rallyFinanceLeft": "ZOSTATOK:",
"rallyTitleOverview": "PREHĽAD",
"shrineProductShoulderRollsTee": "Tričko na plecia",
"shrineNextButtonCaption": "ĎALEJ",
"rallyTitleBudgets": "ROZPOČTY",
"rallyTitleSettings": "NASTAVENIA",
"rallyLoginLoginToRally": "Prihlásenie do aplikácie Rally",
"rallyLoginNoAccount": "Nemáte účet?",
"rallyLoginSignUp": "REGISTROVAŤ SA",
"rallyLoginUsername": "Používateľské meno",
"rallyLoginPassword": "Heslo",
"rallyLoginLabelLogin": "Prihlásiť sa",
"rallyLoginRememberMe": "Zapamätať si ma",
"rallyLoginButtonLogin": "PRIHLÁSIŤ SA",
"rallyAlertsMessageHeadsUpShopping": "Upozorňujeme, že ste minuli {percent} rozpočtu v Nákupoch na tento mesiac.",
"rallyAlertsMessageSpentOnRestaurants": "Tento týždeň ste minuli {amount} v reštauráciách.",
"rallyAlertsMessageATMFees": "Tento mesiac ste minuli {amount} na poplatky v bankomatoch",
"rallyAlertsMessageCheckingAccount": "Dobrá práca. Zostatok na vašom bežnom účte je oproti minulému mesiacu o {percent} vyšší.",
"shrineMenuCaption": "PONUKA",
"shrineCategoryNameAll": "VŠETKO",
"shrineCategoryNameAccessories": "DOPLNKY",
"shrineCategoryNameClothing": "OBLEČENIE",
"shrineCategoryNameHome": "DOMÁCNOSŤ",
"shrineLoginUsernameLabel": "Používateľské meno",
"shrineLoginPasswordLabel": "Heslo",
"shrineCancelButtonCaption": "ZRUŠIŤ",
"shrineCartTaxCaption": "Daň:",
"shrineCartPageCaption": "KOŠÍK",
"shrineProductQuantity": "Množstvo: {quantity}",
"shrineProductPrice": "× {price}",
"shrineCartItemCount": "{quantity,plural,=0{ŽIADNE POLOŽKY}=1{1 POLOŽKA}few{{quantity} POLOŽKY}many{{quantity} POLOŽKY}other{{quantity} POLOŽIEK}}",
"shrineCartClearButtonCaption": "VYMAZAŤ KOŠÍK",
"shrineCartTotalCaption": "CELKOVE",
"shrineCartSubtotalCaption": "Medzisúčet:",
"shrineCartShippingCaption": "Dopravné:",
"shrineProductGreySlouchTank": "Sivé tielko",
"shrineProductStellaSunglasses": "Slnečné okuliare Stella",
"shrineProductWhitePinstripeShirt": "Biela pásiková košeľa",
"demoTextFieldWhereCanWeReachYou": "Na akom čísle sa môžeme s vami spojiť?",
"settingsTextDirectionLTR": "Ľ-P",
"settingsTextScalingLarge": "Veľké",
"demoBottomSheetHeader": "Hlavička",
"demoBottomSheetItem": "Položka {value}",
"demoBottomTextFieldsTitle": "Textové polia",
"demoTextFieldTitle": "Textové polia",
"demoTextFieldSubtitle": "Jeden riadok upraviteľného textu a čísel",
"demoTextFieldDescription": "Textové polia umožňujú používateľom zadávať text do používateľského rozhrania. Zvyčajne sa nachádzajú vo formulároch a dialógových oknách.",
"demoTextFieldShowPasswordLabel": "Zobraziť heslo",
"demoTextFieldHidePasswordLabel": "Skryť heslo",
"demoTextFieldFormErrors": "Pred odoslaním odstráňte chyby označené červenou.",
"demoTextFieldNameRequired": "Meno je povinné.",
"demoTextFieldOnlyAlphabeticalChars": "Zadajte iba abecedné znaky.",
"demoTextFieldEnterUSPhoneNumber": "(###) ###-#### – Zadajte telefónne číslo v USA.",
"demoTextFieldEnterPassword": "Zadajte heslo.",
"demoTextFieldPasswordsDoNotMatch": "Heslá sa nezhodujú",
"demoTextFieldWhatDoPeopleCallYou": "V súvislosti s čím vám ľudia volajú?",
"demoTextFieldNameField": "Názov*",
"demoBottomSheetButtonText": "ZOBRAZIŤ DOLNÝ HÁROK",
"demoTextFieldPhoneNumber": "Telefónne číslo*",
"demoBottomSheetTitle": "Dolný hárok",
"demoTextFieldEmail": "E‑mail",
"demoTextFieldTellUsAboutYourself": "Povedzte nám o sebe (napíšte napríklad, kde pracujete alebo aké máte záľuby)",
"demoTextFieldKeepItShort": "Napíšte stručný text. Toto je iba ukážka.",
"starterAppGenericButton": "TLAČIDLO",
"demoTextFieldLifeStory": "Biografia",
"demoTextFieldSalary": "Plat",
"demoTextFieldUSD": "USD",
"demoTextFieldNoMoreThan": "Maximálne 8 znakov.",
"demoTextFieldPassword": "Heslo*",
"demoTextFieldRetypePassword": "Znovu zadajte heslo*",
"demoTextFieldSubmit": "ODOSLAŤ",
"demoBottomNavigationSubtitle": "Dolná navigácia s prelínajúcimi sa zobrazeniami",
"demoBottomSheetAddLabel": "Pridať",
"demoBottomSheetModalDescription": "Modálny dolný hárok je alternatíva k ponuke alebo dialógovému oknu. Bráni používateľovi interagovať so zvyškom aplikácie.",
"demoBottomSheetModalTitle": "Modálny dolný hárok",
"demoBottomSheetPersistentDescription": "Trvalý dolný hárok zobrazuje informácie doplňujúce hlavný obsah aplikácie. Zobrazuje sa neustále, aj keď používateľ interaguje s inými časťami aplikácie.",
"demoBottomSheetPersistentTitle": "Trvalý dolný hárok",
"demoBottomSheetSubtitle": "Trvalé a modálne dolné hárky",
"demoTextFieldNameHasPhoneNumber": "Telefónne číslo používateľa {name} je {phoneNumber}",
"buttonText": "TLAČIDLO",
"demoTypographyDescription": "Definície rôznych typografických štýlov vo vzhľade Material Design.",
"demoTypographySubtitle": "Všetky preddefinované štýly textu",
"demoTypographyTitle": "Typografia",
"demoFullscreenDialogDescription": "Hodnota fullscreenDialog určuje, či je prichádzajúca stránka modálne dialógové okno na celú obrazovku",
"demoFlatButtonDescription": "Ploché tlačidlo po stlačení zobrazí atramentovú škvrnu, ale nezvýši sa. Používajte ploché tlačidlá v paneloch s nástrojmi, dialógových oknách a texte s odsadením",
"demoBottomNavigationDescription": "Dolné navigačné panely zobrazujú v dolnej časti obrazovky tri až päť cieľov. Každý cieľ prestavuje ikona a nepovinný textový štítok. Používateľ, ktorý klepne na ikonu dolnej navigácie, prejde do cieľa navigácie najvyššej úrovne, ktorá je s touto ikonou spojená.",
"demoBottomNavigationSelectedLabel": "Vybraný štítok",
"demoBottomNavigationPersistentLabels": "Trvalé štítky",
"starterAppDrawerItem": "Položka {value}",
"demoTextFieldRequiredField": "* Označuje povinné pole.",
"demoBottomNavigationTitle": "Dolná navigácia",
"settingsLightTheme": "Svetlý",
"settingsTheme": "Motív",
"settingsPlatformIOS": "iOS",
"settingsPlatformAndroid": "Android",
"settingsTextDirectionRTL": "P-Ľ",
"settingsTextScalingHuge": "Veľmi veľké",
"cupertinoButton": "Tlačidlo",
"settingsTextScalingNormal": "Normálna",
"settingsTextScalingSmall": "Malé",
"settingsSystemDefault": "Systém",
"settingsTitle": "Nastavenia",
"rallyDescription": "Osobná finančná aplikácia",
"aboutDialogDescription": "Ak si chcete zobraziť zdrojový kód tejto aplikácie, prejdite na {repoLink}.",
"bottomNavigationCommentsTab": "Komentáre",
"starterAppGenericBody": "Obsahová časť",
"starterAppGenericHeadline": "Nadpis",
"starterAppGenericSubtitle": "Podnadpis",
"starterAppGenericTitle": "Názov",
"starterAppTooltipSearch": "Hľadať",
"starterAppTooltipShare": "Zdieľať",
"starterAppTooltipFavorite": "Zaradiť medzi obľúbené",
"starterAppTooltipAdd": "Pridať",
"bottomNavigationCalendarTab": "Kalendár",
"starterAppDescription": "Responzívne rozloženie štartovacej aplikácie",
"starterAppTitle": "Štartovacia aplikácia",
"aboutFlutterSamplesRepo": "Odkladací priestor GitHub na ukážky Flutter",
"bottomNavigationContentPlaceholder": "Zástupný symbol pre kartu {title}",
"bottomNavigationCameraTab": "Fotoaparát",
"bottomNavigationAlarmTab": "Budík",
"bottomNavigationAccountTab": "Účet",
"demoTextFieldYourEmailAddress": "Vaša e‑mailová adresa",
"demoToggleButtonDescription": "Pomocou prepínačov môžete zoskupiť súvisiace možnosti. Skupina by mala zdieľať spoločný kontajner na zvýraznenie skupín súvisiacich prepínačov",
"colorsGrey": "SIVÁ",
"colorsBrown": "HNEDÁ",
"colorsDeepOrange": "TMAVOORANŽOVÁ",
"colorsOrange": "ORANŽOVÁ",
"colorsAmber": "ŽLTOHNEDÁ",
"colorsYellow": "ŽLTÁ",
"colorsLime": "ŽLTOZELENÁ",
"colorsLightGreen": "SVETLOZELENÁ",
"colorsGreen": "ZELENÁ",
"homeHeaderGallery": "Galéria",
"homeHeaderCategories": "Kategórie",
"shrineDescription": "Módna predajná aplikácia",
"craneDescription": "Prispôsobená cestovná aplikácia",
"homeCategoryReference": "ŠTÝLY A ĎALŠIE",
"demoInvalidURL": "Webovú adresu sa nepodarilo zobraziť:",
"demoOptionsTooltip": "Možnosti",
"demoInfoTooltip": "Informácie",
"demoCodeTooltip": "Ukážkový kód",
"demoDocumentationTooltip": "Dokumentácia rozhraní API",
"demoFullscreenTooltip": "Celá obrazovka",
"settingsTextScaling": "Mierka písma",
"settingsTextDirection": "Smer textu",
"settingsLocale": "Miestne nastavenie",
"settingsPlatformMechanics": "Mechanika platformy",
"settingsDarkTheme": "Tmavý",
"settingsSlowMotion": "Spomalenie",
"settingsAbout": "Flutter Gallery",
"settingsFeedback": "Odoslať spätnú väzbu",
"settingsAttribution": "Navrhol TOASTER v Londýne",
"demoButtonTitle": "Tlačidlá",
"demoButtonSubtitle": "Textové, zvýšené, s obrysom a ďalšie",
"demoFlatButtonTitle": "Ploché tlačidlo",
"demoRaisedButtonDescription": "Zvýšené tlačidlá pridávajú rozmery do prevažne plochých rozložení. Zvýrazňujú funkcie v neprehľadných alebo širokých priestoroch.",
"demoRaisedButtonTitle": "Zvýšené tlačidlo",
"demoOutlineButtonTitle": "Tlačidlo s obrysom",
"demoOutlineButtonDescription": "Tlačidlá s obrysom sa po stlačení zmenia na nepriehľadné a zvýšia sa. Často sú spárované so zvýšenými tlačidlami na označenie alternatívnej sekundárnej akcie.",
"demoToggleButtonTitle": "Prepínače",
"colorsTeal": "MODROZELENÁ",
"demoFloatingButtonTitle": "Plávajúce tlačidlo akcie",
"demoFloatingButtonDescription": "Plávajúce tlačidlo akcie je okrúhla ikona vznášajúca sa nad obsahom propagujúca primárnu akciu v aplikácii.",
"demoDialogTitle": "Dialógové okná",
"demoDialogSubtitle": "Jednoduché, upozornenie a celá obrazovka",
"demoAlertDialogTitle": "Upozornenie",
"demoAlertDialogDescription": "Dialógové okno upozornenia informuje používateľa o situáciách, ktoré vyžadujú potvrdenie. Má voliteľný názov a voliteľný zoznam akcií.",
"demoAlertTitleDialogTitle": "Upozornenie s názvom",
"demoSimpleDialogTitle": "Jednoduché",
"demoSimpleDialogDescription": "Jednoduché dialógové okno poskytuje používateľovi výber medzi viacerými možnosťami. Má voliteľný názov, ktorý sa zobrazuje nad možnosťami.",
"demoFullscreenDialogTitle": "Celá obrazovka",
"demoCupertinoButtonsTitle": "Tlačidlá",
"demoCupertinoButtonsSubtitle": "Tlačidlá v štýle systému iOS",
"demoCupertinoButtonsDescription": "Tlačidlo v štýle systému iOS. Zahŕňa text a ikonu, ktorá sa po dotyku stmaví alebo vybledne. Voliteľne môže mať aj pozadie.",
"demoCupertinoAlertsTitle": "Upozornenia",
"demoCupertinoAlertsSubtitle": "Dialógové okná upozornení v štýle systému iOS",
"demoCupertinoAlertTitle": "Upozornenie",
"demoCupertinoAlertDescription": "Dialógové okno upozornenia informuje používateľa o situáciách, ktoré vyžadujú potvrdenie. Dialógové okno upozornenia má voliteľný názov, obsah aj zoznam akcií. Názov sa zobrazuje nad obsahom a akcie pod obsahom.",
"demoCupertinoAlertWithTitleTitle": "Upozornenie s názvom",
"demoCupertinoAlertButtonsTitle": "Upozornenie s tlačidlami",
"demoCupertinoAlertButtonsOnlyTitle": "Iba tlačidlá upozornení",
"demoCupertinoActionSheetTitle": "Hárok s akciami",
"demoCupertinoActionSheetDescription": "Hárok s akciami je špecifický štýl upozornenia ponúkajúceho používateľovi dve alebo viac možností, ktoré sa týkajú aktuálneho kontextu. Má názov, dodatočnú správu a zoznam akcií.",
"demoColorsTitle": "Farby",
"demoColorsSubtitle": "Všetky vopred definované farby",
"demoColorsDescription": "Konštantné farby a vzorka farieb, ktoré predstavujú paletu farieb vzhľadu Material Design.",
"buttonTextEnabled": "ENABLED",
"buttonTextDisabled": "DISABLED",
"buttonTextCreate": "Vytvoriť",
"dialogSelectedOption": "Vybrali ste: {value}",
"dialogDiscardTitle": "Chcete zahodiť koncept?",
"dialogLocationTitle": "Chcete použiť službu určovania polohy od Googlu?",
"dialogLocationDescription": "Povoľte, aby mohol Google pomáhať aplikáciám určovať polohu. Znamená to, že do Googlu budú odosielané anonymné údaje o polohe, aj keď nebudú spustené žiadne aplikácie.",
"dialogCancel": "ZRUŠIŤ",
"dialogDiscard": "ZAHODIŤ",
"dialogDisagree": "NESÚHLASÍM",
"dialogAgree": "SÚHLASÍM",
"dialogSetBackup": "Nastavenie zálohovacieho účtu",
"colorsBlueGrey": "MODROSIVÁ",
"dialogShow": "ZOBRAZIŤ DIALÓGOVÉ OKNO",
"dialogFullscreenTitle": "Dialógové okno na celú obrazovku",
"dialogFullscreenSave": "ULOŽIŤ",
"dialogFullscreenDescription": "Ukážka dialógového okna na celú obrazovku",
"cupertinoButtonEnabled": "Enabled",
"cupertinoButtonDisabled": "Disabled",
"cupertinoButtonWithBackground": "S pozadím",
"cupertinoAlertCancel": "Zrušiť",
"cupertinoAlertDiscard": "Zahodiť",
"cupertinoAlertLocationTitle": "Chcete povoliť Mapám prístup k vašej polohe, keď túto aplikáciu používate?",
"cupertinoAlertLocationDescription": "Vaša aktuálna poloha sa zobrazí na mape a budú sa pomocou nej vyhľadávať trasy, výsledky vyhľadávania v okolí a odhadované časy cesty.",
"cupertinoAlertAllow": "Povoliť",
"cupertinoAlertDontAllow": "Nepovoliť",
"cupertinoAlertFavoriteDessert": "Výber obľúbeného dezertu",
"cupertinoAlertDessertDescription": "Vyberte si v zozname nižšie svoj obľúbený typ dezertu. Na základe vášho výberu sa prispôsobí zoznam navrhovaných reštaurácií vo vašom okolí.",
"cupertinoAlertCheesecake": "Tvarohový koláč",
"cupertinoAlertTiramisu": "Tiramisu",
"cupertinoAlertApplePie": "Jablkový koláč",
"cupertinoAlertChocolateBrownie": "Čokoládový koláč",
"cupertinoShowAlert": "Zobraziť upozornenie",
"colorsRed": "ČERVENÁ",
"colorsPink": "RUŽOVÁ",
"colorsPurple": "FIALOVÁ",
"colorsDeepPurple": "TMAVOFIALOVÁ",
"colorsIndigo": "INDIGOVÁ",
"colorsBlue": "MODRÁ",
"colorsLightBlue": "SVETLOMODRÁ",
"colorsCyan": "TYRKYSOVÁ",
"dialogAddAccount": "Pridať účet",
"Gallery": "Galéria",
"Categories": "Kategórie",
"SHRINE": "SHRINE",
"Basic shopping app": "Základná aplikácia na nakupovanie",
"RALLY": "RALLY",
"CRANE": "CRANE",
"Travel app": "Cestovné aplikácie",
"MATERIAL": "MATERIAL",
"CUPERTINO": "CUPERTINO",
"REFERENCE STYLES & MEDIA": "REFERENČNÉ ŠTÝLY A MÉDIÁ"
}
| gallery/lib/l10n/intl_sk.arb/0 | {
"file_path": "gallery/lib/l10n/intl_sk.arb",
"repo_id": "gallery",
"token_count": 23368
} | 808 |
{
"loading": "正在加载",
"deselect": "取消选择",
"select": "选择",
"selectable": "可选择(长按)",
"selected": "已选择",
"demo": "演示",
"bottomAppBar": "底部应用栏",
"notSelected": "未选择",
"demoCupertinoSearchTextFieldTitle": "搜索文本字段",
"demoCupertinoPicker": "选择器",
"demoCupertinoSearchTextFieldSubtitle": "iOS 样式的搜索文本字段",
"demoCupertinoSearchTextFieldDescription": "一种搜索文本字段,允许用户通过输入文本进行搜索,并可提供和过滤建议。",
"demoCupertinoSearchTextFieldPlaceholder": "输入一些文本",
"demoCupertinoScrollbarTitle": "滚动条",
"demoCupertinoScrollbarSubtitle": "iOS 样式的滚动条",
"demoCupertinoScrollbarDescription": "一种用于封装给定子项的滚动条",
"demoTwoPaneItem": "项 {value}",
"demoTwoPaneList": "列表",
"demoTwoPaneFoldableLabel": "可折叠设备",
"demoTwoPaneSmallScreenLabel": "小屏幕设备",
"demoTwoPaneSmallScreenDescription": "这即是 TwoPane 在小屏幕设备上的行为方式。",
"demoTwoPaneTabletLabel": "平板电脑/桌面设备",
"demoTwoPaneTabletDescription": "这即是 TwoPane 在平板电脑或桌面设备等大屏幕设备上的行为方式。",
"demoTwoPaneTitle": "TwoPane",
"demoTwoPaneSubtitle": "旨在演示可折叠设备、大屏幕设备和小屏幕设备上的响应式布局",
"splashSelectDemo": "请选择一种演示",
"demoTwoPaneFoldableDescription": "这即是 TwoPane 在可折叠设备上的行为方式。",
"demoTwoPaneDetails": "详情",
"demoTwoPaneSelectItem": "请选择一个项",
"demoTwoPaneItemDetails": "项 {value} 的详情",
"demoCupertinoContextMenuActionText": "点按并按住 Flutter 徽标即可看到上下文菜单。",
"demoCupertinoContextMenuDescription": "iOS 样式的全屏上下文菜单,会在元素被长按时出现。",
"demoAppBarTitle": "应用栏",
"demoAppBarDescription": "应用栏会提供与当前屏幕有关的内容和操作,用于宣传品牌以及显示屏幕标题、导航和操作",
"demoDividerTitle": "分隔线",
"demoDividerSubtitle": "分隔线是一条细线,用于将列表和布局中的内容分组。",
"demoDividerDescription": "分隔线可用来分隔内容,无论是列表、抽屉式导航栏还是别处均可使用。",
"demoVerticalDividerTitle": "垂直分隔线",
"demoCupertinoContextMenuTitle": "上下文菜单",
"demoCupertinoContextMenuSubtitle": "iOS 样式的上下文菜单",
"demoAppBarSubtitle": "显示与当前屏幕有关的信息和操作",
"demoCupertinoContextMenuActionOne": "操作 1",
"demoCupertinoContextMenuActionTwo": "操作 2",
"demoDateRangePickerDescription": "显示一个包含 Material Design 日期范围选择器的对话框。",
"demoDateRangePickerTitle": "日期范围选择器",
"demoNavigationDrawerUserName": "用户名",
"demoNavigationDrawerUserEmail": "[email protected]",
"demoNavigationDrawerText": "从边缘滑动或点按左上角的图标即可查看抽屉式导航栏",
"demoNavigationRailTitle": "导航栏",
"demoNavigationRailSubtitle": "在应用中显示导航栏",
"demoNavigationRailDescription": "在应用左侧或右侧显示的 Material 微件,用于在少量视图(通常为 3 至 5 个)之间导航。",
"demoNavigationRailFirst": "第一个",
"demoNavigationDrawerTitle": "抽屉式导航栏",
"demoNavigationRailThird": "第三个",
"replyStarredLabel": "已加星标",
"demoTextButtonDescription": "文本按钮会在用户按下后出现墨水飞溅效果,但按钮本身没有升起效果。文本按钮适用于工具栏、对话框和设有内边距的内嵌元素",
"demoElevatedButtonTitle": "凸起按钮",
"demoElevatedButtonDescription": "凸起按钮能为以平面内容为主的布局增添立体感。此类按钮可突出强调位于拥挤或宽阔空间中的功能。",
"demoOutlinedButtonTitle": "轮廓按钮",
"demoOutlinedButtonDescription": "轮廓按钮会在用户按下后变为不透明并升起。此类按钮通常会与凸起按钮配对使用,用于指示其他的次要操作。",
"demoContainerTransformDemoInstructions": "卡片、列表和 FAB",
"demoNavigationDrawerSubtitle": "在应用栏中显示抽屉式导航栏",
"replyDescription": "高效并且重点突出的电子邮件应用",
"demoNavigationDrawerDescription": "从屏幕边缘水平滑入以在应用中显示导航链接的 Material Design 面板。",
"replyDraftsLabel": "草稿",
"demoNavigationDrawerToPageOne": "第一个项目",
"replyInboxLabel": "收件箱",
"demoSharedXAxisDemoInstructions": "“继续”和“返回”按钮",
"replySpamLabel": "垃圾邮件",
"replyTrashLabel": "回收站",
"replySentLabel": "已发送",
"demoNavigationRailSecond": "第二个",
"demoNavigationDrawerToPageTwo": "第二个项目",
"demoFadeScaleDemoInstructions": "模态和 FAB",
"demoFadeThroughDemoInstructions": "底部导航栏",
"demoSharedZAxisDemoInstructions": "“设置”图标按钮",
"demoSharedYAxisDemoInstructions": "按“最近播放”排序",
"demoTextButtonTitle": "文本按钮",
"demoSharedZAxisBeefSandwichRecipeTitle": "牛肉三明治",
"demoSharedZAxisDessertRecipeDescription": "甜品食谱",
"demoSharedYAxisAlbumTileSubtitle": "音乐人",
"demoSharedYAxisAlbumTileTitle": "专辑",
"demoSharedYAxisRecentSortTitle": "最近播放",
"demoSharedYAxisAlphabeticalSortTitle": "按字母升序排列 (A-Z)",
"demoSharedYAxisAlbumCount": "268 个专辑",
"demoSharedYAxisTitle": "共用 Y 轴",
"demoSharedXAxisCreateAccountButtonText": "创建帐号",
"demoFadeScaleAlertDialogDiscardButton": "舍弃",
"demoSharedXAxisSignInTextFieldLabel": "电子邮件地址或电话号码",
"demoSharedXAxisSignInSubtitleText": "使用您的帐号登录",
"demoSharedXAxisSignInWelcomeText": "David Park,您好",
"demoSharedXAxisIndividualCourseSubtitle": "单独显示的课程",
"demoSharedXAxisBundledCourseSubtitle": "捆绑课程",
"demoFadeThroughAlbumsDestination": "专辑",
"demoSharedXAxisDesignCourseTitle": "设计",
"demoSharedXAxisIllustrationCourseTitle": "插图",
"demoSharedXAxisBusinessCourseTitle": "商务",
"demoSharedXAxisArtsAndCraftsCourseTitle": "艺术与手工艺",
"demoMotionPlaceholderSubtitle": "副标题",
"demoFadeScaleAlertDialogCancelButton": "取消",
"demoFadeScaleAlertDialogHeader": "提醒对话框",
"demoFadeScaleHideFabButton": "隐藏悬浮操作按钮",
"demoFadeScaleShowFabButton": "显示悬浮操作按钮",
"demoFadeScaleShowAlertDialogButton": "显示模态",
"demoFadeScaleDescription": "淡化模式可用于让界面元素进入或退出屏幕画面范围,例如对话框会以淡入的方式显示在画面中央。",
"demoFadeScaleTitle": "淡入",
"demoFadeThroughTextPlaceholder": "123 张照片",
"demoFadeThroughSearchDestination": "搜索",
"demoFadeThroughPhotosDestination": "照片",
"demoSharedXAxisCoursePageSubtitle": "在您的 Feed 中,捆绑式类别会显示为群组。您以后可随时进行更改。",
"demoFadeThroughDescription": "淡出后淡入模式可用于转换彼此间关系不太紧密的界面元素。",
"demoFadeThroughTitle": "淡出后淡入",
"demoSharedZAxisHelpSettingLabel": "帮助",
"demoMotionSubtitle": "所有预定义的转换模式",
"demoSharedZAxisNotificationSettingLabel": "通知",
"demoSharedZAxisProfileSettingLabel": "个人资料",
"demoSharedZAxisSavedRecipesListTitle": "保存的食谱",
"demoSharedZAxisBeefSandwichRecipeDescription": "牛肉三明治食谱",
"demoSharedZAxisCrabPlateRecipeDescription": "螃蟹食谱",
"demoSharedXAxisCoursePageTitle": "将课程化繁为简",
"demoSharedZAxisCrabPlateRecipeTitle": "螃蟹",
"demoSharedZAxisShrimpPlateRecipeDescription": "虾食谱",
"demoSharedZAxisShrimpPlateRecipeTitle": "虾",
"demoContainerTransformTypeFadeThrough": "淡出后淡入",
"demoSharedZAxisDessertRecipeTitle": "甜品",
"demoSharedZAxisSandwichRecipeDescription": "三明治食谱",
"demoSharedZAxisSandwichRecipeTitle": "三明治",
"demoSharedZAxisBurgerRecipeDescription": "汉堡包食谱",
"demoSharedZAxisBurgerRecipeTitle": "汉堡包",
"demoSharedZAxisSettingsPageTitle": "设置",
"demoSharedZAxisTitle": "共用 Z 轴",
"demoSharedZAxisPrivacySettingLabel": "隐私设置",
"demoMotionTitle": "动态效果",
"demoContainerTransformTitle": "容器转换",
"demoContainerTransformDescription": "容器转换模式用于转换包含容器的界面元素,这个模式可在两个界面元素之间创建可视化连接",
"demoContainerTransformModalBottomSheetTitle": "淡化模式",
"demoContainerTransformTypeFade": "淡入",
"demoSharedYAxisAlbumTileDurationUnit": "分钟",
"demoMotionPlaceholderTitle": "标题",
"demoSharedXAxisForgotEmailButtonText": "忘记了电子邮件地址?",
"demoMotionSmallPlaceholderSubtitle": "副",
"demoMotionDetailsPageTitle": "详情页面",
"demoMotionListTileTitle": "列表项",
"demoSharedAxisDescription": "共用轴模式可用于转换存在空间或导航关系的界面元素。这个模式会让元素在转换时共用 x 轴、y 轴或 z 轴,用以强调元素间的关系。",
"demoSharedXAxisTitle": "共用 X 轴",
"demoSharedXAxisBackButtonText": "返回",
"demoSharedXAxisNextButtonText": "继续",
"demoSharedXAxisCulinaryCourseTitle": "烹饪",
"githubRepo": "{repoName} GitHub 代码库",
"fortnightlyMenuUS": "美国",
"fortnightlyMenuBusiness": "商业",
"fortnightlyMenuScience": "科学",
"fortnightlyMenuSports": "体育",
"fortnightlyMenuTravel": "旅游",
"fortnightlyMenuCulture": "文化",
"fortnightlyTrendingTechDesign": "技术设计",
"rallyBudgetDetailAmountLeft": "剩余金额",
"fortnightlyHeadlineArmy": "从内部改革绿色军队",
"fortnightlyDescription": "注重内容的新闻应用",
"rallyBillDetailAmountDue": "应付金额",
"rallyBudgetDetailTotalCap": "总金额上限",
"rallyBudgetDetailAmountUsed": "已用金额",
"fortnightlyTrendingHealthcareRevolution": "医疗革命",
"fortnightlyMenuFrontPage": "头版",
"fortnightlyMenuWorld": "世界",
"rallyBillDetailAmountPaid": "已付金额",
"fortnightlyMenuPolitics": "政治",
"fortnightlyHeadlineBees": "农田蜜蜂供不应求",
"fortnightlyHeadlineGasoline": "汽油的未来",
"fortnightlyTrendingGreenArmy": "绿色军队",
"fortnightlyHeadlineFeminists": "女权主义者反对党派之争",
"fortnightlyHeadlineFabrics": "设计师运用技术制作未来主义面料",
"fortnightlyHeadlineStocks": "由于股市萧条,很多人转向货币市场",
"fortnightlyTrendingReform": "改革",
"fortnightlyMenuTech": "技术",
"fortnightlyHeadlineWar": "在战争中被拆散的美国人的生活",
"fortnightlyHeadlineHealthcare": "平缓却又强有力的医疗革命",
"fortnightlyLatestUpdates": "最新动态",
"fortnightlyTrendingStocks": "股票",
"rallyBillDetailTotalAmount": "总金额",
"demoCupertinoPickerDateTime": "日期和时间",
"signIn": "登录",
"dataTableRowWithSugar": "加糖{value}",
"dataTableRowApplePie": "苹果派",
"dataTableRowDonut": "甜甜圈",
"dataTableRowHoneycomb": "蜂巢饼",
"dataTableRowLollipop": "棒棒糖",
"dataTableRowJellyBean": "软心豆粒糖",
"dataTableRowGingerbread": "姜饼",
"dataTableRowCupcake": "纸杯蛋糕",
"dataTableRowEclair": "长形泡芙",
"dataTableRowIceCreamSandwich": "冰淇淋三明治",
"dataTableRowFrozenYogurt": "酸奶冰淇淋",
"dataTableColumnIron": "铁含量 (%)",
"dataTableColumnCalcium": "钙含量 (%)",
"dataTableColumnSodium": "钠(毫克)",
"demoTimePickerTitle": "时间选择器",
"demo2dTransformationsResetTooltip": "重置变形",
"dataTableColumnFat": "脂肪(克)",
"dataTableColumnCalories": "热量",
"dataTableColumnDessert": "甜品(1 份)",
"cardsDemoTravelDestinationLocation1": "泰米尔纳德邦坦贾武尔市",
"demoTimePickerDescription": "显示一个包含 Material Design 时间选择器的对话框。",
"demoPickersShowPicker": "显示选择器",
"demoTabsScrollingTitle": "滚动",
"demoTabsNonScrollingTitle": "非滚动",
"craneHours": "{hours,plural,=1{1 小时}other{{hours} 小时}}",
"craneMinutes": "{minutes,plural,=1{1 分钟}other{{minutes} 分钟}}",
"craneFlightDuration": "{hoursShortForm} {minutesShortForm}",
"dataTableHeader": "营养成分",
"demoDatePickerTitle": "日期选择器",
"demoPickersSubtitle": "选择日期和时间",
"demoPickersTitle": "选择器",
"demo2dTransformationsEditTooltip": "修改卡片",
"demoDataTableDescription": "数据表会以网格般的形式(行+列)显示信息。这种信息组织方式非常直观,便于用户发现模式和洞见。",
"demo2dTransformationsDescription": "点按即可修改卡片,使用手势即可在场景中移动。拖动即可平移对象,双指张合即可缩放对象,用双指即可旋转对象。按重置按钮即可恢复为初始方向。",
"demo2dTransformationsSubtitle": "平移、缩放、旋转",
"demo2dTransformationsTitle": "二维变形",
"demoCupertinoTextFieldPIN": "PIN 码",
"demoCupertinoTextFieldDescription": "一个文本字段,可供用户使用硬件键盘或屏幕键盘输入文本。",
"demoCupertinoTextFieldSubtitle": "iOS 样式的文本字段",
"demoCupertinoTextFieldTitle": "文本字段",
"demoDatePickerDescription": "显示一个包含 Material Design 日期选择器的对话框。",
"demoCupertinoPickerTime": "时间",
"demoCupertinoPickerDate": "日期",
"demoCupertinoPickerTimer": "倒计时器",
"demoCupertinoPickerDescription": "一种 iOS 样式的选择器小组件,可用于选择字符串以及日期和/或时间。",
"demoCupertinoPickerSubtitle": "iOS 样式的选择器",
"demoCupertinoPickerTitle": "选择器",
"dataTableRowWithHoney": "加蜂蜜{value}",
"cardsDemoTravelDestinationCity2": "切蒂纳德",
"bannerDemoResetText": "重置横幅",
"bannerDemoMultipleText": "多项操作",
"bannerDemoLeadingText": "前置图标",
"dismiss": "关闭",
"cardsDemoTappable": "可点按",
"cardsDemoSelectable": "可选择(长按)",
"cardsDemoExplore": "探索",
"cardsDemoExploreSemantics": "探索{destinationName}",
"cardsDemoShareSemantics": "分享{destinationName}",
"cardsDemoTravelDestinationTitle1": "泰米尔纳德邦 10 大值得一游的城市",
"cardsDemoTravelDestinationDescription1": "第 10 名",
"cardsDemoTravelDestinationCity1": "坦贾武尔",
"dataTableColumnProtein": "蛋白质(克)",
"cardsDemoTravelDestinationTitle2": "南印度的工匠",
"cardsDemoTravelDestinationDescription2": "纺纱工人",
"bannerDemoText": "您的密码已在其他设备上更新。请重新登录。",
"cardsDemoTravelDestinationLocation2": "泰米尔纳德邦锡沃根加县",
"cardsDemoTravelDestinationTitle3": "布里哈迪斯瓦拉神庙",
"cardsDemoTravelDestinationDescription3": "寺庙",
"demoBannerTitle": "横幅",
"demoBannerSubtitle": "在列表内显示横幅",
"demoBannerDescription": "横幅显示简明的重要信息,并提供相应操作供用户执行(或关闭横幅)。横幅需要用户手动关闭。",
"demoCardTitle": "卡片",
"demoCardSubtitle": "采用圆角设计的基准卡片",
"demoCardDescription": "卡片是一页用于表示某些相关信息(例如专辑、地理位置、一顿饭、详细联系信息等)的素材。",
"demoDataTableTitle": "数据表格",
"demoDataTableSubtitle": "信息行和信息列",
"dataTableColumnCarbs": "碳水化合物(克)",
"placeTanjore": "坦贾武尔",
"demoGridListsTitle": "网格列表",
"placeFlowerMarket": "花卉市场",
"placeBronzeWorks": "青铜铸造厂",
"placeMarket": "市场",
"placeThanjavurTemple": "坦贾武尔寺庙",
"placeSaltFarm": "盐场",
"placeScooters": "滑板车",
"placeSilkMaker": "制丝机",
"placeLunchPrep": "午餐烹饪",
"placeBeach": "海滩",
"placeFisherman": "渔民",
"demoMenuSelected": "已选择:{value}",
"demoMenuRemove": "移除",
"demoMenuGetLink": "获取链接",
"demoMenuShare": "分享",
"demoBottomAppBarSubtitle": "在底部显示导航栏和几项操作",
"demoMenuAnItemWithASectionedMenu": "包含分块菜单的项",
"demoMenuADisabledMenuItem": "已停用的菜单项",
"demoLinearProgressIndicatorTitle": "线形进度指示器",
"demoMenuContextMenuItemOne": "上下文菜单项 1",
"demoMenuAnItemWithASimpleMenu": "包含简单菜单的项",
"demoCustomSlidersTitle": "自定义滑块",
"demoMenuAnItemWithAChecklistMenu": "包含核对清单菜单的项",
"demoCupertinoActivityIndicatorTitle": "活动指示器",
"demoCupertinoActivityIndicatorSubtitle": "iOS 样式的活动指示器",
"demoCupertinoActivityIndicatorDescription": "一种 iOS 样式的顺时针旋转的活动指示器",
"demoCupertinoNavigationBarTitle": "导航栏",
"demoCupertinoNavigationBarSubtitle": "iOS 样式的导航栏",
"demoCupertinoNavigationBarDescription": "一种 iOS 样式的导航栏。该导航栏是一个工具栏,至少在工具栏的中间包含一个页面标题。",
"demoCupertinoPullToRefreshTitle": "下拉即可刷新",
"demoCupertinoPullToRefreshSubtitle": "iOS 样式的下拉刷新控件",
"demoCupertinoPullToRefreshDescription": "用于实现 iOS 样式的下拉刷新控件的微件。",
"demoProgressIndicatorTitle": "进度指示器",
"demoProgressIndicatorSubtitle": "线形、环形、不确定型",
"demoCircularProgressIndicatorTitle": "环形进度指示器",
"demoCircularProgressIndicatorDescription": "一种 Material Design 环形进度指示器,通过旋转来表示应用正处于忙碌状态。",
"demoMenuFour": "4",
"demoLinearProgressIndicatorDescription": "一种 Material Design 线形进度指示器,又称“进度条”。",
"demoTooltipTitle": "提示",
"demoTooltipSubtitle": "长按元素或将鼠标悬停在元素上方时显示的简短消息",
"demoTooltipDescription": "工具提示提供文本标签,这些标签用于说明按钮的功能或其他界面操作。工具提示会在用户将鼠标悬停在元素上方、聚焦到元素上或长按元素时显示信息性文本。",
"demoTooltipInstructions": "长按元素或将鼠标悬停在元素上方即可显示工具提示。",
"placeChennai": "钦奈",
"demoMenuChecked": "已选中:{value}",
"placeChettinad": "切蒂纳德",
"demoMenuPreview": "预览",
"demoBottomAppBarTitle": "底部应用栏",
"demoBottomAppBarDescription": "底部应用栏包含底部抽屉式导航栏和最多 4 项操作(包括悬浮操作按钮在内)。",
"bottomAppBarNotch": "凹口",
"bottomAppBarPosition": "悬浮操作按钮位置",
"bottomAppBarPositionDockedEnd": "停靠 - 末端",
"bottomAppBarPositionDockedCenter": "停靠 - 居中",
"bottomAppBarPositionFloatingEnd": "悬浮 - 末端",
"bottomAppBarPositionFloatingCenter": "悬浮 - 居中",
"demoSlidersEditableNumericalValue": "可修改的数字值",
"demoGridListsSubtitle": "行和列布局",
"demoGridListsDescription": "网格列表最适合用于显示同类数据(通常为图片)。网格列表中的每一项称为一个图块。",
"demoGridListsImageOnlyTitle": "仅图片",
"demoGridListsHeaderTitle": "含页眉",
"demoGridListsFooterTitle": "含页脚",
"demoSlidersTitle": "滑块",
"demoSlidersSubtitle": "可让用户通过滑动来选择值的微件",
"demoSlidersDescription": "滑块组件的滑动条表示一定范围的值,用户可使用滑块在滑动条上选择一个值。滑块组件非常适合用于调整音量、亮度等设置,或调节图像滤镜的效果。",
"demoRangeSlidersTitle": "范围滑块",
"demoRangeSlidersDescription": "滑块组件的滑动条表示一定范围的值。滑动条两端可放置图标,图标指明值的范围。滑块组件非常适合用于调整音量、亮度等设置,或调节图像滤镜的效果。",
"demoMenuAnItemWithAContextMenuButton": "包含上下文菜单的项",
"demoCustomSlidersDescription": "滑块组件的滑动条表示一定范围的值,用户可使用滑块在滑动条上选择一个值或一定范围的值。可以更改滑块的主题背景,也可以对滑块执行其他自定义设置。",
"demoSlidersContinuousWithEditableNumericalValue": "带有可修改的数字值的连续滑块",
"demoSlidersDiscrete": "间续滑块",
"demoSlidersDiscreteSliderWithCustomTheme": "采用自定义主题背景的间续滑块",
"demoSlidersContinuousRangeSliderWithCustomTheme": "采用自定义主题背景的连续范围滑块",
"demoSlidersContinuous": "连续滑块",
"placePondicherry": "本地治里",
"demoMenuTitle": "菜单",
"demoContextMenuTitle": "上下文菜单",
"demoSectionedMenuTitle": "分块菜单",
"demoSimpleMenuTitle": "简单菜单",
"demoChecklistMenuTitle": "核对清单菜单",
"demoMenuSubtitle": "菜单按钮和简单菜单",
"demoMenuDescription": "在一个临时界面上显示选项列表的菜单。此类菜单会在用户与按钮、操作或其他控件互动时显示。",
"demoMenuItemValueOne": "菜单项 1",
"demoMenuItemValueTwo": "菜单项 2",
"demoMenuItemValueThree": "菜单项 3",
"demoMenuOne": "1",
"demoMenuTwo": "2",
"demoMenuThree": "3",
"demoMenuContextMenuItemThree": "上下文菜单项 3",
"demoCupertinoSwitchSubtitle": "iOS 样式的开关",
"demoSnackbarsText": "这是信息提示控件。",
"demoCupertinoSliderSubtitle": "iOS 样式的滑块",
"demoCupertinoSliderDescription": "滑块可用于从一组连续或间续的值中选择值。",
"demoCupertinoSliderContinuous": "连续:{value}",
"demoCupertinoSliderDiscrete": "间续:{value}",
"demoSnackbarsAction": "您已按下该信息提示控件上的操作按钮。",
"backToGallery": "返回 Flutter Gallery",
"demoCupertinoTabBarTitle": "标签页栏",
"demoCupertinoSwitchDescription": "开关用于切换单个设置的开启/关闭状态。",
"demoSnackbarsActionButtonLabel": "操作",
"cupertinoTabBarProfileTab": "个人资料",
"demoSnackbarsButtonLabel": "显示信息提示控件",
"demoSnackbarsDescription": "信息提示控件会将某个应用已执行或要执行的流程告知用户。它们会短暂地显示在屏幕底部附近,应该不会干扰用户体验,而且不需要用户输入任何内容就会消失。",
"demoSnackbarsSubtitle": "信息提示控件会在屏幕底部显示信息",
"demoSnackbarsTitle": "信息提示控件",
"demoCupertinoSliderTitle": "滑块",
"cupertinoTabBarChatTab": "聊天",
"cupertinoTabBarHomeTab": "首页",
"demoCupertinoTabBarDescription": "iOS 样式的底部导航标签页栏。显示多个标签页,其中一个标签页(默认为第一个标签页)处于活动状态。",
"demoCupertinoTabBarSubtitle": "iOS 样式的底部标签页栏",
"demoOptionsFeatureTitle": "查看选项",
"demoOptionsFeatureDescription": "点按此处即可查看此演示可用的选项。",
"demoCodeViewerCopyAll": "全部复制",
"shrineScreenReaderRemoveProductButton": "移除{product}",
"shrineScreenReaderProductAddToCart": "加入购物车",
"shrineScreenReaderCart": "{quantity,plural,=0{购物车,无商品}=1{购物车,1 件商品}other{购物车,{quantity} 件商品}}",
"demoCodeViewerFailedToCopyToClipboardMessage": "未能复制到剪贴板:{error}",
"demoCodeViewerCopiedToClipboardMessage": "已复制到剪贴板。",
"craneSleep8SemanticLabel": "坐落于海滩上方一处悬崖上的玛雅遗址",
"craneSleep4SemanticLabel": "坐落在山前的湖畔酒店",
"craneSleep2SemanticLabel": "马丘比丘古城",
"craneSleep1SemanticLabel": "旁有常青树的雪中小屋",
"craneSleep0SemanticLabel": "水上小屋",
"craneFly13SemanticLabel": "旁有棕榈树的海滨泳池",
"craneFly12SemanticLabel": "旁有棕榈树的泳池",
"craneFly11SemanticLabel": "海上的砖砌灯塔",
"craneFly10SemanticLabel": "日落时分的爱资哈尔清真寺塔楼",
"craneFly9SemanticLabel": "倚靠在一辆蓝色古董车上的男子",
"craneFly8SemanticLabel": "巨树丛林",
"craneEat9SemanticLabel": "摆有甜点的咖啡厅柜台",
"craneEat2SemanticLabel": "汉堡包",
"craneFly5SemanticLabel": "坐落在山前的湖畔酒店",
"demoSelectionControlsSubtitle": "复选框、单选按钮和开关",
"craneEat10SemanticLabel": "拿着超大熏牛肉三明治的女子",
"craneFly4SemanticLabel": "水上小屋",
"craneEat7SemanticLabel": "面包店门口",
"craneEat6SemanticLabel": "虾料理",
"craneEat5SemanticLabel": "充满艺术气息的餐厅座位区",
"craneEat4SemanticLabel": "巧克力甜点",
"craneEat3SemanticLabel": "韩式玉米卷饼",
"craneFly3SemanticLabel": "马丘比丘古城",
"craneEat1SemanticLabel": "摆着就餐用高脚椅的空荡荡的酒吧",
"craneEat0SemanticLabel": "燃木烤箱中的披萨",
"craneSleep11SemanticLabel": "台北 101 摩天大楼",
"craneSleep10SemanticLabel": "日落时分的爱资哈尔清真寺塔楼",
"craneSleep9SemanticLabel": "海上的砖砌灯塔",
"craneEat8SemanticLabel": "一盘小龙虾",
"craneSleep7SemanticLabel": "里贝拉广场中五颜六色的公寓",
"craneSleep6SemanticLabel": "旁有棕榈树的泳池",
"craneSleep5SemanticLabel": "野外的帐篷",
"settingsButtonCloseLabel": "关闭设置",
"demoSelectionControlsCheckboxDescription": "复选框可让用户从一系列选项中选择多个选项。常规复选框的值为 true 或 false,三态复选框的值还可为 null。",
"settingsButtonLabel": "设置",
"demoListsTitle": "列表",
"demoListsSubtitle": "可滚动列表布局",
"demoListsDescription": "单个固定高度的行通常包含一些文本以及行首或行尾的图标。",
"demoOneLineListsTitle": "一行",
"demoTwoLineListsTitle": "两行",
"demoListsSecondary": "第二行文本",
"demoSelectionControlsTitle": "选择控件",
"craneFly7SemanticLabel": "拉什莫尔山",
"demoSelectionControlsCheckboxTitle": "复选框",
"craneSleep3SemanticLabel": "倚靠在一辆蓝色古董车上的男子",
"demoSelectionControlsRadioTitle": "单选",
"demoSelectionControlsRadioDescription": "单选按钮可让用户从一系列选项中选择一个选项。设置排斥性选择时,如果您觉得用户需要并排看到所有可用选项,可以使用单选按钮。",
"demoSelectionControlsSwitchTitle": "开关",
"demoSelectionControlsSwitchDescription": "开关用于切换单个设置选项的状态。开关所控制的选项和选项所处的状态应通过相应的内嵌标签明示。",
"craneFly0SemanticLabel": "旁有常青树的雪中小屋",
"craneFly1SemanticLabel": "野外的帐篷",
"craneFly2SemanticLabel": "雪山前的经幡",
"craneFly6SemanticLabel": "墨西哥城艺术宫的鸟瞰图",
"rallySeeAllAccounts": "查看所有账户",
"rallyBillAmount": "{billName}帐单的付款日期为 {date},应付金额为 {amount}。",
"shrineTooltipCloseCart": "关闭购物车",
"shrineTooltipCloseMenu": "关闭菜单",
"shrineTooltipOpenMenu": "打开菜单",
"shrineTooltipSettings": "设置",
"shrineTooltipSearch": "搜索",
"demoTabsDescription": "标签页用于整理各个屏幕、数据集和其他互动中的内容。",
"demoTabsSubtitle": "包含可单独滚动的视图的标签页",
"demoTabsTitle": "标签页",
"rallyBudgetAmount": "{budgetName}预算的总金额为 {amountTotal},已用 {amountUsed},剩余 {amountLeft}",
"shrineTooltipRemoveItem": "移除商品",
"rallyAccountAmount": "账号为 {accountNumber} 的{accountName}账户中的存款金额为 {amount}。",
"rallySeeAllBudgets": "查看所有预算",
"rallySeeAllBills": "查看所有帐单",
"craneFormDate": "选择日期",
"craneFormOrigin": "选择出发地",
"craneFly2": "尼泊尔坤布谷",
"craneFly3": "秘鲁马丘比丘",
"craneFly4": "马尔代夫马累",
"craneFly5": "瑞士维兹诺",
"craneFly6": "墨西哥的墨西哥城",
"craneFly7": "美国拉什莫尔山",
"settingsTextDirectionLocaleBased": "根据语言区域",
"craneFly9": "古巴哈瓦那",
"craneFly10": "埃及开罗",
"craneFly11": "葡萄牙里斯本",
"craneFly12": "美国纳帕",
"craneFly13": "印度尼西亚巴厘岛",
"craneSleep0": "马尔代夫马累",
"craneSleep1": "美国阿斯彭",
"craneSleep2": "秘鲁马丘比丘",
"demoCupertinoSegmentedControlTitle": "分段控件",
"craneSleep4": "瑞士维兹诺",
"craneSleep5": "美国大苏尔",
"craneSleep6": "美国纳帕",
"craneSleep7": "葡萄牙波尔图",
"craneSleep8": "墨西哥图伦",
"craneEat5": "韩国首尔",
"demoChipTitle": "信息块",
"demoChipSubtitle": "代表输入、属性或操作的精简元素",
"demoActionChipTitle": "操作信息块",
"demoActionChipDescription": "操作信息块是一组选项,可触发与主要内容相关的操作。操作信息块应以动态和与上下文相关的形式显示在界面中。",
"demoChoiceChipTitle": "选择信息块",
"demoChoiceChipDescription": "选择信息块代表一组选择中的一项。选择信息块包含相关的说明性文字或类别。",
"demoFilterChipTitle": "过滤条件信息块",
"demoFilterChipDescription": "过滤条件信息块使用标签或说明性字词来过滤内容。",
"demoInputChipTitle": "输入信息块",
"demoInputChipDescription": "输入信息块以精简的形式显示一段复杂的信息,例如实体(人物、地点或内容)或对话文字。",
"craneSleep9": "葡萄牙里斯本",
"craneEat10": "葡萄牙里斯本",
"demoCupertinoSegmentedControlDescription": "用于在多个互斥的选项之间做选择。分段控件中的任一选项被选中后,该控件中的其余选项便无法被选中。",
"chipTurnOnLights": "开灯",
"chipSmall": "小",
"chipMedium": "中",
"chipLarge": "大",
"chipElevator": "电梯",
"chipWasher": "洗衣机",
"chipFireplace": "壁炉",
"chipBiking": "骑车",
"craneFormDiners": "小饭馆",
"rallyAlertsMessageUnassignedTransactions": "{count,plural,=1{提高您可能获享的减免税额!为 1 笔未指定类别的交易指定类别。}other{提高您可能获享的减免税额!为 {count} 笔未指定类别的交易指定类别。}}",
"craneFormTime": "选择时间",
"craneFormLocation": "选择位置",
"craneFormTravelers": "旅行者人数",
"craneEat8": "美国亚特兰大",
"craneFormDestination": "选择目的地",
"craneFormDates": "选择日期",
"craneFly": "航班",
"craneSleep": "睡眠",
"craneEat": "用餐",
"craneFlySubhead": "按目的地浏览航班",
"craneSleepSubhead": "按目的地浏览住宿地",
"craneEatSubhead": "按目的地浏览餐厅",
"craneFlyStops": "{numberOfStops,plural,=0{直达}=1{经停 1 次}other{经停 {numberOfStops} 次}}",
"craneSleepProperties": "{totalProperties,plural,=0{无可租赁的房屋}=1{1 处可租赁的房屋}other{{totalProperties} 处可租赁的房屋}}",
"craneEatRestaurants": "{totalRestaurants,plural,=0{无餐厅}=1{1 家餐厅}other{{totalRestaurants} 家餐厅}}",
"craneFly0": "美国阿斯彭",
"demoCupertinoSegmentedControlSubtitle": "iOS 样式的分段控件",
"craneSleep10": "埃及开罗",
"craneEat9": "西班牙马德里",
"craneFly1": "美国大苏尔",
"craneEat7": "美国纳什维尔",
"craneEat6": "美国西雅图",
"craneFly8": "新加坡",
"craneEat4": "法国巴黎",
"craneEat3": "美国波特兰",
"craneEat2": "阿根廷科尔多瓦",
"craneEat1": "美国达拉斯",
"craneEat0": "意大利那不勒斯",
"craneSleep11": "台湾台北",
"craneSleep3": "古巴哈瓦那",
"shrineLogoutButtonCaption": "退出",
"rallyTitleBills": "帐单",
"rallyTitleAccounts": "帐号",
"shrineProductVagabondSack": "流浪包",
"rallyAccountDetailDataInterestYtd": "年初至今的利息",
"shrineProductWhitneyBelt": "Whitney 皮带",
"shrineProductGardenStrand": "花园项链",
"shrineProductStrutEarrings": "Strut 耳环",
"shrineProductVarsitySocks": "大学代表队袜子",
"shrineProductWeaveKeyring": "编织钥匙扣",
"shrineProductGatsbyHat": "盖茨比帽",
"shrineProductShrugBag": "单肩包",
"shrineProductGiltDeskTrio": "镀金桌上三件套",
"shrineProductCopperWireRack": "铜线支架",
"shrineProductSootheCeramicSet": "典雅的陶瓷套装",
"shrineProductHurrahsTeaSet": "Hurrahs 茶具",
"shrineProductBlueStoneMug": "蓝石杯子",
"shrineProductRainwaterTray": "雨水排水沟",
"shrineProductChambrayNapkins": "青年布餐巾",
"shrineProductSucculentPlanters": "多肉植物花盆",
"shrineProductQuartetTable": "四方桌",
"shrineProductKitchenQuattro": "厨房工具四件套",
"shrineProductClaySweater": "粘土色毛线衣",
"shrineProductSeaTunic": "海蓝色束腰外衣",
"shrineProductPlasterTunic": "石膏色束腰外衣",
"rallyBudgetCategoryRestaurants": "餐馆",
"shrineProductChambrayShirt": "青年布衬衫",
"shrineProductSeabreezeSweater": "海风毛线衣",
"shrineProductGentryJacket": "绅士夹克",
"shrineProductNavyTrousers": "海军蓝裤子",
"shrineProductWalterHenleyWhite": "Walter henley(白色)",
"shrineProductSurfAndPerfShirt": "冲浪衬衫",
"shrineProductGingerScarf": "姜黄色围巾",
"shrineProductRamonaCrossover": "Ramona 混搭",
"shrineProductClassicWhiteCollar": "经典白色衣领",
"shrineProductSunshirtDress": "防晒衣",
"rallyAccountDetailDataInterestRate": "利率",
"rallyAccountDetailDataAnnualPercentageYield": "年收益率",
"rallyAccountDataVacation": "度假",
"shrineProductFineLinesTee": "细条纹 T 恤衫",
"rallyAccountDataHomeSavings": "家庭储蓄",
"rallyAccountDataChecking": "支票帐号",
"rallyAccountDetailDataInterestPaidLastYear": "去年支付的利息",
"rallyAccountDetailDataNextStatement": "下一个对帐单",
"rallyAccountDetailDataAccountOwner": "帐号所有者",
"rallyBudgetCategoryCoffeeShops": "咖啡店",
"rallyBudgetCategoryGroceries": "杂货",
"shrineProductCeriseScallopTee": "樱桃色扇贝 T 恤衫",
"rallyBudgetCategoryClothing": "服饰",
"rallySettingsManageAccounts": "管理帐号",
"rallyAccountDataCarSavings": "购车储蓄",
"rallySettingsTaxDocuments": "税费文件",
"rallySettingsPasscodeAndTouchId": "密码和触控 ID",
"rallySettingsNotifications": "通知",
"rallySettingsPersonalInformation": "个人信息",
"rallySettingsPaperlessSettings": "无纸化设置",
"rallySettingsFindAtms": "查找 ATM",
"rallySettingsHelp": "帮助",
"rallySettingsSignOut": "退出",
"rallyAccountTotal": "总计",
"rallyBillsDue": "应付",
"rallyBudgetLeft": "剩余",
"rallyAccounts": "帐号",
"rallyBills": "帐单",
"rallyBudgets": "预算",
"rallyAlerts": "提醒",
"rallySeeAll": "查看全部",
"rallyFinanceLeft": "剩余",
"rallyTitleOverview": "概览",
"shrineProductShoulderRollsTee": "绕肩 T 恤衫",
"shrineNextButtonCaption": "下一步",
"rallyTitleBudgets": "预算",
"rallyTitleSettings": "设置",
"rallyLoginLoginToRally": "登录 Rally",
"rallyLoginNoAccount": "还没有帐号?",
"rallyLoginSignUp": "注册",
"rallyLoginUsername": "用户名",
"rallyLoginPassword": "密码",
"rallyLoginLabelLogin": "登录",
"rallyLoginRememberMe": "记住我的登录信息",
"rallyLoginButtonLogin": "登录",
"rallyAlertsMessageHeadsUpShopping": "注意,您已用完本月购物预算的 {percent}。",
"rallyAlertsMessageSpentOnRestaurants": "本周您已在餐馆花费 {amount}。",
"rallyAlertsMessageATMFees": "本月您已支付 {amount}的 ATM 取款手续费",
"rallyAlertsMessageCheckingAccount": "做得好!您的支票帐号余额比上个月多 {percent}。",
"shrineMenuCaption": "菜单",
"shrineCategoryNameAll": "全部",
"shrineCategoryNameAccessories": "配件",
"shrineCategoryNameClothing": "服饰",
"shrineCategoryNameHome": "家用",
"shrineLoginUsernameLabel": "用户名",
"shrineLoginPasswordLabel": "密码",
"shrineCancelButtonCaption": "取消",
"shrineCartTaxCaption": "税费:",
"shrineCartPageCaption": "购物车",
"shrineProductQuantity": "数量:{quantity}",
"shrineProductPrice": "x {price}",
"shrineCartItemCount": "{quantity,plural,=0{无商品}=1{1 件商品}other{{quantity} 件商品}}",
"shrineCartClearButtonCaption": "清空购物车",
"shrineCartTotalCaption": "总计",
"shrineCartSubtotalCaption": "小计:",
"shrineCartShippingCaption": "运费:",
"shrineProductGreySlouchTank": "灰色水槽",
"shrineProductStellaSunglasses": "Stella 太阳镜",
"shrineProductWhitePinstripeShirt": "白色细条纹衬衫",
"demoTextFieldWhereCanWeReachYou": "我们如何与您联系?",
"settingsTextDirectionLTR": "从左到右",
"settingsTextScalingLarge": "大",
"demoBottomSheetHeader": "页眉",
"demoBottomSheetItem": "项 {value}",
"demoBottomTextFieldsTitle": "文本字段",
"demoTextFieldTitle": "文本字段",
"demoTextFieldSubtitle": "单行可修改的文字和数字",
"demoTextFieldDescription": "文本字段可让用户在界面中输入文本。这些字段通常出现在表单和对话框中。",
"demoTextFieldShowPasswordLabel": "显示密码",
"demoTextFieldHidePasswordLabel": "隐藏密码",
"demoTextFieldFormErrors": "请先修正红色错误,然后再提交。",
"demoTextFieldNameRequired": "必须填写姓名。",
"demoTextFieldOnlyAlphabeticalChars": "请只输入字母字符。",
"demoTextFieldEnterUSPhoneNumber": "(###) ###-#### - 请输入美国手机号码。",
"demoTextFieldEnterPassword": "请输入密码。",
"demoTextFieldPasswordsDoNotMatch": "密码不一致",
"demoTextFieldWhatDoPeopleCallYou": "人们如何称呼您?",
"demoTextFieldNameField": "姓名*",
"demoBottomSheetButtonText": "显示底部工作表",
"demoTextFieldPhoneNumber": "手机号码*",
"demoBottomSheetTitle": "底部工作表",
"demoTextFieldEmail": "电子邮件",
"demoTextFieldTellUsAboutYourself": "请介绍一下您自己(例如,写出您的职业或爱好)",
"demoTextFieldKeepItShort": "请确保内容简洁,因为这只是一个演示。",
"starterAppGenericButton": "按钮",
"demoTextFieldLifeStory": "生平事迹",
"demoTextFieldSalary": "工资",
"demoTextFieldUSD": "美元",
"demoTextFieldNoMoreThan": "请勿超过 8 个字符。",
"demoTextFieldPassword": "密码*",
"demoTextFieldRetypePassword": "再次输入密码*",
"demoTextFieldSubmit": "提交",
"demoBottomNavigationSubtitle": "采用交替淡变视图的底部导航栏",
"demoBottomSheetAddLabel": "添加",
"demoBottomSheetModalDescription": "模态底部工作表可替代菜单或对话框,并且会阻止用户与应用的其余部分互动。",
"demoBottomSheetModalTitle": "模态底部工作表",
"demoBottomSheetPersistentDescription": "常驻底部工作表会显示应用主要内容的补充信息。即使在用户与应用的其他部分互动时,常驻底部工作表也会一直显示。",
"demoBottomSheetPersistentTitle": "常驻底部工作表",
"demoBottomSheetSubtitle": "常驻底部工作表和模态底部工作表",
"demoTextFieldNameHasPhoneNumber": "{name}的手机号码是 {phoneNumber}",
"buttonText": "按钮",
"demoTypographyDescription": "Material Design 中各种字体排版样式的定义。",
"demoTypographySubtitle": "所有预定义文本样式",
"demoTypographyTitle": "字体排版",
"demoFullscreenDialogDescription": "您可以利用 fullscreenDialog 属性指定接下来显示的页面是否为全屏模态对话框",
"demoFlatButtonDescription": "平面按钮,按下后会出现墨水飞溅效果,但按钮本身没有升起效果。这类按钮适用于工具栏、对话框和设有内边距的内嵌元素",
"demoBottomNavigationDescription": "底部导航栏会在屏幕底部显示三到五个目标位置。各个目标位置会显示为图标和文本标签(文本标签选择性显示)。用户点按底部导航栏中的图标后,系统会将用户转至与该图标关联的顶级导航目标位置。",
"demoBottomNavigationSelectedLabel": "已选择标签",
"demoBottomNavigationPersistentLabels": "常驻标签页",
"starterAppDrawerItem": "项 {value}",
"demoTextFieldRequiredField": "* 表示必填字段",
"demoBottomNavigationTitle": "底部导航栏",
"settingsLightTheme": "浅色",
"settingsTheme": "主题背景",
"settingsPlatformIOS": "iOS",
"settingsPlatformAndroid": "Android",
"settingsTextDirectionRTL": "从右到左",
"settingsTextScalingHuge": "超大",
"cupertinoButton": "按钮",
"settingsTextScalingNormal": "正常",
"settingsTextScalingSmall": "小",
"settingsSystemDefault": "系统",
"settingsTitle": "设置",
"rallyDescription": "个人理财应用",
"aboutDialogDescription": "要查看此应用的源代码,请访问 {repoLink}。",
"bottomNavigationCommentsTab": "注释",
"starterAppGenericBody": "正文",
"starterAppGenericHeadline": "标题",
"starterAppGenericSubtitle": "副标题",
"starterAppGenericTitle": "标题",
"starterAppTooltipSearch": "搜索",
"starterAppTooltipShare": "分享",
"starterAppTooltipFavorite": "收藏",
"starterAppTooltipAdd": "添加",
"bottomNavigationCalendarTab": "日历",
"starterAppDescription": "自适应入门布局",
"starterAppTitle": "入门应用",
"aboutFlutterSamplesRepo": "Flutter 示例 GitHub 代码库",
"bottomNavigationContentPlaceholder": "“{title}”标签页的占位符",
"bottomNavigationCameraTab": "相机",
"bottomNavigationAlarmTab": "闹钟",
"bottomNavigationAccountTab": "帐号",
"demoTextFieldYourEmailAddress": "您的电子邮件地址",
"demoToggleButtonDescription": "切换按钮可用于对相关选项进行分组。为了凸显相关切换按钮的群组,一个群组应该共用一个常用容器",
"colorsGrey": "灰色",
"colorsBrown": "棕色",
"colorsDeepOrange": "深橙色",
"colorsOrange": "橙色",
"colorsAmber": "琥珀色",
"colorsYellow": "黄色",
"colorsLime": "绿黄色",
"colorsLightGreen": "浅绿色",
"colorsGreen": "绿色",
"homeHeaderGallery": "图库",
"homeHeaderCategories": "类别",
"shrineDescription": "时尚的零售应用",
"craneDescription": "个性化旅行应用",
"homeCategoryReference": "样式演示和其他演示",
"demoInvalidURL": "无法显示网址。",
"demoOptionsTooltip": "选项",
"demoInfoTooltip": "信息",
"demoCodeTooltip": "演示代码",
"demoDocumentationTooltip": "API 文档",
"demoFullscreenTooltip": "全屏",
"settingsTextScaling": "文字缩放",
"settingsTextDirection": "文本方向",
"settingsLocale": "语言区域",
"settingsPlatformMechanics": "平台力学",
"settingsDarkTheme": "深色",
"settingsSlowMotion": "慢镜头",
"settingsAbout": "关于 Flutter Gallery",
"settingsFeedback": "发送反馈",
"settingsAttribution": "由伦敦的 TOASTER 设计",
"demoButtonTitle": "按钮",
"demoButtonSubtitle": "文本按钮、凸起按钮、轮廓按钮等",
"demoFlatButtonTitle": "平面按钮",
"demoRaisedButtonDescription": "凸起按钮能为以平面内容为主的布局增添立体感。此类按钮可突出强调位于拥挤或宽阔空间中的功能。",
"demoRaisedButtonTitle": "凸起按钮",
"demoOutlineButtonTitle": "轮廓按钮",
"demoOutlineButtonDescription": "轮廓按钮会在用户按下后变为不透明并升起。这类按钮通常会与凸起按钮配对使用,用于指示其他的次要操作。",
"demoToggleButtonTitle": "切换按钮",
"colorsTeal": "蓝绿色",
"demoFloatingButtonTitle": "悬浮操作按钮",
"demoFloatingButtonDescription": "悬浮操作按钮是一种圆形图标按钮,它会悬停在内容上,可用来在应用中执行一项主要操作。",
"demoDialogTitle": "对话框",
"demoDialogSubtitle": "简易、提醒和全屏",
"demoAlertDialogTitle": "提醒",
"demoAlertDialogDescription": "提醒对话框会通知用户需要知悉的情况。您可以选择性地为提醒对话框提供标题和操作列表。",
"demoAlertTitleDialogTitle": "带有标题的提醒",
"demoSimpleDialogTitle": "简洁",
"demoSimpleDialogDescription": "简易对话框可以让用户在多个选项之间做选择。您可以选择性地为简易对话框提供标题(标题会显示在选项上方)。",
"demoFullscreenDialogTitle": "全屏",
"demoCupertinoButtonsTitle": "按钮",
"demoCupertinoButtonsSubtitle": "iOS 样式的按钮",
"demoCupertinoButtonsDescription": "iOS 样式的按钮,这类按钮所采用的文本和/或图标会在用户轻触按钮时淡出和淡入,并可选择性地加入背景。",
"demoCupertinoAlertsTitle": "提醒",
"demoCupertinoAlertsSubtitle": "iOS 样式的提醒对话框",
"demoCupertinoAlertTitle": "提醒",
"demoCupertinoAlertDescription": "提醒对话框会通知用户需要知悉的情况。您可以选择性地为提醒对话框提供标题、内容和操作列表。标题会显示在内容上方,操作则会显示在内容下方。",
"demoCupertinoAlertWithTitleTitle": "带有标题的提醒",
"demoCupertinoAlertButtonsTitle": "带有按钮的提醒",
"demoCupertinoAlertButtonsOnlyTitle": "仅限提醒按钮",
"demoCupertinoActionSheetTitle": "操作表",
"demoCupertinoActionSheetDescription": "操作表是一种特定样式的提醒,它会根据目前的使用情况向用户显示一组选项(最少两个选项)。操作表可有标题、附加消息和操作列表。",
"demoColorsTitle": "颜色",
"demoColorsSubtitle": "所有预定义的颜色",
"demoColorsDescription": "代表 Material Design 调色板的颜色和色样常量。",
"buttonTextEnabled": "ENABLED",
"buttonTextDisabled": "DISABLED",
"buttonTextCreate": "创建",
"dialogSelectedOption": "您已选择:“{value}”",
"dialogDiscardTitle": "要舍弃草稿吗?",
"dialogLocationTitle": "要使用 Google 的位置信息服务吗?",
"dialogLocationDescription": "让 Google 协助应用判断位置,即代表系统会将匿名的位置数据发送给 Google(即使设备并没有运行任何应用)。",
"dialogCancel": "取消",
"dialogDiscard": "舍弃",
"dialogDisagree": "不同意",
"dialogAgree": "同意",
"dialogSetBackup": "设置备份帐号",
"colorsBlueGrey": "蓝灰色",
"dialogShow": "显示对话框",
"dialogFullscreenTitle": "全屏对话框",
"dialogFullscreenSave": "保存",
"dialogFullscreenDescription": "全屏对话框演示",
"cupertinoButtonEnabled": "Enabled",
"cupertinoButtonDisabled": "Disabled",
"cupertinoButtonWithBackground": "设有背景",
"cupertinoAlertCancel": "取消",
"cupertinoAlertDiscard": "舍弃",
"cupertinoAlertLocationTitle": "是否允许“Google 地图”在您使用该应用时获取您的位置信息?",
"cupertinoAlertLocationDescription": "您当前所在的位置将显示在地图上,并用于提供路线、附近位置的搜索结果和预计的行程时间。",
"cupertinoAlertAllow": "允许",
"cupertinoAlertDontAllow": "不允许",
"cupertinoAlertFavoriteDessert": "选择最喜爱的甜点",
"cupertinoAlertDessertDescription": "请从下面的列表中选择您最喜爱的甜点类型。系统将根据您的选择自定义您所在地区的推荐餐厅列表。",
"cupertinoAlertCheesecake": "奶酪蛋糕",
"cupertinoAlertTiramisu": "提拉米苏",
"cupertinoAlertApplePie": "苹果派",
"cupertinoAlertChocolateBrownie": "巧克力布朗尼",
"cupertinoShowAlert": "显示提醒",
"colorsRed": "红色",
"colorsPink": "粉红色",
"colorsPurple": "紫色",
"colorsDeepPurple": "深紫色",
"colorsIndigo": "靛青色",
"colorsBlue": "蓝色",
"colorsLightBlue": "浅蓝色",
"colorsCyan": "青色",
"dialogAddAccount": "添加帐号",
"Gallery": "图库",
"Categories": "类别",
"SHRINE": "神社",
"Basic shopping app": "基本购物应用",
"RALLY": "集会",
"CRANE": "鹤",
"Travel app": "旅行应用",
"MATERIAL": "质感",
"CUPERTINO": "库比蒂诺",
"REFERENCE STYLES & MEDIA": "参考资料样式和媒体"
}
| gallery/lib/l10n/intl_zh.arb/0 | {
"file_path": "gallery/lib/l10n/intl_zh.arb",
"repo_id": "gallery",
"token_count": 25854
} | 809 |
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:collection';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart';
import 'package:flutter_localized_locales/flutter_localized_locales.dart';
import 'package:gallery/constants.dart';
import 'package:gallery/data/gallery_options.dart';
import 'package:gallery/layout/adaptive.dart';
import 'package:gallery/pages/about.dart' as about;
import 'package:gallery/pages/home.dart';
import 'package:gallery/pages/settings_list_item.dart';
import 'package:url_launcher/url_launcher.dart';
enum _ExpandableSetting {
textScale,
textDirection,
locale,
platform,
theme,
}
class SettingsPage extends StatefulWidget {
const SettingsPage({
super.key,
required this.animationController,
});
final AnimationController animationController;
@override
State<SettingsPage> createState() => _SettingsPageState();
}
class _SettingsPageState extends State<SettingsPage> {
_ExpandableSetting? _expandedSettingId;
late Animation<double> _staggerSettingsItemsAnimation;
void onTapSetting(_ExpandableSetting settingId) {
setState(() {
if (_expandedSettingId == settingId) {
_expandedSettingId = null;
} else {
_expandedSettingId = settingId;
}
});
}
void _closeSettingId(AnimationStatus status) {
if (status == AnimationStatus.dismissed) {
setState(() {
_expandedSettingId = null;
});
}
}
@override
void initState() {
super.initState();
// When closing settings, also shrink expanded setting.
widget.animationController.addStatusListener(_closeSettingId);
_staggerSettingsItemsAnimation = CurvedAnimation(
parent: widget.animationController,
curve: const Interval(
0.4,
1.0,
curve: Curves.ease,
),
);
}
@override
void dispose() {
super.dispose();
widget.animationController.removeStatusListener(_closeSettingId);
}
/// Given a [Locale], returns a [DisplayOption] with its native name for a
/// title and its name in the currently selected locale for a subtitle. If the
/// native name can't be determined, it is omitted. If the locale can't be
/// determined, the locale code is used.
DisplayOption _getLocaleDisplayOption(BuildContext context, Locale? locale) {
final localeCode = locale.toString();
final localeName = LocaleNames.of(context)!.nameOf(localeCode);
if (localeName != null) {
final localeNativeName =
LocaleNamesLocalizationsDelegate.nativeLocaleNames[localeCode];
return localeNativeName != null
? DisplayOption(localeNativeName, subtitle: localeName)
: DisplayOption(localeName);
} else {
// gsw, fil, and es_419 aren't in flutter_localized_countries' dataset
// so we handle them separately
switch (localeCode) {
case 'gsw':
return DisplayOption('Schwiizertüütsch', subtitle: 'Swiss German');
case 'fil':
return DisplayOption('Filipino', subtitle: 'Filipino');
case 'es_419':
return DisplayOption(
'español (Latinoamérica)',
subtitle: 'Spanish (Latin America)',
);
}
}
return DisplayOption(localeCode);
}
/// Create a sorted — by native name – map of supported locales to their
/// intended display string, with a system option as the first element.
LinkedHashMap<Locale, DisplayOption> _getLocaleOptions() {
var localeOptions = LinkedHashMap.of({
systemLocaleOption: DisplayOption(
GalleryLocalizations.of(context)!.settingsSystemDefault +
(deviceLocale != null
? ' - ${_getLocaleDisplayOption(context, deviceLocale).title}'
: ''),
),
});
var supportedLocales =
List<Locale>.from(GalleryLocalizations.supportedLocales);
supportedLocales.removeWhere((locale) => locale == deviceLocale);
final displayLocales = Map<Locale, DisplayOption>.fromIterable(
supportedLocales,
value: (dynamic locale) =>
_getLocaleDisplayOption(context, locale as Locale?),
).entries.toList()
..sort((l1, l2) => compareAsciiUpperCase(l1.value.title, l2.value.title));
localeOptions.addAll(LinkedHashMap.fromEntries(displayLocales));
return localeOptions;
}
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
final options = GalleryOptions.of(context);
final isDesktop = isDisplayDesktop(context);
final localizations = GalleryLocalizations.of(context)!;
final settingsListItems = [
SettingsListItem<double?>(
title: localizations.settingsTextScaling,
selectedOption: options.textScaleFactor(
context,
useSentinel: true,
),
optionsMap: LinkedHashMap.of({
systemTextScaleFactorOption: DisplayOption(
localizations.settingsSystemDefault,
),
0.8: DisplayOption(
localizations.settingsTextScalingSmall,
),
1.0: DisplayOption(
localizations.settingsTextScalingNormal,
),
2.0: DisplayOption(
localizations.settingsTextScalingLarge,
),
3.0: DisplayOption(
localizations.settingsTextScalingHuge,
),
}),
onOptionChanged: (newTextScale) => GalleryOptions.update(
context,
options.copyWith(textScaleFactor: newTextScale),
),
onTapSetting: () => onTapSetting(_ExpandableSetting.textScale),
isExpanded: _expandedSettingId == _ExpandableSetting.textScale,
),
SettingsListItem<CustomTextDirection?>(
title: localizations.settingsTextDirection,
selectedOption: options.customTextDirection,
optionsMap: LinkedHashMap.of({
CustomTextDirection.localeBased: DisplayOption(
localizations.settingsTextDirectionLocaleBased,
),
CustomTextDirection.ltr: DisplayOption(
localizations.settingsTextDirectionLTR,
),
CustomTextDirection.rtl: DisplayOption(
localizations.settingsTextDirectionRTL,
),
}),
onOptionChanged: (newTextDirection) => GalleryOptions.update(
context,
options.copyWith(customTextDirection: newTextDirection),
),
onTapSetting: () => onTapSetting(_ExpandableSetting.textDirection),
isExpanded: _expandedSettingId == _ExpandableSetting.textDirection,
),
SettingsListItem<Locale?>(
title: localizations.settingsLocale,
selectedOption: options.locale == deviceLocale
? systemLocaleOption
: options.locale,
optionsMap: _getLocaleOptions(),
onOptionChanged: (newLocale) {
if (newLocale == systemLocaleOption) {
newLocale = deviceLocale;
}
GalleryOptions.update(
context,
options.copyWith(locale: newLocale),
);
},
onTapSetting: () => onTapSetting(_ExpandableSetting.locale),
isExpanded: _expandedSettingId == _ExpandableSetting.locale,
),
SettingsListItem<TargetPlatform?>(
title: localizations.settingsPlatformMechanics,
selectedOption: options.platform,
optionsMap: LinkedHashMap.of({
TargetPlatform.android: DisplayOption('Android'),
TargetPlatform.iOS: DisplayOption('iOS'),
TargetPlatform.macOS: DisplayOption('macOS'),
TargetPlatform.linux: DisplayOption('Linux'),
TargetPlatform.windows: DisplayOption('Windows'),
}),
onOptionChanged: (newPlatform) => GalleryOptions.update(
context,
options.copyWith(platform: newPlatform),
),
onTapSetting: () => onTapSetting(_ExpandableSetting.platform),
isExpanded: _expandedSettingId == _ExpandableSetting.platform,
),
SettingsListItem<ThemeMode?>(
title: localizations.settingsTheme,
selectedOption: options.themeMode,
optionsMap: LinkedHashMap.of({
ThemeMode.system: DisplayOption(
localizations.settingsSystemDefault,
),
ThemeMode.dark: DisplayOption(
localizations.settingsDarkTheme,
),
ThemeMode.light: DisplayOption(
localizations.settingsLightTheme,
),
}),
onOptionChanged: (newThemeMode) => GalleryOptions.update(
context,
options.copyWith(themeMode: newThemeMode),
),
onTapSetting: () => onTapSetting(_ExpandableSetting.theme),
isExpanded: _expandedSettingId == _ExpandableSetting.theme,
),
ToggleSetting(
text: GalleryLocalizations.of(context)!.settingsSlowMotion,
value: options.timeDilation != 1.0,
onChanged: (isOn) => GalleryOptions.update(
context,
options.copyWith(timeDilation: isOn ? 5.0 : 1.0),
),
),
];
return Material(
color: colorScheme.secondaryContainer,
child: Padding(
padding: isDesktop
? EdgeInsets.zero
: const EdgeInsets.only(
bottom: galleryHeaderHeight,
),
// Remove ListView top padding as it is already accounted for.
child: MediaQuery.removePadding(
removeTop: isDesktop,
context: context,
child: ListView(
children: [
if (isDesktop)
const SizedBox(height: firstHeaderDesktopTopPadding),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: ExcludeSemantics(
child: Header(
color: Theme.of(context).colorScheme.onSurface,
text: localizations.settingsTitle,
),
),
),
if (isDesktop)
...settingsListItems
else ...[
_AnimateSettingsListItems(
animation: _staggerSettingsItemsAnimation,
children: settingsListItems,
),
const SizedBox(height: 16),
Divider(thickness: 2, height: 0, color: colorScheme.outline),
const SizedBox(height: 12),
const SettingsAbout(),
const SettingsFeedback(),
const SizedBox(height: 12),
Divider(thickness: 2, height: 0, color: colorScheme.outline),
const SettingsAttribution(),
],
],
),
),
),
);
}
}
class SettingsAbout extends StatelessWidget {
const SettingsAbout({super.key});
@override
Widget build(BuildContext context) {
return _SettingsLink(
title: GalleryLocalizations.of(context)!.settingsAbout,
icon: Icons.info_outline,
onTap: () {
about.showAboutDialog(context: context);
},
);
}
}
class SettingsFeedback extends StatelessWidget {
const SettingsFeedback({super.key});
@override
Widget build(BuildContext context) {
return _SettingsLink(
title: GalleryLocalizations.of(context)!.settingsFeedback,
icon: Icons.feedback,
onTap: () async {
final url =
Uri.parse('https://github.com/flutter/gallery/issues/new/choose/');
if (await canLaunchUrl(url)) {
await launchUrl(url);
}
},
);
}
}
class SettingsAttribution extends StatelessWidget {
const SettingsAttribution({super.key});
@override
Widget build(BuildContext context) {
final isDesktop = isDisplayDesktop(context);
final verticalPadding = isDesktop ? 0.0 : 28.0;
return MergeSemantics(
child: Padding(
padding: EdgeInsetsDirectional.only(
start: isDesktop ? 24 : 32,
end: isDesktop ? 0 : 32,
top: verticalPadding,
bottom: verticalPadding,
),
child: SelectableText(
GalleryLocalizations.of(context)!.settingsAttribution,
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
fontSize: 12,
color: Theme.of(context).colorScheme.onSecondary,
),
textAlign: isDesktop ? TextAlign.end : TextAlign.start,
),
),
);
}
}
class _SettingsLink extends StatelessWidget {
final String title;
final IconData? icon;
final GestureTapCallback? onTap;
const _SettingsLink({
required this.title,
this.icon,
this.onTap,
});
@override
Widget build(BuildContext context) {
final textTheme = Theme.of(context).textTheme;
final colorScheme = Theme.of(context).colorScheme;
final isDesktop = isDisplayDesktop(context);
return InkWell(
onTap: onTap,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: isDesktop ? 24 : 32,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
icon,
color: colorScheme.onSecondary.withOpacity(0.5),
size: 24,
),
Flexible(
child: Padding(
padding: const EdgeInsetsDirectional.only(
start: 16,
top: 12,
bottom: 12,
),
child: Text(
title,
style: textTheme.titleSmall!.apply(
color: colorScheme.onSecondary,
),
textAlign: isDesktop ? TextAlign.end : TextAlign.start,
),
),
),
],
),
),
);
}
}
/// Animate the settings list items to stagger in from above.
class _AnimateSettingsListItems extends StatelessWidget {
const _AnimateSettingsListItems({
required this.animation,
required this.children,
});
final Animation<double> animation;
final List<Widget> children;
@override
Widget build(BuildContext context) {
const dividingPadding = 4.0;
final dividerTween = Tween<double>(
begin: 0,
end: dividingPadding,
);
return Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: Column(
children: [
for (Widget child in children)
AnimatedBuilder(
animation: animation,
builder: (context, child) {
return Padding(
padding: EdgeInsets.only(
top: dividerTween.animate(animation).value,
),
child: child,
);
},
child: child,
),
],
),
);
}
}
| gallery/lib/pages/settings.dart/0 | {
"file_path": "gallery/lib/pages/settings.dart",
"repo_id": "gallery",
"token_count": 6483
} | 810 |
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart';
import 'package:gallery/data/gallery_options.dart';
import 'package:gallery/studies/crane/model/formatters.dart';
abstract class Destination {
const Destination({
required this.id,
required this.destination,
required this.assetSemanticLabel,
required this.imageAspectRatio,
});
final int id;
final String destination;
final String assetSemanticLabel;
final double imageAspectRatio;
String get assetName;
String subtitle(BuildContext context);
String subtitleSemantics(BuildContext context) => subtitle(context);
@override
String toString() => '$destination (id=$id)';
}
class FlyDestination extends Destination {
const FlyDestination({
required super.id,
required super.destination,
required super.assetSemanticLabel,
required this.stops,
super.imageAspectRatio = 1,
this.duration,
});
final int stops;
final Duration? duration;
@override
String get assetName => 'crane/destinations/fly_$id.jpg';
@override
String subtitle(BuildContext context) {
final stopsText = GalleryLocalizations.of(context)!.craneFlyStops(stops);
if (duration == null) {
return stopsText;
} else {
final textDirection = GalleryOptions.of(context).resolvedTextDirection();
final durationText =
formattedDuration(context, duration!, abbreviated: true);
return textDirection == TextDirection.ltr
? '$stopsText · $durationText'
: '$durationText · $stopsText';
}
}
@override
String subtitleSemantics(BuildContext context) {
final stopsText = GalleryLocalizations.of(context)!.craneFlyStops(stops);
if (duration == null) {
return stopsText;
} else {
final durationText =
formattedDuration(context, duration!, abbreviated: false);
return '$stopsText, $durationText';
}
}
}
class SleepDestination extends Destination {
const SleepDestination({
required super.id,
required super.destination,
required super.assetSemanticLabel,
required this.total,
super.imageAspectRatio = 1,
});
final int total;
@override
String get assetName => 'crane/destinations/sleep_$id.jpg';
@override
String subtitle(BuildContext context) {
return GalleryLocalizations.of(context)!.craneSleepProperties(total);
}
}
class EatDestination extends Destination {
const EatDestination({
required super.id,
required super.destination,
required super.assetSemanticLabel,
required this.total,
super.imageAspectRatio = 1,
});
final int total;
@override
String get assetName => 'crane/destinations/eat_$id.jpg';
@override
String subtitle(BuildContext context) {
return GalleryLocalizations.of(context)!.craneEatRestaurants(total);
}
}
| gallery/lib/studies/crane/model/destination.dart/0 | {
"file_path": "gallery/lib/studies/crane/model/destination.dart",
"repo_id": "gallery",
"token_count": 1005
} | 811 |
import 'package:flutter/material.dart';
import 'package:gallery/layout/adaptive.dart';
import 'package:gallery/studies/reply/mail_card_preview.dart';
import 'package:gallery/studies/reply/model/email_model.dart';
import 'package:gallery/studies/reply/model/email_store.dart';
import 'package:provider/provider.dart';
class MailboxBody extends StatelessWidget {
const MailboxBody({super.key});
@override
Widget build(BuildContext context) {
final isDesktop = isDisplayDesktop(context);
final isTablet = isDisplaySmallDesktop(context);
final startPadding = isTablet
? 60.0
: isDesktop
? 120.0
: 4.0;
final endPadding = isTablet
? 30.0
: isDesktop
? 60.0
: 4.0;
return Consumer<EmailStore>(
builder: (context, model, child) {
final destination = model.selectedMailboxPage;
final destinationString = destination
.toString()
.substring(destination.toString().indexOf('.') + 1);
late List<Email> emails;
switch (destination) {
case MailboxPageType.inbox:
{
emails = model.inboxEmails;
break;
}
case MailboxPageType.sent:
{
emails = model.outboxEmails;
break;
}
case MailboxPageType.starred:
{
emails = model.starredEmails;
break;
}
case MailboxPageType.trash:
{
emails = model.trashEmails;
break;
}
case MailboxPageType.spam:
{
emails = model.spamEmails;
break;
}
case MailboxPageType.drafts:
{
emails = model.draftEmails;
break;
}
}
return SafeArea(
bottom: false,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: emails.isEmpty
? Center(child: Text('Empty in $destinationString'))
: ListView.separated(
itemCount: emails.length,
padding: EdgeInsetsDirectional.only(
start: startPadding,
end: endPadding,
top: isDesktop ? 28 : 0,
bottom: kToolbarHeight,
),
primary: false,
separatorBuilder: (context, index) =>
const SizedBox(height: 4),
itemBuilder: (context, index) {
var email = emails[index];
return MailPreviewCard(
id: email.id,
email: email,
isStarred: model.isEmailStarred(email.id),
onDelete: () => model.deleteEmail(email.id),
onStar: () {
int emailId = email.id;
if (model.isEmailStarred(emailId)) {
model.unstarEmail(emailId);
} else {
model.starEmail(emailId);
}
},
onStarredMailbox: model.selectedMailboxPage ==
MailboxPageType.starred,
);
},
),
),
if (isDesktop) ...[
Padding(
padding: const EdgeInsetsDirectional.only(top: 14),
child: Row(
children: [
IconButton(
key: const ValueKey('ReplySearch'),
icon: const Icon(Icons.search),
onPressed: () {
Provider.of<EmailStore>(
context,
listen: false,
).onSearchPage = true;
},
),
SizedBox(width: isTablet ? 30 : 60),
],
),
),
]
],
),
);
},
);
}
}
| gallery/lib/studies/reply/mailbox_body.dart/0 | {
"file_path": "gallery/lib/studies/reply/mailbox_body.dart",
"repo_id": "gallery",
"token_count": 2739
} | 812 |
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart';
import 'package:gallery/studies/shrine/model/product.dart';
class ProductsRepository {
static List<Product> loadProducts(Category category) {
final allProducts = [
Product(
category: categoryAccessories,
id: 0,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductVagabondSack,
price: 120,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryAccessories,
id: 1,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductStellaSunglasses,
price: 58,
assetAspectRatio: 329 / 247,
),
Product(
category: categoryAccessories,
id: 2,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductWhitneyBelt,
price: 35,
assetAspectRatio: 329 / 228,
),
Product(
category: categoryAccessories,
id: 3,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductGardenStrand,
price: 98,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryAccessories,
id: 4,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductStrutEarrings,
price: 34,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryAccessories,
id: 5,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductVarsitySocks,
price: 12,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryAccessories,
id: 6,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductWeaveKeyring,
price: 16,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryAccessories,
id: 7,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductGatsbyHat,
price: 40,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryAccessories,
id: 8,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductShrugBag,
price: 198,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryHome,
id: 9,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductGiltDeskTrio,
price: 58,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryHome,
id: 10,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductCopperWireRack,
price: 18,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryHome,
id: 11,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductSootheCeramicSet,
price: 28,
assetAspectRatio: 329 / 247,
),
Product(
category: categoryHome,
id: 12,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductHurrahsTeaSet,
price: 34,
assetAspectRatio: 329 / 213,
),
Product(
category: categoryHome,
id: 13,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductBlueStoneMug,
price: 18,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryHome,
id: 14,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductRainwaterTray,
price: 27,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryHome,
id: 15,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductChambrayNapkins,
price: 16,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryHome,
id: 16,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductSucculentPlanters,
price: 16,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryHome,
id: 17,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductQuartetTable,
price: 175,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryHome,
id: 18,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductKitchenQuattro,
price: 129,
assetAspectRatio: 329 / 246,
),
Product(
category: categoryClothing,
id: 19,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductClaySweater,
price: 48,
assetAspectRatio: 329 / 219,
),
Product(
category: categoryClothing,
id: 20,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductSeaTunic,
price: 45,
assetAspectRatio: 329 / 221,
),
Product(
category: categoryClothing,
id: 21,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductPlasterTunic,
price: 38,
assetAspectRatio: 220 / 329,
),
Product(
category: categoryClothing,
id: 22,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductWhitePinstripeShirt,
price: 70,
assetAspectRatio: 219 / 329,
),
Product(
category: categoryClothing,
id: 23,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductChambrayShirt,
price: 70,
assetAspectRatio: 329 / 221,
),
Product(
category: categoryClothing,
id: 24,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductSeabreezeSweater,
price: 60,
assetAspectRatio: 220 / 329,
),
Product(
category: categoryClothing,
id: 25,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductGentryJacket,
price: 178,
assetAspectRatio: 329 / 219,
),
Product(
category: categoryClothing,
id: 26,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductNavyTrousers,
price: 74,
assetAspectRatio: 220 / 329,
),
Product(
category: categoryClothing,
id: 27,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductWalterHenleyWhite,
price: 38,
assetAspectRatio: 219 / 329,
),
Product(
category: categoryClothing,
id: 28,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductSurfAndPerfShirt,
price: 48,
assetAspectRatio: 329 / 219,
),
Product(
category: categoryClothing,
id: 29,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductGingerScarf,
price: 98,
assetAspectRatio: 219 / 329,
),
Product(
category: categoryClothing,
id: 30,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductRamonaCrossover,
price: 68,
assetAspectRatio: 220 / 329,
),
Product(
category: categoryClothing,
id: 31,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductChambrayShirt,
price: 38,
assetAspectRatio: 329 / 223,
),
Product(
category: categoryClothing,
id: 32,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductClassicWhiteCollar,
price: 58,
assetAspectRatio: 221 / 329,
),
Product(
category: categoryClothing,
id: 33,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductCeriseScallopTee,
price: 42,
assetAspectRatio: 329 / 219,
),
Product(
category: categoryClothing,
id: 34,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductShoulderRollsTee,
price: 27,
assetAspectRatio: 220 / 329,
),
Product(
category: categoryClothing,
id: 35,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductGreySlouchTank,
price: 24,
assetAspectRatio: 222 / 329,
),
Product(
category: categoryClothing,
id: 36,
isFeatured: false,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductSunshirtDress,
price: 58,
assetAspectRatio: 219 / 329,
),
Product(
category: categoryClothing,
id: 37,
isFeatured: true,
name: (context) =>
GalleryLocalizations.of(context)!.shrineProductFineLinesTee,
price: 58,
assetAspectRatio: 219 / 329,
),
];
if (category == categoryAll) {
return allProducts;
} else {
return allProducts.where((p) => p.category == category).toList();
}
}
}
| gallery/lib/studies/shrine/model/products_repository.dart/0 | {
"file_path": "gallery/lib/studies/shrine/model/products_repository.dart",
"repo_id": "gallery",
"token_count": 5034
} | 813 |
//
// Generated file. Do not edit.
//
import FlutterMacOS
import Foundation
import path_provider_foundation
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
| gallery/macos/Flutter/GeneratedPluginRegistrant.swift/0 | {
"file_path": "gallery/macos/Flutter/GeneratedPluginRegistrant.swift",
"repo_id": "gallery",
"token_count": 115
} | 814 |
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
import '../tool/l10n_cli/l10n_cli.dart';
import 'utils.dart';
void main() {
test('verify intl_en_US.xml is up to date', () async {
final currentXml = readEnglishXml();
final newXml = await generateXmlFromArb();
expect(standardizeLineEndings(currentXml), standardizeLineEndings(newXml),
reason: 'intl_en_US.xml is not up to date. '
'Did you forget to run `flutter pub run grinder l10n`?');
});
}
| gallery/test/l10n_test.dart/0 | {
"file_path": "gallery/test/l10n_test.dart",
"repo_id": "gallery",
"token_count": 231
} | 815 |
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:gallery/main.dart';
import 'package:gallery/studies/shrine/supplemental/product_card.dart';
import 'testing/precache_images.dart';
import 'testing/util.dart';
void main() {
group('mobile', () {
testWidgets(
'shrine displays shopping cart correctly',
(tester) async {
await setUpBinding(tester, size: mobileSize);
await pumpWidgetWithImages(
tester,
const GalleryApp(initialRoute: '/shrine'),
shrineAssets,
);
await tester.pumpAndSettle();
await tester.tap(
find.byWidgetPredicate(
(widget) => widget is Text && widget.data == 'NEXT',
),
);
await tester.pumpAndSettle();
await tester.tap(find.byType(MobileProductCard).first);
await tester.tap(find.byType(MobileProductCard).at(1));
await tester.pumpAndSettle();
await expectLater(
find.byType(GalleryApp),
matchesGoldenFile('goldens/shrine_mobile.png'),
);
},
);
});
group('desktop', () {
testWidgets(
'shrine displays shopping cart correctly',
(tester) async {
await setUpBinding(tester, size: desktopSize);
await pumpWidgetWithImages(
tester,
const GalleryApp(initialRoute: '/shrine'),
shrineAssets,
);
await tester.pumpAndSettle();
await tester.tap(
find.byWidgetPredicate(
(widget) => widget is Text && widget.data == 'NEXT',
),
);
await tester.pumpAndSettle();
await tester.tap(find.byType(DesktopProductCard).first);
await tester.tap(find.byType(DesktopProductCard).at(1));
await tester.pumpAndSettle();
await expectLater(
find.byType(GalleryApp),
matchesGoldenFile('goldens/shrine_desktop.png'),
);
},
);
});
}
| gallery/test_goldens/shrine_test.dart/0 | {
"file_path": "gallery/test_goldens/shrine_test.dart",
"repo_id": "gallery",
"token_count": 940
} | 816 |
# Codeviewer
A command-line application to highlight dart source code.
## Overview
Code segments are highlighted before the app is compiled.
This is done because the highlighting process can take 300ms to finish, creating
a noticeable delay when the demo switches to code page.
The highlighter takes all files in the `lib/demos/` folder and scans each.
Highlighted code widgets are stored in the
`lib/codeviewer/code_segments.dart` file.
## How to generate code segments
From the `gallery/` directory:
1. Make sure you have [grinder](https://pub.dev/packages/grinder) installed by
running `flutter pub get`.
2. Then run `flutter pub run grinder update-code-segments` to generate code
segments with highlighting.
## How to define a block of code to generate highlighting for
Wrap a block of code with lines `// BEGIN yourDemoName` and `// END` to mark it
for highlighting. The block in between, as well as any copyright notice and
imports at the beginning of the file, are automatically taken and highlighted,
and stored as `static TextSpan yourDemoName(BuildContext context)` in
`gallery/lib/codeviewer/code_segments.dart`. To display the code, go to
`gallery/lib/data/demos.dart`, and add `code: CodeSegments.yourDemoName,` to
your `GalleryDemoConfiguration` object.
## Multiple blocks of code
Use the following method to join multiple blocks of code into a single segment:
```
// BEGIN yourDemo#2
a();
// END
b();
// BEGIN yourDemo#1
c();
// END
```
The generated code will be
```
c();
a();
```
Code blocks can nest or overlap. In these cases, specify which file(s) to `END`.
The following source file
```
// BEGIN demoOne
a();
// BEGIN demoTwo
b();
// END demoOne
c();
// END demoTwo
```
will create the following segments:
(demoOne)
```
a();
b();
```
(demoTwo)
```
b();
c();
```
| gallery/tool/codeviewer_cli/README.md/0 | {
"file_path": "gallery/tool/codeviewer_cli/README.md",
"repo_id": "gallery",
"token_count": 539
} | 817 |
{
"eslint.workingDirectories": [
"functions"
]
} | io_flip/.vscode/settings.json/0 | {
"file_path": "io_flip/.vscode/settings.json",
"repo_id": "io_flip",
"token_count": 26
} | 818 |
import 'package:api/templates/templates.dart';
import 'package:mustache_template/mustache_template.dart';
const _template = '''
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/png" href="{{{meta.favIconUrl}}}" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>{{meta.title}}</title>
<meta name="descripton" content="{{meta.description}}" />
{{{meta.ga}}}
<meta property="og:title" content="{{meta.title}}" />
<meta property="og:description" content="{{meta.description}}" />
<meta property="og:url" content="{{{meta.shareUrl}}}" />
<meta property="og:image" content="{{{meta.image}}}" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="{{meta.title}}" />
<meta name="twitter:text:title" content="{{meta.title}}" />
<meta name="twitter:description" content="{{meta.description}}" />
<meta name="twitter:image" content="{{{meta.image}}}" />
<meta name="twitter:site" content="@flutterdev" />
<link
href="https://fonts.googleapis.com/css?family=Google+Sans:400,500"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css?family=Google+Sans+Text:400,500"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css?family=Saira:700"
rel="stylesheet"
/>
<style>
body {
margin: 0;
padding: 0;
font-family: "Google Sans", sans-serif;
font-size: 16px;
line-height: 1.5;
background-color: #202124;
display: flex;
flex-direction: column;
min-height: 100vh;
}
main {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
flex: 1;
margin: 0;
}
footer {
padding: 20px;
}
.links {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.links a {
font-size: 14px;
font-weight: 400;
color: #bdc1c6;
padding: 10px;
text-decoration: none;
}
h3 {
font-family: "Google Sans";
font-style: normal;
font-weight: 500;
font-size: 24px;
line-height: 32px;
text-align: center;
color: #fff;
}
h3.initials {
font-family: "Saira";
font-style: normal;
font-weight: 700;
font-size: 36px;
line-height: 48px;
display: flex;
align-items: center;
text-align: center;
letter-spacing: -2px;
color: #fff;
padding: 0px;
margin: 0px;
}
h4.streak {
font-family: "Google Sans";
font-style: normal;
font-weight: 500;
font-size: 18px;
line-height: 24px;
margin-top: 0px;
padding: 0px;
display: flex;
align-items: center;
text-align: center;
letter-spacing: -0.25px;
color: #ffbb00;
}
p {
font-family: "Google Sans Text";
font-style: normal;
font-weight: 400;
font-size: 16px;
line-height: 24px;
text-align: center;
color: #fff;
margin: 8px 32px;
}
img {
max-width: 400px;
margin-bottom: 32px;
}
.btn {
padding: 8px 24px;
background: #ffbb00;
box-shadow: -3px 4px 0px #000000;
border: 2px solid #202124;
border-radius: 100px;
font-family: "Google Sans";
font-style: normal;
font-weight: 500;
font-size: 16px;
line-height: 24px;
display: flex;
align-items: center;
text-align: center;
letter-spacing: 0.25px;
text-transform: uppercase;
text-decoration: none;
color: #202124;
}
.hand-section {
display: flex;
flex-direction: column;
align-items: center;
}
</style>
</head>
<body>
<main>
{{{content}}}
<h3>{{header}}</h3>
<p>
Play I/O FLIP, an AI-designed card game powered by Google
and compete against players from around the globe.
</p>
<a class="btn" href="{{{meta.gameUrl}}}"> PLAY NOW </a>
</main>
<footer>
<div class="links">
<a href="https://io.google/2023/">Google I/O</a>
<a href="https://flutter.dev/flip">How It's Made</a>
<a href="https://policies.google.com/privacy">Privacy Policy</a>
<a href="https://policies.google.com/terms">Terms of Service</a>
<a href="https://flutter.dev/flip">FAQ</a>
</div>
</footer>
</body>
</html>
''';
/// Builds the HMTL page for the sare card link.
String buildShareTemplate({
required String content,
required String header,
required TemplateMetadata meta,
}) {
return Template(_template).renderString({
'content': content,
'header': header,
'meta': meta.toJson(),
});
}
| io_flip/api/lib/templates/share_template.dart/0 | {
"file_path": "io_flip/api/lib/templates/share_template.dart",
"repo_id": "io_flip",
"token_count": 2424
} | 819 |
/// Renders a card based on its metadata and illustration
library card_renderer;
export 'src/card_renderer.dart';
export 'src/rainbow_filter.dart';
| io_flip/api/packages/card_renderer/lib/card_renderer.dart/0 | {
"file_path": "io_flip/api/packages/card_renderer/lib/card_renderer.dart",
"repo_id": "io_flip",
"token_count": 46
} | 820 |
include: package:very_good_analysis/analysis_options.3.1.0.yaml
| io_flip/api/packages/config_repository/analysis_options.yaml/0 | {
"file_path": "io_flip/api/packages/config_repository/analysis_options.yaml",
"repo_id": "io_flip",
"token_count": 23
} | 821 |
include: package:very_good_analysis/analysis_options.3.1.0.yaml
| io_flip/api/packages/encryption_middleware/analysis_options.yaml/0 | {
"file_path": "io_flip/api/packages/encryption_middleware/analysis_options.yaml",
"repo_id": "io_flip",
"token_count": 23
} | 822 |
/// Domain classes for the game
library game_domain;
export 'src/keys.dart';
export 'src/models/models.dart';
export 'src/solvers/solvers.dart';
| io_flip/api/packages/game_domain/lib/game_domain.dart/0 | {
"file_path": "io_flip/api/packages/game_domain/lib/game_domain.dart",
"repo_id": "io_flip",
"token_count": 50
} | 823 |
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'prompt.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Prompt _$PromptFromJson(Map<String, dynamic> json) => Prompt(
characterClass: json['characterClass'] as String?,
power: json['power'] as String?,
);
Map<String, dynamic> _$PromptToJson(Prompt instance) => <String, dynamic>{
'characterClass': instance.characterClass,
'power': instance.power,
};
| io_flip/api/packages/game_domain/lib/src/models/prompt.g.dart/0 | {
"file_path": "io_flip/api/packages/game_domain/lib/src/models/prompt.g.dart",
"repo_id": "io_flip",
"token_count": 167
} | 824 |
// ignore_for_file: prefer_const_constructors
import 'package:game_domain/game_domain.dart';
import 'package:test/test.dart';
void main() {
group('PromptTerm', () {
test('can be instantiated', () {
expect(
PromptTerm(
id: '',
term: '',
type: PromptTermType.character,
),
isNotNull,
);
});
test('supports equality', () {
final promptTerm = PromptTerm(
id: '',
term: '',
type: PromptTermType.character,
);
expect(
promptTerm,
equals(
PromptTerm(
id: '',
term: '',
type: PromptTermType.character,
),
),
);
expect(
promptTerm,
isNot(
equals(
PromptTerm(
id: '',
term: '',
type: PromptTermType.location,
),
),
),
);
expect(
promptTerm,
isNot(
equals(
PromptTerm(
id: 'id',
term: '',
type: PromptTermType.location,
),
),
),
);
expect(
promptTerm,
isNot(
equals(
PromptTerm(
id: '',
term: 'term',
type: PromptTermType.location,
),
),
),
);
expect(
promptTerm,
isNot(
equals(
PromptTerm(
id: '',
term: '',
shortenedTerm: 'shortenedTerm',
type: PromptTermType.location,
),
),
),
);
});
test('can serializes to json', () {
final promptTerm = PromptTerm(
id: 'id',
term: 'term',
type: PromptTermType.location,
);
expect(
promptTerm.toJson(),
equals(
{
'id': 'id',
'term': 'term',
'shortenedTerm': null,
'type': 'location',
},
),
);
});
test('can deserialize from json', () {
final promptTerm = PromptTerm.fromJson(
const {
'id': 'id',
'term': 'term',
'shortenedTerm': 't',
'type': 'location',
},
);
expect(
promptTerm,
equals(
PromptTerm(
id: 'id',
term: 'term',
shortenedTerm: 't',
type: PromptTermType.location,
),
),
);
});
});
}
| io_flip/api/packages/game_domain/test/src/models/prompt_term_test.dart/0 | {
"file_path": "io_flip/api/packages/game_domain/test/src/models/prompt_term_test.dart",
"repo_id": "io_flip",
"token_count": 1512
} | 825 |
include: package:very_good_analysis/analysis_options.4.0.0.yaml
| io_flip/api/packages/image_model_repository/analysis_options.yaml/0 | {
"file_path": "io_flip/api/packages/image_model_repository/analysis_options.yaml",
"repo_id": "io_flip",
"token_count": 23
} | 826 |
// ignore_for_file: prefer_const_constructors
import 'package:db_client/db_client.dart';
import 'package:game_domain/game_domain.dart';
import 'package:leaderboard_repository/leaderboard_repository.dart';
import 'package:mocktail/mocktail.dart';
import 'package:test/test.dart';
class _MockDbClient extends Mock implements DbClient {}
void main() {
group('LeaderboardRepository', () {
late DbClient dbClient;
late LeaderboardRepository leaderboardRepository;
const blacklistDocumentId = 'id';
setUp(() {
dbClient = _MockDbClient();
leaderboardRepository = LeaderboardRepository(
dbClient: dbClient,
blacklistDocumentId: blacklistDocumentId,
);
});
test('can be instantiated', () {
expect(
LeaderboardRepository(
dbClient: dbClient,
blacklistDocumentId: blacklistDocumentId,
),
isNotNull,
);
});
group('getLeaderboard', () {
test('returns list of leaderboard players', () async {
const playerOne = LeaderboardPlayer(
id: 'id',
longestStreak: 2,
initials: 'AAA',
);
const playerTwo = LeaderboardPlayer(
id: 'id2',
longestStreak: 3,
initials: 'BBB',
);
when(() => dbClient.orderBy('leaderboard', 'longestStreak'))
.thenAnswer((_) async {
return [
DbEntityRecord(
id: 'id',
data: {
'longestStreak': playerOne.longestStreak,
'initials': playerOne.initials,
},
),
DbEntityRecord(
id: 'id2',
data: {
'longestStreak': playerTwo.longestStreak,
'initials': playerTwo.initials,
},
),
];
});
final result = await leaderboardRepository.getLeaderboard();
expect(result, equals([playerOne, playerTwo]));
});
test('returns empty list if results are empty', () async {
when(() => dbClient.orderBy('leaderboard', 'longestStreak'))
.thenAnswer((_) async {
return [];
});
final response = await leaderboardRepository.getLeaderboard();
expect(response, isEmpty);
});
});
group('getInitialsBlacklist', () {
const blacklist = ['AAA', 'BBB', 'CCC'];
test('returns the blacklist', () async {
when(() => dbClient.getById('initials_blacklist', blacklistDocumentId))
.thenAnswer(
(_) async => DbEntityRecord(
id: blacklistDocumentId,
data: const {
'blacklist': ['AAA', 'BBB', 'CCC'],
},
),
);
final response = await leaderboardRepository.getInitialsBlacklist();
expect(response, equals(blacklist));
});
test('returns empty list if not found', () async {
when(() => dbClient.getById('initials_blacklist', any())).thenAnswer(
(_) async => null,
);
final response = await leaderboardRepository.getInitialsBlacklist();
expect(response, isEmpty);
});
});
group('findScoreCardByLongestStreakDeck', () {
test('returns the score card', () async {
const deckId = 'deckId';
final scoreCard = ScoreCard(
id: '',
wins: 2,
currentStreak: 2,
longestStreak: 3,
longestStreakDeck: deckId,
);
when(() => dbClient.findBy('score_cards', 'longestStreakDeck', deckId))
.thenAnswer((_) async {
return [
DbEntityRecord(
id: '',
data: {
'wins': scoreCard.wins,
'currentStreak': scoreCard.currentStreak,
'longestStreak': scoreCard.longestStreak,
'longestStreakDeck': deckId,
},
),
];
});
final result = await leaderboardRepository
.findScoreCardByLongestStreakDeck(deckId);
expect(result, equals(scoreCard));
});
test('returns null when no score card is to be found', () async {
const deckId = 'deckId';
when(() => dbClient.findBy('score_cards', 'longestStreakDeck', deckId))
.thenAnswer((_) async {
return [];
});
final result = await leaderboardRepository
.findScoreCardByLongestStreakDeck(deckId);
expect(result, isNull);
});
});
group('getScoreCardsWithMostWins', () {
test('returns list of score cards', () async {
const scoreCardOne = ScoreCard(
id: 'id',
wins: 2,
currentStreak: 2,
longestStreak: 3,
longestStreakDeck: 'deckId',
);
const scoreCardTwo = ScoreCard(
id: 'id2',
wins: 3,
currentStreak: 3,
longestStreak: 4,
longestStreakDeck: 'deckId2',
);
when(() => dbClient.orderBy('score_cards', 'wins'))
.thenAnswer((_) async {
return [
DbEntityRecord(
id: 'id',
data: {
'wins': scoreCardOne.wins,
'currentStreak': scoreCardOne.currentStreak,
'longestStreak': scoreCardOne.longestStreak,
'longestStreakDeck': scoreCardOne.longestStreakDeck,
},
),
DbEntityRecord(
id: 'id2',
data: {
'wins': scoreCardTwo.wins,
'currentStreak': scoreCardTwo.currentStreak,
'longestStreak': scoreCardTwo.longestStreak,
'longestStreakDeck': scoreCardTwo.longestStreakDeck,
},
),
];
});
final result = await leaderboardRepository.getScoreCardsWithMostWins();
expect(result, equals([scoreCardOne, scoreCardTwo]));
});
test('returns empty list if results are empty', () async {
when(() => dbClient.orderBy('score_cards', 'wins'))
.thenAnswer((_) async {
return [];
});
final response =
await leaderboardRepository.getScoreCardsWithMostWins();
expect(response, isEmpty);
});
});
group('getScoreCardsWithLongestStreak', () {
test('returns list of score cards', () async {
const scoreCardOne = ScoreCard(
id: 'id',
wins: 2,
currentStreak: 2,
longestStreak: 3,
longestStreakDeck: 'deckId',
);
const scoreCardTwo = ScoreCard(
id: 'id2',
wins: 3,
currentStreak: 3,
longestStreak: 4,
longestStreakDeck: 'deckId2',
);
when(() => dbClient.orderBy('score_cards', 'longestStreak'))
.thenAnswer((_) async {
return [
DbEntityRecord(
id: 'id',
data: {
'wins': scoreCardOne.wins,
'currentStreak': scoreCardOne.currentStreak,
'longestStreak': scoreCardOne.longestStreak,
'longestStreakDeck': scoreCardOne.longestStreakDeck,
},
),
DbEntityRecord(
id: 'id2',
data: {
'wins': scoreCardTwo.wins,
'currentStreak': scoreCardTwo.currentStreak,
'longestStreak': scoreCardTwo.longestStreak,
'longestStreakDeck': scoreCardTwo.longestStreakDeck,
},
),
];
});
final result =
await leaderboardRepository.getScoreCardsWithLongestStreak();
expect(result, equals([scoreCardOne, scoreCardTwo]));
});
test('returns empty list if results are empty', () async {
when(() => dbClient.orderBy('score_cards', 'longestStreak'))
.thenAnswer((_) async {
return [];
});
final response =
await leaderboardRepository.getScoreCardsWithLongestStreak();
expect(response, isEmpty);
});
});
group('addInitialsToScoreCard', () {
test('adds initials to score card', () async {
const scoreCardId = 'scoreCardId';
const initials = 'AAA';
when(
() => dbClient.update(
'score_cards',
DbEntityRecord(
id: scoreCardId,
data: const {
'initials': initials,
},
),
),
).thenAnswer((_) async {});
await leaderboardRepository.addInitialsToScoreCard(
scoreCardId: scoreCardId,
initials: initials,
);
verify(
() => dbClient.update(
'score_cards',
DbEntityRecord(
id: scoreCardId,
data: const {
'initials': initials,
},
),
),
).called(1);
});
});
});
}
| io_flip/api/packages/leaderboard_repository/test/src/leaderboard_repository_test.dart/0 | {
"file_path": "io_flip/api/packages/leaderboard_repository/test/src/leaderboard_repository_test.dart",
"repo_id": "io_flip",
"token_count": 4526
} | 827 |
import 'dart:async';
import 'dart:io';
import 'package:cards_repository/cards_repository.dart';
import 'package:dart_frog/dart_frog.dart';
FutureOr<Response> onRequest(RequestContext context, String deckId) {
if (context.request.method == HttpMethod.get) {
return _getDeck(context, deckId);
}
return Response(statusCode: HttpStatus.methodNotAllowed);
}
FutureOr<Response> _getDeck(RequestContext context, String deckId) async {
final cardsRepository = context.read<CardsRepository>();
final deck = await cardsRepository.getDeck(deckId);
if (deck == null) {
return Response(statusCode: 404);
}
return Response.json(body: deck.toJson());
}
| io_flip/api/routes/game/decks/[deckId].dart/0 | {
"file_path": "io_flip/api/routes/game/decks/[deckId].dart",
"repo_id": "io_flip",
"token_count": 226
} | 828 |
import 'dart:convert';
import 'dart:io';
import 'package:api/game_url.dart';
import 'package:api/templates/templates.dart';
import 'package:cards_repository/cards_repository.dart';
import 'package:dart_frog/dart_frog.dart';
import 'package:leaderboard_repository/leaderboard_repository.dart';
Future<Response> onRequest(RequestContext context) async {
final cardId = context.request.uri.queryParameters['cardId'];
final deckId = context.request.uri.queryParameters['deckId'];
final gameUrl = context.read<GameUrl>().url;
late String content;
late String header;
final String metaImagePath;
final redirectResponse = Response(
statusCode: HttpStatus.movedPermanently,
headers: {
HttpHeaders.locationHeader: gameUrl,
},
);
if (cardId != null) {
final card = await context.read<CardsRepository>().getCard(cardId);
if (card == null) {
return redirectResponse;
}
header = 'Check out my card from I/O FLIP!';
content = buildShareCardContent(card: card);
metaImagePath = '/public/cards/$cardId';
} else if (deckId != null) {
final deck = await context.read<CardsRepository>().getDeck(deckId);
if (deck == null) {
return redirectResponse;
}
final scoreCard = await context
.read<LeaderboardRepository>()
.findScoreCardByLongestStreakDeck(
deckId,
);
header = 'Check out my team from I/O FLIP!';
content = buildHandContent(
handImage: '/public/decks/$deckId',
initials: scoreCard?.initials,
streak: scoreCard?.longestStreak.toString(),
);
metaImagePath = '/public/decks/$deckId';
} else {
return redirectResponse;
}
final meta = TemplateMetadata(
title: header,
description: '',
shareUrl: context.request.uri.toString(),
favIconUrl: '',
ga: '',
gameUrl: gameUrl,
image: context.request.uri.replace(
path: metaImagePath,
queryParameters: {},
).toString(),
);
return Response.bytes(
body: utf8.encode(
buildShareTemplate(
content: content,
header: header,
meta: meta,
),
),
headers: {
HttpHeaders.contentTypeHeader: ContentType.html.toString(),
},
);
}
| io_flip/api/routes/public/share.dart/0 | {
"file_path": "io_flip/api/routes/public/share.dart",
"repo_id": "io_flip",
"token_count": 851
} | 829 |
// ignore_for_file: lines_longer_than_80_chars
import 'dart:async';
import 'dart:convert';
import 'package:dart_frog/dart_frog.dart';
import 'package:dart_frog_web_socket/dart_frog_web_socket.dart';
import 'package:game_domain/game_domain.dart';
import 'package:jwt_middleware/jwt_middleware.dart';
import 'package:match_repository/match_repository.dart';
import 'package:mocktail/mocktail.dart';
import 'package:test/test.dart';
import '../../../main.dart';
import '../../../routes/public/connect.dart';
import '../../../routes/public/connect.dart' as route show onRequest;
typedef _OnConnection = void Function(
WebSocketChannel channel,
String? protocol,
);
class _MockMatchRepository extends Mock implements MatchRepository {}
class _MockJwtMiddleware extends Mock implements JwtMiddleware {}
class _MockWebSocketSink extends Mock implements WebSocketSink {}
class _FakeRequestContext extends Fake implements RequestContext {
_FakeRequestContext({
required this.getRequest,
required this.matchRepository,
required this.webSocketHandlerFactory,
});
final Request Function() getRequest;
@override
Request get request => getRequest();
final MatchRepository matchRepository;
final WebSocketHandlerFactory webSocketHandlerFactory;
@override
T read<T>() {
if (T == MatchRepository) {
return matchRepository as T;
}
if (T == WebSocketHandlerFactory) {
return webSocketHandlerFactory as T;
}
throw UnimplementedError();
}
}
class _FakeRequest extends Fake implements Request {
_FakeRequest({
required this.uri,
});
@override
final Uri uri;
}
class _FakeResponse extends Fake implements Response {}
class _FakeWebSocketChannel extends Fake implements WebSocketChannel {
_FakeWebSocketChannel({
required this.stream,
required this.sink,
});
@override
final Stream<dynamic> stream;
@override
final WebSocketSink sink;
}
class _FakeWebSocketHandlerFactory extends Fake {
_FakeWebSocketHandlerFactory({
required this.channelStream,
required this.channelSink,
required this.onCreate,
});
final Stream<dynamic> channelStream;
final WebSocketSink channelSink;
final void Function(
_OnConnection onConnection,
) onCreate;
Handler call(
_OnConnection onConnection,
) {
return (context) async {
onCreate(onConnection);
return _FakeResponse();
};
}
}
void main() {
group('GET /connect', () {
late MatchRepository matchRepository;
late StreamController<dynamic> channelStream;
late WebSocketSink channelSink;
late RequestContext context;
late _OnConnection onConnection;
const matchId = 'matchId';
const userId = 'userId';
setUp(() {
channelStream = StreamController<dynamic>();
channelSink = _MockWebSocketSink();
jwtMiddleware = _MockJwtMiddleware();
when(
() => jwtMiddleware.verifyToken(any()),
).thenAnswer((_) async => userId);
matchRepository = _MockMatchRepository();
when(
() => matchRepository.setPlayerConnectivity(
userId: any(named: 'userId'),
connected: any<bool>(named: 'connected'),
),
).thenAnswer((_) async {});
when(
() => matchRepository.setHostConnectivity(
match: matchId,
active: any<bool>(named: 'active'),
),
).thenAnswer((_) async {});
when(
() => matchRepository.setGuestConnectivity(
match: matchId,
active: any<bool>(named: 'active'),
),
).thenAnswer((_) async {});
context = _FakeRequestContext(
getRequest: () => _FakeRequest(
uri: Uri(path: '/public/connect'),
),
matchRepository: matchRepository,
webSocketHandlerFactory: _FakeWebSocketHandlerFactory(
channelStream: channelStream.stream,
channelSink: channelSink,
onCreate: (newOnConnection) {
onConnection = newOnConnection;
},
).call,
);
});
tearDown(() {
channelStream.close();
});
void connectToSocket() {
onConnection(
_FakeWebSocketChannel(
stream: channelStream.stream,
sink: channelSink,
),
null,
);
}
Future<void> waitAndVerify(void Function() action) async {
await untilCalled(action);
verify(action).called(1);
}
Future<void> checkSetHostConnectivity({required bool active}) =>
waitAndVerify(
() => matchRepository.setHostConnectivity(
match: matchId,
active: active,
),
);
Future<void> checkSetGuestConnectivity({required bool active}) =>
waitAndVerify(
() => matchRepository.setGuestConnectivity(
match: matchId,
active: active,
),
);
Future<void> checkSetPlayerConnectivity({required bool connected}) =>
waitAndVerify(
() => matchRepository.setPlayerConnectivity(
userId: userId,
connected: connected,
),
);
Future<void> checkResponseSent(String message) =>
waitAndVerify(() => channelSink.add(message));
test('does nothing when no token message is sent', () async {
final response = await route.onRequest(context);
expect(response, isA<_FakeResponse>());
connectToSocket();
await channelStream.close();
verifyZeroInteractions(matchRepository);
});
test('does nothing when authentication fails', () async {
when(() => jwtMiddleware.verifyToken('token'))
.thenAnswer((_) async => null);
final response = await route.onRequest(context);
expect(response, isA<_FakeResponse>());
connectToSocket();
channelStream.add(jsonEncode(WebSocketMessage.token('token')));
await channelStream.close();
verifyZeroInteractions(matchRepository);
});
test('establishes user connection', () async {
when(
() => matchRepository.getPlayerConnectivity(userId: userId),
).thenAnswer((_) async => false);
final response = await route.onRequest(context);
expect(response, isA<_FakeResponse>());
connectToSocket();
channelStream.add(jsonEncode(WebSocketMessage.token('token')));
await checkSetPlayerConnectivity(connected: true);
await checkResponseSent(jsonEncode(const WebSocketMessage.connected()));
await channelStream.close();
await checkSetPlayerConnectivity(connected: false);
});
test('on matchJoined updates host connectivity', () async {
when(
() => matchRepository.getPlayerConnectivity(userId: userId),
).thenAnswer((_) async => false);
final response = await route.onRequest(context);
expect(response, isA<_FakeResponse>());
connectToSocket();
channelStream.add(jsonEncode(WebSocketMessage.token('token')));
await checkSetPlayerConnectivity(connected: true);
channelStream.add(
jsonEncode(
WebSocketMessage.matchJoined(
matchId: matchId,
isHost: true,
),
),
);
await checkSetHostConnectivity(active: true);
await checkResponseSent(
jsonEncode(
WebSocketMessage.matchJoined(
matchId: matchId,
isHost: true,
),
),
);
await channelStream.close();
await checkSetPlayerConnectivity(connected: false);
await checkSetHostConnectivity(active: false);
});
test('on matchJoined updates old match connectivity', () async {
when(
() => matchRepository.getPlayerConnectivity(userId: userId),
).thenAnswer((_) async => false);
final response = await route.onRequest(context);
expect(response, isA<_FakeResponse>());
connectToSocket();
channelStream.add(jsonEncode(WebSocketMessage.token('token')));
await checkSetPlayerConnectivity(connected: true);
channelStream.add(
jsonEncode(
WebSocketMessage.matchJoined(
matchId: matchId,
isHost: true,
),
),
);
await checkSetHostConnectivity(active: true);
await checkResponseSent(
jsonEncode(
WebSocketMessage.matchJoined(
matchId: matchId,
isHost: true,
),
),
);
channelStream.add(
jsonEncode(
WebSocketMessage.matchJoined(
matchId: matchId,
isHost: false,
),
),
);
await checkSetHostConnectivity(active: false);
await checkSetGuestConnectivity(active: true);
await checkResponseSent(
jsonEncode(
WebSocketMessage.matchJoined(
matchId: matchId,
isHost: false,
),
),
);
await channelStream.close();
await checkSetPlayerConnectivity(connected: false);
await checkSetGuestConnectivity(active: false);
});
test('on matchJoined updates guest connectivity', () async {
when(
() => matchRepository.getPlayerConnectivity(userId: userId),
).thenAnswer((_) async => false);
final response = await route.onRequest(context);
expect(response, isA<_FakeResponse>());
connectToSocket();
channelStream.add(jsonEncode(WebSocketMessage.token('token')));
await checkSetPlayerConnectivity(connected: true);
channelStream.add(
jsonEncode(
WebSocketMessage.matchJoined(
matchId: matchId,
isHost: false,
),
),
);
await checkSetGuestConnectivity(active: true);
await checkResponseSent(
jsonEncode(
WebSocketMessage.matchJoined(
matchId: matchId,
isHost: false,
),
),
);
await channelStream.close();
await checkSetPlayerConnectivity(connected: false);
await checkSetGuestConnectivity(active: false);
});
test('on matchLeft updates connectivity', () async {
when(
() => matchRepository.getPlayerConnectivity(userId: userId),
).thenAnswer((_) async => false);
final response = await route.onRequest(context);
expect(response, isA<_FakeResponse>());
connectToSocket();
channelStream.add(jsonEncode(WebSocketMessage.token('token')));
await checkSetPlayerConnectivity(connected: true);
channelStream.add(
jsonEncode(
WebSocketMessage.matchJoined(
matchId: matchId,
isHost: false,
),
),
);
await checkSetGuestConnectivity(active: true);
await checkResponseSent(
jsonEncode(
WebSocketMessage.matchJoined(
matchId: matchId,
isHost: false,
),
),
);
channelStream.add(jsonEncode(const WebSocketMessage.matchLeft()));
await checkSetGuestConnectivity(active: false);
await channelStream.close();
await checkSetPlayerConnectivity(connected: false);
});
test('sets old user as inactive when a new user connects', () async {
when(() => jwtMiddleware.verifyToken('token2'))
.thenAnswer((_) async => 'newUserId');
when(
() => matchRepository.getPlayerConnectivity(userId: userId),
).thenAnswer((_) async => false);
when(
() => matchRepository.getPlayerConnectivity(userId: 'newUserId'),
).thenAnswer((_) async => false);
final response = await route.onRequest(context);
expect(response, isA<_FakeResponse>());
connectToSocket();
channelStream.add(jsonEncode(WebSocketMessage.token('token')));
await checkSetPlayerConnectivity(connected: true);
channelStream.add(jsonEncode(WebSocketMessage.token('token2')));
await checkSetPlayerConnectivity(connected: false);
await waitAndVerify(
() => matchRepository.setPlayerConnectivity(
userId: 'newUserId',
connected: true,
),
);
});
test('sends error when player is already connected', () async {
when(
() => matchRepository.getPlayerConnectivity(userId: userId),
).thenAnswer((_) async => true);
final response = await route.onRequest(context);
expect(response, isA<_FakeResponse>());
connectToSocket();
channelStream.add(jsonEncode(WebSocketMessage.token('token')));
await waitAndVerify(
() => matchRepository.getPlayerConnectivity(userId: userId),
);
await checkResponseSent(
jsonEncode(
WebSocketMessage.error(
WebSocketErrorCode.playerAlreadyConnected,
),
),
);
});
test(
'sends connected when player is already connected but reconnect is true',
() async {
when(
() => matchRepository.getPlayerConnectivity(userId: userId),
).thenAnswer((_) async => true);
final response = await route.onRequest(context);
expect(response, isA<_FakeResponse>());
connectToSocket();
channelStream.add(
jsonEncode(
WebSocketMessage.token(
'token',
reconnect: true,
),
),
);
await waitAndVerify(
() => matchRepository.getPlayerConnectivity(userId: userId),
);
await checkResponseSent(jsonEncode(const WebSocketMessage.connected()));
},
);
test('sends error when cannot update player connectivity', () async {
when(
() => matchRepository.getPlayerConnectivity(userId: userId),
).thenAnswer((_) async => false);
when(
() => matchRepository.setPlayerConnectivity(
userId: userId,
connected: true,
),
).thenThrow(Exception('oops'));
final response = await route.onRequest(context);
expect(response, isA<_FakeResponse>());
connectToSocket();
channelStream.add(jsonEncode(WebSocketMessage.token('token')));
await checkSetPlayerConnectivity(connected: true);
await checkResponseSent(
jsonEncode(
WebSocketMessage.error(WebSocketErrorCode.firebaseException),
),
);
await channelStream.close();
await checkSetPlayerConnectivity(connected: false);
});
});
}
| io_flip/api/test/routes/public/connect_test.dart/0 | {
"file_path": "io_flip/api/test/routes/public/connect_test.dart",
"repo_id": "io_flip",
"token_count": 5766
} | 830 |
// ignore_for_file: avoid_print
import 'dart:io';
import 'dart:math' as math;
import 'package:path/path.dart' as path;
/// {@template character_folder_validator}
/// Dart tool that checks if the character folder is valid
/// given the prompts stored in csv file.
/// {@endtemplate}
class NormalizeImageNames {
/// {@macro character_folder_validator}
const NormalizeImageNames({
required Directory imagesFolder,
required Directory destImagesFolder,
}) : _imagesFolder = imagesFolder,
_destImagesFolder = destImagesFolder;
final Directory _imagesFolder;
final Directory _destImagesFolder;
/// Uses the prompts stored in the csv file to generate
/// a lookup table in case there are missing images for a given prompt
/// combination.
/// [onProgress] is called everytime there is progress,
/// it takes in the current inserted and the total to insert.
Future<void> normalize(
void Function(int, int) onProgress,
) async {
final map = <String, List<String>>{};
await _imagesFolder
.list(recursive: true)
.where((entity) => entity is File)
.forEach((entity) {
final file = entity as File;
final basename = path.basename(file.path);
final promptKey =
RegExp('([a-z_]+[^_0-9])').allMatches(basename).first.group(0)!;
map.putIfAbsent(promptKey, () => []).add(file.path);
});
var biggerVariation = 0;
var progress = 0;
onProgress(0, map.length);
for (final entry in map.entries) {
print('${entry.key} has ${entry.value.length} variations');
biggerVariation = math.max(biggerVariation, entry.value.length);
for (var i = 0; i < entry.value.length; i++) {
final filePath = entry.value[i];
if (!filePath.endsWith('png')) continue;
print('Processing $filePath');
final destFile = filePath
.replaceAll(_imagesFolder.path, _destImagesFolder.path)
.replaceAll(path.basename(filePath), '${entry.key}_$i.png');
File(filePath).copySync(destFile);
}
onProgress(++progress, map.length);
}
print('Done normalizing images');
print('Bigger variation: $biggerVariation');
}
}
| io_flip/api/tools/data_loader/lib/src/normalize_file_names.dart/0 | {
"file_path": "io_flip/api/tools/data_loader/lib/src/normalize_file_names.dart",
"repo_id": "io_flip",
"token_count": 797
} | 831 |
export 'flop_page.dart';
export 'flop_view.dart';
| io_flip/flop/lib/flop/view/view.dart/0 | {
"file_path": "io_flip/flop/lib/flop/view/view.dart",
"repo_id": "io_flip",
"token_count": 22
} | 832 |
import * as admin from 'firebase-admin';
import * as functions from 'firebase-functions';
admin.initializeApp(functions.config().firebase);
export {deleteUserData} from './deleteUserData';
export {updateLeaderboard} from './updateLeaderboard';
| io_flip/functions/src/index.ts/0 | {
"file_path": "io_flip/functions/src/index.ts",
"repo_id": "io_flip",
"token_count": 70
} | 833 |
import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:connection_repository/connection_repository.dart';
import 'package:equatable/equatable.dart';
import 'package:game_domain/game_domain.dart';
part 'connection_event.dart';
part 'connection_state.dart';
class ConnectionBloc extends Bloc<ConnectionEvent, ConnectionState> {
ConnectionBloc({
required ConnectionRepository connectionRepository,
}) : _connectionRepository = connectionRepository,
super(const ConnectionInitial()) {
on<ConnectionRequested>(_onConnectionRequested);
on<ConnectionClosed>(_onConnectionClosed);
on<WebSocketMessageReceived>(_onWebSocketMessageReceived);
}
final ConnectionRepository _connectionRepository;
StreamSubscription<WebSocketMessage>? _messageSubscription;
@override
Future<void> close() async {
await _messageSubscription?.cancel();
_connectionRepository.close();
return super.close();
}
Future<void> _onConnectionRequested(
ConnectionRequested event,
Emitter<ConnectionState> emit,
) async {
emit(const ConnectionInProgress());
try {
await _messageSubscription?.cancel();
_connectionRepository.close();
await _connectionRepository.connect();
_messageSubscription = _connectionRepository.messages.listen(
(message) => add(WebSocketMessageReceived(message)),
onDone: () => add(const ConnectionClosed()),
);
} catch (e, s) {
emit(const ConnectionFailure(WebSocketErrorCode.unknown));
addError(e, s);
}
}
Future<void> _onConnectionClosed(
ConnectionClosed event,
Emitter<ConnectionState> emit,
) async {
emit(const ConnectionInitial());
await _messageSubscription?.cancel();
}
Future<void> _onWebSocketMessageReceived(
WebSocketMessageReceived event,
Emitter<ConnectionState> emit,
) async {
final message = event.message;
if (message.messageType == MessageType.connected) {
emit(const ConnectionSuccess());
} else if (message.messageType == MessageType.error) {
final payload = message.payload! as WebSocketErrorPayload;
emit(ConnectionFailure(payload.errorCode));
}
}
}
| io_flip/lib/connection/bloc/connection_bloc.dart/0 | {
"file_path": "io_flip/lib/connection/bloc/connection_bloc.dart",
"repo_id": "io_flip",
"token_count": 729
} | 834 |
part of 'how_to_play_bloc.dart';
abstract class HowToPlayEvent extends Equatable {
const HowToPlayEvent();
@override
List<Object> get props => [];
}
class NextPageRequested extends HowToPlayEvent {
const NextPageRequested();
}
class PreviousPageRequested extends HowToPlayEvent {
const PreviousPageRequested();
}
| io_flip/lib/how_to_play/bloc/how_to_play_event.dart/0 | {
"file_path": "io_flip/lib/how_to_play/bloc/how_to_play_event.dart",
"repo_id": "io_flip",
"token_count": 100
} | 835 |
// ignore_for_file: avoid_web_libraries_in_flutter
import 'dart:async';
import 'dart:js' as js;
import 'package:api_client/api_client.dart';
import 'package:authentication_repository/authentication_repository.dart';
import 'package:config_repository/config_repository.dart';
import 'package:connection_repository/connection_repository.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/foundation.dart';
import 'package:game_domain/game_domain.dart';
import 'package:game_script_machine/game_script_machine.dart';
import 'package:io_flip/app/app.dart';
import 'package:io_flip/bootstrap.dart';
import 'package:io_flip/firebase_options_development.dart';
import 'package:io_flip/settings/persistence/persistence.dart';
import 'package:match_maker_repository/match_maker_repository.dart';
void main() async {
if (kDebugMode) {
js.context['FIREBASE_APPCHECK_DEBUG_TOKEN'] =
const String.fromEnvironment('APPCHECK_DEBUG_TOKEN');
}
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
unawaited(
bootstrap(
(firestore, firebaseAuth, appCheck) async {
await appCheck.activate(
webRecaptchaSiteKey: const String.fromEnvironment('RECAPTCHA_KEY'),
);
await appCheck.setTokenAutoRefreshEnabled(true);
final authenticationRepository = AuthenticationRepository(
firebaseAuth: firebaseAuth,
);
final apiClient = ApiClient(
baseUrl: 'https://top-dash-dev-api-synvj3dcmq-uc.a.run.app',
idTokenStream: authenticationRepository.idToken,
refreshIdToken: authenticationRepository.refreshIdToken,
appCheckTokenStream: appCheck.onTokenChange,
appCheckToken: await appCheck.getToken(),
);
await authenticationRepository.signInAnonymously();
await authenticationRepository.idToken.first;
final currentScript =
await apiClient.scriptsResource.getCurrentScript();
final gameScriptMachine = GameScriptMachine.initialize(currentScript);
return App(
settingsPersistence: LocalStorageSettingsPersistence(),
apiClient: apiClient,
matchMakerRepository: MatchMakerRepository(db: firestore),
configRepository: ConfigRepository(db: firestore),
connectionRepository: ConnectionRepository(apiClient: apiClient),
matchSolver: MatchSolver(gameScriptMachine: gameScriptMachine),
gameScriptMachine: gameScriptMachine,
user: await authenticationRepository.user.first,
isScriptsEnabled: true,
);
},
),
);
}
| io_flip/lib/main_development.dart/0 | {
"file_path": "io_flip/lib/main_development.dart",
"repo_id": "io_flip",
"token_count": 997
} | 836 |
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:game_domain/game_domain.dart';
import 'package:io_flip/l10n/l10n.dart';
import 'package:io_flip/prompt/prompt.dart';
import 'package:io_flip_ui/io_flip_ui.dart';
import 'package:provider/provider.dart';
class PromptForm extends StatelessWidget {
PromptForm({
math.Random? randomGenerator,
super.key,
}) {
_rng = randomGenerator ?? math.Random();
}
late final math.Random _rng;
@override
Widget build(BuildContext context) {
final bloc = context.watch<PromptFormBloc>();
return SimpleFlow(
initialData: () => const Prompt(),
onComplete: (data) {
bloc.add(PromptSubmitted(data: data));
},
stepBuilder: (context, data, _) {
final introSeen = data.isIntroSeen ?? false;
if (!introSeen) {
return const PromptFormIntroView();
}
if (data.characterClass == null) {
return PromptFormView(
title: context.l10n.characterClassPromptPageTitle,
itemsList: bloc.state.characterClasses,
initialItem: _rng.nextInt(bloc.state.characterClasses.length),
);
}
return PromptFormView(
title: context.l10n.powerPromptPageTitle,
itemsList: bloc.state.powers,
initialItem: _rng.nextInt(bloc.state.powers.length),
isLastOfFlow: true,
);
},
);
}
}
| io_flip/lib/prompt/view/prompt_form.dart/0 | {
"file_path": "io_flip/lib/prompt/view/prompt_form.dart",
"repo_id": "io_flip",
"token_count": 650
} | 837 |
// Copyright 2022, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:io_flip/settings/persistence/persistence.dart';
import 'package:shared_preferences/shared_preferences.dart';
/// An implementation of [SettingsPersistence] that uses
/// `package:shared_preferences`.
class LocalStorageSettingsPersistence extends SettingsPersistence {
final Future<SharedPreferences> instanceFuture =
SharedPreferences.getInstance();
@override
Future<bool> getMusicOn() async {
final prefs = await instanceFuture;
return prefs.getBool('musicOn') ?? true;
}
@override
Future<bool> getMuted({required bool defaultValue}) async {
final prefs = await instanceFuture;
return prefs.getBool('mute') ?? defaultValue;
}
@override
Future<bool> getSoundsOn() async {
final prefs = await instanceFuture;
return prefs.getBool('soundsOn') ?? true;
}
@override
Future<void> saveMusicOn({required bool active}) async {
final prefs = await instanceFuture;
await prefs.setBool('musicOn', active);
}
@override
Future<void> saveMuted({required bool active}) async {
final prefs = await instanceFuture;
await prefs.setBool('mute', active);
}
@override
Future<void> saveSoundsOn({required bool active}) async {
final prefs = await instanceFuture;
await prefs.setBool('soundsOn', active);
}
}
| io_flip/lib/settings/persistence/local_storage_settings_persistence.dart/0 | {
"file_path": "io_flip/lib/settings/persistence/local_storage_settings_persistence.dart",
"repo_id": "io_flip",
"token_count": 475
} | 838 |
import 'package:api_client/api_client.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart' hide Card;
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:game_domain/game_domain.dart';
import 'package:io_flip/gen/assets.gen.dart';
import 'package:io_flip/l10n/l10n.dart';
import 'package:io_flip/share/bloc/download_bloc.dart';
import 'package:io_flip/utils/external_links.dart';
import 'package:io_flip_ui/io_flip_ui.dart';
import 'package:url_launcher/url_launcher_string.dart';
class ShareDialog extends StatelessWidget {
const ShareDialog({
required this.twitterShareUrl,
required this.facebookShareUrl,
required this.content,
this.downloadCards,
this.downloadDeck,
this.urlLauncher,
super.key,
});
final String twitterShareUrl;
final String facebookShareUrl;
final AsyncValueSetter<String>? urlLauncher;
final Widget content;
final List<Card>? downloadCards;
final Deck? downloadDeck;
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (_) => DownloadBloc(shareResource: context.read<ShareResource>()),
child: ShareDialogView(
twitterShareUrl: twitterShareUrl,
facebookShareUrl: facebookShareUrl,
content: content,
urlLauncher: urlLauncher,
downloadCards: downloadCards,
downloadDeck: downloadDeck,
key: key,
),
);
}
}
class ShareDialogView extends StatelessWidget {
const ShareDialogView({
required this.twitterShareUrl,
required this.facebookShareUrl,
required this.content,
this.downloadCards,
this.downloadDeck,
AsyncValueSetter<String>? urlLauncher,
super.key,
}) : _urlLauncher = urlLauncher ?? launchUrlString;
final String twitterShareUrl;
final String facebookShareUrl;
final AsyncValueSetter<String> _urlLauncher;
final Widget content;
final List<Card>? downloadCards;
final Deck? downloadDeck;
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final bloc = context.watch<DownloadBloc>();
return Material(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
content,
const SizedBox(height: IoFlipSpacing.xlg),
Column(
mainAxisSize: MainAxisSize.min,
children: [
RoundedButton.image(
Image.asset(
Assets.images.twitter.path,
width: IoFlipSpacing.xlg,
color: IoFlipColors.seedWhite,
),
label: l10n.twitterButtonLabel,
onPressed: () => _urlLauncher(twitterShareUrl),
),
const SizedBox(height: IoFlipSpacing.sm),
RoundedButton.image(
Image.asset(
Assets.images.facebook.path,
color: IoFlipColors.seedWhite,
width: IoFlipSpacing.xlg,
),
label: l10n.facebookButtonLabel,
onPressed: () => _urlLauncher(facebookShareUrl),
),
const SizedBox(height: IoFlipSpacing.sm),
RoundedButton.image(
Image.asset(
Assets.images.google.path,
color: IoFlipColors.seedWhite,
width: IoFlipSpacing.xlg,
),
label: l10n.devButtonLabel,
onPressed: () => _urlLauncher(ExternalLinks.devAward),
),
const SizedBox(height: IoFlipSpacing.sm),
if (downloadCards != null || downloadDeck != null)
_SaveButton(
status: bloc.state.status,
onSave: () {
if (downloadDeck != null) {
bloc.add(DownloadDeckRequested(deck: downloadDeck!));
} else if (downloadCards != null) {
bloc.add(DownloadCardsRequested(cards: downloadCards!));
}
},
),
const SizedBox(height: IoFlipSpacing.sm),
if (bloc.state.status != DownloadStatus.idle &&
bloc.state.status != DownloadStatus.loading)
_DownloadStatusBar(status: bloc.state.status),
const SizedBox(height: IoFlipSpacing.lg),
Text(
downloadDeck != null
? l10n.shareTeamDisclaimer
: l10n.shareCardDisclaimer,
style: IoFlipTextStyles.bodyMD,
textAlign: TextAlign.center,
),
],
),
],
),
);
}
}
class _SaveButton extends StatelessWidget {
const _SaveButton({required this.status, required this.onSave});
final DownloadStatus status;
final VoidCallback onSave;
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
switch (status) {
case DownloadStatus.loading:
return RoundedButton.image(
const SizedBox(
width: IoFlipSpacing.xlg,
height: IoFlipSpacing.xlg,
child: CircularProgressIndicator(
color: IoFlipColors.seedGrey70,
strokeWidth: 2,
),
),
label: l10n.downloadingButtonLabel,
borderColor: IoFlipColors.seedGrey50,
foregroundColor: IoFlipColors.seedGrey70,
backgroundColor: IoFlipColors.seedGrey30,
);
case DownloadStatus.completed:
return RoundedButton.image(
const Icon(
Icons.check,
size: IoFlipSpacing.xlg,
color: IoFlipColors.seedGrey70,
),
label: l10n.downloadCompleteButtonLabel,
borderColor: IoFlipColors.seedGrey50,
foregroundColor: IoFlipColors.seedGrey70,
backgroundColor: IoFlipColors.seedGrey30,
);
case DownloadStatus.idle:
case DownloadStatus.failure:
return RoundedButton.image(
Image.asset(
Assets.images.download.path,
color: IoFlipColors.seedWhite,
width: IoFlipSpacing.xlg,
),
label: l10n.saveButtonLabel,
onPressed: onSave,
);
}
}
}
class _DownloadStatusBar extends StatelessWidget {
const _DownloadStatusBar({required this.status});
final DownloadStatus status;
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final success = status == DownloadStatus.completed;
return ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 327),
child: Container(
height: IoFlipSpacing.xxlg,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(100)),
color: success ? IoFlipColors.seedGreen : IoFlipColors.seedRed,
),
child: Center(
child: Text(
success ? l10n.downloadCompleteLabel : l10n.downloadFailedLabel,
style:
IoFlipTextStyles.bodyMD.copyWith(color: IoFlipColors.seedBlack),
),
),
),
);
}
}
| io_flip/lib/share/widgets/share_dialog.dart/0 | {
"file_path": "io_flip/lib/share/widgets/share_dialog.dart",
"repo_id": "io_flip",
"token_count": 3417
} | 839 |
import 'dart:io';
import 'package:api_client/api_client.dart';
import 'package:http/http.dart' as http;
import 'package:mocktail/mocktail.dart';
import 'package:test/test.dart';
class _MockApiClient extends Mock implements ApiClient {}
class _MockResponse extends Mock implements http.Response {}
void main() {
group('ScriptsResource', () {
late ApiClient apiClient;
late http.Response response;
late ScriptsResource resource;
setUp(() {
apiClient = _MockApiClient();
response = _MockResponse();
when(() => apiClient.get(any())).thenAnswer((_) async => response);
when(
() => apiClient.put(
any(),
body: any(named: 'body'),
),
).thenAnswer((_) async => response);
resource = ScriptsResource(apiClient: apiClient);
});
group('getCurrentScript', () {
test('returns the script', () async {
when(() => response.statusCode).thenReturn(HttpStatus.ok);
when(() => response.body).thenReturn('script');
final returnedScript = await resource.getCurrentScript();
expect(returnedScript, equals('script'));
});
test('throws ApiClientError when request fails', () async {
when(() => response.statusCode)
.thenReturn(HttpStatus.internalServerError);
when(() => response.body).thenReturn('Ops');
await expectLater(
resource.getCurrentScript,
throwsA(
isA<ApiClientError>().having(
(e) => e.cause,
'cause',
equals(
'GET /scripts/current returned status 500 with the following response: "Ops"',
),
),
),
);
});
});
group('updateScript', () {
test('send the correct request', () async {
when(() => response.statusCode).thenReturn(HttpStatus.noContent);
await resource.updateScript('current', 'script');
verify(
() => apiClient.put('/game/scripts/current', body: 'script'),
);
});
test('throws ApiClientError when request fails', () async {
when(() => response.statusCode)
.thenReturn(HttpStatus.internalServerError);
when(() => response.body).thenReturn('Ops');
await expectLater(
() => resource.updateScript('current', 'script'),
throwsA(
isA<ApiClientError>().having(
(e) => e.cause,
'cause',
equals(
'PUT /scripts/current returned status 500 with the following response: "Ops"',
),
),
),
);
});
});
});
}
| io_flip/packages/api_client/test/src/resources/scripts_resource_test.dart/0 | {
"file_path": "io_flip/packages/api_client/test/src/resources/scripts_resource_test.dart",
"repo_id": "io_flip",
"token_count": 1159
} | 840 |
import 'package:flutter/material.dart';
import 'package:gallery/story_scaffold.dart';
import 'package:io_flip_ui/io_flip_ui.dart';
class BottomBarStory extends StatelessWidget {
const BottomBarStory({super.key});
@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
final isSmall = screenWidth < IoFlipBreakpoints.small;
return StoryScaffold(
title: 'Io Flip Bottom Bar',
body: Column(
children: [
const Expanded(
child: Center(
child: Text(
'Bottom bar\nResize to see its behavior on different '
'screen sizes',
textAlign: TextAlign.center,
),
),
),
IoFlipBottomBar(
leading: RoundedButton.icon(Icons.volume_up),
height: isSmall ? 120 : null,
middle: Wrap(
direction: isSmall ? Axis.vertical : Axis.horizontal,
spacing: 8,
children: [
RoundedButton.text('PLAY NOW'),
RoundedButton.text('PLAY NOW'),
],
),
trailing: RoundedButton.icon(Icons.question_mark),
),
],
),
);
}
}
| io_flip/packages/io_flip_ui/gallery/lib/widgets/bottom_bar_story.dart/0 | {
"file_path": "io_flip/packages/io_flip_ui/gallery/lib/widgets/bottom_bar_story.dart",
"repo_id": "io_flip",
"token_count": 622
} | 841 |
import 'dart:async';
import 'dart:math';
import 'package:flame/sprite.dart';
import 'package:flutter/material.dart';
import 'package:io_flip_ui/io_flip_ui.dart';
import 'package:io_flip_ui/src/animations/damages/air_damage.dart';
import 'package:io_flip_ui/src/animations/damages/earth_damage.dart';
import 'package:io_flip_ui/src/animations/damages/fire_damage.dart';
import 'package:io_flip_ui/src/animations/damages/water_damage.dart';
import 'package:io_flip_ui/src/widgets/damages/dual_animation.dart';
/// {@template elemental_damage_step_notifier}
/// A notifier that allows an external
/// test to know when an [DamageAnimationState] is complete
/// {@endtemplate}
@visibleForTesting
class ElementalDamageStepNotifier {
final _charged = Completer<void>();
final _sent = Completer<void>();
final _received = Completer<void>();
final _victory = Completer<void>();
/// Future notifying when [DamageAnimationState.charging] is complete
Future<void> get charged => _charged.future;
/// Future notifying when [DamageAnimationState.sending] is complete
Future<void> get sent => _sent.future;
/// Future notifying when [DamageAnimationState.receiving] is complete
Future<void> get received => _received.future;
/// Future notifying when [DamageAnimationState.victory] is complete
Future<void> get victory => _victory.future;
}
/// {@template elemental_damage_animation}
/// A widget that renders a list of [SpriteAnimation] for a given element
/// {@endtemplate}
class ElementalDamageAnimation extends StatefulWidget {
/// {@macro elemental_damage_animation}
const ElementalDamageAnimation(
this.element, {
required this.direction,
required this.initialState,
required this.size,
this.assetSize = AssetSize.large,
this.onComplete,
this.onDamageReceived,
this.pointDeductionCompleter,
this.stepNotifier,
super.key,
});
/// Optional callback to be called when all the animations of the damage
/// are complete.
final VoidCallback? onComplete;
/// Optional callback to be called when the damage is received.
final VoidCallback? onDamageReceived;
/// Completer to be completed when the points have been deducted.
final Completer<void>? pointDeductionCompleter;
/// Element defining which [ElementalDamage] to use
final Element element;
/// Direction of the damages
final DamageDirection direction;
/// Size of the card
final GameCardSize size;
/// Notifies when an [DamageAnimationState] is complete
final ElementalDamageStepNotifier? stepNotifier;
/// Size of the assets to use, large or small
final AssetSize assetSize;
/// Initial state of the animation
final DamageAnimationState initialState;
@override
State<ElementalDamageAnimation> createState() =>
_ElementalDamageAnimationState();
}
class _ElementalDamageAnimationState extends State<ElementalDamageAnimation> {
late var _animationState = widget.initialState;
late final ElementalDamage elementalDamage;
@override
void initState() {
super.initState();
switch (widget.element) {
case Element.metal:
elementalDamage = MetalDamage(size: widget.size);
break;
case Element.air:
elementalDamage = AirDamage(size: widget.size);
break;
case Element.fire:
elementalDamage = FireDamage(size: widget.size);
break;
case Element.earth:
elementalDamage = EarthDamage(size: widget.size);
break;
case Element.water:
elementalDamage = WaterDamage(size: widget.size);
break;
}
}
@override
Widget build(BuildContext context) {
if (widget.assetSize == AssetSize.large) {
switch (_animationState) {
case DamageAnimationState.charging:
return Stack(
children: [
if (widget.direction == DamageDirection.topToBottom)
Transform.translate(
offset: -Offset(
0.32 * widget.size.width,
0.315 * widget.size.height,
),
child: DualAnimation(
cardOffset: Offset(
0.32 * widget.size.width,
0.315 * widget.size.height,
),
cardSize: widget.size,
back: elementalDamage.chargeBackBuilder,
front: elementalDamage.chargeFrontBuilder,
assetSize: widget.assetSize,
onComplete: _onStepCompleted,
),
)
else
_BottomAnimation(
child: Transform.translate(
offset: Offset(
0.32 * widget.size.width,
0.215 * widget.size.height,
),
child: DualAnimation(
cardOffset: Offset(
0.32 * widget.size.width,
0.315 * widget.size.height,
),
cardSize: widget.size,
back: elementalDamage.chargeBackBuilder,
front: elementalDamage.chargeFrontBuilder,
assetSize: widget.assetSize,
onComplete: _onStepCompleted,
),
),
)
],
);
case DamageAnimationState.sending:
return Stack(
children: [
if (widget.direction == DamageDirection.topToBottom)
Align(
alignment: const Alignment(-0.7, 0.3),
child: elementalDamage.damageSendBuilder(
_onStepCompleted,
widget.assetSize,
),
)
else
Align(
alignment: const Alignment(0.7, 0),
child: Transform.rotate(
angle: pi,
child: elementalDamage.damageSendBuilder(
_onStepCompleted,
widget.assetSize,
),
),
)
],
);
case DamageAnimationState.receiving:
return Stack(
children: [
if (widget.direction == DamageDirection.topToBottom)
_BottomAnimation(
child: Transform.translate(
offset: Offset(
0.3 * widget.size.width,
0.3 * widget.size.height,
),
child: elementalDamage.damageReceiveBuilder(
_onStepCompleted,
widget.assetSize,
),
),
)
else
Transform.translate(
offset: -Offset(
0.3 * widget.size.width,
0.3 * widget.size.height,
),
child: elementalDamage.damageReceiveBuilder(
_onStepCompleted,
widget.assetSize,
),
)
],
);
case DamageAnimationState.waitingVictory:
return const SizedBox.shrink(key: Key('elementalDamage_empty'));
case DamageAnimationState.victory:
return Stack(
children: [
if (widget.direction == DamageDirection.topToBottom)
Transform.translate(
offset: -Offset(
0.25 * widget.size.width,
0.11 * widget.size.height,
),
child: DualAnimation(
cardOffset: Offset(
0.25 * widget.size.width,
0.11 * widget.size.height,
),
cardSize: widget.size,
back: elementalDamage.victoryChargeBackBuilder,
front: elementalDamage.victoryChargeFrontBuilder,
assetSize: widget.assetSize,
onComplete: _onStepCompleted,
),
)
else
_BottomAnimation(
child: Transform.translate(
offset: Offset(
0.255 * widget.size.width,
0.115 * widget.size.height,
),
child: DualAnimation(
cardOffset: Offset(
0.25 * widget.size.width,
0.11 * widget.size.height,
),
cardSize: widget.size,
back: elementalDamage.victoryChargeBackBuilder,
front: elementalDamage.victoryChargeFrontBuilder,
assetSize: widget.assetSize,
onComplete: _onStepCompleted,
),
),
)
],
);
case DamageAnimationState.ended:
return const SizedBox.shrink(key: Key('elementalDamage_empty'));
}
} else {
switch (_animationState) {
case DamageAnimationState.charging:
return Stack(
children: [
if (widget.direction == DamageDirection.topToBottom)
Transform.translate(
offset: -Offset(
0.32 * widget.size.width,
0.32 * widget.size.height,
),
child: DualAnimation(
cardOffset: Offset(
0.32 * widget.size.width,
0.315 * widget.size.height,
),
cardSize: widget.size,
back: elementalDamage.chargeBackBuilder,
front: elementalDamage.chargeFrontBuilder,
assetSize: widget.assetSize,
onComplete: _onStepCompleted,
),
)
else
Transform.translate(
offset: Offset(
0.38 * widget.size.width,
0.86 * widget.size.height,
),
child: DualAnimation(
cardOffset: Offset(
0.32 * widget.size.width,
0.315 * widget.size.height,
),
cardSize: widget.size,
back: elementalDamage.chargeBackBuilder,
front: elementalDamage.chargeFrontBuilder,
assetSize: widget.assetSize,
onComplete: _onStepCompleted,
),
)
],
);
case DamageAnimationState.sending:
return Stack(
children: [
if (widget.direction == DamageDirection.topToBottom)
Align(
alignment: const Alignment(-0.7, 0.3),
child: elementalDamage.damageSendBuilder(
_onStepCompleted,
widget.assetSize,
),
)
else
Align(
alignment: const Alignment(-0.7, 0),
child: Transform.rotate(
angle: pi,
child: elementalDamage.damageSendBuilder(
_onStepCompleted,
widget.assetSize,
),
),
)
],
);
case DamageAnimationState.receiving:
return Stack(
children: [
if (widget.direction == DamageDirection.topToBottom)
Transform.translate(
offset: Offset(
1.32 * widget.size.width,
1.16 * widget.size.height,
),
child: elementalDamage.damageReceiveBuilder(
_onStepCompleted,
widget.assetSize,
),
)
else
Transform.translate(
offset: -Offset(
-0.6 * widget.size.width,
-0.02 * widget.size.height,
),
child: elementalDamage.damageReceiveBuilder(
_onStepCompleted,
widget.assetSize,
),
)
],
);
case DamageAnimationState.waitingVictory:
return const SizedBox.shrink(key: Key('elementalDamage_empty'));
case DamageAnimationState.victory:
return Stack(
children: [
if (widget.direction == DamageDirection.topToBottom)
Transform.translate(
offset: -Offset(
0.25 * widget.size.width,
0.11 * widget.size.height,
),
child: DualAnimation(
cardOffset: Offset(
0.25 * widget.size.width,
0.11 * widget.size.height,
),
cardSize: widget.size,
back: elementalDamage.victoryChargeBackBuilder,
front: elementalDamage.victoryChargeFrontBuilder,
assetSize: widget.assetSize,
onComplete: _onStepCompleted,
),
)
else
Transform.translate(
offset: Offset(
0.46 * widget.size.width,
1.10 * widget.size.height,
),
child: DualAnimation(
cardOffset: Offset(
0.25 * widget.size.width,
0.11 * widget.size.height,
),
cardSize: widget.size,
back: elementalDamage.victoryChargeBackBuilder,
front: elementalDamage.victoryChargeFrontBuilder,
assetSize: widget.assetSize,
onComplete: _onStepCompleted,
),
)
],
);
case DamageAnimationState.ended:
return const SizedBox.shrink(key: Key('elementalDamage_empty'));
}
}
}
Future<void> _onStepCompleted() async {
if (_animationState == DamageAnimationState.charging) {
widget.stepNotifier?._charged.complete();
setState(() {
_animationState = DamageAnimationState.sending;
});
} else if (_animationState == DamageAnimationState.sending) {
widget.stepNotifier?._sent.complete();
setState(() {
_animationState = DamageAnimationState.receiving;
});
} else if (_animationState == DamageAnimationState.receiving) {
setState(() {
_animationState = DamageAnimationState.waitingVictory;
});
widget.stepNotifier?._received.complete();
widget.onDamageReceived?.call();
await widget.pointDeductionCompleter?.future;
setState(() {
_animationState = DamageAnimationState.victory;
});
} else if (_animationState == DamageAnimationState.victory) {
widget.stepNotifier?._victory.complete();
widget.onComplete?.call();
setState(() {
_animationState = DamageAnimationState.ended;
});
}
}
}
class _BottomAnimation extends StatelessWidget {
const _BottomAnimation({required this.child});
final Widget child;
@override
Widget build(BuildContext context) {
return Positioned(
bottom: 0,
right: 0,
child: child,
);
}
}
/// State of the animation playing
enum DamageAnimationState {
/// Charging animation
charging,
/// Sending animation
sending,
/// Receiving animation
receiving,
/// Waiting for victory animation
waitingVictory,
/// Victory animation
victory,
/// Animation ended
ended
}
/// Represents the size that should be used for the assets
enum AssetSize {
/// Represents small assets
small,
/// Represents large assets
large
}
/// Represents the direction of the damages
enum DamageDirection {
/// Represents the damages from top card to bottom card
topToBottom,
/// Represents the damages from bottom card to top card
bottomToTop
}
/// Represents the element of damage animation
enum Element {
/// Represents the element of metal.
metal,
/// Represents the element of water.
water,
/// Represents the element of air.
air,
/// Represents the element of fire.
fire,
/// Represents the element of earth.
earth,
}
| io_flip/packages/io_flip_ui/lib/src/animations/damages/elemental_damage_animation.dart/0 | {
"file_path": "io_flip/packages/io_flip_ui/lib/src/animations/damages/elemental_damage_animation.dart",
"repo_id": "io_flip",
"token_count": 8529
} | 842 |
/// Function definition for a function that plays a sound for buttons.
typedef PlayButtonSound = void Function();
/// {@template ui_sound_adapter}
/// An adapter used by the io_flip_ui package to play sounds.
///
/// This adapter should be provided on top of the application tree
/// in order for its widgets to have access to it.
///
/// {@endtemplate}
class UISoundAdapter {
/// {@macro ui_sound_adapter}
const UISoundAdapter({
required this.playButtonSound,
});
/// The function that plays a sound for buttons.
final PlayButtonSound playButtonSound;
}
| io_flip/packages/io_flip_ui/lib/src/ui_sound_adapter.dart/0 | {
"file_path": "io_flip/packages/io_flip_ui/lib/src/ui_sound_adapter.dart",
"repo_id": "io_flip",
"token_count": 162
} | 843 |
import 'package:flutter/material.dart';
import 'package:io_flip_ui/gen/assets.gen.dart';
import 'package:io_flip_ui/io_flip_ui.dart';
/// {@template flipped_game_card}
/// I/O FLIP Flipped Game Card.
/// {@endtemplate}
class FlippedGameCard extends StatelessWidget {
/// {@macro flipped_game_card}
const FlippedGameCard({
super.key,
this.size = const GameCardSize.lg(),
});
/// Size of the card.
final GameCardSize size;
@override
Widget build(BuildContext context) {
return SizedBox(
width: size.width,
height: size.height,
child: Assets.images.cardFrames.cardBack.image(
fit: BoxFit.cover,
),
);
}
}
| io_flip/packages/io_flip_ui/lib/src/widgets/flipped_game_card.dart/0 | {
"file_path": "io_flip/packages/io_flip_ui/lib/src/widgets/flipped_game_card.dart",
"repo_id": "io_flip",
"token_count": 263
} | 844 |
import 'dart:io';
import 'package:mocktail/mocktail.dart';
T mockFailedNetworkImages<T>(T Function() body) {
return HttpOverrides.runZoned(
body,
createHttpClient: (_) => _createErrorHttpClient(),
);
}
class _MockHttpClient extends Mock implements HttpClient {
_MockHttpClient() {
registerFallbackValue((List<int> _) {});
registerFallbackValue(Uri());
}
@override
// ignore: avoid_setters_without_getters, no_leading_underscores_for_local_identifiers
set autoUncompress(bool _autoUncompress) {}
}
class _MockHttpClientRequest extends Mock implements HttpClientRequest {}
class _MockHttpClientResponse extends Mock implements HttpClientResponse {}
class _MockHttpHeaders extends Mock implements HttpHeaders {}
HttpClient _createErrorHttpClient() {
final client = _MockHttpClient();
final request = _MockHttpClientRequest();
final response = _MockHttpClientResponse();
final headers = _MockHttpHeaders();
when(() => response.statusCode).thenReturn(HttpStatus.internalServerError);
when(() => request.headers).thenReturn(headers);
when(request.close).thenAnswer((_) async => response);
when(() => client.getUrl(any())).thenAnswer((_) async => request);
return client;
}
| io_flip/packages/io_flip_ui/test/helpers/mock_failed_network_image.dart/0 | {
"file_path": "io_flip/packages/io_flip_ui/test/helpers/mock_failed_network_image.dart",
"repo_id": "io_flip",
"token_count": 383
} | 845 |
import 'package:flame/cache.dart';
import 'package:flame/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:io_flip_ui/io_flip_ui.dart';
import 'package:mocktail/mocktail.dart';
import 'package:provider/provider.dart';
class _MockImages extends Mock implements Images {}
void main() {
group('VictoryChargeFront', () {
late Images images;
setUp(() {
images = _MockImages();
});
testWidgets('renders SpriteAnimationWidget', (tester) async {
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: Provider.value(
value: images,
child: const VictoryChargeFront(
'',
assetSize: AssetSize.large,
size: GameCardSize.md(),
animationColor: Colors.white,
),
),
),
);
expect(find.byType(SpriteAnimationWidget), findsOneWidget);
});
});
}
| io_flip/packages/io_flip_ui/test/src/widgets/damages/victory_charge_front_test.dart/0 | {
"file_path": "io_flip/packages/io_flip_ui/test/src/widgets/damages/victory_charge_front_test.dart",
"repo_id": "io_flip",
"token_count": 443
} | 846 |
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:io_flip_ui/io_flip_ui.dart';
void main() {
group('TiltBuilder', () {
const child = SizedBox(
width: 200,
height: 200,
key: Key('child'),
);
Offset? lastOffset;
Widget builder(BuildContext context, Offset tilt) {
lastOffset = tilt;
return child;
}
testWidgets('shows child', (tester) async {
await tester.pumpWidget(TiltBuilder(builder: builder));
expect(find.byWidget(child), findsOneWidget);
});
testWidgets('builds the child with offsets on mouse hover', (tester) async {
await tester.pumpWidget(TiltBuilder(builder: builder));
var offset = tester.getTopLeft(find.byType(TiltBuilder));
final gesture = await tester.createGesture(
kind: PointerDeviceKind.mouse,
);
await gesture.moveTo(offset);
await tester.pumpAndSettle();
expect(lastOffset, equals(const Offset(-1, -1)));
offset = tester.getBottomRight(find.byType(TiltBuilder));
await gesture.moveTo(offset - const Offset(1, 1));
await tester.pumpAndSettle();
expect(lastOffset?.dx, closeTo(1, 0.01));
expect(lastOffset?.dy, closeTo(1, 0.01));
await gesture.moveTo(offset + const Offset(20, 20));
await tester.pumpAndSettle();
expect(lastOffset, equals(Offset.zero));
});
testWidgets('builds the child with offsets on touch drag', (tester) async {
await tester.pumpWidget(TiltBuilder(builder: builder));
var offset = tester.getTopLeft(find.byType(TiltBuilder));
final gesture = await tester.startGesture(offset);
await tester.pumpAndSettle();
expect(lastOffset, equals(const Offset(-1, -1)));
offset = tester.getBottomRight(find.byType(TiltBuilder));
await gesture.moveTo(offset - const Offset(1, 1));
await tester.pumpAndSettle();
expect(lastOffset?.dx, closeTo(1, 0.01));
expect(lastOffset?.dy, closeTo(1, 0.01));
await gesture.up();
await tester.pumpAndSettle();
expect(lastOffset, equals(Offset.zero));
});
});
}
| io_flip/packages/io_flip_ui/test/src/widgets/tilt_builder_test.dart/0 | {
"file_path": "io_flip/packages/io_flip_ui/test/src/widgets/tilt_builder_test.dart",
"repo_id": "io_flip",
"token_count": 875
} | 847 |
#!/bin/bash
PORT=$1
for ((n=0;n<30;n++))
do
open -na "Google Chrome" --args --new-window --incognito http://localhost:$PORT/index.html
sleep 1
done
| io_flip/scripts/spam_flop.sh/0 | {
"file_path": "io_flip/scripts/spam_flop.sh",
"repo_id": "io_flip",
"token_count": 61
} | 848 |
// ignore_for_file: prefer_const_constructors
import 'package:flutter_test/flutter_test.dart';
import 'package:game_domain/game_domain.dart';
import 'package:io_flip/draft/draft.dart';
void main() {
const card1 = Card(
id: '1',
name: '',
description: '',
rarity: true,
image: '',
power: 1,
suit: Suit.air,
);
const card2 = Card(
id: '2',
name: '',
description: '',
rarity: true,
image: '',
power: 1,
suit: Suit.air,
);
group('DraftState', () {
test('can be instantiated', () {
expect(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
),
isNotNull,
);
});
test('has the correct initial state', () {
expect(
DraftState.initial(),
equals(
DraftState(
cards: const [],
selectedCards: const [null, null, null],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
),
),
);
});
test('supports equality', () {
expect(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
),
equals(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
),
),
);
expect(
DraftState(
cards: const [card1],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
),
isNot(
equals(
DraftState(
cards: const [card2],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
),
),
),
);
expect(
DraftState(
cards: const [],
selectedCards: const [card1],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
),
isNot(
equals(
DraftState(
cards: const [],
selectedCards: const [card2],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
),
),
),
);
expect(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
),
isNot(
equals(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.deckLoading,
firstCardOpacity: 1,
),
),
),
);
expect(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
),
isNot(
equals(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: .8,
),
),
),
);
});
test('copyWith returns a new instance', () {
expect(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
).copyWith(cards: [card1, card2]),
equals(
DraftState(
cards: const [card1, card2],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
),
),
);
expect(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
).copyWith(selectedCards: [card1, card2]),
equals(
DraftState(
cards: const [],
selectedCards: const [card1, card2],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
),
),
);
expect(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
).copyWith(status: DraftStateStatus.deckLoaded),
equals(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.deckLoaded,
firstCardOpacity: 1,
),
),
);
expect(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: 1,
).copyWith(firstCardOpacity: .8),
equals(
DraftState(
cards: const [],
selectedCards: const [],
status: DraftStateStatus.initial,
firstCardOpacity: .8,
),
),
);
});
});
}
| io_flip/test/draft/bloc/draft_state_test.dart/0 | {
"file_path": "io_flip/test/draft/bloc/draft_state_test.dart",
"repo_id": "io_flip",
"token_count": 2762
} | 849 |
import 'dart:ui';
import 'package:flutter_test/flutter_test.dart';
extension IoFlipWidgetTester on WidgetTester {
void setDisplaySize(Size size) {
view
..physicalSize = size
..devicePixelRatio = 1.0;
addTearDown(() {
view
..resetPhysicalSize()
..resetDevicePixelRatio();
});
}
void setLandscapeDisplaySize() {
setDisplaySize(const Size(1400, 800));
}
void setPortraitDisplaySize() {
setDisplaySize(const Size(400, 800));
}
void setSmallestPhoneDisplaySize() {
setDisplaySize(const Size(375, 600));
}
void setLargePhoneDisplaySize() {
setDisplaySize(const Size(377, 812));
}
}
| io_flip/test/helpers/set_display_size.dart/0 | {
"file_path": "io_flip/test/helpers/set_display_size.dart",
"repo_id": "io_flip",
"token_count": 257
} | 850 |
import 'package:bloc_test/bloc_test.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:game_domain/game_domain.dart';
import 'package:go_router/go_router.dart';
import 'package:io_flip/l10n/l10n.dart';
import 'package:io_flip/leaderboard/initials_form/initials_form.dart';
import 'package:io_flip/share/share.dart';
import 'package:io_flip_ui/io_flip_ui.dart';
import 'package:mocktail/mocktail.dart';
import '../../../helpers/helpers.dart';
class _MockInitialsFormBloc
extends MockBloc<InitialsFormEvent, InitialsFormState>
implements InitialsFormBloc {}
void main() {
late InitialsFormBloc initialsFormBloc;
setUp(() {
initialsFormBloc = _MockInitialsFormBloc();
});
group('InitialsFormView', () {
testWidgets('renders enter button', (tester) async {
when(() => initialsFormBloc.state).thenReturn(const InitialsFormState());
await tester.pumpSubject(initialsFormBloc);
final l10n = tester.element(find.byType(InitialsFormView)).l10n;
expect(find.text(l10n.enter), findsOneWidget);
expect(find.byType(RoundedButton), findsOneWidget);
});
testWidgets(
'renders error text when state status is InitialsFormStatus.failure',
(tester) async {
when(() => initialsFormBloc.state).thenReturn(
const InitialsFormState(
status: InitialsFormStatus.failure,
),
);
await tester.pumpSubject(initialsFormBloc);
expect(find.text('Error submitting initials'), findsOneWidget);
},
);
testWidgets(
'routes navigation to home when initials submission is successful',
(tester) async {
final goRouter = MockGoRouter();
whenListen(
initialsFormBloc,
Stream.fromIterable([
const InitialsFormState(
status: InitialsFormStatus.success,
),
]),
initialState: const InitialsFormState(),
);
await tester.pumpSubject(
initialsFormBloc,
router: goRouter,
);
verify(() => goRouter.go('/')).called(1);
},
);
testWidgets(
'routes navigation to route passed in '
'when initials submission is successful',
(tester) async {
final goRouter = MockGoRouter();
whenListen(
initialsFormBloc,
Stream.fromIterable([
const InitialsFormState(
initials: ['A', 'A', 'A'],
status: InitialsFormStatus.success,
),
]),
initialState: const InitialsFormState(),
);
const data = ShareHandPageData(
initials: 'AAA',
wins: 0,
deck: Deck(id: '', userId: '', cards: []),
);
await tester.pumpSubject(
initialsFormBloc,
router: goRouter,
shareHandPageData: data,
);
verify(() => goRouter.goNamed('share_hand', extra: data)).called(1);
},
);
group('initials textfield', () {
testWidgets('renders correctly', (tester) async {
when(() => initialsFormBloc.state)
.thenReturn(const InitialsFormState());
await tester.pumpSubject(initialsFormBloc);
expect(find.byType(TextFormField), findsNWidgets(3));
});
testWidgets('correctly updates fields and focus', (tester) async {
when(() => initialsFormBloc.state)
.thenReturn(const InitialsFormState());
await tester.pumpSubject(initialsFormBloc);
final l10n = tester.element(find.byType(InitialsFormView)).l10n;
final initial0 = find.byKey(const Key('initial_form_field_0'));
final initial1 = find.byKey(const Key('initial_form_field_1'));
final initial2 = find.byKey(const Key('initial_form_field_2'));
await tester.enterText(initial0, 'a');
await tester.enterText(initial1, 'a');
await tester.enterText(initial2, 'a');
await tester.pumpAndSettle();
final inputs =
tester.widgetList<EditableText>(find.byType(EditableText));
for (final input in inputs) {
expect(input.controller.text == 'A', isTrue);
}
await tester.enterText(initial2, '');
await tester.pumpAndSettle();
expect(inputs.last.controller.text, equals(emptyCharacter));
expect(find.text(l10n.enterInitialsError), findsNothing);
});
testWidgets('correctly moves focus on backspaces', (tester) async {
when(() => initialsFormBloc.state)
.thenReturn(const InitialsFormState());
await tester.pumpSubject(initialsFormBloc);
final initial0 = find.byKey(const Key('initial_form_field_0'));
final initial2 = find.byKey(const Key('initial_form_field_2'));
await tester.enterText(initial0, 'a');
await tester.enterText(initial2, 'a');
await tester.pumpAndSettle();
await tester.tap(initial2);
await tester.sendKeyEvent(LogicalKeyboardKey.backspace);
await tester.pumpAndSettle();
await tester.sendKeyEvent(LogicalKeyboardKey.backspace);
await tester.pumpAndSettle();
await tester.sendKeyEvent(LogicalKeyboardKey.backspace);
await tester.pumpAndSettle();
await tester.sendKeyEvent(LogicalKeyboardKey.backspace);
await tester.pumpAndSettle();
final inputs =
tester.widgetList<EditableText>(find.byType(EditableText));
for (final input in inputs) {
expect(input.controller.text == emptyCharacter, isTrue);
}
});
testWidgets('moves focus on typing repeated letters', (tester) async {
when(() => initialsFormBloc.state)
.thenReturn(const InitialsFormState());
await tester.pumpSubject(initialsFormBloc);
final initial0 = find.byKey(const Key('initial_form_field_0'));
final initial1 = find.byKey(const Key('initial_form_field_1'));
final initial2 = find.byKey(const Key('initial_form_field_2'));
await tester.enterText(initial0, 'a');
await tester.enterText(initial1, 'a');
await tester.enterText(initial2, 'a');
await tester.pumpAndSettle();
await tester.tap(initial0);
await tester.pumpAndSettle();
await tester.enterText(initial0, 'aa');
await tester.enterText(initial1, 'ab');
await tester.enterText(initial0, 'aa');
final inputs =
tester.widgetList<EditableText>(find.byType(EditableText));
await tester.pumpAndSettle();
expect(inputs.elementAt(1).controller.text, 'B');
});
testWidgets('validates initials', (tester) async {
when(() => initialsFormBloc.state).thenReturn(
const InitialsFormState(
initials: ['A', 'A', 'A'],
status: InitialsFormStatus.valid,
),
);
await tester.pumpSubject(initialsFormBloc);
final l10n = tester.element(find.byType(InitialsFormView)).l10n;
await tester.tap(find.byType(RoundedButton));
await tester.pumpAndSettle();
expect(find.text(l10n.enterInitialsError), findsNothing);
});
testWidgets('shows error text on failed validation', (tester) async {
when(() => initialsFormBloc.state).thenReturn(
const InitialsFormState(
initials: ['A', 'A', ''],
status: InitialsFormStatus.invalid,
),
);
await tester.pumpSubject(initialsFormBloc);
final l10n = tester.element(find.byType(InitialsFormView)).l10n;
expect(find.text(l10n.enterInitialsError), findsOneWidget);
});
testWidgets(
'requests focus on last input when status is '
'InitialsFormStatus.blacklisted',
(tester) async {
whenListen(
initialsFormBloc,
Stream.fromIterable([
const InitialsFormState(
initials: ['A', 'A', 'A'],
status: InitialsFormStatus.blacklisted,
),
]),
initialState: const InitialsFormState(),
);
await tester.pumpSubject(initialsFormBloc);
final inputs =
tester.widgetList<EditableText>(find.byType(EditableText));
for (final input in inputs) {
if (input != inputs.last) {
expect(input.focusNode.hasFocus, isFalse);
} else {
expect(input.focusNode.hasFocus, isTrue);
}
}
},
);
testWidgets('shows blacklist error text on blacklist initials',
(tester) async {
when(() => initialsFormBloc.state).thenReturn(
const InitialsFormState(
initials: ['A', 'A', 'A'],
status: InitialsFormStatus.blacklisted,
),
);
await tester.pumpSubject(initialsFormBloc);
final l10n = tester.element(find.byType(InitialsFormView)).l10n;
expect(find.text(l10n.blacklistedErrorMessage), findsOneWidget);
});
testWidgets('shows blacklist error styling on blacklist initials',
(tester) async {
when(() => initialsFormBloc.state).thenReturn(
const InitialsFormState(
initials: ['A', 'A', 'A'],
status: InitialsFormStatus.blacklisted,
),
);
await tester.pumpSubject(initialsFormBloc);
final blacklistDecoration = find.byWidgetPredicate(
(widget) =>
widget is Container &&
widget.decoration is BoxDecoration &&
((widget.decoration! as BoxDecoration).border ==
Border.all(color: IoFlipColors.seedRed, width: 2)),
);
expect(blacklistDecoration, findsNWidgets(3));
});
testWidgets('capitalizes lowercase letters', (tester) async {
when(() => initialsFormBloc.state)
.thenReturn(const InitialsFormState());
await tester.pumpSubject(initialsFormBloc);
final l10n = tester.element(find.byType(InitialsFormView)).l10n;
final initial0 = find.byKey(const Key('initial_form_field_0'));
final initial1 = find.byKey(const Key('initial_form_field_1'));
final initial2 = find.byKey(const Key('initial_form_field_2'));
await tester.enterText(initial0, 'a');
await tester.enterText(initial1, 'a');
await tester.enterText(initial2, 'a');
await tester.pumpAndSettle();
final inputs =
tester.widgetList<EditableText>(find.byType(EditableText));
for (final input in inputs) {
expect(input.controller.text == 'A', isTrue);
}
expect(find.text(l10n.enterInitialsError), findsNothing);
});
testWidgets('typing two letters in the same field keeps last letter',
(tester) async {
when(() => initialsFormBloc.state)
.thenReturn(const InitialsFormState());
await tester.pumpSubject(initialsFormBloc);
final l10n = tester.element(find.byType(InitialsFormView)).l10n;
final initial = find.byKey(const Key('initial_form_field_0'));
await tester.enterText(initial, 'ab');
await tester.pumpAndSettle();
final input =
tester.widget<EditableText>(find.byType(EditableText).first);
expect(input.controller.text == 'B', isTrue);
expect(find.text(l10n.enterInitialsError), findsNothing);
});
});
});
}
extension InitialsFormViewTest on WidgetTester {
Future<void> pumpSubject(
InitialsFormBloc bloc, {
GoRouter? router,
ShareHandPageData? shareHandPageData,
}) async {
return pumpApp(
BlocProvider.value(
value: bloc,
child: Scaffold(
body: InitialsFormView(
shareHandPageData: shareHandPageData,
),
),
),
router: router,
);
}
}
| io_flip/test/leaderboard/initials_form/view/initials_form_view_test.dart/0 | {
"file_path": "io_flip/test/leaderboard/initials_form/view/initials_form_view_test.dart",
"repo_id": "io_flip",
"token_count": 5323
} | 851 |
// ignore_for_file: prefer_const_constructors
import 'package:bloc_test/bloc_test.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:game_domain/game_domain.dart';
import 'package:go_router/go_router.dart';
import 'package:io_flip/prompt/prompt.dart';
import 'package:io_flip/settings/settings.dart';
import 'package:mocktail/mocktail.dart';
import '../../helpers/helpers.dart';
class _MockPromptFormBloc extends MockBloc<PromptFormEvent, PromptFormState>
implements PromptFormBloc {}
class _MockSettingsController extends Mock implements SettingsController {}
void main() {
late PromptFormBloc promptFormBloc;
const prompt = Prompt(
isIntroSeen: true,
characterClass: 'class',
power: 'power',
);
const characterClasses = ['Archer', 'Magician'];
const powers = ['Speed', 'Lazy'];
setUp(() {
promptFormBloc = _MockPromptFormBloc();
});
group('PromptView', () {
testWidgets('renders prompt view', (tester) async {
when(() => promptFormBloc.state).thenReturn(PromptFormState.initial());
await tester.pumpSubject(promptFormBloc, null);
expect(find.byType(PromptView), findsOneWidget);
});
testWidgets('renders error message view', (tester) async {
when(() => promptFormBloc.state).thenReturn(
PromptFormState(status: PromptTermsStatus.failed, prompts: Prompt()),
);
await tester.pumpSubject(promptFormBloc, null);
expect(find.byType(PromptView), findsOneWidget);
});
});
group('navigation', () {
setUp(() {
whenListen(
promptFormBloc,
Stream<PromptFormState>.fromIterable([
PromptFormState.initial(),
PromptFormState(
status: PromptTermsStatus.loaded,
characterClasses: characterClasses,
powers: powers,
prompts: prompt,
),
]),
initialState: const PromptFormState.initial(),
);
});
testWidgets('can navigate to draft page', (tester) async {
final goRouter = MockGoRouter();
await tester.pumpSubject(promptFormBloc, goRouter);
await tester.pumpAndSettle();
verify(
() => goRouter.go('/draft', extra: prompt),
).called(1);
});
});
}
extension PromptViewTest on WidgetTester {
Future<void> pumpSubject(PromptFormBloc bloc, GoRouter? goRouter) {
final SettingsController settingsController = _MockSettingsController();
when(() => settingsController.muted).thenReturn(ValueNotifier(true));
return pumpApp(
Scaffold(
body: BlocProvider.value(
value: bloc,
child: const PromptView(),
),
),
router: goRouter,
settingsController: settingsController,
);
}
}
| io_flip/test/prompt/view/prompt_view_test.dart/0 | {
"file_path": "io_flip/test/prompt/view/prompt_view_test.dart",
"repo_id": "io_flip",
"token_count": 1113
} | 852 |
import 'package:flutter/material.dart' hide Card;
import 'package:flutter_test/flutter_test.dart';
import 'package:game_domain/game_domain.dart';
import 'package:io_flip/share/widgets/widgets.dart';
import 'package:io_flip_ui/io_flip_ui.dart';
import 'package:mocktail_image_network/mocktail_image_network.dart';
import '../../helpers/helpers.dart';
const card = Card(
id: '',
name: 'name',
description: 'description',
image: '',
rarity: false,
power: 1,
suit: Suit.air,
);
void main() {
group('CardFan', () {
testWidgets('renders', (tester) async {
await tester.pumpSubject();
expect(find.byType(CardFan), findsOneWidget);
});
testWidgets('renders a GameCard', (tester) async {
await tester.pumpSubject();
expect(find.byType(GameCard), findsNWidgets(3));
});
});
}
extension ShareCardDialogTest on WidgetTester {
Future<void> pumpSubject() async {
await mockNetworkImages(() {
return pumpApp(
const Scaffold(
body: CardFan(
cards: [card, card, card],
),
),
);
});
}
}
| io_flip/test/share/widgets/card_fan_test.dart/0 | {
"file_path": "io_flip/test/share/widgets/card_fan_test.dart",
"repo_id": "io_flip",
"token_count": 459
} | 853 |
---
sidebar_position: 6
description: Learn how to configure authentication in your Flutter news application.
---
# Authentication
Currently, the Flutter News Toolkit project supports multiple ways of authentication such as `email`, `google`, `apple`, `twitter`, and `facebook` login.
The current implementation of the login functionality can be found in [FirebaseAuthenticationClient](https://github.com/flutter/news_toolkit/blob/main/flutter_news_example/packages/authentication_client/firebase_authentication_client/lib/src/firebase_authentication_client.dart#L20) inside the `packages/authentication_client` package.
The package depends on the third-party packages that expose authentication methods such as:
- `firebase_auth`
- `flutter_facebook_auth`
- `google_sign_in`
- `sign_in_with_apple`
- `twitter_login`
To enable authentication, configure each authentication method:
- For email login, enable the **Email/password sign-in provider** in the Firebase Console of your project. In the same section, enable the **Email link sign-in method**. On the dynamic links page, set up a new dynamic link URL prefix (for example, `yourApplicationName.page.link`) with a dynamic link URL of "/email_login".
- For Google login, enable the **Google sign-in provider** in the Firebase Console of your project. You might need to generate a `SHA1` key for use with Android.
- For Apple login, [configure sign-in with Apple](https://firebase.google.com/docs/auth/ios/apple#configure-sign-in-with-apple) in the Apple's developer portal and [enable the **Apple sign-in provider**](https://firebase.google.com/docs/auth/ios/apple#enable-apple-as-a-sign-in-provider) in the Firebase Console of your project.
- For Twitter login, register an app in the Twitter developer portal and enable the **Twitter sign-in provider** in the Firebase Console of your project.
- For Facebook login, register an app in the Facebook developer portal and enable the **Facebook sign-in provider** in the Firebase Console of your project.
Once configured, make sure to update the Firebase config file (Google services) in your application.
For more detailed information about these authentication methods, check out the [firebase.google.com](https://firebase.google.com/docs/auth/flutter/federated-auth) documentation.
| news_toolkit/docs/docs/flutter_development/authentication.md/0 | {
"file_path": "news_toolkit/docs/docs/flutter_development/authentication.md",
"repo_id": "news_toolkit",
"token_count": 590
} | 854 |
---
sidebar_position: 1
description: Learn how to configure your repository on GitHub.
---
# GitHub setup
Below are the recommended configuration settings for your repository on GitHub. Note that you're welcome to use other development hosting services, if desired.
## Create repository
If you don't already have an account, please follow GitHub's [getting started guide](https://docs.github.com/en/get-started/onboarding/getting-started-with-your-github-account) to generate and configure your account. Check out the instructions to [create a repo](https://docs.github.com/en/get-started/quickstart/create-a-repo).
## Branch protection rules
You can protect important branches by setting _branch protection rules_, which define whether collaborators can delete or force push to a branch, and set requirements for pushing to a branch, such as passing status checks or requiring a linear commit history. We recommend that you enable the following branch protection rules for your project:
- Require a pull request before merging (require approvals, dismiss stale pull request approvals when new commits are pushed, require review from code owners).
- Require status checks to pass before merging (require branches to be up to date before merging).
- Require linear history.
To learn more, check out [branch protection rules](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches).
## Slack integration
The GitHub integration for Slack gives you and your team full visibility into your GitHub projects right in Slack channels, where you can generate ideas, triage issues, and collaborate with other teams to move projects forward. To configure this for your repository, check out [GitHub and Slack integration](https://github.com/integrations/slack/blob/master/README.md) (recommended).
## Configuring PR merges
Whenever you propose a change in Git, you create a new branch. [Branch management](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository) is an important part of the Git workflow. After some time, your list of branches will grow, so it's a good idea to delete merged or stale branches.
To streamline branch management, you can automatically delete head branches after pull requests are merged in your repository. To set this up, check out [how to automatically delete branches](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-the-automatic-deletion-of-branches).
In addition, you can allow or disallow auto-merge for pull requests in your repository. To set this up for your project, check out [managing automerge for PRs](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository).
## Draft PRs
You can set it up so that a new pull request can be optionally created as a draft PR or a standard PR. To learn how to set this up, check out [introducing draft pull requests](https://github.blog/2019-02-14-introducing-draft-pull-requests/). Draft pull requests can't be merged and code owners aren't automatically notified to review them. However, you can collaborate with other team members in GitHub when using this feature. We recommended using draft pull requests for your project, but this isn't a requirement.
:::note
If any of the above features aren't available to you, your account might need to be upgraded. For an overview of your options, check out [GitHub's products](https://docs.github.com/en/get-started/learning-about-github/githubs-products).
:::
| news_toolkit/docs/docs/project_configuration/github.md/0 | {
"file_path": "news_toolkit/docs/docs/project_configuration/github.md",
"repo_id": "news_toolkit",
"token_count": 954
} | 855 |
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="production" type="FlutterRunConfigurationType" factoryName="Flutter" singleton="false">
<option name="additionalArgs" value="--dart-define FLAVOR_DEEP_LINK_DOMAIN=googlenewstemplate.page.link --dart-define FLAVOR_DEEP_LINK_PATH=email_login --dart-define TWITTER_API_KEY=jxG8uZsNuHxn6oeUZm8wfWFcH --dart-define TWITTER_API_SECRET=eQMm0mdvraBIxh418IVGsujj6XnHwTEICLoIex7X7wMcJvEytI --dart-define TWITTER_REDIRECT_URI=google-news-template://" />
<option name="buildFlavor" value="production" />
<option name="filePath" value="$PROJECT_DIR$/lib/main/main_production.dart" />
<method v="2" />
</configuration>
</component> | news_toolkit/flutter_news_example/.idea/runConfigurations/production.xml/0 | {
"file_path": "news_toolkit/flutter_news_example/.idea/runConfigurations/production.xml",
"repo_id": "news_toolkit",
"token_count": 282
} | 856 |
buildscript {
ext.kotlin_version = '1.8.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
| news_toolkit/flutter_news_example/android/build.gradle/0 | {
"file_path": "news_toolkit/flutter_news_example/android/build.gradle",
"repo_id": "news_toolkit",
"token_count": 323
} | 857 |
import 'package:news_blocks/news_blocks.dart';
/// {@template news_item}
/// An class that contains metadata representing a news item.
/// News items contain the post used within a news feed as well as
/// the article content.
/// {@endtemplate}
class NewsItem {
/// {@macro post}
const NewsItem({
required this.content,
required this.contentPreview,
required this.post,
required this.url,
this.relatedArticles = const [],
});
/// The associated content.
final List<NewsBlock> content;
/// The associated preview of the content.
final List<NewsBlock> contentPreview;
/// The associated [PostBlock] for the feed.
final PostBlock post;
/// The associated article url.
final Uri url;
/// The related articles.
final List<NewsBlock> relatedArticles;
}
| news_toolkit/flutter_news_example/api/lib/src/data/models/news_item.dart/0 | {
"file_path": "news_toolkit/flutter_news_example/api/lib/src/data/models/news_item.dart",
"repo_id": "news_toolkit",
"token_count": 232
} | 858 |
import 'package:equatable/equatable.dart';
import 'package:flutter_news_example_api/api.dart';
import 'package:json_annotation/json_annotation.dart';
part 'current_user_response.g.dart';
/// {@template current_user_response}
/// A response object which contains the current user.
/// {@endtemplate}
@JsonSerializable(explicitToJson: true)
class CurrentUserResponse extends Equatable {
/// {@macro current_user_response}
const CurrentUserResponse({required this.user});
/// Converts a `Map<String, dynamic>` into a
/// [CurrentUserResponse] instance.
factory CurrentUserResponse.fromJson(Map<String, dynamic> json) =>
_$CurrentUserResponseFromJson(json);
/// The associated current user.
final User user;
/// Converts the current instance to a `Map<String, dynamic>`.
Map<String, dynamic> toJson() => _$CurrentUserResponseToJson(this);
@override
List<Object> get props => [user];
}
| news_toolkit/flutter_news_example/api/lib/src/models/current_user_response/current_user_response.dart/0 | {
"file_path": "news_toolkit/flutter_news_example/api/lib/src/models/current_user_response/current_user_response.dart",
"repo_id": "news_toolkit",
"token_count": 283
} | 859 |
targets:
$default:
builders:
source_gen|combining_builder:
options:
ignore_for_file:
- cast_nullable_to_non_nullable
- implicit_dynamic_parameter
- lines_longer_than_80_chars
- prefer_const_constructors
- require_trailing_commas
json_serializable:
options:
create_to_json: true
create_factory: true
checked: true
explicit_to_json: true
field_rename: snake
include_if_null: false
| news_toolkit/flutter_news_example/api/packages/news_blocks/build.yaml/0 | {
"file_path": "news_toolkit/flutter_news_example/api/packages/news_blocks/build.yaml",
"repo_id": "news_toolkit",
"token_count": 281
} | 860 |
import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';
import 'package:news_blocks/news_blocks.dart';
/// {@template news_block}
/// A reusable news block which represents a content-based component.
/// {@endtemplate}
@immutable
@JsonSerializable()
abstract class NewsBlock {
/// {@macro news_block}
const NewsBlock({required this.type});
/// The block type key used to identify the type of block/metadata.
final String type;
/// Converts the current instance to a `Map<String, dynamic>`.
Map<String, dynamic> toJson();
/// Deserialize [json] into a [NewsBlock] instance.
/// Returns [UnknownBlock] when the [json] is not a recognized type.
static NewsBlock fromJson(Map<String, dynamic> json) {
final type = json['type'] as String?;
switch (type) {
case SectionHeaderBlock.identifier:
return SectionHeaderBlock.fromJson(json);
case DividerHorizontalBlock.identifier:
return DividerHorizontalBlock.fromJson(json);
case SpacerBlock.identifier:
return SpacerBlock.fromJson(json);
case PostLargeBlock.identifier:
return PostLargeBlock.fromJson(json);
case PostMediumBlock.identifier:
return PostMediumBlock.fromJson(json);
case PostSmallBlock.identifier:
return PostSmallBlock.fromJson(json);
case PostGridGroupBlock.identifier:
return PostGridGroupBlock.fromJson(json);
case PostGridTileBlock.identifier:
return PostGridTileBlock.fromJson(json);
case TextCaptionBlock.identifier:
return TextCaptionBlock.fromJson(json);
case TextHeadlineBlock.identifier:
return TextHeadlineBlock.fromJson(json);
case TextLeadParagraphBlock.identifier:
return TextLeadParagraphBlock.fromJson(json);
case TextParagraphBlock.identifier:
return TextParagraphBlock.fromJson(json);
case ImageBlock.identifier:
return ImageBlock.fromJson(json);
case NewsletterBlock.identifier:
return NewsletterBlock.fromJson(json);
case ArticleIntroductionBlock.identifier:
return ArticleIntroductionBlock.fromJson(json);
case VideoBlock.identifier:
return VideoBlock.fromJson(json);
case VideoIntroductionBlock.identifier:
return VideoIntroductionBlock.fromJson(json);
case BannerAdBlock.identifier:
return BannerAdBlock.fromJson(json);
case HtmlBlock.identifier:
return HtmlBlock.fromJson(json);
case TrendingStoryBlock.identifier:
return TrendingStoryBlock.fromJson(json);
case SlideshowBlock.identifier:
return SlideshowBlock.fromJson(json);
case SlideBlock.identifier:
return SlideBlock.fromJson(json);
case SlideshowIntroductionBlock.identifier:
return SlideshowIntroductionBlock.fromJson(json);
}
return const UnknownBlock();
}
}
| news_toolkit/flutter_news_example/api/packages/news_blocks/lib/src/news_block.dart/0 | {
"file_path": "news_toolkit/flutter_news_example/api/packages/news_blocks/lib/src/news_block.dart",
"repo_id": "news_toolkit",
"token_count": 1040
} | 861 |
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:news_blocks/news_blocks.dart';
part 'section_header_block.g.dart';
/// {@template section_header_block}
/// A block which represents a section header.
/// https://www.figma.com/file/RajSN6YbRqTuqvdKYtij3b/Google-News-Template-App-v3?node-id=179%3A13701
/// {@endtemplate}
@JsonSerializable()
class SectionHeaderBlock with EquatableMixin implements NewsBlock {
/// {@macro section_header_block}
const SectionHeaderBlock({
required this.title,
this.action,
this.type = SectionHeaderBlock.identifier,
});
/// Converts a `Map<String, dynamic>` into a [SectionHeaderBlock] instance.
factory SectionHeaderBlock.fromJson(Map<String, dynamic> json) =>
_$SectionHeaderBlockFromJson(json);
/// The section header block type identifier.
static const identifier = '__section_header__';
/// The title of the section header.
final String title;
/// An optional action which occurs upon interaction.
@BlockActionConverter()
final BlockAction? action;
@override
final String type;
@override
Map<String, dynamic> toJson() => _$SectionHeaderBlockToJson(this);
@override
List<Object?> get props => [title, action, type];
}
| news_toolkit/flutter_news_example/api/packages/news_blocks/lib/src/section_header_block.dart/0 | {
"file_path": "news_toolkit/flutter_news_example/api/packages/news_blocks/lib/src/section_header_block.dart",
"repo_id": "news_toolkit",
"token_count": 410
} | 862 |
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:news_blocks/news_blocks.dart';
part 'text_paragraph_block.g.dart';
/// {@template text_paragraph_block}
/// A block which represents a text paragraph.
/// https://www.figma.com/file/RajSN6YbRqTuqvdKYtij3b/Google-News-Template-App-v3?node-id=35%3A5007
/// {@endtemplate}
@JsonSerializable()
class TextParagraphBlock with EquatableMixin implements NewsBlock {
/// {@macro text_paragraph_block}
const TextParagraphBlock({
required this.text,
this.type = TextParagraphBlock.identifier,
});
/// Converts a `Map<String, dynamic>` into a [TextParagraphBlock] instance.
factory TextParagraphBlock.fromJson(Map<String, dynamic> json) =>
_$TextParagraphBlockFromJson(json);
/// The text paragraph block type identifier.
static const identifier = '__text_paragraph__';
/// The text of the text paragraph.
final String text;
@override
final String type;
@override
Map<String, dynamic> toJson() => _$TextParagraphBlockToJson(this);
@override
List<Object?> get props => [text, type];
}
| news_toolkit/flutter_news_example/api/packages/news_blocks/lib/src/text_paragraph_block.dart/0 | {
"file_path": "news_toolkit/flutter_news_example/api/packages/news_blocks/lib/src/text_paragraph_block.dart",
"repo_id": "news_toolkit",
"token_count": 379
} | 863 |
// ignore_for_file: prefer_const_constructors
import 'package:news_blocks/src/divider_horizontal_block.dart';
import 'package:test/test.dart';
void main() {
group('DividerHorizontalBlock', () {
test('can be (de)serialized', () {
final block = DividerHorizontalBlock();
expect(DividerHorizontalBlock.fromJson(block.toJson()), equals(block));
});
});
}
| news_toolkit/flutter_news_example/api/packages/news_blocks/test/src/divider_horizontal_block_test.dart/0 | {
"file_path": "news_toolkit/flutter_news_example/api/packages/news_blocks/test/src/divider_horizontal_block_test.dart",
"repo_id": "news_toolkit",
"token_count": 137
} | 864 |
// ignore_for_file: prefer_const_constructors
import 'package:news_blocks/news_blocks.dart';
import 'package:test/test.dart';
void main() {
group('SpacerBlock', () {
test('can be (de)serialized', () {
final block = SpacerBlock(spacing: Spacing.medium);
expect(SpacerBlock.fromJson(block.toJson()), equals(block));
});
});
}
| news_toolkit/flutter_news_example/api/packages/news_blocks/test/src/spacer_block_test.dart/0 | {
"file_path": "news_toolkit/flutter_news_example/api/packages/news_blocks/test/src/spacer_block_test.dart",
"repo_id": "news_toolkit",
"token_count": 133
} | 865 |
import 'dart:io';
import 'package:dart_frog/dart_frog.dart';
Response onRequest(RequestContext context) {
if (context.request.method != HttpMethod.post) {
return Response(statusCode: HttpStatus.methodNotAllowed);
}
return Response(statusCode: HttpStatus.created);
}
| news_toolkit/flutter_news_example/api/routes/api/v1/newsletter/subscription.dart/0 | {
"file_path": "news_toolkit/flutter_news_example/api/routes/api/v1/newsletter/subscription.dart",
"repo_id": "news_toolkit",
"token_count": 93
} | 866 |
// ignore_for_file: prefer_const_constructors
import 'dart:io';
import 'package:dart_frog/dart_frog.dart';
import 'package:flutter_news_example_api/api.dart';
import 'package:mocktail/mocktail.dart';
import 'package:test/test.dart';
import '../../../routes/api/v1/users/me.dart' as route;
class _MockRequestContext extends Mock implements RequestContext {}
class _MockNewsDataSource extends Mock implements NewsDataSource {}
class _MockRequestUser extends Mock implements RequestUser {}
void main() {
late NewsDataSource newsDataSource;
setUp(() {
newsDataSource = _MockNewsDataSource();
});
group('GET /api/v1/users/me', () {
test('responds with a 400 when user is anonymous.', () async {
final request = Request('GET', Uri.parse('http://127.0.0.1/'));
final context = _MockRequestContext();
when(() => context.request).thenReturn(request);
when(() => context.read<RequestUser>()).thenReturn(RequestUser.anonymous);
final response = await route.onRequest(context);
expect(response.statusCode, equals(HttpStatus.badRequest));
});
test('responds with a 404 when user is not found.', () async {
const userId = '__userId__';
final request = Request('GET', Uri.parse('http://127.0.0.1/'));
final user = _MockRequestUser();
when(() => user.id).thenReturn(userId);
when(() => user.isAnonymous).thenReturn(false);
final context = _MockRequestContext();
when(() => context.request).thenReturn(request);
when(() => context.read<NewsDataSource>()).thenReturn(newsDataSource);
when(() => context.read<RequestUser>()).thenReturn(user);
when(
() => newsDataSource.getUser(userId: any(named: 'userId')),
).thenAnswer((_) async => null);
final response = await route.onRequest(context);
expect(response.statusCode, equals(HttpStatus.notFound));
verify(() => newsDataSource.getUser(userId: userId)).called(1);
});
test('responds with a 200 when user is found.', () async {
const userId = '__userId__';
final user = User(id: 'id', subscription: SubscriptionPlan.basic);
final request = Request('GET', Uri.parse('http://127.0.0.1/'));
final requestUser = _MockRequestUser();
when(() => requestUser.id).thenReturn(userId);
when(() => requestUser.isAnonymous).thenReturn(false);
final context = _MockRequestContext();
when(() => context.request).thenReturn(request);
when(() => context.read<NewsDataSource>()).thenReturn(newsDataSource);
when(() => context.read<RequestUser>()).thenReturn(requestUser);
when(
() => newsDataSource.getUser(userId: any(named: 'userId')),
).thenAnswer((_) async => user);
final expected = CurrentUserResponse(user: user);
final response = await route.onRequest(context);
expect(response.statusCode, equals(HttpStatus.ok));
expect(response.json(), completion(equals(expected.toJson())));
verify(() => newsDataSource.getUser(userId: userId)).called(1);
});
});
test('responds with 405 when method is not GET.', () async {
final request = Request('POST', Uri.parse('http://127.0.0.1/'));
final context = _MockRequestContext();
when(() => context.request).thenReturn(request);
final response = await route.onRequest(context);
expect(response.statusCode, equals(HttpStatus.methodNotAllowed));
});
}
| news_toolkit/flutter_news_example/api/test/routes/users/me_test.dart/0 | {
"file_path": "news_toolkit/flutter_news_example/api/test/routes/users/me_test.dart",
"repo_id": "news_toolkit",
"token_count": 1216
} | 867 |
import 'dart:async';
import 'package:analytics_repository/analytics_repository.dart' as analytics;
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:user_repository/user_repository.dart';
part 'analytics_event.dart';
part 'analytics_state.dart';
class AnalyticsBloc extends Bloc<AnalyticsEvent, AnalyticsState> {
AnalyticsBloc({
required analytics.AnalyticsRepository analyticsRepository,
required UserRepository userRepository,
}) : _analyticsRepository = analyticsRepository,
super(AnalyticsInitial()) {
on<TrackAnalyticsEvent>(_onTrackAnalyticsEvent);
_userSubscription = userRepository.user.listen(_onUserChanged);
}
final analytics.AnalyticsRepository _analyticsRepository;
late StreamSubscription<User> _userSubscription;
Future<void> _onUserChanged(User user) async {
try {
await _analyticsRepository
.setUserId(user != User.anonymous ? user.id : null);
} catch (error, stackTrace) {
addError(error, stackTrace);
}
}
Future<void> _onTrackAnalyticsEvent(
TrackAnalyticsEvent event,
Emitter<AnalyticsState> emit,
) async {
try {
await _analyticsRepository.track(event.event);
} catch (error, stackTrace) {
addError(error, stackTrace);
}
}
@override
Future<void> close() {
_userSubscription.cancel();
return super.close();
}
}
| news_toolkit/flutter_news_example/lib/analytics/bloc/analytics_bloc.dart/0 | {
"file_path": "news_toolkit/flutter_news_example/lib/analytics/bloc/analytics_bloc.dart",
"repo_id": "news_toolkit",
"token_count": 501
} | 868 |
import 'package:app_ui/app_ui.dart';
import 'package:article_repository/article_repository.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_news_example/ads/ads.dart';
import 'package:flutter_news_example/app/app.dart';
import 'package:flutter_news_example/article/article.dart';
import 'package:flutter_news_example/l10n/l10n.dart';
import 'package:flutter_news_example/subscriptions/subscriptions.dart';
import 'package:news_blocks_ui/news_blocks_ui.dart';
import 'package:share_launcher/share_launcher.dart';
/// The supported behaviors for interstitial ad.
enum InterstitialAdBehavior {
/// Displays the ad when opening the article.
onOpen,
/// Displays the ad when closing the article.
onClose,
}
class ArticlePage extends StatelessWidget {
const ArticlePage({
required this.id,
required this.isVideoArticle,
required this.interstitialAdBehavior,
super.key,
});
/// The id of the requested article.
final String id;
/// Whether the requested article is a video article.
final bool isVideoArticle;
/// Indicates when the interstitial ad will be displayed.
/// Default to [InterstitialAdBehavior.onOpen]
final InterstitialAdBehavior interstitialAdBehavior;
static Route<void> route({
required String id,
bool isVideoArticle = false,
InterstitialAdBehavior interstitialAdBehavior =
InterstitialAdBehavior.onOpen,
}) =>
MaterialPageRoute<void>(
builder: (_) => ArticlePage(
id: id,
isVideoArticle: isVideoArticle,
interstitialAdBehavior: interstitialAdBehavior,
),
);
@override
Widget build(BuildContext context) {
return BlocProvider<ArticleBloc>(
create: (_) => ArticleBloc(
articleId: id,
shareLauncher: const ShareLauncher(),
articleRepository: context.read<ArticleRepository>(),
)..add(const ArticleRequested()),
child: ArticleView(
isVideoArticle: isVideoArticle,
interstitialAdBehavior: interstitialAdBehavior,
),
);
}
}
class ArticleView extends StatelessWidget {
const ArticleView({
required this.isVideoArticle,
required this.interstitialAdBehavior,
super.key,
});
final bool isVideoArticle;
final InterstitialAdBehavior interstitialAdBehavior;
@override
Widget build(BuildContext context) {
final backgroundColor =
isVideoArticle ? AppColors.darkBackground : AppColors.white;
final foregroundColor =
isVideoArticle ? AppColors.white : AppColors.highEmphasisSurface;
final uri = context.select((ArticleBloc bloc) => bloc.state.uri);
final isSubscriber =
context.select<AppBloc, bool>((bloc) => bloc.state.isUserSubscribed);
return WillPopScope(
onWillPop: () async {
_onPop(context);
return true;
},
child: HasToShowInterstitialAdListener(
interstitialAdBehavior: interstitialAdBehavior,
child: HasReachedArticleLimitListener(
child: HasWatchedRewardedAdListener(
child: Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarIconBrightness:
isVideoArticle ? Brightness.light : Brightness.dark,
statusBarBrightness:
isVideoArticle ? Brightness.dark : Brightness.light,
),
leading: isVideoArticle
? AppBackButton.light(
onPressed: () => _onBackButtonPressed(context),
)
: AppBackButton(
onPressed: () => _onBackButtonPressed(context),
),
actions: [
if (uri != null && uri.toString().isNotEmpty)
Padding(
key: const Key('articlePage_shareButton'),
padding: const EdgeInsets.only(right: AppSpacing.lg),
child: ShareButton(
shareText: context.l10n.shareText,
color: foregroundColor,
onPressed: () => context
.read<ArticleBloc>()
.add(ShareRequested(uri: uri)),
),
),
if (!isSubscriber) const ArticleSubscribeButton()
],
),
body: ArticleThemeOverride(
isVideoArticle: isVideoArticle,
child: const ArticleContent(),
),
),
),
),
),
);
}
void _onBackButtonPressed(BuildContext context) {
_onPop(context);
Navigator.of(context).pop();
}
void _onPop(BuildContext context) {
final state = context.read<ArticleBloc>().state;
if (state.showInterstitialAd &&
interstitialAdBehavior == InterstitialAdBehavior.onClose) {
context
.read<FullScreenAdsBloc>()
.add(const ShowInterstitialAdRequested());
}
}
}
@visibleForTesting
class ArticleSubscribeButton extends StatelessWidget {
const ArticleSubscribeButton({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(right: AppSpacing.lg),
child: Align(
alignment: Alignment.centerRight,
child: AppButton.smallRedWine(
onPressed: () => showPurchaseSubscriptionDialog(context: context),
child: Text(context.l10n.subscribeButtonText),
),
),
);
}
}
@visibleForTesting
class HasReachedArticleLimitListener extends StatelessWidget {
const HasReachedArticleLimitListener({super.key, this.child});
final Widget? child;
@override
Widget build(BuildContext context) {
return BlocListener<ArticleBloc, ArticleState>(
listener: (context, state) {
if (!state.hasReachedArticleViewsLimit) {
context.read<ArticleBloc>().add(const ArticleRequested());
}
},
listenWhen: (previous, current) =>
previous.hasReachedArticleViewsLimit !=
current.hasReachedArticleViewsLimit,
child: child,
);
}
}
@visibleForTesting
class HasWatchedRewardedAdListener extends StatelessWidget {
const HasWatchedRewardedAdListener({super.key, this.child});
final Widget? child;
@override
Widget build(BuildContext context) {
return BlocListener<FullScreenAdsBloc, FullScreenAdsState>(
listener: (context, state) {
if (state.earnedReward != null) {
context.read<ArticleBloc>().add(const ArticleRewardedAdWatched());
}
},
listenWhen: (previous, current) =>
previous.earnedReward != current.earnedReward,
child: child,
);
}
}
@visibleForTesting
class HasToShowInterstitialAdListener extends StatelessWidget {
const HasToShowInterstitialAdListener({
required this.child,
required this.interstitialAdBehavior,
super.key,
});
final Widget child;
final InterstitialAdBehavior interstitialAdBehavior;
@override
Widget build(BuildContext context) {
return BlocListener<ArticleBloc, ArticleState>(
listener: (context, state) {
if (state.showInterstitialAd &&
interstitialAdBehavior == InterstitialAdBehavior.onOpen) {
context
.read<FullScreenAdsBloc>()
.add(const ShowInterstitialAdRequested());
}
},
listenWhen: (previous, current) =>
previous.showInterstitialAd != current.showInterstitialAd,
child: child,
);
}
}
| news_toolkit/flutter_news_example/lib/article/view/article_page.dart/0 | {
"file_path": "news_toolkit/flutter_news_example/lib/article/view/article_page.dart",
"repo_id": "news_toolkit",
"token_count": 3219
} | 869 |
import 'dart:async';
import 'package:bloc_concurrency/bloc_concurrency.dart';
import 'package:equatable/equatable.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:news_blocks/news_blocks.dart';
import 'package:news_repository/news_repository.dart';
part 'feed_bloc.g.dart';
part 'feed_event.dart';
part 'feed_state.dart';
class FeedBloc extends HydratedBloc<FeedEvent, FeedState> {
FeedBloc({
required NewsRepository newsRepository,
}) : _newsRepository = newsRepository,
super(const FeedState.initial()) {
on<FeedRequested>(_onFeedRequested, transformer: sequential());
on<FeedRefreshRequested>(
_onFeedRefreshRequested,
transformer: droppable(),
);
on<FeedResumed>(_onFeedResumed, transformer: droppable());
}
final NewsRepository _newsRepository;
FutureOr<void> _onFeedRequested(
FeedRequested event,
Emitter<FeedState> emit,
) async {
emit(state.copyWith(status: FeedStatus.loading));
return _updateFeed(category: event.category, emit: emit);
}
FutureOr<void> _onFeedResumed(
FeedResumed event,
Emitter<FeedState> emit,
) async {
await Future.wait(
state.feed.keys.map(
(category) => _updateFeed(category: category, emit: emit),
),
);
}
Future<void> _updateFeed({
required Category category,
required Emitter<FeedState> emit,
}) async {
try {
final categoryFeed = state.feed[category] ?? [];
final response = await _newsRepository.getFeed(
category: category,
offset: categoryFeed.length,
);
// Append fetched feed blocks to the list of feed blocks
// for the given category.
final updatedCategoryFeed = [...categoryFeed, ...response.feed];
final hasMoreNewsForCategory =
response.totalCount > updatedCategoryFeed.length;
emit(
state.copyWith(
status: FeedStatus.populated,
feed: Map<Category, List<NewsBlock>>.from(state.feed)
..addAll({category: updatedCategoryFeed}),
hasMoreNews: Map<Category, bool>.from(state.hasMoreNews)
..addAll({category: hasMoreNewsForCategory}),
),
);
} catch (error, stackTrace) {
emit(state.copyWith(status: FeedStatus.failure));
addError(error, stackTrace);
}
}
@override
FeedState? fromJson(Map<String, dynamic> json) => FeedState.fromJson(json);
@override
Map<String, dynamic>? toJson(FeedState state) => state.toJson();
FutureOr<void> _onFeedRefreshRequested(
FeedRefreshRequested event,
Emitter<FeedState> emit,
) async {
emit(state.copyWith(status: FeedStatus.loading));
try {
final category = event.category;
final response = await _newsRepository.getFeed(
category: category,
offset: 0,
);
final refreshedCategoryFeed = response.feed;
final hasMoreNewsForCategory =
response.totalCount > refreshedCategoryFeed.length;
emit(
state.copyWith(
status: FeedStatus.populated,
feed: Map<Category, List<NewsBlock>>.of(state.feed)
..addAll({category: refreshedCategoryFeed}),
hasMoreNews: Map<Category, bool>.of(state.hasMoreNews)
..addAll({category: hasMoreNewsForCategory}),
),
);
} catch (error, stackTrace) {
emit(state.copyWith(status: FeedStatus.failure));
addError(error, stackTrace);
}
}
}
| news_toolkit/flutter_news_example/lib/feed/bloc/feed_bloc.dart/0 | {
"file_path": "news_toolkit/flutter_news_example/lib/feed/bloc/feed_bloc.dart",
"repo_id": "news_toolkit",
"token_count": 1372
} | 870 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.