sort_constructors_first (#22575)
This commit is contained in:
parent
a68b03e9ce
commit
2ea1d81cdc
@ -281,8 +281,6 @@ Future<ProcessResult> _resultOfGradleTask({String workingDirectory, String task,
|
||||
}
|
||||
|
||||
class _Dependencies {
|
||||
String target;
|
||||
Set<String> dependencies;
|
||||
_Dependencies(String depfilePath) {
|
||||
final RegExp _separatorExpr = RegExp(r'([^\\]) ');
|
||||
final RegExp _escapeExpr = RegExp(r'\\(.)');
|
||||
@ -301,6 +299,9 @@ class _Dependencies {
|
||||
.where((String path) => path.isNotEmpty)
|
||||
.toSet();
|
||||
}
|
||||
|
||||
String target;
|
||||
Set<String> dependencies;
|
||||
}
|
||||
|
||||
/// Returns [null] if target matches [expectedTarget], otherwise returns an error message.
|
||||
|
@ -100,6 +100,12 @@ abstract class Device {
|
||||
}
|
||||
|
||||
class AndroidDeviceDiscovery implements DeviceDiscovery {
|
||||
factory AndroidDeviceDiscovery() {
|
||||
return _instance ??= AndroidDeviceDiscovery._();
|
||||
}
|
||||
|
||||
AndroidDeviceDiscovery._();
|
||||
|
||||
// Parses information about a device. Example:
|
||||
//
|
||||
// 015d172c98400a03 device usb:340787200X product:nakasi model:Nexus_7 device:grouper
|
||||
@ -107,12 +113,6 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
|
||||
|
||||
static AndroidDeviceDiscovery _instance;
|
||||
|
||||
factory AndroidDeviceDiscovery() {
|
||||
return _instance ??= AndroidDeviceDiscovery._();
|
||||
}
|
||||
|
||||
AndroidDeviceDiscovery._();
|
||||
|
||||
AndroidDevice _workingDevice;
|
||||
|
||||
@override
|
||||
@ -349,15 +349,14 @@ class AndroidDevice implements Device {
|
||||
}
|
||||
|
||||
class IosDeviceDiscovery implements DeviceDiscovery {
|
||||
|
||||
static IosDeviceDiscovery _instance;
|
||||
|
||||
factory IosDeviceDiscovery() {
|
||||
return _instance ??= IosDeviceDiscovery._();
|
||||
}
|
||||
|
||||
IosDeviceDiscovery._();
|
||||
|
||||
static IosDeviceDiscovery _instance;
|
||||
|
||||
IosDevice _workingDevice;
|
||||
|
||||
@override
|
||||
|
@ -49,17 +49,6 @@ Future<TaskResult> task(TaskFunction task) {
|
||||
}
|
||||
|
||||
class _TaskRunner {
|
||||
static final Logger logger = Logger('TaskRunner');
|
||||
|
||||
final TaskFunction task;
|
||||
|
||||
// TODO(ianh): workaround for https://github.com/dart-lang/sdk/issues/23797
|
||||
RawReceivePort _keepAlivePort;
|
||||
Timer _startTaskTimeout;
|
||||
bool _taskStarted = false;
|
||||
|
||||
final Completer<TaskResult> _completer = Completer<TaskResult>();
|
||||
|
||||
_TaskRunner(this.task) {
|
||||
registerExtension('ext.cocoonRunTask',
|
||||
(String method, Map<String, String> parameters) async {
|
||||
@ -75,6 +64,17 @@ class _TaskRunner {
|
||||
});
|
||||
}
|
||||
|
||||
final TaskFunction task;
|
||||
|
||||
// TODO(ianh): workaround for https://github.com/dart-lang/sdk/issues/23797
|
||||
RawReceivePort _keepAlivePort;
|
||||
Timer _startTaskTimeout;
|
||||
bool _taskStarted = false;
|
||||
|
||||
final Completer<TaskResult> _completer = Completer<TaskResult>();
|
||||
|
||||
static final Logger logger = Logger('TaskRunner');
|
||||
|
||||
/// Signals that this task runner finished running the task.
|
||||
Future<TaskResult> get whenDone => _completer.future;
|
||||
|
||||
|
@ -26,11 +26,11 @@ TaskFunction combine(List<TaskFunction> tasks) {
|
||||
/// Defines task that creates new Flutter project, adds a plugin, and then
|
||||
/// builds the specified [buildTarget].
|
||||
class PluginTest {
|
||||
PluginTest(this.buildTarget, this.options);
|
||||
|
||||
final String buildTarget;
|
||||
final List<String> options;
|
||||
|
||||
PluginTest(this.buildTarget, this.options);
|
||||
|
||||
Future<TaskResult> call() async {
|
||||
section('Create Flutter project');
|
||||
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_devicelab_plugin_test.');
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
/// A pair of values. Used for testing custom codecs.
|
||||
class Pair {
|
||||
Pair(this.left, this.right);
|
||||
|
||||
final dynamic left;
|
||||
final dynamic right;
|
||||
|
||||
Pair(this.left, this.right);
|
||||
|
||||
@override
|
||||
String toString() => 'Pair[$left, $right]';
|
||||
}
|
||||
|
@ -25,13 +25,6 @@ const String nothing = '-';
|
||||
/// - The Flutter app records the incoming reply echo.
|
||||
/// - The platform finally replies to the original message with another echo.
|
||||
class TestStepResult {
|
||||
static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
|
||||
static const TestStepResult complete = TestStepResult(
|
||||
'Test complete',
|
||||
nothing,
|
||||
TestStatus.complete,
|
||||
);
|
||||
|
||||
const TestStepResult(
|
||||
this.name,
|
||||
this.description,
|
||||
@ -71,6 +64,13 @@ class TestStepResult {
|
||||
final dynamic replyEcho;
|
||||
final dynamic error;
|
||||
|
||||
static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
|
||||
static const TestStepResult complete = TestStepResult(
|
||||
'Test complete',
|
||||
nothing,
|
||||
TestStatus.complete,
|
||||
);
|
||||
|
||||
Widget asWidget(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
@ -13,13 +13,6 @@ typedef TestStep = Future<TestStepResult> Function();
|
||||
const String nothing = '-';
|
||||
|
||||
class TestStepResult {
|
||||
static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
|
||||
static const TestStepResult complete = TestStepResult(
|
||||
'Test complete',
|
||||
nothing,
|
||||
TestStatus.complete,
|
||||
);
|
||||
|
||||
const TestStepResult(this.name, this.description, this.status);
|
||||
|
||||
factory TestStepResult.fromSnapshot(AsyncSnapshot<TestStepResult> snapshot) {
|
||||
@ -45,6 +38,13 @@ class TestStepResult {
|
||||
final String description;
|
||||
final TestStatus status;
|
||||
|
||||
static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
|
||||
static const TestStepResult complete = TestStepResult(
|
||||
'Test complete',
|
||||
nothing,
|
||||
TestStatus.complete,
|
||||
);
|
||||
|
||||
Widget asWidget(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
@ -47,19 +47,6 @@ class SectionCard extends StatelessWidget {
|
||||
// The title is rendered with two overlapping text widgets that are vertically
|
||||
// offset a little. It's supposed to look sort-of 3D.
|
||||
class SectionTitle extends StatelessWidget {
|
||||
static const TextStyle sectionTitleStyle = TextStyle(
|
||||
fontFamily: 'Raleway',
|
||||
inherit: false,
|
||||
fontSize: 24.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
textBaseline: TextBaseline.alphabetic,
|
||||
);
|
||||
|
||||
static final TextStyle sectionTitleShadowStyle = sectionTitleStyle.copyWith(
|
||||
color: const Color(0x19000000),
|
||||
);
|
||||
|
||||
const SectionTitle({
|
||||
Key key,
|
||||
@required this.section,
|
||||
@ -74,6 +61,19 @@ class SectionTitle extends StatelessWidget {
|
||||
final double scale;
|
||||
final double opacity;
|
||||
|
||||
static const TextStyle sectionTitleStyle = TextStyle(
|
||||
fontFamily: 'Raleway',
|
||||
inherit: false,
|
||||
fontSize: 24.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
textBaseline: TextBaseline.alphabetic,
|
||||
);
|
||||
|
||||
static final TextStyle sectionTitleShadowStyle = sectionTitleStyle.copyWith(
|
||||
color: const Color(0x19000000),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IgnorePointer(
|
||||
|
@ -83,9 +83,6 @@ class ColorItem extends StatelessWidget {
|
||||
}
|
||||
|
||||
class PaletteTabView extends StatelessWidget {
|
||||
static const List<int> primaryKeys = <int>[50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
|
||||
static const List<int> accentKeys = <int>[100, 200, 400, 700];
|
||||
|
||||
PaletteTabView({
|
||||
Key key,
|
||||
@required this.colors,
|
||||
@ -94,6 +91,9 @@ class PaletteTabView extends StatelessWidget {
|
||||
|
||||
final Palette colors;
|
||||
|
||||
static const List<int> primaryKeys = <int>[50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
|
||||
static const List<int> accentKeys = <int>[100, 200, 400, 700];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final TextTheme textTheme = Theme.of(context).textTheme;
|
||||
|
@ -432,14 +432,14 @@ class _RecipePageState extends State<RecipePage> {
|
||||
|
||||
/// Displays the recipe's name and instructions.
|
||||
class RecipeSheet extends StatelessWidget {
|
||||
RecipeSheet({ Key key, this.recipe }) : super(key: key);
|
||||
|
||||
final TextStyle titleStyle = const PestoStyle(fontSize: 34.0);
|
||||
final TextStyle descriptionStyle = const PestoStyle(fontSize: 15.0, color: Colors.black54, height: 24.0/15.0);
|
||||
final TextStyle itemStyle = const PestoStyle(fontSize: 15.0, height: 24.0/15.0);
|
||||
final TextStyle itemAmountStyle = PestoStyle(fontSize: 15.0, color: _kTheme.primaryColor, height: 24.0/15.0);
|
||||
final TextStyle headingStyle = const PestoStyle(fontSize: 16.0, fontWeight: FontWeight.bold, height: 24.0/15.0);
|
||||
|
||||
RecipeSheet({ Key key, this.recipe }) : super(key: key);
|
||||
|
||||
final Recipe recipe;
|
||||
|
||||
@override
|
||||
|
@ -14,13 +14,13 @@ const String beeUri =
|
||||
'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4';
|
||||
|
||||
class VideoCard extends StatelessWidget {
|
||||
const VideoCard({Key key, this.controller, this.title, this.subtitle})
|
||||
: super(key: key);
|
||||
|
||||
final VideoPlayerController controller;
|
||||
final String title;
|
||||
final String subtitle;
|
||||
|
||||
const VideoCard({Key key, this.controller, this.title, this.subtitle})
|
||||
: super(key: key);
|
||||
|
||||
Widget _buildInlineVideo() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 30.0),
|
||||
@ -93,10 +93,10 @@ class VideoCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
class VideoPlayerLoading extends StatefulWidget {
|
||||
final VideoPlayerController controller;
|
||||
|
||||
const VideoPlayerLoading(this.controller);
|
||||
|
||||
final VideoPlayerController controller;
|
||||
|
||||
@override
|
||||
_VideoPlayerLoadingState createState() => _VideoPlayerLoadingState();
|
||||
}
|
||||
@ -137,18 +137,15 @@ class _VideoPlayerLoadingState extends State<VideoPlayerLoading> {
|
||||
}
|
||||
|
||||
class VideoPlayPause extends StatefulWidget {
|
||||
final VideoPlayerController controller;
|
||||
|
||||
const VideoPlayPause(this.controller);
|
||||
|
||||
final VideoPlayerController controller;
|
||||
|
||||
@override
|
||||
State createState() => _VideoPlayPauseState();
|
||||
}
|
||||
|
||||
class _VideoPlayPauseState extends State<VideoPlayPause> {
|
||||
FadeAnimation imageFadeAnimation;
|
||||
VoidCallback listener;
|
||||
|
||||
_VideoPlayPauseState() {
|
||||
listener = () {
|
||||
if (mounted)
|
||||
@ -156,6 +153,9 @@ class _VideoPlayPauseState extends State<VideoPlayPause> {
|
||||
};
|
||||
}
|
||||
|
||||
FadeAnimation imageFadeAnimation;
|
||||
VoidCallback listener;
|
||||
|
||||
VideoPlayerController get controller => widget.controller;
|
||||
|
||||
@override
|
||||
@ -202,14 +202,14 @@ class _VideoPlayPauseState extends State<VideoPlayPause> {
|
||||
}
|
||||
|
||||
class FadeAnimation extends StatefulWidget {
|
||||
final Widget child;
|
||||
final Duration duration;
|
||||
|
||||
const FadeAnimation({
|
||||
this.child,
|
||||
this.duration = const Duration(milliseconds: 500),
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
final Duration duration;
|
||||
|
||||
@override
|
||||
_FadeAnimationState createState() => _FadeAnimationState();
|
||||
}
|
||||
@ -265,16 +265,16 @@ class _FadeAnimationState extends State<FadeAnimation>
|
||||
}
|
||||
|
||||
class ConnectivityOverlay extends StatefulWidget {
|
||||
final Widget child;
|
||||
final Completer<Null> connectedCompleter;
|
||||
final GlobalKey<ScaffoldState> scaffoldKey;
|
||||
|
||||
const ConnectivityOverlay({
|
||||
this.child,
|
||||
this.connectedCompleter,
|
||||
this.scaffoldKey,
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
final Completer<Null> connectedCompleter;
|
||||
final GlobalKey<ScaffoldState> scaffoldKey;
|
||||
|
||||
@override
|
||||
_ConnectivityOverlayState createState() => _ConnectivityOverlayState();
|
||||
}
|
||||
|
@ -268,10 +268,6 @@ class _DemosPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
class GalleryHome extends StatefulWidget {
|
||||
// In checked mode our MaterialApp will show the default "debug" banner.
|
||||
// Otherwise show the "preview" banner.
|
||||
static bool showPreviewBanner = true;
|
||||
|
||||
const GalleryHome({
|
||||
Key key,
|
||||
this.testMode = false,
|
||||
@ -281,6 +277,10 @@ class GalleryHome extends StatefulWidget {
|
||||
final Widget optionsPage;
|
||||
final bool testMode;
|
||||
|
||||
// In checked mode our MaterialApp will show the default "debug" banner.
|
||||
// Otherwise show the "preview" banner.
|
||||
static bool showPreviewBanner = true;
|
||||
|
||||
@override
|
||||
_GalleryHomeState createState() => _GalleryHomeState();
|
||||
}
|
||||
|
@ -6,12 +6,12 @@ import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
|
||||
class RenderSolidColorBox extends RenderDecoratedBox {
|
||||
final Size desiredSize;
|
||||
final Color backgroundColor;
|
||||
|
||||
RenderSolidColorBox(this.backgroundColor, { this.desiredSize = Size.infinite })
|
||||
: super(decoration: BoxDecoration(color: backgroundColor));
|
||||
|
||||
final Size desiredSize;
|
||||
final Color backgroundColor;
|
||||
|
||||
@override
|
||||
double computeMinIntrinsicWidth(double height) {
|
||||
return desiredSize.width == double.infinity ? 0.0 : desiredSize.width;
|
||||
|
@ -16,12 +16,6 @@ import 'package:http/http.dart' as http;
|
||||
final math.Random _rng = math.Random();
|
||||
|
||||
class Stock {
|
||||
String symbol;
|
||||
String name;
|
||||
double lastSale;
|
||||
String marketCap;
|
||||
double percentChange;
|
||||
|
||||
Stock(this.symbol, this.name, this.lastSale, this.marketCap, this.percentChange);
|
||||
|
||||
Stock.fromFields(List<String> fields) {
|
||||
@ -36,6 +30,12 @@ class Stock {
|
||||
marketCap = fields[4];
|
||||
percentChange = (_rng.nextDouble() * 20) - 10;
|
||||
}
|
||||
|
||||
String symbol;
|
||||
String name;
|
||||
double lastSale;
|
||||
String marketCap;
|
||||
double percentChange;
|
||||
}
|
||||
|
||||
class StockData extends ChangeNotifier {
|
||||
|
@ -77,10 +77,6 @@ const int kMaxUnsignedSMI = 0x3FFFFFFFFFFFFFFF;
|
||||
/// A BitField over an enum (or other class whose values implement "index").
|
||||
/// Only the first 62 values of the enum can be used as indices.
|
||||
class BitField<T extends dynamic> {
|
||||
static const int _smiBits = 62; // see https://www.dartlang.org/articles/numeric-computation/#smis-and-mints
|
||||
static const int _allZeros = 0;
|
||||
static const int _allOnes = kMaxUnsignedSMI; // 2^(_kSMIBits+1)-1
|
||||
|
||||
/// Creates a bit field of all zeros.
|
||||
///
|
||||
/// The given length must be at most 62.
|
||||
@ -101,6 +97,10 @@ class BitField<T extends dynamic> {
|
||||
final int _length;
|
||||
int _bits;
|
||||
|
||||
static const int _smiBits = 62; // see https://www.dartlang.org/articles/numeric-computation/#smis-and-mints
|
||||
static const int _allZeros = 0;
|
||||
static const int _allOnes = kMaxUnsignedSMI; // 2^(_kSMIBits+1)-1
|
||||
|
||||
/// Returns whether the bit with the given index is set to one.
|
||||
bool operator [](T index) {
|
||||
assert(index.index < _length);
|
||||
|
@ -720,11 +720,11 @@ class _MonthPickerState extends State<MonthPicker> with SingleTickerProviderStat
|
||||
// Defines semantic traversal order of the top-level widgets inside the month
|
||||
// picker.
|
||||
class _MonthPickerSortKey extends OrdinalSortKey {
|
||||
const _MonthPickerSortKey(double order) : super(order);
|
||||
|
||||
static const _MonthPickerSortKey previousMonth = _MonthPickerSortKey(1.0);
|
||||
static const _MonthPickerSortKey nextMonth = _MonthPickerSortKey(2.0);
|
||||
static const _MonthPickerSortKey calendar = _MonthPickerSortKey(3.0);
|
||||
|
||||
const _MonthPickerSortKey(double order) : super(order);
|
||||
}
|
||||
|
||||
/// A scrollable list of years to allow picking a year.
|
||||
|
@ -92,13 +92,6 @@ class _InkRippleFactory extends InteractiveInkFeatureFactory {
|
||||
/// * [InkHighlight], which is an ink feature that emphasizes a part of a
|
||||
/// [Material].
|
||||
class InkRipple extends InteractiveInkFeature {
|
||||
/// Used to specify this type of ink splash for an [InkWell], [InkResponse]
|
||||
/// or material [Theme].
|
||||
static const InteractiveInkFeatureFactory splashFactory = _InkRippleFactory();
|
||||
|
||||
static final Animatable<double> _easeCurveTween = CurveTween(curve: Curves.ease);
|
||||
static final Animatable<double> _fadeOutIntervalTween = CurveTween(curve: const Interval(_kFadeOutIntervalStart, 1.0));
|
||||
|
||||
/// Begin a ripple, centered at [position] relative to [referenceBox].
|
||||
///
|
||||
/// The [controller] argument is typically obtained via
|
||||
@ -192,6 +185,13 @@ class InkRipple extends InteractiveInkFeature {
|
||||
Animation<int> _fadeOut;
|
||||
AnimationController _fadeOutController;
|
||||
|
||||
/// Used to specify this type of ink splash for an [InkWell], [InkResponse]
|
||||
/// or material [Theme].
|
||||
static const InteractiveInkFeatureFactory splashFactory = _InkRippleFactory();
|
||||
|
||||
static final Animatable<double> _easeCurveTween = CurveTween(curve: Curves.ease);
|
||||
static final Animatable<double> _fadeOutIntervalTween = CurveTween(curve: const Interval(_kFadeOutIntervalStart, 1.0));
|
||||
|
||||
@override
|
||||
void confirm() {
|
||||
_radiusController
|
||||
|
@ -96,10 +96,6 @@ class _InkSplashFactory extends InteractiveInkFeatureFactory {
|
||||
/// * [InkHighlight], which is an ink feature that emphasizes a part of a
|
||||
/// [Material].
|
||||
class InkSplash extends InteractiveInkFeature {
|
||||
/// Used to specify this type of ink splash for an [InkWell], [InkResponse]
|
||||
/// or material [Theme].
|
||||
static const InteractiveInkFeatureFactory splashFactory = _InkSplashFactory();
|
||||
|
||||
/// Begin a splash, centered at position relative to [referenceBox].
|
||||
///
|
||||
/// The [controller] argument is typically obtained via
|
||||
@ -169,6 +165,10 @@ class InkSplash extends InteractiveInkFeature {
|
||||
Animation<int> _alpha;
|
||||
AnimationController _alphaController;
|
||||
|
||||
/// Used to specify this type of ink splash for an [InkWell], [InkResponse]
|
||||
/// or material [Theme].
|
||||
static const InteractiveInkFeatureFactory splashFactory = _InkSplashFactory();
|
||||
|
||||
@override
|
||||
void confirm() {
|
||||
final int duration = (_targetRadius / _kSplashConfirmedVelocity).floor();
|
||||
|
@ -28,13 +28,6 @@ import 'package:flutter/widgets.dart';
|
||||
/// rounded rectangle around the input decorator's container.
|
||||
/// * [InputDecoration], which is used to configure an [InputDecorator].
|
||||
abstract class InputBorder extends ShapeBorder {
|
||||
/// No input border.
|
||||
///
|
||||
/// Use this value with [InputDecoration.border] to specify that no border
|
||||
/// should be drawn. The [InputDecoration.shrinkWrap] constructor sets
|
||||
/// its border to this value.
|
||||
static const InputBorder none = _NoInputBorder();
|
||||
|
||||
/// Creates a border for an [InputDecorator].
|
||||
///
|
||||
/// The [borderSide] parameter must not be null. Applications typically do
|
||||
@ -45,6 +38,13 @@ abstract class InputBorder extends ShapeBorder {
|
||||
this.borderSide = BorderSide.none,
|
||||
}) : assert(borderSide != null);
|
||||
|
||||
/// No input border.
|
||||
///
|
||||
/// Use this value with [InputDecoration.border] to specify that no border
|
||||
/// should be drawn. The [InputDecoration.shrinkWrap] constructor sets
|
||||
/// its border to this value.
|
||||
static const InputBorder none = _NoInputBorder();
|
||||
|
||||
/// Defines the border line's color and weight.
|
||||
///
|
||||
/// The [InputDecorator] creates copies of its input border, using [copyWith],
|
||||
|
@ -69,6 +69,20 @@ abstract class ProgressIndicator extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LinearProgressIndicatorPainter extends CustomPainter {
|
||||
const _LinearProgressIndicatorPainter({
|
||||
this.backgroundColor,
|
||||
this.valueColor,
|
||||
this.value,
|
||||
this.animationValue,
|
||||
@required this.textDirection,
|
||||
}) : assert(textDirection != null);
|
||||
|
||||
final Color backgroundColor;
|
||||
final Color valueColor;
|
||||
final double value;
|
||||
final double animationValue;
|
||||
final TextDirection textDirection;
|
||||
|
||||
// The indeterminate progress animation displays two lines whose leading (head)
|
||||
// and trailing (tail) endpoints are defined by the following four curves.
|
||||
static const Curve line1Head = Interval(
|
||||
@ -92,20 +106,6 @@ class _LinearProgressIndicatorPainter extends CustomPainter {
|
||||
curve: Cubic(0.10, 0.0, 0.45, 1.0),
|
||||
);
|
||||
|
||||
const _LinearProgressIndicatorPainter({
|
||||
this.backgroundColor,
|
||||
this.valueColor,
|
||||
this.value,
|
||||
this.animationValue,
|
||||
@required this.textDirection,
|
||||
}) : assert(textDirection != null);
|
||||
|
||||
final Color backgroundColor;
|
||||
final Color valueColor;
|
||||
final double value;
|
||||
final double animationValue;
|
||||
final TextDirection textDirection;
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final Paint paint = Paint()
|
||||
@ -254,12 +254,6 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with
|
||||
}
|
||||
|
||||
class _CircularProgressIndicatorPainter extends CustomPainter {
|
||||
static const double _twoPi = math.pi * 2.0;
|
||||
static const double _epsilon = .001;
|
||||
// Canvas.drawArc(r, 0, 2*PI) doesn't draw anything, so just get close.
|
||||
static const double _sweep = _twoPi - _epsilon;
|
||||
static const double _startAngle = -math.pi / 2.0;
|
||||
|
||||
_CircularProgressIndicatorPainter({
|
||||
this.valueColor,
|
||||
this.value,
|
||||
@ -285,6 +279,12 @@ class _CircularProgressIndicatorPainter extends CustomPainter {
|
||||
final double arcStart;
|
||||
final double arcSweep;
|
||||
|
||||
static const double _twoPi = math.pi * 2.0;
|
||||
static const double _epsilon = .001;
|
||||
// Canvas.drawArc(r, 0, 2*PI) doesn't draw anything, so just get close.
|
||||
static const double _sweep = _twoPi - _epsilon;
|
||||
static const double _startAngle = -math.pi / 2.0;
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final Paint paint = Paint()
|
||||
|
@ -30,15 +30,6 @@ enum DayPeriod {
|
||||
/// time zones.
|
||||
@immutable
|
||||
class TimeOfDay {
|
||||
/// The number of hours in one day, i.e. 24.
|
||||
static const int hoursPerDay = 24;
|
||||
|
||||
/// The number of hours in one day period (see also [DayPeriod]), i.e. 12.
|
||||
static const int hoursPerPeriod = 12;
|
||||
|
||||
/// The number of minutes in one hour, i.e. 60.
|
||||
static const int minutesPerHour = 60;
|
||||
|
||||
/// Creates a time of day.
|
||||
///
|
||||
/// The [hour] argument must be between 0 and 23, inclusive. The [minute]
|
||||
@ -57,6 +48,15 @@ class TimeOfDay {
|
||||
/// current minute in the local time zone.
|
||||
factory TimeOfDay.now() { return TimeOfDay.fromDateTime(DateTime.now()); }
|
||||
|
||||
/// The number of hours in one day, i.e. 24.
|
||||
static const int hoursPerDay = 24;
|
||||
|
||||
/// The number of hours in one day period (see also [DayPeriod]), i.e. 12.
|
||||
static const int hoursPerPeriod = 12;
|
||||
|
||||
/// The number of minutes in one hour, i.e. 60.
|
||||
static const int minutesPerHour = 60;
|
||||
|
||||
/// Returns a new TimeOfDay with the hour and/or minute replaced.
|
||||
TimeOfDay replacing({ int hour, int minute }) {
|
||||
assert(hour == null || (hour >= 0 && hour < hoursPerDay));
|
||||
|
@ -92,22 +92,6 @@ class BoxConstraints extends Constraints {
|
||||
this.maxHeight = double.infinity
|
||||
});
|
||||
|
||||
/// The minimum width that satisfies the constraints.
|
||||
final double minWidth;
|
||||
|
||||
/// The maximum width that satisfies the constraints.
|
||||
///
|
||||
/// Might be [double.infinity].
|
||||
final double maxWidth;
|
||||
|
||||
/// The minimum height that satisfies the constraints.
|
||||
final double minHeight;
|
||||
|
||||
/// The maximum height that satisfies the constraints.
|
||||
///
|
||||
/// Might be [double.infinity].
|
||||
final double maxHeight;
|
||||
|
||||
/// Creates box constraints that is respected only by the given size.
|
||||
BoxConstraints.tight(Size size)
|
||||
: minWidth = size.width,
|
||||
@ -164,6 +148,22 @@ class BoxConstraints extends Constraints {
|
||||
minHeight = height != null ? height : double.infinity,
|
||||
maxHeight = height != null ? height : double.infinity;
|
||||
|
||||
/// The minimum width that satisfies the constraints.
|
||||
final double minWidth;
|
||||
|
||||
/// The maximum width that satisfies the constraints.
|
||||
///
|
||||
/// Might be [double.infinity].
|
||||
final double maxWidth;
|
||||
|
||||
/// The minimum height that satisfies the constraints.
|
||||
final double minHeight;
|
||||
|
||||
/// The maximum height that satisfies the constraints.
|
||||
///
|
||||
/// Might be [double.infinity].
|
||||
final double maxHeight;
|
||||
|
||||
/// Creates a copy of this box constraints but with the given fields replaced with the new values.
|
||||
BoxConstraints copyWith({
|
||||
double minWidth,
|
||||
|
@ -212,6 +212,9 @@ class JSONMethodCodec implements MethodCodec {
|
||||
/// The codec is extensible by subclasses overriding [writeValue] and
|
||||
/// [readValueOfType].
|
||||
class StandardMessageCodec implements MessageCodec<dynamic> {
|
||||
/// Creates a [MessageCodec] using the Flutter standard binary encoding.
|
||||
const StandardMessageCodec();
|
||||
|
||||
// The codec serializes messages as outlined below. This format must
|
||||
// match the Android and iOS counterparts.
|
||||
//
|
||||
@ -264,9 +267,6 @@ class StandardMessageCodec implements MessageCodec<dynamic> {
|
||||
static const int _valueList = 12;
|
||||
static const int _valueMap = 13;
|
||||
|
||||
/// Creates a [MessageCodec] using the Flutter standard binary encoding.
|
||||
const StandardMessageCodec();
|
||||
|
||||
@override
|
||||
ByteData encodeMessage(dynamic message) {
|
||||
if (message == null)
|
||||
|
@ -97,21 +97,6 @@ class PlatformViewsService {
|
||||
///
|
||||
/// A Dart version of Android's [MotionEvent.PointerProperties](https://developer.android.com/reference/android/view/MotionEvent.PointerProperties).
|
||||
class AndroidPointerProperties {
|
||||
/// Value for `toolType` when the tool type is unknown.
|
||||
static const int kToolTypeUnknown = 0;
|
||||
|
||||
/// Value for `toolType` when the tool type is a finger.
|
||||
static const int kToolTypeFinger = 1;
|
||||
|
||||
/// Value for `toolType` when the tool type is a stylus.
|
||||
static const int kToolTypeStylus = 2;
|
||||
|
||||
/// Value for `toolType` when the tool type is a mouse.
|
||||
static const int kToolTypeMouse = 3;
|
||||
|
||||
/// Value for `toolType` when the tool type is an eraser.
|
||||
static const int kToolTypeEraser = 4;
|
||||
|
||||
/// Creates an AndroidPointerProperties.
|
||||
///
|
||||
/// All parameters must not be null.
|
||||
@ -128,6 +113,21 @@ class AndroidPointerProperties {
|
||||
/// See Android's [MotionEvent.PointerProperties#toolType](https://developer.android.com/reference/android/view/MotionEvent.PointerProperties.html#toolType).
|
||||
final int toolType;
|
||||
|
||||
/// Value for `toolType` when the tool type is unknown.
|
||||
static const int kToolTypeUnknown = 0;
|
||||
|
||||
/// Value for `toolType` when the tool type is a finger.
|
||||
static const int kToolTypeFinger = 1;
|
||||
|
||||
/// Value for `toolType` when the tool type is a stylus.
|
||||
static const int kToolTypeStylus = 2;
|
||||
|
||||
/// Value for `toolType` when the tool type is a mouse.
|
||||
static const int kToolTypeMouse = 3;
|
||||
|
||||
/// Value for `toolType` when the tool type is an eraser.
|
||||
static const int kToolTypeEraser = 4;
|
||||
|
||||
List<int> _asList() => <int>[id, toolType];
|
||||
|
||||
@override
|
||||
|
@ -97,28 +97,6 @@ enum Brightness {
|
||||
///
|
||||
/// Used by [SystemChrome.setSystemUIOverlayStyle].
|
||||
class SystemUiOverlayStyle {
|
||||
/// System overlays should be drawn with a light color. Intended for
|
||||
/// applications with a dark background.
|
||||
static const SystemUiOverlayStyle light = SystemUiOverlayStyle(
|
||||
systemNavigationBarColor: Color(0xFF000000),
|
||||
systemNavigationBarDividerColor: null,
|
||||
statusBarColor: null,
|
||||
systemNavigationBarIconBrightness: Brightness.light,
|
||||
statusBarIconBrightness: Brightness.light,
|
||||
statusBarBrightness: Brightness.dark,
|
||||
);
|
||||
|
||||
/// System overlays should be drawn with a dark color. Intended for
|
||||
/// applications with a light background.
|
||||
static const SystemUiOverlayStyle dark = SystemUiOverlayStyle(
|
||||
systemNavigationBarColor: Color(0xFF000000),
|
||||
systemNavigationBarDividerColor: null,
|
||||
statusBarColor: null,
|
||||
systemNavigationBarIconBrightness: Brightness.light,
|
||||
statusBarIconBrightness: Brightness.dark,
|
||||
statusBarBrightness: Brightness.light,
|
||||
);
|
||||
|
||||
/// Creates a new [SystemUiOverlayStyle].
|
||||
const SystemUiOverlayStyle({
|
||||
this.systemNavigationBarColor,
|
||||
@ -159,6 +137,28 @@ class SystemUiOverlayStyle {
|
||||
/// Only honored in Android version M and greater.
|
||||
final Brightness statusBarIconBrightness;
|
||||
|
||||
/// System overlays should be drawn with a light color. Intended for
|
||||
/// applications with a dark background.
|
||||
static const SystemUiOverlayStyle light = SystemUiOverlayStyle(
|
||||
systemNavigationBarColor: Color(0xFF000000),
|
||||
systemNavigationBarDividerColor: null,
|
||||
statusBarColor: null,
|
||||
systemNavigationBarIconBrightness: Brightness.light,
|
||||
statusBarIconBrightness: Brightness.light,
|
||||
statusBarBrightness: Brightness.dark,
|
||||
);
|
||||
|
||||
/// System overlays should be drawn with a dark color. Intended for
|
||||
/// applications with a light background.
|
||||
static const SystemUiOverlayStyle dark = SystemUiOverlayStyle(
|
||||
systemNavigationBarColor: Color(0xFF000000),
|
||||
systemNavigationBarDividerColor: null,
|
||||
statusBarColor: null,
|
||||
systemNavigationBarIconBrightness: Brightness.light,
|
||||
statusBarIconBrightness: Brightness.dark,
|
||||
statusBarBrightness: Brightness.light,
|
||||
);
|
||||
|
||||
/// Convert this event to a map for serialization.
|
||||
Map<String, dynamic> _toMap() {
|
||||
return <String, dynamic>{
|
||||
|
@ -698,6 +698,8 @@ final _TextInputClientHandler _clientHandler = _TextInputClientHandler();
|
||||
|
||||
/// An interface to the system's text input control.
|
||||
class TextInput {
|
||||
TextInput._();
|
||||
|
||||
static const List<TextInputAction> _androidSupportedInputActions = <TextInputAction>[
|
||||
TextInputAction.none,
|
||||
TextInputAction.unspecified,
|
||||
@ -724,8 +726,6 @@ class TextInput {
|
||||
TextInputAction.emergencyCall,
|
||||
];
|
||||
|
||||
TextInput._();
|
||||
|
||||
/// Begin interacting with the text input control.
|
||||
///
|
||||
/// Calling this function helps multiple clients coordinate about which one is
|
||||
|
@ -5564,17 +5564,17 @@ class KeyedSubtree extends StatelessWidget {
|
||||
}) : assert(child != null),
|
||||
super(key: key);
|
||||
|
||||
/// The widget below this widget in the tree.
|
||||
///
|
||||
/// {@macro flutter.widgets.child}
|
||||
final Widget child;
|
||||
|
||||
/// Creates a KeyedSubtree for child with a key that's based on the child's existing key or childIndex.
|
||||
factory KeyedSubtree.wrap(Widget child, int childIndex) {
|
||||
final Key key = child.key != null ? ValueKey<Key>(child.key) : ValueKey<int>(childIndex);
|
||||
return KeyedSubtree(key: key, child: child);
|
||||
}
|
||||
|
||||
/// The widget below this widget in the tree.
|
||||
///
|
||||
/// {@macro flutter.widgets.child}
|
||||
final Widget child;
|
||||
|
||||
/// Wrap each item in a KeyedSubtree whose key is based on the item's existing key or
|
||||
/// the sum of its list index and `baseIndex`.
|
||||
static List<Widget> ensureUniqueKeysForList(Iterable<Widget> items, { int baseIndex = 0 }) {
|
||||
|
@ -49,10 +49,10 @@ typedef _RegisterServiceExtensionCallback = void Function({
|
||||
/// A proxy layer is used for cases where a layer needs to be placed into
|
||||
/// multiple trees of layers.
|
||||
class _ProxyLayer extends Layer {
|
||||
final Layer _layer;
|
||||
|
||||
_ProxyLayer(this._layer);
|
||||
|
||||
final Layer _layer;
|
||||
|
||||
@override
|
||||
void addToScene(ui.SceneBuilder builder, [Offset layerOffset = Offset.zero]) {
|
||||
_layer.addToScene(builder, layerOffset);
|
||||
@ -66,9 +66,6 @@ class _ProxyLayer extends Layer {
|
||||
/// secondary screenshot canvas so that a screenshot can be recorded at the same
|
||||
/// time as performing a normal paint.
|
||||
class _MulticastCanvas implements Canvas {
|
||||
final Canvas _main;
|
||||
final Canvas _screenshot;
|
||||
|
||||
_MulticastCanvas({
|
||||
@required Canvas main,
|
||||
@required Canvas screenshot,
|
||||
@ -77,6 +74,9 @@ class _MulticastCanvas implements Canvas {
|
||||
_main = main,
|
||||
_screenshot = screenshot;
|
||||
|
||||
final Canvas _main;
|
||||
final Canvas _screenshot;
|
||||
|
||||
@override
|
||||
void clipPath(Path path, {bool doAntiAlias = true}) {
|
||||
_main.clipPath(path, doAntiAlias: doAntiAlias);
|
||||
|
@ -513,13 +513,13 @@ final Finder findDialPaint = find.descendant(
|
||||
);
|
||||
|
||||
class _SemanticsNodeExpectation {
|
||||
_SemanticsNodeExpectation(this.label, this.left, this.top, this.right, this.bottom);
|
||||
|
||||
final String label;
|
||||
final double left;
|
||||
final double top;
|
||||
final double right;
|
||||
final double bottom;
|
||||
|
||||
_SemanticsNodeExpectation(this.label, this.left, this.top, this.right, this.bottom);
|
||||
}
|
||||
|
||||
class _CustomPainterSemanticsTester {
|
||||
|
@ -14,13 +14,13 @@ import 'package:flutter/foundation.dart';
|
||||
/// This is useful for running in the test Zone, where it is tricky to receive
|
||||
/// callbacks originating from the IO thread.
|
||||
class FakeCodec implements ui.Codec {
|
||||
FakeCodec._(this._frameCount, this._repetitionCount, this._frameInfos);
|
||||
|
||||
final int _frameCount;
|
||||
final int _repetitionCount;
|
||||
final List<ui.FrameInfo> _frameInfos;
|
||||
int _nextFrame = 0;
|
||||
|
||||
FakeCodec._(this._frameCount, this._repetitionCount, this._frameInfos);
|
||||
|
||||
/// Creates a FakeCodec from encoded image data.
|
||||
///
|
||||
/// Only call this method outside of the test zone.
|
||||
|
@ -13,11 +13,10 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
class TestAssetBundle extends CachingAssetBundle {
|
||||
TestAssetBundle(this._assetBundleMap);
|
||||
|
||||
Map<String, List<String>> _assetBundleMap;
|
||||
|
||||
TestAssetBundle(this._assetBundleMap);
|
||||
|
||||
Map<String, int> loadCallCount = <String, int>{};
|
||||
|
||||
String get _assetBundleContents {
|
||||
|
@ -11,12 +11,12 @@ import 'package:flutter/scheduler.dart' show timeDilation;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
class FakeFrameInfo implements FrameInfo {
|
||||
final Duration _duration;
|
||||
final Image _image;
|
||||
|
||||
FakeFrameInfo(int width, int height, this._duration) :
|
||||
_image = FakeImage(width, height);
|
||||
|
||||
final Duration _duration;
|
||||
final Image _image;
|
||||
|
||||
@override
|
||||
Duration get duration => _duration;
|
||||
|
||||
@ -25,11 +25,11 @@ class FakeFrameInfo implements FrameInfo {
|
||||
}
|
||||
|
||||
class FakeImage implements Image {
|
||||
FakeImage(this._width, this._height);
|
||||
|
||||
final int _width;
|
||||
final int _height;
|
||||
|
||||
FakeImage(this._width, this._height);
|
||||
|
||||
@override
|
||||
int get width => _width;
|
||||
|
||||
|
@ -558,12 +558,12 @@ abstract class _TestRecordingCanvasMatcher extends Matcher {
|
||||
}
|
||||
|
||||
class _TestRecordingCanvasPaintsCountMatcher extends _TestRecordingCanvasMatcher {
|
||||
final Symbol _methodName;
|
||||
final int _count;
|
||||
|
||||
_TestRecordingCanvasPaintsCountMatcher(Symbol methodName, int count)
|
||||
: _methodName = methodName, _count = count;
|
||||
|
||||
final Symbol _methodName;
|
||||
final int _count;
|
||||
|
||||
@override
|
||||
Description describe(Description description) {
|
||||
return description.add('Object or closure painting $_methodName exactly $_count times');
|
||||
|
@ -792,15 +792,15 @@ void main() {
|
||||
}
|
||||
|
||||
class TestImageProvider extends ImageProvider<TestImageProvider> {
|
||||
final Completer<ImageInfo> _completer = Completer<ImageInfo>();
|
||||
ImageStreamCompleter _streamCompleter;
|
||||
ImageConfiguration _lastResolvedConfiguration;
|
||||
|
||||
TestImageProvider({ImageStreamCompleter streamCompleter}) {
|
||||
_streamCompleter = streamCompleter
|
||||
?? OneFrameImageStreamCompleter(_completer.future);
|
||||
}
|
||||
|
||||
final Completer<ImageInfo> _completer = Completer<ImageInfo>();
|
||||
ImageStreamCompleter _streamCompleter;
|
||||
ImageConfiguration _lastResolvedConfiguration;
|
||||
|
||||
@override
|
||||
Future<TestImageProvider> obtainKey(ImageConfiguration configuration) {
|
||||
return SynchronousFuture<TestImageProvider>(this);
|
||||
|
@ -41,14 +41,14 @@ class EnterText extends Command {
|
||||
/// Creates a command that enters text into the currently focused widget.
|
||||
EnterText(this.text, { Duration timeout }) : super(timeout: timeout);
|
||||
|
||||
/// The text extracted by the [GetText] command.
|
||||
final String text;
|
||||
|
||||
/// Deserializes this command from the value generated by [serialize].
|
||||
EnterText.deserialize(Map<String, dynamic> json)
|
||||
: text = json['text'],
|
||||
super.deserialize(json);
|
||||
|
||||
/// The text extracted by the [GetText] command.
|
||||
final String text;
|
||||
|
||||
@override
|
||||
final String kind = 'enter_text';
|
||||
|
||||
@ -77,14 +77,14 @@ class SetTextEntryEmulation extends Command {
|
||||
/// Creates a command that enables and disables text entry emulation.
|
||||
SetTextEntryEmulation(this.enabled, { Duration timeout }) : super(timeout: timeout);
|
||||
|
||||
/// Whether text entry emulation should be enabled.
|
||||
final bool enabled;
|
||||
|
||||
/// Deserializes this command from the value generated by [serialize].
|
||||
SetTextEntryEmulation.deserialize(Map<String, dynamic> json)
|
||||
: enabled = json['enabled'] == 'true',
|
||||
super.deserialize(json);
|
||||
|
||||
/// Whether text entry emulation should be enabled.
|
||||
final bool enabled;
|
||||
|
||||
@override
|
||||
final String kind = 'set_text_entry_emulation';
|
||||
|
||||
|
@ -770,6 +770,9 @@ class FlutterDriver {
|
||||
/// Encapsulates connection information to an instance of a Flutter application.
|
||||
@visibleForTesting
|
||||
class VMServiceClientConnection {
|
||||
/// Creates an instance of this class given a [client] and a [peer].
|
||||
VMServiceClientConnection(this.client, this.peer);
|
||||
|
||||
/// Use this for structured access to the VM service's public APIs.
|
||||
final VMServiceClient client;
|
||||
|
||||
@ -778,9 +781,6 @@ class VMServiceClientConnection {
|
||||
/// This object allows reaching into private VM service APIs. Use with
|
||||
/// caution.
|
||||
final rpc.Peer peer;
|
||||
|
||||
/// Creates an instance of this class given a [client] and a [peer].
|
||||
VMServiceClientConnection(this.client, this.peer);
|
||||
}
|
||||
|
||||
/// A function that connects to a Dart VM service given the [url].
|
||||
|
@ -92,8 +92,6 @@ typedef FinderConstructor = Finder Function(SerializableFinder finder);
|
||||
/// calling [enableFlutterDriverExtension].
|
||||
@visibleForTesting
|
||||
class FlutterDriverExtension {
|
||||
final TestTextInput _testTextInput = TestTextInput();
|
||||
|
||||
/// Creates an object to manage a Flutter Driver connection.
|
||||
FlutterDriverExtension(this._requestDataHandler, this._silenceErrors) {
|
||||
_testTextInput.register();
|
||||
@ -143,6 +141,8 @@ class FlutterDriverExtension {
|
||||
});
|
||||
}
|
||||
|
||||
final TestTextInput _testTextInput = TestTextInput();
|
||||
|
||||
final DataHandler _requestDataHandler;
|
||||
final bool _silenceErrors;
|
||||
|
||||
|
@ -36,16 +36,6 @@ class AndroidStudio implements Comparable<AndroidStudio> {
|
||||
_init();
|
||||
}
|
||||
|
||||
final String directory;
|
||||
final String studioAppName;
|
||||
final Version version;
|
||||
final String configured;
|
||||
|
||||
String _pluginsPath;
|
||||
String _javaPath;
|
||||
bool _isValid = false;
|
||||
final List<String> _validationMessages = <String>[];
|
||||
|
||||
factory AndroidStudio.fromMacOSBundle(String bundlePath) {
|
||||
final String studioPath = fs.path.join(bundlePath, 'Contents');
|
||||
final String plistFile = fs.path.join(studioPath, 'Info.plist');
|
||||
@ -89,6 +79,16 @@ class AndroidStudio implements Comparable<AndroidStudio> {
|
||||
return null;
|
||||
}
|
||||
|
||||
final String directory;
|
||||
final String studioAppName;
|
||||
final Version version;
|
||||
final String configured;
|
||||
|
||||
String _pluginsPath;
|
||||
String _javaPath;
|
||||
bool _isValid = false;
|
||||
final List<String> _validationMessages = <String>[];
|
||||
|
||||
String get javaPath => _javaPath;
|
||||
|
||||
bool get isValid => _isValid;
|
||||
|
@ -11,10 +11,10 @@ import '../intellij/intellij.dart';
|
||||
import 'android_studio.dart';
|
||||
|
||||
class AndroidStudioValidator extends DoctorValidator {
|
||||
final AndroidStudio _studio;
|
||||
|
||||
AndroidStudioValidator(this._studio) : super('Android Studio');
|
||||
|
||||
final AndroidStudio _studio;
|
||||
|
||||
static List<DoctorValidator> get allValidators {
|
||||
final List<DoctorValidator> validators = <DoctorValidator>[];
|
||||
final List<AndroidStudio> studios = AndroidStudio.allInstalled();
|
||||
|
@ -21,12 +21,12 @@ import 'project.dart';
|
||||
import 'tester/flutter_tester.dart';
|
||||
|
||||
abstract class ApplicationPackage {
|
||||
/// Package ID from the Android Manifest or equivalent.
|
||||
final String id;
|
||||
|
||||
ApplicationPackage({ @required this.id })
|
||||
: assert(id != null);
|
||||
|
||||
/// Package ID from the Android Manifest or equivalent.
|
||||
final String id;
|
||||
|
||||
String get name;
|
||||
|
||||
String get displayName => name;
|
||||
@ -38,12 +38,6 @@ abstract class ApplicationPackage {
|
||||
}
|
||||
|
||||
class AndroidApk extends ApplicationPackage {
|
||||
/// Path to the actual apk file.
|
||||
final File file;
|
||||
|
||||
/// The path to the activity that should be launched.
|
||||
final String launchActivity;
|
||||
|
||||
AndroidApk({
|
||||
String id,
|
||||
@required this.file,
|
||||
@ -88,6 +82,12 @@ class AndroidApk extends ApplicationPackage {
|
||||
);
|
||||
}
|
||||
|
||||
/// Path to the actual apk file.
|
||||
final File file;
|
||||
|
||||
/// The path to the activity that should be launched.
|
||||
final String launchActivity;
|
||||
|
||||
/// Creates a new AndroidApk based on the information in the Android manifest.
|
||||
static Future<AndroidApk> fromAndroidProject(AndroidProject androidProject) async {
|
||||
File apkFile;
|
||||
@ -250,15 +250,15 @@ class BuildableIOSApp extends IOSApp {
|
||||
}
|
||||
|
||||
class PrebuiltIOSApp extends IOSApp {
|
||||
final Directory bundleDir;
|
||||
final String bundleName;
|
||||
|
||||
PrebuiltIOSApp({
|
||||
this.bundleDir,
|
||||
this.bundleName,
|
||||
@required String projectBundleId,
|
||||
}) : super(projectBundleId: projectBundleId);
|
||||
|
||||
final Directory bundleDir;
|
||||
final String bundleName;
|
||||
|
||||
@override
|
||||
String get name => bundleName;
|
||||
|
||||
@ -299,11 +299,11 @@ Future<ApplicationPackage> getApplicationPackageForPlatform(
|
||||
}
|
||||
|
||||
class ApplicationPackageStore {
|
||||
ApplicationPackageStore({ this.android, this.iOS });
|
||||
|
||||
AndroidApk android;
|
||||
IOSApp iOS;
|
||||
|
||||
ApplicationPackageStore({ this.android, this.iOS });
|
||||
|
||||
Future<ApplicationPackage> getPackageForPlatform(TargetPlatform platform) async {
|
||||
switch (platform) {
|
||||
case TargetPlatform.android_arm:
|
||||
@ -332,9 +332,6 @@ class _Entry {
|
||||
}
|
||||
|
||||
class _Element extends _Entry {
|
||||
List<_Entry> children;
|
||||
String name;
|
||||
|
||||
_Element.fromLine(String line, _Element parent) {
|
||||
// E: application (line=29)
|
||||
final List<String> parts = line.trimLeft().split(' ');
|
||||
@ -344,6 +341,9 @@ class _Element extends _Entry {
|
||||
children = <_Entry>[];
|
||||
}
|
||||
|
||||
List<_Entry> children;
|
||||
String name;
|
||||
|
||||
void addChild(_Entry child) {
|
||||
children.add(child);
|
||||
}
|
||||
@ -369,9 +369,6 @@ class _Element extends _Entry {
|
||||
}
|
||||
|
||||
class _Attribute extends _Entry {
|
||||
String key;
|
||||
String value;
|
||||
|
||||
_Attribute.fromLine(String line, _Element parent) {
|
||||
// A: android:label(0x01010001)="hello_world" (Raw: "hello_world")
|
||||
const String attributePrefix = 'A: ';
|
||||
@ -383,6 +380,9 @@ class _Attribute extends _Entry {
|
||||
level = line.length - line.trimLeft().length;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
String key;
|
||||
String value;
|
||||
}
|
||||
|
||||
class ApkManifestData {
|
||||
|
@ -231,12 +231,12 @@ class CachedArtifacts extends Artifacts {
|
||||
|
||||
/// Manages the artifacts of a locally built engine.
|
||||
class LocalEngineArtifacts extends Artifacts {
|
||||
LocalEngineArtifacts(this._engineSrcPath, this.engineOutPath, this._hostEngineOutPath);
|
||||
|
||||
final String _engineSrcPath;
|
||||
final String engineOutPath; // TODO(goderbauer): This should be private.
|
||||
String _hostEngineOutPath;
|
||||
|
||||
LocalEngineArtifacts(this._engineSrcPath, this.engineOutPath, this._hostEngineOutPath);
|
||||
|
||||
@override
|
||||
String getArtifactPath(Artifact artifact, [TargetPlatform platform, BuildMode mode]) {
|
||||
switch (artifact) {
|
||||
|
@ -56,21 +56,21 @@ class _ManifestAssetBundleFactory implements AssetBundleFactory {
|
||||
}
|
||||
|
||||
class _ManifestAssetBundle implements AssetBundle {
|
||||
/// Constructs an [_ManifestAssetBundle] that gathers the set of assets from the
|
||||
/// pubspec.yaml manifest.
|
||||
_ManifestAssetBundle();
|
||||
|
||||
@override
|
||||
final Map<String, DevFSContent> entries = <String, DevFSContent>{};
|
||||
|
||||
DateTime _lastBuildTimestamp;
|
||||
|
||||
static const String defaultManifestPath = 'pubspec.yaml';
|
||||
static const String _assetManifestJson = 'AssetManifest.json';
|
||||
static const String _fontManifestJson = 'FontManifest.json';
|
||||
static const String _fontSetMaterial = 'material';
|
||||
static const String _license = 'LICENSE';
|
||||
|
||||
DateTime _lastBuildTimestamp;
|
||||
|
||||
/// Constructs an [_ManifestAssetBundle] that gathers the set of assets from the
|
||||
/// pubspec.yaml manifest.
|
||||
_ManifestAssetBundle();
|
||||
|
||||
@override
|
||||
bool wasBuiltOnce() => _lastBuildTimestamp != null;
|
||||
|
||||
|
@ -3,24 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
class Version implements Comparable<Version> {
|
||||
static final RegExp versionPattern =
|
||||
RegExp(r'^(\d+)(\.(\d+)(\.(\d+))?)?');
|
||||
|
||||
/// The major version number: "1" in "1.2.3".
|
||||
final int major;
|
||||
|
||||
/// The minor version number: "2" in "1.2.3".
|
||||
final int minor;
|
||||
|
||||
/// The patch version number: "3" in "1.2.3".
|
||||
final int patch;
|
||||
|
||||
/// The original string representation of the version number.
|
||||
///
|
||||
/// This preserves textual artifacts like leading zeros that may be left out
|
||||
/// of the parsed version.
|
||||
final String _text;
|
||||
|
||||
/// Creates a new [Version] object.
|
||||
factory Version(int major, int minor, int patch, {String text}) {
|
||||
if (text == null) {
|
||||
@ -76,6 +58,24 @@ class Version implements Comparable<Version> {
|
||||
|
||||
static Version get unknown => Version(0, 0, 0, text: 'unknown');
|
||||
|
||||
/// The major version number: "1" in "1.2.3".
|
||||
final int major;
|
||||
|
||||
/// The minor version number: "2" in "1.2.3".
|
||||
final int minor;
|
||||
|
||||
/// The patch version number: "3" in "1.2.3".
|
||||
final int patch;
|
||||
|
||||
/// The original string representation of the version number.
|
||||
///
|
||||
/// This preserves textual artifacts like leading zeros that may be left out
|
||||
/// of the parsed version.
|
||||
final String _text;
|
||||
|
||||
static final RegExp versionPattern =
|
||||
RegExp(r'^(\d+)(\.(\d+)(\.(\d+))?)?');
|
||||
|
||||
/// Two [Version]s are equal if their version numbers are. The version text
|
||||
/// is ignored.
|
||||
@override
|
||||
|
@ -15,11 +15,11 @@ import '../globals.dart';
|
||||
|
||||
/// Common behavior for `flutter analyze` and `flutter analyze --watch`
|
||||
abstract class AnalyzeBase {
|
||||
AnalyzeBase(this.argResults);
|
||||
|
||||
/// The parsed argument results for execution.
|
||||
final ArgResults argResults;
|
||||
|
||||
AnalyzeBase(this.argResults);
|
||||
|
||||
/// Called by [AnalyzeCommand] to start the analysis process.
|
||||
Future<Null> analyze();
|
||||
|
||||
|
@ -819,14 +819,14 @@ class AppInstance {
|
||||
|
||||
/// This domain responds to methods like [getEmulators] and [launch].
|
||||
class EmulatorDomain extends Domain {
|
||||
EmulatorManager emulators = EmulatorManager();
|
||||
|
||||
EmulatorDomain(Daemon daemon) : super(daemon, 'emulator') {
|
||||
registerHandler('getEmulators', getEmulators);
|
||||
registerHandler('launch', launch);
|
||||
registerHandler('create', create);
|
||||
}
|
||||
|
||||
EmulatorManager emulators = EmulatorManager();
|
||||
|
||||
Future<List<Map<String, dynamic>>> getEmulators([Map<String, dynamic> args]) async {
|
||||
final List<Emulator> list = await emulators.getAllAvailableEmulators();
|
||||
return list.map<Map<String, dynamic>>(_emulatorToMap).toList();
|
||||
@ -971,9 +971,9 @@ class _AppRunLogger extends Logger {
|
||||
}
|
||||
|
||||
class LogMessage {
|
||||
LogMessage(this.level, this.message, [this.stackTrace]);
|
||||
|
||||
final String level;
|
||||
final String message;
|
||||
final StackTrace stackTrace;
|
||||
|
||||
LogMessage(this.level, this.message, [this.stackTrace]);
|
||||
}
|
||||
|
@ -444,18 +444,18 @@ class FuchsiaReloadCommand extends FlutterCommand {
|
||||
// VM service running on a Fuchsia device. [process] is the ssh process running
|
||||
// the tunnel and [port] is the local port.
|
||||
class _PortForwarder {
|
||||
final String _remoteAddress;
|
||||
final int _remotePort;
|
||||
final int _localPort;
|
||||
final Process _process;
|
||||
final String _sshConfig;
|
||||
|
||||
_PortForwarder._(this._remoteAddress,
|
||||
this._remotePort,
|
||||
this._localPort,
|
||||
this._process,
|
||||
this._sshConfig);
|
||||
|
||||
final String _remoteAddress;
|
||||
final int _remotePort;
|
||||
final int _localPort;
|
||||
final Process _process;
|
||||
final String _sshConfig;
|
||||
|
||||
int get port => _localPort;
|
||||
|
||||
static Future<_PortForwarder> start(String sshConfig,
|
||||
@ -519,11 +519,11 @@ class _PortForwarder {
|
||||
}
|
||||
|
||||
class FuchsiaDeviceCommandRunner {
|
||||
FuchsiaDeviceCommandRunner(this._address, this._sshConfig);
|
||||
|
||||
final String _address;
|
||||
final String _sshConfig;
|
||||
|
||||
FuchsiaDeviceCommandRunner(this._address, this._sshConfig);
|
||||
|
||||
Future<List<String>> run(String command) async {
|
||||
final List<String> args = <String>['ssh', '-F', _sshConfig, _address, command];
|
||||
printTrace(args.join(' '));
|
||||
|
@ -72,12 +72,6 @@ abstract class RunCommandBase extends FlutterCommand {
|
||||
}
|
||||
|
||||
class RunCommand extends RunCommandBase {
|
||||
@override
|
||||
final String name = 'run';
|
||||
|
||||
@override
|
||||
final String description = 'Run your Flutter app on an attached device.';
|
||||
|
||||
RunCommand({ bool verboseHelp = false }) : super(verboseHelp: verboseHelp) {
|
||||
requiresPubspecYaml();
|
||||
usesFilesystemOptions(hide: !verboseHelp);
|
||||
@ -179,6 +173,12 @@ class RunCommand extends RunCommandBase {
|
||||
..addOption(FlutterOptions.kExtraGenSnapshotOptions, hide: true);
|
||||
}
|
||||
|
||||
@override
|
||||
final String name = 'run';
|
||||
|
||||
@override
|
||||
final String description = 'Run your Flutter app on an attached device.';
|
||||
|
||||
List<Device> devices;
|
||||
|
||||
@override
|
||||
|
@ -21,10 +21,10 @@ KernelCompiler get kernelCompiler => context[KernelCompiler];
|
||||
typedef CompilerMessageConsumer = void Function(String message, {bool emphasis, TerminalColor color});
|
||||
|
||||
class CompilerOutput {
|
||||
const CompilerOutput(this.outputFilename, this.errorCount);
|
||||
|
||||
final String outputFilename;
|
||||
final int errorCount;
|
||||
|
||||
const CompilerOutput(this.outputFilename, this.errorCount);
|
||||
}
|
||||
|
||||
class _StdoutHandler {
|
||||
@ -198,10 +198,10 @@ class KernelCompiler {
|
||||
|
||||
/// Class that allows to serialize compilation requests to the compiler.
|
||||
abstract class _CompilationRequest {
|
||||
Completer<CompilerOutput> completer;
|
||||
|
||||
_CompilationRequest(this.completer);
|
||||
|
||||
Completer<CompilerOutput> completer;
|
||||
|
||||
Future<CompilerOutput> _run(ResidentCompiler compiler);
|
||||
|
||||
Future<void> run(ResidentCompiler compiler) async {
|
||||
|
@ -48,10 +48,10 @@ const String _kStackTraceFilename = 'stacktrace_file';
|
||||
/// * In tests call [initializeWith] and provide a mock implementation of
|
||||
/// [http.Client].
|
||||
class CrashReportSender {
|
||||
static CrashReportSender _instance;
|
||||
|
||||
CrashReportSender._(this._client);
|
||||
|
||||
static CrashReportSender _instance;
|
||||
|
||||
static CrashReportSender get instance => _instance ?? CrashReportSender._(http.Client());
|
||||
|
||||
/// Overrides the default [http.Client] with [client] for testing purposes.
|
||||
|
@ -23,7 +23,17 @@ import 'sdk.dart';
|
||||
// DO NOT update without contacting kevmoo.
|
||||
// We have server-side tooling that assumes the values are consistent.
|
||||
class PubContext {
|
||||
static final RegExp _validContext = RegExp('[a-z][a-z_]*[a-z]');
|
||||
PubContext._(this._values) {
|
||||
for (String item in _values) {
|
||||
if (!_validContext.hasMatch(item)) {
|
||||
throw ArgumentError.value(
|
||||
_values, 'value', 'Must match RegExp ${_validContext.pattern}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static PubContext getVerifyContext(String commandName) =>
|
||||
PubContext._(<String>['verify', commandName.replaceAll('-', '_')]);
|
||||
|
||||
static final PubContext create = PubContext._(<String>['create']);
|
||||
static final PubContext createPackage = PubContext._(<String>['create_pkg']);
|
||||
@ -38,17 +48,7 @@ class PubContext {
|
||||
|
||||
final List<String> _values;
|
||||
|
||||
PubContext._(this._values) {
|
||||
for (String item in _values) {
|
||||
if (!_validContext.hasMatch(item)) {
|
||||
throw ArgumentError.value(
|
||||
_values, 'value', 'Must match RegExp ${_validContext.pattern}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static PubContext getVerifyContext(String commandName) =>
|
||||
PubContext._(<String>['verify', commandName.replaceAll('-', '_')]);
|
||||
static final RegExp _validContext = RegExp('[a-z][a-z_]*[a-z]');
|
||||
|
||||
@override
|
||||
String toString() => 'PubContext: ${_values.join(':')}';
|
||||
|
@ -8,10 +8,11 @@ import 'dart/dependencies.dart';
|
||||
import 'globals.dart';
|
||||
|
||||
class DependencyChecker {
|
||||
DependencyChecker(this.builder, this.assets);
|
||||
|
||||
final DartDependencySetBuilder builder;
|
||||
final Set<String> _dependencies = Set<String>();
|
||||
final AssetBundle assets;
|
||||
DependencyChecker(this.builder, this.assets);
|
||||
|
||||
/// Returns [true] if any components have been modified after [threshold] or
|
||||
/// if it cannot be determined.
|
||||
|
@ -201,10 +201,10 @@ abstract class DevFSOperations {
|
||||
/// An implementation of [DevFSOperations] that speaks to the
|
||||
/// vm service.
|
||||
class ServiceProtocolDevFSOperations implements DevFSOperations {
|
||||
final VMService vmService;
|
||||
|
||||
ServiceProtocolDevFSOperations(this.vmService);
|
||||
|
||||
final VMService vmService;
|
||||
|
||||
@override
|
||||
Future<Uri> create(String fsName) async {
|
||||
final Map<String, dynamic> response = await vmService.vm.createDevFS(fsName);
|
||||
|
@ -420,10 +420,10 @@ class NoIdeValidator extends DoctorValidator {
|
||||
}
|
||||
|
||||
abstract class IntelliJValidator extends DoctorValidator {
|
||||
final String installPath;
|
||||
|
||||
IntelliJValidator(String title, this.installPath) : super(title);
|
||||
|
||||
final String installPath;
|
||||
|
||||
String get version;
|
||||
String get pluginsPath;
|
||||
|
||||
@ -644,10 +644,10 @@ class DeviceValidator extends DoctorValidator {
|
||||
}
|
||||
|
||||
class ValidatorWithResult extends DoctorValidator {
|
||||
final ValidationResult result;
|
||||
|
||||
ValidatorWithResult(String title, this.result) : super(title);
|
||||
|
||||
final ValidationResult result;
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async => result;
|
||||
}
|
||||
|
@ -277,10 +277,10 @@ abstract class Emulator {
|
||||
}
|
||||
|
||||
class CreateEmulatorResult {
|
||||
CreateEmulatorResult(this.emulatorName, {this.success, this.output, this.error});
|
||||
|
||||
final bool success;
|
||||
final String emulatorName;
|
||||
final String output;
|
||||
final String error;
|
||||
|
||||
CreateEmulatorResult(this.emulatorName, {this.success, this.output, this.error});
|
||||
}
|
||||
|
@ -10,10 +10,10 @@ import '../device.dart';
|
||||
|
||||
/// Read the log for a particular device.
|
||||
class _FuchsiaLogReader extends DeviceLogReader {
|
||||
FuchsiaDevice _device;
|
||||
|
||||
_FuchsiaLogReader(this._device);
|
||||
|
||||
FuchsiaDevice _device;
|
||||
|
||||
@override String get name => _device.name;
|
||||
|
||||
Stream<String> _logLines;
|
||||
|
@ -11,11 +11,11 @@ import '../base/version.dart';
|
||||
import '../doctor.dart';
|
||||
|
||||
class IntelliJPlugins {
|
||||
static final Version kMinFlutterPluginVersion = Version(16, 0, 0);
|
||||
IntelliJPlugins(this.pluginsPath);
|
||||
|
||||
final String pluginsPath;
|
||||
|
||||
IntelliJPlugins(this.pluginsPath);
|
||||
static final Version kMinFlutterPluginVersion = Version(16, 0, 0);
|
||||
|
||||
void validatePackage(
|
||||
List<ValidationMessage> messages, List<String> packageNames, String title,
|
||||
|
@ -440,11 +440,6 @@ String decodeSyslog(String line) {
|
||||
}
|
||||
|
||||
class _IOSDeviceLogReader extends DeviceLogReader {
|
||||
// Matches a syslog line from the runner.
|
||||
RegExp _runnerLineRegex;
|
||||
// Matches a syslog line from any app.
|
||||
RegExp _anyLineRegex;
|
||||
|
||||
_IOSDeviceLogReader(this.device, ApplicationPackage app) {
|
||||
_linesController = StreamController<String>.broadcast(
|
||||
onListen: _start,
|
||||
@ -465,6 +460,11 @@ class _IOSDeviceLogReader extends DeviceLogReader {
|
||||
|
||||
final IOSDevice device;
|
||||
|
||||
// Matches a syslog line from the runner.
|
||||
RegExp _runnerLineRegex;
|
||||
// Matches a syslog line from any app.
|
||||
RegExp _anyLineRegex;
|
||||
|
||||
StreamController<String> _linesController;
|
||||
Process _process;
|
||||
|
||||
|
@ -482,8 +482,6 @@ Future<Process> launchSystemLogTool(IOSSimulator device) async {
|
||||
}
|
||||
|
||||
class _IOSSimulatorLogReader extends DeviceLogReader {
|
||||
String _appName;
|
||||
|
||||
_IOSSimulatorLogReader(this.device, IOSApp app) {
|
||||
_linesController = StreamController<String>.broadcast(
|
||||
onListen: _start,
|
||||
@ -494,6 +492,8 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
|
||||
|
||||
final IOSSimulator device;
|
||||
|
||||
String _appName;
|
||||
|
||||
StreamController<String> _linesController;
|
||||
|
||||
// We log from two files: the device and the system log.
|
||||
|
@ -22,12 +22,6 @@ void _renderTemplateToFile(String template, dynamic context, String filePath) {
|
||||
}
|
||||
|
||||
class Plugin {
|
||||
final String name;
|
||||
final String path;
|
||||
final String androidPackage;
|
||||
final String iosPrefix;
|
||||
final String pluginClass;
|
||||
|
||||
Plugin({
|
||||
this.name,
|
||||
this.path,
|
||||
@ -53,6 +47,12 @@ class Plugin {
|
||||
pluginClass: pluginClass,
|
||||
);
|
||||
}
|
||||
|
||||
final String name;
|
||||
final String path;
|
||||
final String androidPackage;
|
||||
final String iosPrefix;
|
||||
final String pluginClass;
|
||||
}
|
||||
|
||||
Plugin _pluginFromPubspec(String name, Uri packageRoot) {
|
||||
|
@ -148,15 +148,15 @@ class FlutterProject {
|
||||
/// Instances will reflect the contents of the `ios/` sub-folder of
|
||||
/// Flutter applications and the `.ios/` sub-folder of Flutter modules.
|
||||
class IosProject {
|
||||
static final RegExp _productBundleIdPattern = RegExp(r'^\s*PRODUCT_BUNDLE_IDENTIFIER\s*=\s*(.*);\s*$');
|
||||
static const String _productBundleIdVariable = r'$(PRODUCT_BUNDLE_IDENTIFIER)';
|
||||
static const String _hostAppBundleName = 'Runner';
|
||||
|
||||
IosProject._(this.parent);
|
||||
|
||||
/// The parent of this project.
|
||||
final FlutterProject parent;
|
||||
|
||||
static final RegExp _productBundleIdPattern = RegExp(r'^\s*PRODUCT_BUNDLE_IDENTIFIER\s*=\s*(.*);\s*$');
|
||||
static const String _productBundleIdVariable = r'$(PRODUCT_BUNDLE_IDENTIFIER)';
|
||||
static const String _hostAppBundleName = 'Runner';
|
||||
|
||||
Directory get _ephemeralDirectory => parent.directory.childDirectory('.ios');
|
||||
Directory get _editableDirectory => parent.directory.childDirectory('ios');
|
||||
|
||||
@ -321,14 +321,14 @@ class IosProject {
|
||||
/// Instances will reflect the contents of the `android/` sub-folder of
|
||||
/// Flutter applications and the `.android/` sub-folder of Flutter modules.
|
||||
class AndroidProject {
|
||||
static final RegExp _applicationIdPattern = RegExp('^\\s*applicationId\\s+[\'\"](.*)[\'\"]\\s*\$');
|
||||
static final RegExp _groupPattern = RegExp('^\\s*group\\s+[\'\"](.*)[\'\"]\\s*\$');
|
||||
|
||||
AndroidProject._(this.parent);
|
||||
|
||||
/// The parent of this project.
|
||||
final FlutterProject parent;
|
||||
|
||||
static final RegExp _applicationIdPattern = RegExp('^\\s*applicationId\\s+[\'\"](.*)[\'\"]\\s*\$');
|
||||
static final RegExp _groupPattern = RegExp('^\\s*group\\s+[\'\"](.*)[\'\"]\\s*\$');
|
||||
|
||||
/// The Gradle root directory of the Android host app. This is the directory
|
||||
/// containing the `app/` subdirectory and the `settings.gradle` file that
|
||||
/// includes it in the overall Gradle project.
|
||||
|
@ -22,8 +22,6 @@ import '../protocol_discovery.dart';
|
||||
import '../version.dart';
|
||||
|
||||
class FlutterTesterApp extends ApplicationPackage {
|
||||
final Directory _directory;
|
||||
|
||||
factory FlutterTesterApp.fromCurrentDirectory() {
|
||||
return FlutterTesterApp._(fs.currentDirectory);
|
||||
}
|
||||
@ -32,6 +30,8 @@ class FlutterTesterApp extends ApplicationPackage {
|
||||
: _directory = directory,
|
||||
super(id: directory.path);
|
||||
|
||||
final Directory _directory;
|
||||
|
||||
@override
|
||||
String get name => _directory.basename;
|
||||
|
||||
|
@ -368,10 +368,6 @@ class FlutterVersion {
|
||||
/// Contains data and load/save logic pertaining to Flutter version checks.
|
||||
@visibleForTesting
|
||||
class VersionCheckStamp {
|
||||
/// The prefix of the stamp file where we cache Flutter version check data.
|
||||
@visibleForTesting
|
||||
static const String kFlutterVersionCheckStampFile = 'flutter_version_check';
|
||||
|
||||
const VersionCheckStamp({
|
||||
this.lastTimeVersionWasChecked,
|
||||
this.lastKnownRemoteVersion,
|
||||
@ -382,6 +378,10 @@ class VersionCheckStamp {
|
||||
final DateTime lastKnownRemoteVersion;
|
||||
final DateTime lastTimeWarningWasPrinted;
|
||||
|
||||
/// The prefix of the stamp file where we cache Flutter version check data.
|
||||
@visibleForTesting
|
||||
static const String kFlutterVersionCheckStampFile = 'flutter_version_check';
|
||||
|
||||
static Future<VersionCheckStamp> load() async {
|
||||
final String versionCheckStamp = Cache.instance.getStampFor(kFlutterVersionCheckStampFile);
|
||||
|
||||
|
@ -559,7 +559,20 @@ abstract class ServiceObject {
|
||||
}
|
||||
|
||||
class ServiceEvent extends ServiceObject {
|
||||
/// The possible 'kind' values.
|
||||
ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner);
|
||||
|
||||
String _kind;
|
||||
String get kind => _kind;
|
||||
DateTime _timestamp;
|
||||
DateTime get timestamp => _timestamp;
|
||||
String _extensionKind;
|
||||
String get extensionKind => _extensionKind;
|
||||
Map<String, dynamic> _extensionData;
|
||||
Map<String, dynamic> get extensionData => _extensionData;
|
||||
List<Map<String, dynamic>> _timelineEvents;
|
||||
List<Map<String, dynamic>> get timelineEvents => _timelineEvents;
|
||||
|
||||
// The possible 'kind' values.
|
||||
static const String kVMUpdate = 'VMUpdate';
|
||||
static const String kIsolateStart = 'IsolateStart';
|
||||
static const String kIsolateRunnable = 'IsolateRunnable';
|
||||
@ -587,19 +600,6 @@ class ServiceEvent extends ServiceObject {
|
||||
static const String kLogging = '_Logging';
|
||||
static const String kExtension = 'Extension';
|
||||
|
||||
ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner);
|
||||
|
||||
String _kind;
|
||||
String get kind => _kind;
|
||||
DateTime _timestamp;
|
||||
DateTime get timestamp => _timestamp;
|
||||
String _extensionKind;
|
||||
String get extensionKind => _extensionKind;
|
||||
Map<String, dynamic> _extensionData;
|
||||
Map<String, dynamic> get extensionData => _extensionData;
|
||||
List<Map<String, dynamic>> _timelineEvents;
|
||||
List<Map<String, dynamic>> get timelineEvents => _timelineEvents;
|
||||
|
||||
@override
|
||||
void _update(Map<String, dynamic> map, bool mapIsRef) {
|
||||
_loaded = true;
|
||||
|
@ -22,11 +22,6 @@ const String _kData = 'data';
|
||||
/// A [StreamChannel] that expects VM service (JSON-rpc) protocol messages and
|
||||
/// serializes all such messages to the file system for later playback.
|
||||
class RecordingVMServiceChannel extends DelegatingStreamChannel<String> {
|
||||
final List<_Message> _messages = <_Message>[];
|
||||
|
||||
_RecordingStream _streamRecorder;
|
||||
_RecordingSink _sinkRecorder;
|
||||
|
||||
RecordingVMServiceChannel(StreamChannel<String> delegate, Directory location)
|
||||
: super(delegate) {
|
||||
addShutdownHook(() async {
|
||||
@ -41,6 +36,11 @@ class RecordingVMServiceChannel extends DelegatingStreamChannel<String> {
|
||||
}, ShutdownStage.SERIALIZE_RECORDING);
|
||||
}
|
||||
|
||||
final List<_Message> _messages = <_Message>[];
|
||||
|
||||
_RecordingStream _streamRecorder;
|
||||
_RecordingSink _sinkRecorder;
|
||||
|
||||
@override
|
||||
Stream<String> get stream {
|
||||
_streamRecorder ??= _RecordingStream(super.stream, _messages);
|
||||
@ -53,9 +53,6 @@ class RecordingVMServiceChannel extends DelegatingStreamChannel<String> {
|
||||
|
||||
/// Base class for request and response JSON-rpc messages.
|
||||
abstract class _Message implements Comparable<_Message> {
|
||||
final String type;
|
||||
final Map<String, dynamic> data;
|
||||
|
||||
_Message(this.type, this.data);
|
||||
|
||||
factory _Message.fromRecording(Map<String, dynamic> recordingData) {
|
||||
@ -64,6 +61,9 @@ abstract class _Message implements Comparable<_Message> {
|
||||
: _Response(recordingData[_kData]);
|
||||
}
|
||||
|
||||
final String type;
|
||||
final Map<String, dynamic> data;
|
||||
|
||||
int get id => data[_kId];
|
||||
|
||||
/// Allows [JsonEncoder] to properly encode objects of this type.
|
||||
@ -115,11 +115,6 @@ class _Transaction {
|
||||
/// A helper class that monitors a [Stream] of VM service JSON-rpc responses
|
||||
/// and saves the responses to a recording.
|
||||
class _RecordingStream {
|
||||
final Stream<String> _delegate;
|
||||
final StreamController<String> _controller;
|
||||
final List<_Message> _recording;
|
||||
StreamSubscription<String> _subscription;
|
||||
|
||||
_RecordingStream(Stream<String> stream, this._recording)
|
||||
: _delegate = stream,
|
||||
_controller = stream.isBroadcast
|
||||
@ -144,6 +139,11 @@ class _RecordingStream {
|
||||
};
|
||||
}
|
||||
|
||||
final Stream<String> _delegate;
|
||||
final StreamController<String> _controller;
|
||||
final List<_Message> _recording;
|
||||
StreamSubscription<String> _subscription;
|
||||
|
||||
StreamSubscription<String> _listenToStream() {
|
||||
return _delegate.listen(
|
||||
(String element) {
|
||||
@ -162,11 +162,11 @@ class _RecordingStream {
|
||||
/// A [StreamSink] that monitors VM service JSON-rpc requests and saves the
|
||||
/// requests to a recording.
|
||||
class _RecordingSink implements StreamSink<String> {
|
||||
_RecordingSink(this._delegate, this._recording);
|
||||
|
||||
final StreamSink<String> _delegate;
|
||||
final List<_Message> _recording;
|
||||
|
||||
_RecordingSink(this._delegate, this._recording);
|
||||
|
||||
@override
|
||||
Future<dynamic> close() => _delegate.close();
|
||||
|
||||
@ -194,13 +194,13 @@ class _RecordingSink implements StreamSink<String> {
|
||||
/// to its [StreamChannel.sink], looks up those requests in a recording, and
|
||||
/// replays the corresponding responses back from the recording.
|
||||
class ReplayVMServiceChannel extends StreamChannelMixin<String> {
|
||||
ReplayVMServiceChannel(Directory location)
|
||||
: _transactions = _loadTransactions(location);
|
||||
|
||||
final Map<int, _Transaction> _transactions;
|
||||
final StreamController<String> _controller = StreamController<String>();
|
||||
_ReplaySink _replaySink;
|
||||
|
||||
ReplayVMServiceChannel(Directory location)
|
||||
: _transactions = _loadTransactions(location);
|
||||
|
||||
static Map<int, _Transaction> _loadTransactions(Directory location) {
|
||||
final File file = _getManifest(location);
|
||||
final String jsonData = file.readAsStringSync();
|
||||
@ -250,11 +250,11 @@ class ReplayVMServiceChannel extends StreamChannelMixin<String> {
|
||||
}
|
||||
|
||||
class _ReplaySink implements StreamSink<String> {
|
||||
_ReplaySink(this.channel);
|
||||
|
||||
final ReplayVMServiceChannel channel;
|
||||
final Completer<Null> _completer = Completer<Null>();
|
||||
|
||||
_ReplaySink(this.channel);
|
||||
|
||||
@override
|
||||
Future<dynamic> close() {
|
||||
_completer.complete();
|
||||
|
@ -45,17 +45,6 @@ class VsCode {
|
||||
}
|
||||
}
|
||||
|
||||
final String directory;
|
||||
final String extensionDirectory;
|
||||
final Version version;
|
||||
final String edition;
|
||||
|
||||
static const String extensionIdentifier = 'Dart-Code.flutter';
|
||||
|
||||
bool _isValid = false;
|
||||
Version _extensionVersion;
|
||||
final List<String> _validationMessages = <String>[];
|
||||
|
||||
factory VsCode.fromDirectory(String installPath, String extensionDirectory,
|
||||
{ String edition }) {
|
||||
final String packageJsonPath =
|
||||
@ -67,6 +56,17 @@ class VsCode {
|
||||
return VsCode._(installPath, extensionDirectory, version: version, edition: edition);
|
||||
}
|
||||
|
||||
final String directory;
|
||||
final String extensionDirectory;
|
||||
final Version version;
|
||||
final String edition;
|
||||
|
||||
static const String extensionIdentifier = 'Dart-Code.flutter';
|
||||
|
||||
bool _isValid = false;
|
||||
Version _extensionVersion;
|
||||
final List<String> _validationMessages = <String>[];
|
||||
|
||||
bool get isValid => _isValid;
|
||||
String get productName => 'VS Code' + (edition != null ? ', $edition' : '');
|
||||
|
||||
|
@ -9,11 +9,12 @@ import '../doctor.dart';
|
||||
import 'vscode.dart';
|
||||
|
||||
class VsCodeValidator extends DoctorValidator {
|
||||
static const String extensionMarketplaceUrl =
|
||||
'https://marketplace.visualstudio.com/items?itemName=${VsCode.extensionIdentifier}';
|
||||
VsCodeValidator(this._vsCode) : super(_vsCode.productName);
|
||||
|
||||
final VsCode _vsCode;
|
||||
|
||||
VsCodeValidator(this._vsCode) : super(_vsCode.productName);
|
||||
static const String extensionMarketplaceUrl =
|
||||
'https://marketplace.visualstudio.com/items?itemName=${VsCode.extensionIdentifier}';
|
||||
|
||||
static Iterable<DoctorValidator> get installedValidators {
|
||||
return VsCode
|
||||
|
@ -510,18 +510,17 @@ class FakeGroupedDoctorWithStatus extends Doctor {
|
||||
/// A doctor that takes any two validators. Used to check behavior when
|
||||
/// merging ValidationTypes (installed, missing, partial).
|
||||
class FakeSmallGroupDoctor extends Doctor {
|
||||
List<DoctorValidator> _validators;
|
||||
FakeSmallGroupDoctor(DoctorValidator val1, DoctorValidator val2) {
|
||||
_validators = <DoctorValidator>[GroupedValidator(<DoctorValidator>[val1, val2])];
|
||||
}
|
||||
|
||||
List<DoctorValidator> _validators;
|
||||
|
||||
@override
|
||||
List<DoctorValidator> get validators => _validators;
|
||||
}
|
||||
|
||||
class VsCodeValidatorTestTargets extends VsCodeValidator {
|
||||
static final String validInstall = fs.path.join('test', 'data', 'vscode', 'application');
|
||||
static final String validExtensions = fs.path.join('test', 'data', 'vscode', 'extensions');
|
||||
static final String missingExtensions = fs.path.join('test', 'data', 'vscode', 'notExtensions');
|
||||
VsCodeValidatorTestTargets._(String installDirectory, String extensionDirectory, {String edition})
|
||||
: super(VsCode.fromDirectory(installDirectory, extensionDirectory, edition: edition));
|
||||
|
||||
@ -533,4 +532,8 @@ class VsCodeValidatorTestTargets extends VsCodeValidator {
|
||||
|
||||
static VsCodeValidatorTestTargets get installedWithoutExtension =>
|
||||
VsCodeValidatorTestTargets._(validInstall, missingExtensions);
|
||||
|
||||
static final String validInstall = fs.path.join('test', 'data', 'vscode', 'application');
|
||||
static final String validExtensions = fs.path.join('test', 'data', 'vscode', 'extensions');
|
||||
static final String missingExtensions = fs.path.join('test', 'data', 'vscode', 'notExtensions');
|
||||
}
|
||||
|
@ -251,13 +251,13 @@ class MockFile implements File {
|
||||
}
|
||||
|
||||
class MockDirectory implements Directory {
|
||||
static bool findCache = false;
|
||||
|
||||
MockDirectory(this.path);
|
||||
|
||||
@override
|
||||
final String path;
|
||||
|
||||
static bool findCache = false;
|
||||
|
||||
@override
|
||||
bool existsSync() => findCache && path.endsWith('.pub-cache');
|
||||
|
||||
|
@ -424,14 +424,14 @@ void main() {
|
||||
}
|
||||
|
||||
class MockVMService extends BasicMock implements VMService {
|
||||
Uri _httpAddress;
|
||||
HttpServer _server;
|
||||
MockVM _vm;
|
||||
|
||||
MockVMService() {
|
||||
_vm = MockVM(this);
|
||||
}
|
||||
|
||||
Uri _httpAddress;
|
||||
HttpServer _server;
|
||||
MockVM _vm;
|
||||
|
||||
@override
|
||||
Uri get httpAddress => _httpAddress;
|
||||
|
||||
@ -468,14 +468,14 @@ class MockVMService extends BasicMock implements VMService {
|
||||
}
|
||||
|
||||
class MockVM implements VM {
|
||||
MockVM(this._service);
|
||||
|
||||
final MockVMService _service;
|
||||
final Uri _baseUri = Uri.parse('file:///tmp/devfs/test');
|
||||
bool _devFSExists = false;
|
||||
|
||||
static const int kFileSystemAlreadyExists = 1001;
|
||||
|
||||
MockVM(this._service);
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> createDevFS(String fsName) async {
|
||||
_service.messages.add('create $fsName');
|
||||
|
@ -39,10 +39,10 @@ void main() {
|
||||
}
|
||||
|
||||
class TestDeviceManager extends DeviceManager {
|
||||
final List<Device> allDevices;
|
||||
|
||||
TestDeviceManager(this.allDevices);
|
||||
|
||||
final List<Device> allDevices;
|
||||
|
||||
@override
|
||||
Stream<Device> getAllConnectedDevices() {
|
||||
return Stream<Device>.fromIterable(allDevices);
|
||||
@ -50,11 +50,11 @@ class TestDeviceManager extends DeviceManager {
|
||||
}
|
||||
|
||||
class _MockDevice extends Device {
|
||||
_MockDevice(this.name, String id) : super(id);
|
||||
|
||||
@override
|
||||
final String name;
|
||||
|
||||
_MockDevice(this.name, String id) : super(id);
|
||||
|
||||
@override
|
||||
void noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
|
||||
}
|
||||
|
@ -152,10 +152,10 @@ void main() {
|
||||
}
|
||||
|
||||
class TestEmulatorManager extends EmulatorManager {
|
||||
final List<Emulator> allEmulators;
|
||||
|
||||
TestEmulatorManager(this.allEmulators);
|
||||
|
||||
final List<Emulator> allEmulators;
|
||||
|
||||
@override
|
||||
Future<List<Emulator>> getAllAvailableEmulators() {
|
||||
return Future<List<Emulator>>.value(allEmulators);
|
||||
|
@ -135,10 +135,10 @@ class MockDevice extends Mock implements Device {
|
||||
}
|
||||
|
||||
class TestHotRunnerConfig extends HotRunnerConfig {
|
||||
bool successfulSetup;
|
||||
|
||||
TestHotRunnerConfig({@required this.successfulSetup});
|
||||
|
||||
bool successfulSetup;
|
||||
|
||||
@override
|
||||
Future<bool> setupHotRestart() async {
|
||||
return successfulSetup;
|
||||
|
@ -223,9 +223,10 @@ void main() {
|
||||
}
|
||||
|
||||
class MockPortForwarder extends DevicePortForwarder {
|
||||
final int availablePort;
|
||||
MockPortForwarder([this.availablePort]);
|
||||
|
||||
final int availablePort;
|
||||
|
||||
@override
|
||||
Future<int> forward(int devicePort, {int hostPort}) async {
|
||||
hostPort ??= 0;
|
||||
|
@ -308,12 +308,12 @@ class MockStdio extends Stdio {
|
||||
}
|
||||
|
||||
class MockPollingDeviceDiscovery extends PollingDeviceDiscovery {
|
||||
MockPollingDeviceDiscovery() : super('mock');
|
||||
|
||||
final List<Device> _devices = <Device>[];
|
||||
final StreamController<Device> _onAddedController = StreamController<Device>.broadcast();
|
||||
final StreamController<Device> _onRemovedController = StreamController<Device>.broadcast();
|
||||
|
||||
MockPollingDeviceDiscovery() : super('mock');
|
||||
|
||||
@override
|
||||
Future<List<Device>> pollingGetDevices() async => _devices;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user