mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Trivial nit fixes (#12285)
This commit is contained in:
parent
4389f07024
commit
efb45ea788
@ -23,7 +23,7 @@ DeviceOperatingSystem deviceOperatingSystem = DeviceOperatingSystem.android;
|
||||
/// Discovers available devices and chooses one to work with.
|
||||
abstract class DeviceDiscovery {
|
||||
factory DeviceDiscovery() {
|
||||
switch(deviceOperatingSystem) {
|
||||
switch (deviceOperatingSystem) {
|
||||
case DeviceOperatingSystem.android:
|
||||
return new AndroidDeviceDiscovery();
|
||||
case DeviceOperatingSystem.ios:
|
||||
|
@ -101,7 +101,7 @@ Future<Null> saveScreenshots(List<String> fromPaths, List<String> largeNames, Li
|
||||
for (int index = 0; index < uploads.length; index += 1)
|
||||
uploads[index] = new Upload(fromPaths[index], largeNames[index], smallNames[index]);
|
||||
|
||||
while(uploads.any(Upload.isNotComplete)) {
|
||||
while (uploads.any(Upload.isNotComplete)) {
|
||||
final HttpClient client = new HttpClient();
|
||||
uploads = uploads.where(Upload.isNotComplete).toList();
|
||||
await Future.wait(uploads.map((Upload upload) => upload.run(client)));
|
||||
|
@ -265,7 +265,7 @@ class CardCollectionState extends State<CardCollection> {
|
||||
);
|
||||
|
||||
String backgroundMessage;
|
||||
switch(_dismissDirection) {
|
||||
switch (_dismissDirection) {
|
||||
case DismissDirection.horizontal:
|
||||
backgroundMessage = "Swipe in either direction";
|
||||
break;
|
||||
|
@ -199,7 +199,7 @@ class GridDemoPhotoItem extends StatelessWidget {
|
||||
|
||||
final IconData icon = photo.isFavorite ? Icons.star : Icons.star_border;
|
||||
|
||||
switch(tileStyle) {
|
||||
switch (tileStyle) {
|
||||
case GridDemoTileStyle.imageOnly:
|
||||
return image;
|
||||
|
||||
|
@ -60,7 +60,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
|
||||
}
|
||||
|
||||
void handleDemoAction(LeaveBehindDemoAction action) {
|
||||
switch(action) {
|
||||
switch (action) {
|
||||
case LeaveBehindDemoAction.reset:
|
||||
initListItems();
|
||||
break;
|
||||
|
@ -83,7 +83,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
|
||||
controller: _controller,
|
||||
isScrollable: true,
|
||||
tabs: _allPages.map((_Page page) {
|
||||
switch(_demoStyle) {
|
||||
switch (_demoStyle) {
|
||||
case TabsDemoStyle.iconsAndText:
|
||||
return new Tab(text: page.text, icon: new Icon(page.icon));
|
||||
case TabsDemoStyle.iconsOnly:
|
||||
|
@ -116,7 +116,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
|
||||
bool _generateSpans() {
|
||||
int lastLoopPosition = _scanner.position;
|
||||
|
||||
while(!_scanner.isDone) {
|
||||
while (!_scanner.isDone) {
|
||||
// Skip White space
|
||||
_scanner.scan(new RegExp(r"\s+"));
|
||||
|
||||
@ -294,7 +294,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
|
||||
}
|
||||
|
||||
void _simplify() {
|
||||
for(int i = _spans.length - 2; i >= 0; i -= 1) {
|
||||
for (int i = _spans.length - 2; i >= 0; i -= 1) {
|
||||
if (_spans[i].type == _spans[i + 1].type && _spans[i].end == _spans[i + 1].start) {
|
||||
_spans[i] = new _HighlightSpan(
|
||||
_spans[i].type,
|
||||
|
@ -121,7 +121,7 @@ Future<Null> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
|
||||
final Iterator<Map<String, dynamic>> eventIter = events.iterator;
|
||||
String lastEventName = '';
|
||||
String lastRouteName = '';
|
||||
while(eventIter.moveNext()) {
|
||||
while (eventIter.moveNext()) {
|
||||
final String eventName = eventIter.current['name'];
|
||||
|
||||
if (!<String>['Start Transition', 'Frame'].contains(eventName))
|
||||
|
@ -282,7 +282,7 @@ class IsolateExampleState extends State<StatefulWidget> with SingleTickerProvide
|
||||
}
|
||||
|
||||
String _getStatus(CalculationState state) {
|
||||
switch(state) {
|
||||
switch (state) {
|
||||
case CalculationState.loading:
|
||||
return 'Loading...';
|
||||
case CalculationState.calculating:
|
||||
|
@ -27,7 +27,7 @@ void main() {
|
||||
await driver.tap(button);
|
||||
|
||||
String batteryLevel;
|
||||
while(batteryLevel == null || batteryLevel.isEmpty) {
|
||||
while (batteryLevel == null || batteryLevel.isEmpty) {
|
||||
batteryLevel = await driver.getText(batteryLevelLabel);
|
||||
}
|
||||
expect(batteryLevel, isNotEmpty);
|
||||
|
@ -86,7 +86,7 @@ class StockHomeState extends State<StockHome> {
|
||||
}
|
||||
|
||||
void _handleStockMenu(BuildContext context, _StockMenuItem value) {
|
||||
switch(value) {
|
||||
switch (value) {
|
||||
case _StockMenuItem.autorefresh:
|
||||
setState(() {
|
||||
_autorefresh = !_autorefresh;
|
||||
|
@ -1386,7 +1386,7 @@ class IterableProperty<T> extends DiagnosticsProperty<Iterable<T>> {
|
||||
/// Create a diagnostics property for iterables (e.g. lists).
|
||||
///
|
||||
/// The [ifEmpty] argument is used to indicate how an iterable [value] with 0
|
||||
/// elements is displayed. If [ifEmpty] equals `null` that indicates that an
|
||||
/// elements is displayed. If [ifEmpty] equals null that indicates that an
|
||||
/// empty iterable [value] is not interesting to display similar to how
|
||||
/// [defaultValue] is used to indicate that a specific concrete value is not
|
||||
/// interesting to display.
|
||||
@ -1433,10 +1433,10 @@ class IterableProperty<T> extends DiagnosticsProperty<Iterable<T>> {
|
||||
/// Priority level of the diagnostic used to control which diagnostics should
|
||||
/// be shown and filtered.
|
||||
///
|
||||
/// If [ifEmpty] is `null` and the [value] is an empty [Iterable] then level
|
||||
/// If [ifEmpty] is null and the [value] is an empty [Iterable] then level
|
||||
/// [DiagnosticLevel.fine] is returned in a similar way to how an
|
||||
/// [ObjectFlagProperty] handles when [ifNull] is `null` and the [value] is
|
||||
/// `null`.
|
||||
/// [ObjectFlagProperty] handles when [ifNull] is null and the [value] is
|
||||
/// null.
|
||||
@override
|
||||
DiagnosticLevel get level {
|
||||
if (ifEmpty == null && value != null && value.isEmpty && super.level != DiagnosticLevel.hidden)
|
||||
@ -1605,8 +1605,8 @@ class DiagnosticsProperty<T> extends DiagnosticsNode {
|
||||
///
|
||||
/// The [level] argument is just a suggestion and can be overridden if
|
||||
/// something else about the property causes it to have a lower or higher
|
||||
/// level. For example, if the property value is `null` and [missingIfNull] is
|
||||
/// `true`, [level] is raised to [DiagnosticLevel.warning].
|
||||
/// level. For example, if the property value is null and [missingIfNull] is
|
||||
/// true, [level] is raised to [DiagnosticLevel.warning].
|
||||
DiagnosticsProperty(
|
||||
String name,
|
||||
T value, {
|
||||
@ -2056,7 +2056,7 @@ abstract class Diagnosticable {
|
||||
/// Returns a debug representation of the object that is used by debugging
|
||||
/// tools and by [toStringDeep].
|
||||
///
|
||||
/// Leave [name] as `null` if there is not a meaningful description of the
|
||||
/// Leave [name] as null if there is not a meaningful description of the
|
||||
/// relationship between the this node and its parent.
|
||||
///
|
||||
/// Typically the [style] argument is only specified to indicate an atypical
|
||||
|
@ -254,7 +254,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
|
||||
|
||||
@override
|
||||
void didStopTrackingLastPointer(int pointer) {
|
||||
switch(_state) {
|
||||
switch (_state) {
|
||||
case _ScaleState.possible:
|
||||
resolve(GestureDisposition.rejected);
|
||||
break;
|
||||
|
@ -87,7 +87,7 @@ class _DatePickerHeader extends StatelessWidget {
|
||||
final TextTheme headerTextTheme = themeData.primaryTextTheme;
|
||||
Color dayColor;
|
||||
Color yearColor;
|
||||
switch(themeData.primaryColorBrightness) {
|
||||
switch (themeData.primaryColorBrightness) {
|
||||
case Brightness.light:
|
||||
dayColor = mode == DatePickerMode.day ? Colors.black87 : Colors.black54;
|
||||
yearColor = mode == DatePickerMode.year ? Colors.black87 : Colors.black54;
|
||||
|
@ -54,7 +54,7 @@ class ExpansionTile extends StatefulWidget {
|
||||
/// Called when the tile expands or collapses.
|
||||
///
|
||||
/// When the tile starts expanding, this function is called with the value
|
||||
/// `true`. When the tile starts collapsing, this function is called with
|
||||
/// true. When the tile starts collapsing, this function is called with
|
||||
/// the value false.
|
||||
final ValueChanged<bool> onExpansionChanged;
|
||||
|
||||
|
@ -71,7 +71,7 @@ import 'theme.dart';
|
||||
/// ```dart
|
||||
/// assert(debugCheckHasMaterial(context));
|
||||
/// ```
|
||||
/// The parameter [enableFeedback] must not be `null`.
|
||||
/// The parameter [enableFeedback] must not be null.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
|
@ -102,7 +102,7 @@ abstract class MaterialLocalizations {
|
||||
/// This text theme is incomplete. For example, it lacks text color
|
||||
/// information. This theme must be merged with another text theme that
|
||||
/// provides the missing values. The text styles provided by this theme have
|
||||
/// their [TextStyle.inherit] property set to `true`.
|
||||
/// their [TextStyle.inherit] property set to true.
|
||||
///
|
||||
/// Typically a complete theme is obtained via [Theme.of], which can be
|
||||
/// localized using the [Localizations] widget.
|
||||
|
@ -303,7 +303,7 @@ class _IndicatorPainter extends CustomPainter {
|
||||
|
||||
static bool _tabOffsetsNotEqual(List<double> a, List<double> b) {
|
||||
assert(a != null && b != null && a.length == b.length);
|
||||
for(int i = 0; i < a.length; i++) {
|
||||
for (int i = 0; i < a.length; i += 1) {
|
||||
if (a[i] != b[i])
|
||||
return true;
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ class ThemeData {
|
||||
/// provided by the [localTextGeometry].
|
||||
///
|
||||
/// The [TextStyle.inherit] field in the text styles provided by
|
||||
/// [localTextGeometry] must be set to `true`.
|
||||
/// [localTextGeometry] must be set to true.
|
||||
static ThemeData localize(ThemeData baseTheme, TextTheme localTextGeometry) {
|
||||
assert(baseTheme != null);
|
||||
assert(localTextGeometry != null);
|
||||
|
@ -287,7 +287,7 @@ class _MinuteControl extends StatelessWidget {
|
||||
/// Provides time picker header layout configuration for the given
|
||||
/// [timeOfDayFormat] passing [context] to each widget in the configuration.
|
||||
///
|
||||
/// [timeOfDayFormat] and [context] must not be `null`.
|
||||
/// The [timeOfDayFormat] and [context] arguments must not be null.
|
||||
_TimePickerHeaderFormat _buildHeaderFormat(TimeOfDayFormat timeOfDayFormat, _TimePickerFragmentContext context) {
|
||||
// Creates an hour fragment.
|
||||
_TimePickerHeaderFragment hour(HourFormat hourFormat) {
|
||||
|
@ -130,7 +130,7 @@ class TwoLevelSublist extends StatefulWidget {
|
||||
/// Called when the sublist expands or collapses.
|
||||
///
|
||||
/// When the sublist starts expanding, this function is called with the value
|
||||
/// `true`. When the sublist starts collapsing, this function is called with
|
||||
/// true. When the sublist starts collapsing, this function is called with
|
||||
/// the value false.
|
||||
final ValueChanged<bool> onOpenChanged;
|
||||
|
||||
|
@ -778,7 +778,7 @@ class _RootSemanticsFragment extends _InterestingSemanticsFragment {
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a RenderObject that has [isSemanticBoundary] set to `true`.
|
||||
/// Represents a RenderObject that has [isSemanticBoundary] set to true.
|
||||
///
|
||||
/// It returns the SemanticsNode for that [RenderObject].
|
||||
class _ConcreteSemanticsFragment extends _InterestingSemanticsFragment {
|
||||
@ -818,7 +818,7 @@ class _ConcreteSemanticsFragment extends _InterestingSemanticsFragment {
|
||||
}
|
||||
|
||||
/// Represents a RenderObject that does not have [isSemanticBoundary] set to
|
||||
/// `true`, but which does have some semantic annotators.
|
||||
/// true, but which does have some semantic annotators.
|
||||
///
|
||||
/// When it is compiled, if the nearest ancestor [_SemanticsFragment] that isn't
|
||||
/// also an [_ImplicitSemanticsFragment] is a [_RootSemanticsFragment] or a
|
||||
@ -2500,7 +2500,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
/// Whether this [RenderObject] makes other [RenderObject]s previously painted
|
||||
/// within the same semantic boundary unreachable for accessibility purposes.
|
||||
///
|
||||
/// If `true` is returned, the [SemanticsNode]s for all siblings and cousins
|
||||
/// If true is returned, the [SemanticsNode]s for all siblings and cousins
|
||||
/// of this node, that are earlier in a depth-first pre-order traversal, are
|
||||
/// dropped from the semantics tree up until a semantic boundary (as defined
|
||||
/// by [isSemanticBoundary]) is reached.
|
||||
@ -2562,9 +2562,9 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
///
|
||||
/// The parameters [onlyLocalUpdates] and [noGeometry] tell the framework
|
||||
/// how much of the semantics have changed. Bigger changes (indicated by
|
||||
/// setting one or both parameters to `false`) are more expansive to compute.
|
||||
/// setting one or both parameters to false) are more expansive to compute.
|
||||
///
|
||||
/// [onlyLocalUpdates] should be set to `true` to reduce cost if the semantics
|
||||
/// [onlyLocalUpdates] should be set to true to reduce cost if the semantics
|
||||
/// update does not in any way change the shape of the semantics tree (e.g.
|
||||
/// [SemanticsNode]s will neither be added/removed from the tree nor be moved
|
||||
/// within the tree). In other words, with [onlyLocalChanges] the
|
||||
@ -2572,14 +2572,14 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
/// local [SemanticsNode] (e.g. changing a label or flag) without affecting
|
||||
/// other nodes in the tree.
|
||||
///
|
||||
/// [onlyLocalUpdates] has to be set to `false` in the following cases as they
|
||||
/// [onlyLocalUpdates] has to be set to false in the following cases as they
|
||||
/// will change the shape of the tree:
|
||||
///
|
||||
/// 1. [isSemanticBoundary] changed its value.
|
||||
/// 2. [semanticsAnnotator] changed from or to returning `null` and
|
||||
/// [isSemanticBoundary] isn't `true`.
|
||||
/// 2. [semanticsAnnotator] changed from or to returning null and
|
||||
/// [isSemanticBoundary] isn't true.
|
||||
///
|
||||
/// [noGeometry] should be set to `true` to reduce cost if the geometry (e.g.
|
||||
/// [noGeometry] should be set to true to reduce cost if the geometry (e.g.
|
||||
/// size and position) of the corresponding [SemanticsNode] has not
|
||||
/// changed. Examples for such semantic updates that don't require a geometry
|
||||
/// update are changes to flags, labels, or actions.
|
||||
@ -2766,7 +2766,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
/// [markNeedsSemanticsUpdate] must not have `onlyLocalUpdates` set, as it is
|
||||
/// possible that the node should be entirely removed.
|
||||
///
|
||||
/// If the annotation should only happen under certain conditions, `null`
|
||||
/// If the annotation should only happen under certain conditions, null
|
||||
/// should be returned if those conditions are currently not met to avoid
|
||||
/// the creation of an empty [SemanticsNode].
|
||||
SemanticsAnnotator get semanticsAnnotator => null;
|
||||
|
@ -830,7 +830,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
|
||||
if (_children == null)
|
||||
return const <SemanticsNode>[];
|
||||
|
||||
switch(childOrder) {
|
||||
switch (childOrder) {
|
||||
case DebugSemanticsDumpOrder.traversal:
|
||||
return new List<SemanticsNode>.from(_children)..sort(_geometryComparator);
|
||||
case DebugSemanticsDumpOrder.inverseHitTest:
|
||||
|
@ -209,7 +209,7 @@ abstract class RenderSliverPersistentHeader extends RenderSliver with RenderObje
|
||||
/// be excluded from the semantic scrolling area.
|
||||
///
|
||||
/// [RenderSliver]s that stay on the screen even though the user has scrolled
|
||||
/// past them (e.g. a pinned app bar) should set this to `true`.
|
||||
/// past them (e.g. a pinned app bar) should set this to true.
|
||||
@protected
|
||||
bool get excludeFromSemanticsScrolling => _excludeFromSemanticsScrolling;
|
||||
bool _excludeFromSemanticsScrolling = false;
|
||||
|
@ -330,7 +330,7 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
|
||||
// Android devices (Java really) report 3 deprecated language codes, see
|
||||
// http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4140555
|
||||
// and https://developer.android.com/reference/java/util/Locale.html
|
||||
switch(newLocale.languageCode) {
|
||||
switch (newLocale.languageCode) {
|
||||
case 'iw':
|
||||
newLocale = new Locale('he', newLocale.countryCode); // Hebrew
|
||||
break;
|
||||
|
@ -285,7 +285,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
|
||||
if (_directionIsXAxis) {
|
||||
if (vx.abs() - vy.abs() < _kMinFlingVelocityDelta)
|
||||
return false;
|
||||
switch(widget.direction) {
|
||||
switch (widget.direction) {
|
||||
case DismissDirection.horizontal:
|
||||
return vx.abs() > _kMinFlingVelocity;
|
||||
case DismissDirection.endToStart:
|
||||
@ -296,7 +296,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
|
||||
} else {
|
||||
if (vy.abs() - vx.abs() < _kMinFlingVelocityDelta)
|
||||
return false;
|
||||
switch(widget.direction) {
|
||||
switch (widget.direction) {
|
||||
case DismissDirection.vertical:
|
||||
return vy.abs() > _kMinFlingVelocity;
|
||||
case DismissDirection.up:
|
||||
|
@ -406,7 +406,7 @@ class _FadeInImageState extends State<FadeInImage> with TickerProviderStateMixin
|
||||
|
||||
void _updatePhase() {
|
||||
setState(() {
|
||||
switch(_phase) {
|
||||
switch (_phase) {
|
||||
case FadeInImagePhase.start:
|
||||
if (_imageResolver._imageInfo != null)
|
||||
_phase = FadeInImagePhase.completed;
|
||||
|
@ -567,7 +567,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
|
||||
/// The event can be interpreted by assistive technologies to provide
|
||||
/// additional feedback to the user about the state of the UI.
|
||||
///
|
||||
/// The event will not be sent if [excludeFromSemantics] is set to `true`.
|
||||
/// The event will not be sent if [excludeFromSemantics] is set to true.
|
||||
void sendSemanticsEvent(SemanticsEvent event) {
|
||||
if (!widget.excludeFromSemantics) {
|
||||
final RenderSemanticsGestureHandler semanticsGestureHandler = context.findRenderObject();
|
||||
|
@ -411,7 +411,7 @@ class Localizations extends StatefulWidget {
|
||||
/// Returns the localized resources object of the given `type` for the widget
|
||||
/// tree that corresponds to the given `context`.
|
||||
///
|
||||
/// Returns `null` if no resources object of the given `type` exists within
|
||||
/// Returns null if no resources object of the given `type` exists within
|
||||
/// the given `context`.
|
||||
///
|
||||
/// This method is typically used by a static factory method on the `type`
|
||||
|
@ -274,7 +274,7 @@ void main() {
|
||||
// have the same origin and height as the dropdown button.
|
||||
final List<RenderObject> itemBoxes = tester.renderObjectList(find.byKey(const ValueKey<String>('two'))).toList();
|
||||
expect(itemBoxes.length, equals(2));
|
||||
for(RenderBox itemBox in itemBoxes) {
|
||||
for (RenderBox itemBox in itemBoxes) {
|
||||
assert(itemBox.attached);
|
||||
expect(buttonBox.localToGlobal(Offset.zero), equals(itemBox.localToGlobal(Offset.zero)));
|
||||
expect(buttonBox.size.height, equals(itemBox.size.height));
|
||||
@ -310,7 +310,7 @@ void main() {
|
||||
final double menuItemHeight = itemBoxes.map((RenderBox box) => box.size.height).reduce(math.max);
|
||||
expect(menuItemHeight, greaterThan(buttonBox.size.height));
|
||||
|
||||
for(RenderBox itemBox in itemBoxes) {
|
||||
for (RenderBox itemBox in itemBoxes) {
|
||||
assert(itemBox.attached);
|
||||
final Offset buttonBoxCenter = buttonBox.size.center(buttonBox.localToGlobal(Offset.zero));
|
||||
final Offset itemBoxCenter = itemBox.size.center(itemBox.localToGlobal(Offset.zero));
|
||||
|
@ -82,7 +82,7 @@ void main() {
|
||||
headerBuilder: (BuildContext context, bool isExpanded) {
|
||||
return new Text(isExpanded ? 'B' : 'A');
|
||||
},
|
||||
body: const SizedBox(height:100.0),
|
||||
body: const SizedBox(height: 100.0),
|
||||
isExpanded: true,
|
||||
),
|
||||
],
|
||||
@ -93,7 +93,7 @@ void main() {
|
||||
headerBuilder: (BuildContext context, bool isExpanded){
|
||||
return new Text(isExpanded ? 'D' : 'C');
|
||||
},
|
||||
body: const SizedBox(height:100.0),
|
||||
body: const SizedBox(height: 100.0),
|
||||
isExpanded: true,
|
||||
),
|
||||
],
|
||||
|
@ -160,29 +160,31 @@ void main() {
|
||||
);
|
||||
|
||||
expect(
|
||||
Material.of(tester.element(find.byType(Switch))),
|
||||
paints
|
||||
..rrect(
|
||||
color: Colors.blue[500],
|
||||
rrect: new RRect.fromLTRBR(
|
||||
383.5, 293.0, 416.5, 307.0, const Radius.circular(7.0)))
|
||||
..circle(color: const Color(0x33000000))
|
||||
..circle(color: const Color(0x24000000))
|
||||
..circle(color: const Color(0x1f000000))
|
||||
..circle(color: Colors.yellow[500]));
|
||||
Material.of(tester.element(find.byType(Switch))),
|
||||
paints
|
||||
..rrect(
|
||||
color: Colors.blue[500],
|
||||
rrect: new RRect.fromLTRBR(
|
||||
383.5, 293.0, 416.5, 307.0, const Radius.circular(7.0)))
|
||||
..circle(color: const Color(0x33000000))
|
||||
..circle(color: const Color(0x24000000))
|
||||
..circle(color: const Color(0x1f000000))
|
||||
..circle(color: Colors.yellow[500])
|
||||
);
|
||||
await tester.drag(find.byType(Switch), const Offset(-30.0, 0.0));
|
||||
await tester.pump();
|
||||
|
||||
expect(
|
||||
Material.of(tester.element(find.byType(Switch))),
|
||||
paints
|
||||
..rrect(
|
||||
color: Colors.green[500],
|
||||
rrect: new RRect.fromLTRBR(
|
||||
383.5, 293.0, 416.5, 307.0, const Radius.circular(7.0)))
|
||||
..circle(color: const Color(0x33000000))
|
||||
..circle(color: const Color(0x24000000))
|
||||
..circle(color: const Color(0x1f000000))
|
||||
..circle(color: Colors.red[500]));
|
||||
Material.of(tester.element(find.byType(Switch))),
|
||||
paints
|
||||
..rrect(
|
||||
color: Colors.green[500],
|
||||
rrect: new RRect.fromLTRBR(
|
||||
383.5, 293.0, 416.5, 307.0, const Radius.circular(7.0)))
|
||||
..circle(color: const Color(0x33000000))
|
||||
..circle(color: const Color(0x24000000))
|
||||
..circle(color: const Color(0x1f000000))
|
||||
..circle(color: Colors.red[500])
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ void main() {
|
||||
await tester.tap(find.byKey(dropdownMenuButtonKey));
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
|
||||
for(Element item in tester.elementList(find.text('menuItem')))
|
||||
for (Element item in tester.elementList(find.text('menuItem')))
|
||||
expect(Theme.of(item).brightness, equals(Brightness.light));
|
||||
});
|
||||
|
||||
|
@ -75,7 +75,7 @@ final Duration _kPauseBetweenReconnectAttempts = _kShortTimeout ~/ 5;
|
||||
// See https://github.com/dart-lang/sdk/blob/master/runtime/vm/timeline.cc#L32
|
||||
String _timelineStreamsToString(List<TimelineStream> streams) {
|
||||
final String contents = streams.map((TimelineStream stream) {
|
||||
switch(stream) {
|
||||
switch (stream) {
|
||||
case TimelineStream.all: return 'all';
|
||||
case TimelineStream.api: return 'API';
|
||||
case TimelineStream.compiler: return 'Compiler';
|
||||
@ -425,7 +425,7 @@ class FlutterDriver {
|
||||
|
||||
/// Turns semantics on or off in the Flutter app under test.
|
||||
///
|
||||
/// Returns `true` when the call actually changed the state from on to off or
|
||||
/// Returns true when the call actually changed the state from on to off or
|
||||
/// vice versa.
|
||||
Future<bool> setSemantics(bool enabled, { Duration timeout: _kShortTimeout }) async {
|
||||
final SetSemanticsResult result = SetSemanticsResult.fromJson(await _sendCommand(new SetSemantics(enabled, timeout: timeout)));
|
||||
|
@ -131,7 +131,7 @@ abstract class SerializableFinder {
|
||||
/// Deserializes a finder from JSON generated by [serialize].
|
||||
static SerializableFinder deserialize(Map<String, String> json) {
|
||||
final String finderType = json['finderType'];
|
||||
switch(finderType) {
|
||||
switch (finderType) {
|
||||
case 'ByType': return ByType.deserialize(json);
|
||||
case 'ByValueKey': return ByValueKey.deserialize(json);
|
||||
case 'ByTooltipMessage': return ByTooltipMessage.deserialize(json);
|
||||
@ -219,7 +219,7 @@ class ByValueKey extends SerializableFinder {
|
||||
static ByValueKey deserialize(Map<String, String> json) {
|
||||
final String keyValueString = json['keyValueString'];
|
||||
final String keyValueType = json['keyValueType'];
|
||||
switch(keyValueType) {
|
||||
switch (keyValueType) {
|
||||
case 'int':
|
||||
return new ByValueKey(int.parse(keyValueString));
|
||||
case 'String':
|
||||
|
@ -138,7 +138,7 @@ class TimelineSummary {
|
||||
// Timeline does not guarantee that the first event is the "begin" event.
|
||||
final Iterator<TimelineEvent> events = _extractNamedEvents(name)
|
||||
.skipWhile((TimelineEvent evt) => evt.phase != 'B').iterator;
|
||||
while(events.moveNext()) {
|
||||
while (events.moveNext()) {
|
||||
final TimelineEvent beginEvent = events.current;
|
||||
if (events.moveNext()) {
|
||||
final TimelineEvent endEvent = events.current;
|
||||
|
@ -434,10 +434,10 @@ class _EqualsIgnoringHashCodes extends Matcher {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `true` if [c] represents a whitespace code unit.
|
||||
/// Returns true if [c] represents a whitespace code unit.
|
||||
bool _isWhitespace(int c) => (c <= 0x000D && c >= 0x0009) || c == 0x0020;
|
||||
|
||||
/// Returns `true` if [c] represents a vertical line unicode line art code unit.
|
||||
/// Returns true if [c] represents a vertical line unicode line art code unit.
|
||||
///
|
||||
/// See [https://en.wikipedia.org/wiki/Box-drawing_character]. This method only
|
||||
/// specifies vertical line art code units currently used by Flutter line art.
|
||||
|
@ -118,11 +118,7 @@ class AnsiTerminal {
|
||||
}
|
||||
String choice;
|
||||
singleCharMode = true;
|
||||
while(
|
||||
isEmpty(choice)
|
||||
|| choice.length != 1
|
||||
|| !acceptedCharacters.contains(choice)
|
||||
) {
|
||||
while (isEmpty(choice) || choice.length != 1 || !acceptedCharacters.contains(choice)) {
|
||||
if (isNotEmpty(prompt)) {
|
||||
printStatus(prompt, emphasis: true, newline: false);
|
||||
if (displayAcceptedCharacters)
|
||||
|
@ -53,8 +53,8 @@ abstract class AnalyzeBase {
|
||||
bool get isBenchmarking => argResults['benchmark'];
|
||||
}
|
||||
|
||||
/// Return `true` if [fileList] contains a path that resides inside the Flutter repository.
|
||||
/// If [fileList] is empty, then return `true` if the current directory resides inside the Flutter repository.
|
||||
/// Return true if [fileList] contains a path that resides inside the Flutter repository.
|
||||
/// If [fileList] is empty, then return true if the current directory resides inside the Flutter repository.
|
||||
bool inRepo(List<String> fileList) {
|
||||
if (fileList == null || fileList.isEmpty)
|
||||
fileList = <String>[fs.path.current];
|
||||
|
@ -383,7 +383,7 @@ String _validateProjectDir(String dirPath, { String flutterRoot }) {
|
||||
final FileSystemEntityType type = fs.typeSync(dirPath);
|
||||
|
||||
if (type != FileSystemEntityType.NOT_FOUND) {
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case FileSystemEntityType.FILE:
|
||||
// Do not overwrite files.
|
||||
return "Invalid project name: '$dirPath' - file exists.";
|
||||
|
@ -109,7 +109,7 @@ class ResidentCompiler {
|
||||
/// Otherwise, [mainPath] is ignored, but [invalidatedFiles] is recompiled
|
||||
/// into new binary.
|
||||
/// Binary file name is returned if compilation was successful, otherwise
|
||||
/// `null` is returned.
|
||||
/// null is returned.
|
||||
Future<String> recompile(String mainPath, List<String> invalidatedFiles) async {
|
||||
stdoutHandler.reset();
|
||||
|
||||
|
@ -30,7 +30,7 @@ DevFSConfig get devFSConfig => context[DevFSConfig];
|
||||
abstract class DevFSContent {
|
||||
bool _exists = true;
|
||||
|
||||
/// Return `true` if this is the first time this method is called
|
||||
/// Return true if this is the first time this method is called
|
||||
/// or if the entry has been modified since this method was last called.
|
||||
bool get isModified;
|
||||
|
||||
@ -125,7 +125,7 @@ class DevFSByteContent extends DevFSContent {
|
||||
_isModified = true;
|
||||
}
|
||||
|
||||
/// Return `true` only once so that the content is written to the device only once.
|
||||
/// Return true only once so that the content is written to the device only once.
|
||||
@override
|
||||
bool get isModified {
|
||||
final bool modified = _isModified;
|
||||
|
@ -668,12 +668,12 @@ int compareIosVersions(String v1, String v2) {
|
||||
final List<int> v2Fragments = v2.split('.').map(int.parse).toList();
|
||||
|
||||
int i = 0;
|
||||
while(i < v1Fragments.length && i < v2Fragments.length) {
|
||||
while (i < v1Fragments.length && i < v2Fragments.length) {
|
||||
final int v1Fragment = v1Fragments[i];
|
||||
final int v2Fragment = v2Fragments[i];
|
||||
if (v1Fragment != v2Fragment)
|
||||
return v1Fragment.compareTo(v2Fragment);
|
||||
i++;
|
||||
i += 1;
|
||||
}
|
||||
return v1Fragments.length.compareTo(v2Fragments.length);
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ class VersionCheckError implements Exception {
|
||||
|
||||
/// Runs [command] and returns the standard output as a string.
|
||||
///
|
||||
/// If [lenient] is `true` and the command fails, returns an empty string.
|
||||
/// If [lenient] is true and the command fails, returns an empty string.
|
||||
/// Otherwise, throws a [ToolExit] exception.
|
||||
String _runSync(List<String> command, {bool lenient: true}) {
|
||||
final ProcessResult results = processManager.runSync(command, workingDirectory: Cache.flutterRoot);
|
||||
|
Loading…
Reference in New Issue
Block a user