Unverified Commit 4c1f4d14 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

fix some formatting issues (#28809)

* fix some formatting issues

* address review comments

* fix indent
parent 01a29b85
...@@ -119,8 +119,10 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { ...@@ -119,8 +119,10 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
final double maxHeight; final double maxHeight;
final Widget child; final Widget child;
@override double get minExtent => minHeight; @override
@override double get maxExtent => math.max(maxHeight, minHeight); double get minExtent => minHeight;
@override
double get maxExtent => math.max(maxHeight, minHeight);
@override @override
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) { Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
......
...@@ -669,7 +669,7 @@ class Tab2ConversationRow extends StatelessWidget { ...@@ -669,7 +669,7 @@ class Tab2ConversationRow extends StatelessWidget {
} }
List<Widget> buildTab2Conversation() { List<Widget> buildTab2Conversation() {
return <Widget>[ return <Widget>[
const Tab2ConversationRow( const Tab2ConversationRow(
text: "My Xanadu doesn't look right", text: "My Xanadu doesn't look right",
), ),
......
...@@ -8,9 +8,13 @@ import '../demo/all.dart'; ...@@ -8,9 +8,13 @@ import '../demo/all.dart';
import 'icons.dart'; import 'icons.dart';
class GalleryDemoCategory { class GalleryDemoCategory {
const GalleryDemoCategory._({ this.name, this.icon }); const GalleryDemoCategory._({
@required final String name; @required this.name,
@required final IconData icon; @required this.icon,
});
final String name;
final IconData icon;
@override @override
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
......
...@@ -20,11 +20,11 @@ Future<void> endOfAnimation() async { ...@@ -20,11 +20,11 @@ Future<void> endOfAnimation() async {
int iteration = 0; int iteration = 0;
class LifecycleObserver extends WidgetsBindingObserver { class LifecycleObserver extends WidgetsBindingObserver {
@override @override
void didChangeAppLifecycleState(AppLifecycleState state) { void didChangeAppLifecycleState(AppLifecycleState state) {
debugPrint('==== MEMORY BENCHMARK ==== $state ===='); debugPrint('==== MEMORY BENCHMARK ==== $state ====');
debugPrint('This was lifecycle event number $iteration in this instance'); debugPrint('This was lifecycle event number $iteration in this instance');
} }
} }
Future<void> main() async { Future<void> main() async {
......
...@@ -281,15 +281,15 @@ class IsolateExampleState extends State<StatefulWidget> with SingleTickerProvide ...@@ -281,15 +281,15 @@ class IsolateExampleState extends State<StatefulWidget> with SingleTickerProvide
} }
String _getStatus(CalculationState state) { String _getStatus(CalculationState state) {
switch (state) { switch (state) {
case CalculationState.loading: case CalculationState.loading:
return 'Loading...'; return 'Loading...';
case CalculationState.calculating: case CalculationState.calculating:
return 'In Progress'; return 'In Progress';
case CalculationState.idle: case CalculationState.idle:
default: default:
return 'Idle'; return 'Idle';
} }
} }
void _updateState(String result, double progress) { void _updateState(String result, double progress) {
......
...@@ -809,7 +809,7 @@ class _LargeTitleNavigationBarSliverDelegate ...@@ -809,7 +809,7 @@ class _LargeTitleNavigationBarSliverDelegate
@override @override
bool shouldRebuild(_LargeTitleNavigationBarSliverDelegate oldDelegate) { bool shouldRebuild(_LargeTitleNavigationBarSliverDelegate oldDelegate) {
return components != oldDelegate.components return components != oldDelegate.components
|| userMiddle != oldDelegate.userMiddle || userMiddle != oldDelegate.userMiddle
|| backgroundColor != oldDelegate.backgroundColor || backgroundColor != oldDelegate.backgroundColor
|| border != oldDelegate.border || border != oldDelegate.border
......
...@@ -254,10 +254,16 @@ class _NoDefaultCupertinoThemeData extends CupertinoThemeData { ...@@ -254,10 +254,16 @@ class _NoDefaultCupertinoThemeData extends CupertinoThemeData {
scaffoldBackgroundColor, scaffoldBackgroundColor,
); );
@override final Brightness brightness; @override
@override final Color primaryColor; final Brightness brightness;
@override final Color primaryContrastingColor; @override
@override final CupertinoTextThemeData textTheme; final Color primaryColor;
@override final Color barBackgroundColor; @override
@override final Color scaffoldBackgroundColor; final Color primaryContrastingColor;
@override
final CupertinoTextThemeData textTheme;
@override
final Color barBackgroundColor;
@override
final Color scaffoldBackgroundColor;
} }
...@@ -64,4 +64,4 @@ class BitField<T extends dynamic> { ...@@ -64,4 +64,4 @@ class BitField<T extends dynamic> {
void reset([ bool value = false ]) { void reset([ bool value = false ]) {
_bits = value ? _allOnes : _allZeros; _bits = value ? _allOnes : _allZeros;
} }
} }
\ No newline at end of file
...@@ -1984,7 +1984,8 @@ class DiagnosticableNode<T extends Diagnosticable> extends DiagnosticsNode { ...@@ -1984,7 +1984,8 @@ class DiagnosticableNode<T extends Diagnosticable> extends DiagnosticsNode {
return _cachedBuilder; return _cachedBuilder;
} }
@override DiagnosticsTreeStyle get style { @override
DiagnosticsTreeStyle get style {
return super.style ?? _builder.defaultDiagnosticsTreeStyle; return super.style ?? _builder.defaultDiagnosticsTreeStyle;
} }
......
...@@ -291,12 +291,12 @@ class ButtonThemeData extends Diagnosticable { ...@@ -291,12 +291,12 @@ class ButtonThemeData extends Diagnosticable {
EdgeInsetsGeometry get padding { EdgeInsetsGeometry get padding {
if (_padding != null) if (_padding != null)
return _padding; return _padding;
switch (textTheme) { switch (textTheme) {
case ButtonTextTheme.normal: case ButtonTextTheme.normal:
case ButtonTextTheme.accent: case ButtonTextTheme.accent:
return const EdgeInsets.symmetric(horizontal: 16.0); return const EdgeInsets.symmetric(horizontal: 16.0);
case ButtonTextTheme.primary: case ButtonTextTheme.primary:
return const EdgeInsets.symmetric(horizontal: 24.0); return const EdgeInsets.symmetric(horizontal: 24.0);
} }
assert(false); assert(false);
return EdgeInsets.zero; return EdgeInsets.zero;
......
...@@ -350,7 +350,7 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> { ...@@ -350,7 +350,7 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
} }
class _DropdownRoutePage<T> extends StatelessWidget { class _DropdownRoutePage<T> extends StatelessWidget {
const _DropdownRoutePage({ const _DropdownRoutePage({
Key key, Key key,
this.route, this.route,
this.constraints, this.constraints,
......
...@@ -1094,4 +1094,4 @@ class _RenderSlider extends RenderBox { ...@@ -1094,4 +1094,4 @@ class _RenderSlider extends RenderBox {
onChanged((value - _semanticActionUnit).clamp(0.0, 1.0)); onChanged((value - _semanticActionUnit).clamp(0.0, 1.0));
} }
} }
} }
\ No newline at end of file
...@@ -163,4 +163,4 @@ class ContinuousRectangleBorder extends ShapeBorder { ...@@ -163,4 +163,4 @@ class ContinuousRectangleBorder extends ShapeBorder {
String toString() { String toString() {
return '$runtimeType($side, $borderRadius)'; return '$runtimeType($side, $borderRadius)';
} }
} }
\ No newline at end of file
...@@ -3416,7 +3416,8 @@ abstract class Element extends DiagnosticableTree implements BuildContext { ...@@ -3416,7 +3416,8 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
} }
/// A short, textual description of this element. /// A short, textual description of this element.
@override String toStringShort() { @override
String toStringShort() {
return widget != null ? '${widget.toStringShort()}' : '[$runtimeType]'; return widget != null ? '${widget.toStringShort()}' : '[$runtimeType]';
} }
......
...@@ -1172,9 +1172,9 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render ...@@ -1172,9 +1172,9 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
@override @override
void visitChildren(ElementVisitor visitor) { void visitChildren(ElementVisitor visitor) {
// The toList() is to make a copy so that the underlying list can be modified by // The toList() is to make a copy so that the underlying list can be modified by
// the visitor: // the visitor:
assert(!_childElements.values.any((Element child) => child == null)); assert(!_childElements.values.any((Element child) => child == null));
_childElements.values.toList().forEach(visitor); _childElements.values.toList().forEach(visitor);
} }
......
...@@ -285,7 +285,7 @@ void main() { ...@@ -285,7 +285,7 @@ void main() {
expect(await result, equals('all done')); expect(await result, equals('all done'));
}); });
testWidgets('Two-step initial route', (WidgetTester tester) async { testWidgets('Two-step initial route', (WidgetTester tester) async {
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
'/': (BuildContext context) => const Text('route "/"'), '/': (BuildContext context) => const Text('route "/"'),
'/a': (BuildContext context) => const Text('route "/a"'), '/a': (BuildContext context) => const Text('route "/a"'),
......
...@@ -238,4 +238,4 @@ void main() { ...@@ -238,4 +238,4 @@ void main() {
final RenderParagraph content = _getTextRenderObjectFromDialog(tester, contentText); final RenderParagraph content = _getTextRenderObjectFromDialog(tester, contentText);
expect(content.text.style.color, contentTextStyle.color); expect(content.text.style.color, contentTextStyle.color);
}); });
} }
\ No newline at end of file
...@@ -1114,7 +1114,7 @@ void main() { ...@@ -1114,7 +1114,7 @@ void main() {
expect(tester.getRect(find.text('test')).left, 12.0); expect(tester.getRect(find.text('test')).left, 12.0);
}); });
testWidgets('counter text has correct right margin - LTR, dense', (WidgetTester tester) async { testWidgets('counter text has correct right margin - LTR, dense', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
buildInputDecorator( buildInputDecorator(
// isEmpty: false (default) // isEmpty: false (default)
......
...@@ -1422,4 +1422,4 @@ void main() { ...@@ -1422,4 +1422,4 @@ void main() {
expect(await tester.pumpAndSettle(const Duration(milliseconds: 100)), equals(1)); expect(await tester.pumpAndSettle(const Duration(milliseconds: 100)), equals(1));
await gesture.up(); await gesture.up();
}); });
} }
\ No newline at end of file
...@@ -760,4 +760,4 @@ Widget _buildApp( ...@@ -760,4 +760,4 @@ Widget _buildApp(
), ),
), ),
); );
} }
\ No newline at end of file
...@@ -63,7 +63,7 @@ void main() { ...@@ -63,7 +63,7 @@ void main() {
testWidgets('SwitchListTile.adaptive delegates to', (WidgetTester tester) async { testWidgets('SwitchListTile.adaptive delegates to', (WidgetTester tester) async {
bool value = false; bool value = false;
Widget buildFrame(TargetPlatform platform) { Widget buildFrame(TargetPlatform platform) {
return MaterialApp( return MaterialApp(
theme: ThemeData(platform: platform), theme: ThemeData(platform: platform),
home: StatefulBuilder( home: StatefulBuilder(
......
...@@ -665,26 +665,46 @@ class _TextStyleProxy implements TextStyle { ...@@ -665,26 +665,46 @@ class _TextStyleProxy implements TextStyle {
final TextStyle _delegate; final TextStyle _delegate;
// Do make sure that all the properties correctly forward to the _delegate. // Do make sure that all the properties correctly forward to the _delegate.
@override Color get color => _delegate.color; @override
@override Color get backgroundColor => _delegate.backgroundColor; Color get color => _delegate.color;
@override String get debugLabel => _delegate.debugLabel; @override
@override TextDecoration get decoration => _delegate.decoration; Color get backgroundColor => _delegate.backgroundColor;
@override Color get decorationColor => _delegate.decorationColor; @override
@override TextDecorationStyle get decorationStyle => _delegate.decorationStyle; String get debugLabel => _delegate.debugLabel;
@override String get fontFamily => _delegate.fontFamily; @override
@override List<String> get fontFamilyFallback => _delegate.fontFamilyFallback; TextDecoration get decoration => _delegate.decoration;
@override double get fontSize => _delegate.fontSize; @override
@override FontStyle get fontStyle => _delegate.fontStyle; Color get decorationColor => _delegate.decorationColor;
@override FontWeight get fontWeight => _delegate.fontWeight; @override
@override double get height => _delegate.height; TextDecorationStyle get decorationStyle => _delegate.decorationStyle;
@override Locale get locale => _delegate.locale; @override
@override ui.Paint get foreground => _delegate.foreground; String get fontFamily => _delegate.fontFamily;
@override ui.Paint get background => _delegate.background; @override
@override bool get inherit => _delegate.inherit; List<String> get fontFamilyFallback => _delegate.fontFamilyFallback;
@override double get letterSpacing => _delegate.letterSpacing; @override
@override TextBaseline get textBaseline => _delegate.textBaseline; double get fontSize => _delegate.fontSize;
@override double get wordSpacing => _delegate.wordSpacing; @override
@override List<Shadow> get shadows => _delegate.shadows; FontStyle get fontStyle => _delegate.fontStyle;
@override
FontWeight get fontWeight => _delegate.fontWeight;
@override
double get height => _delegate.height;
@override
Locale get locale => _delegate.locale;
@override
ui.Paint get foreground => _delegate.foreground;
@override
ui.Paint get background => _delegate.background;
@override
bool get inherit => _delegate.inherit;
@override
double get letterSpacing => _delegate.letterSpacing;
@override
TextBaseline get textBaseline => _delegate.textBaseline;
@override
double get wordSpacing => _delegate.wordSpacing;
@override
List<Shadow> get shadows => _delegate.shadows;
@override @override
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.debug }) => String toString({ DiagnosticLevel minLevel = DiagnosticLevel.debug }) =>
......
...@@ -37,37 +37,37 @@ void main() { ...@@ -37,37 +37,37 @@ void main() {
} }
void _testZeroAndNegativeSizes(BoxFit fit) { void _testZeroAndNegativeSizes(BoxFit fit) {
FittedSizes result; FittedSizes result;
result = applyBoxFit(fit, const Size(-400.0, 2000.0), const Size(100.0, 1000.0)); result = applyBoxFit(fit, const Size(-400.0, 2000.0), const Size(100.0, 1000.0));
expect(result.source, equals(Size.zero)); expect(result.source, equals(Size.zero));
expect(result.destination, equals(Size.zero)); expect(result.destination, equals(Size.zero));
result = applyBoxFit(fit, const Size(400.0, -2000.0), const Size(100.0, 1000.0)); result = applyBoxFit(fit, const Size(400.0, -2000.0), const Size(100.0, 1000.0));
expect(result.source, equals(Size.zero)); expect(result.source, equals(Size.zero));
expect(result.destination, equals(Size.zero)); expect(result.destination, equals(Size.zero));
result = applyBoxFit(fit, const Size(400.0, 2000.0), const Size(-100.0, 1000.0)); result = applyBoxFit(fit, const Size(400.0, 2000.0), const Size(-100.0, 1000.0));
expect(result.source, equals(Size.zero)); expect(result.source, equals(Size.zero));
expect(result.destination, equals(Size.zero)); expect(result.destination, equals(Size.zero));
result = applyBoxFit(fit, const Size(400.0, 2000.0), const Size(100.0, -1000.0)); result = applyBoxFit(fit, const Size(400.0, 2000.0), const Size(100.0, -1000.0));
expect(result.source, equals(Size.zero)); expect(result.source, equals(Size.zero));
expect(result.destination, equals(Size.zero)); expect(result.destination, equals(Size.zero));
result = applyBoxFit(fit, const Size(0.0, 2000.0), const Size(100.0, 1000.0)); result = applyBoxFit(fit, const Size(0.0, 2000.0), const Size(100.0, 1000.0));
expect(result.source, equals(Size.zero)); expect(result.source, equals(Size.zero));
expect(result.destination, equals(Size.zero)); expect(result.destination, equals(Size.zero));
result = applyBoxFit(fit, const Size(400.0, 0.0), const Size(100.0, 1000.0)); result = applyBoxFit(fit, const Size(400.0, 0.0), const Size(100.0, 1000.0));
expect(result.source, equals(Size.zero)); expect(result.source, equals(Size.zero));
expect(result.destination, equals(Size.zero)); expect(result.destination, equals(Size.zero));
result = applyBoxFit(fit, const Size(400.0, 2000.0), const Size(0.0, 1000.0)); result = applyBoxFit(fit, const Size(400.0, 2000.0), const Size(0.0, 1000.0));
expect(result.source, equals(Size.zero)); expect(result.source, equals(Size.zero));
expect(result.destination, equals(Size.zero)); expect(result.destination, equals(Size.zero));
result = applyBoxFit(fit, const Size(400.0, 2000.0), const Size(100.0, 0.0)); result = applyBoxFit(fit, const Size(400.0, 2000.0), const Size(100.0, 0.0));
expect(result.source, equals(Size.zero)); expect(result.source, equals(Size.zero));
expect(result.destination, equals(Size.zero)); expect(result.destination, equals(Size.zero));
} }
...@@ -103,7 +103,7 @@ void main() { ...@@ -103,7 +103,7 @@ void main() {
expect(mockCodec.numFramesAsked, 1); expect(mockCodec.numFramesAsked, 1);
}); });
testWidgets('getNextFrame future fails', (WidgetTester tester) async { testWidgets('getNextFrame future fails', (WidgetTester tester) async {
final MockCodec mockCodec = MockCodec(); final MockCodec mockCodec = MockCodec();
mockCodec.frameCount = 1; mockCodec.frameCount = 1;
final Completer<Codec> codecCompleter = Completer<Codec>(); final Completer<Codec> codecCompleter = Completer<Codec>();
......
...@@ -8,10 +8,14 @@ import '../flutter_test_alternative.dart'; ...@@ -8,10 +8,14 @@ import '../flutter_test_alternative.dart';
class RenderTestBox extends RenderBox { class RenderTestBox extends RenderBox {
double value = 0.0; double value = 0.0;
double next() { value += 1.0; return value; } double next() { value += 1.0; return value; }
@override double computeMinIntrinsicWidth(double height) => next(); @override
@override double computeMaxIntrinsicWidth(double height) => next(); double computeMinIntrinsicWidth(double height) => next();
@override double computeMinIntrinsicHeight(double width) => next(); @override
@override double computeMaxIntrinsicHeight(double width) => next(); double computeMaxIntrinsicWidth(double height) => next();
@override
double computeMinIntrinsicHeight(double width) => next();
@override
double computeMaxIntrinsicHeight(double width) => next();
} }
void main() { void main() {
......
...@@ -15,10 +15,14 @@ class RenderFixedSize extends RenderBox { ...@@ -15,10 +15,14 @@ class RenderFixedSize extends RenderBox {
markNeedsLayout(); markNeedsLayout();
} }
@override double computeMinIntrinsicWidth(double height) => dimension; @override
@override double computeMaxIntrinsicWidth(double height) => dimension; double computeMinIntrinsicWidth(double height) => dimension;
@override double computeMinIntrinsicHeight(double width) => dimension; @override
@override double computeMaxIntrinsicHeight(double width) => dimension; double computeMaxIntrinsicWidth(double height) => dimension;
@override
double computeMinIntrinsicHeight(double width) => dimension;
@override
double computeMaxIntrinsicHeight(double width) => dimension;
@override @override
void performLayout() { void performLayout() {
......
...@@ -51,4 +51,4 @@ void main() { ...@@ -51,4 +51,4 @@ void main() {
expect(key1, equals(key2)); expect(key1, equals(key2));
}); });
}); });
} }
\ No newline at end of file
...@@ -93,58 +93,58 @@ void main() { ...@@ -93,58 +93,58 @@ void main() {
expect(copied.platformBrightness, Brightness.dark); expect(copied.platformBrightness, Brightness.dark);
}); });
testWidgets('MediaQuery.removePadding removes specified padding', (WidgetTester tester) async { testWidgets('MediaQuery.removePadding removes specified padding', (WidgetTester tester) async {
const Size size = Size(2.0, 4.0); const Size size = Size(2.0, 4.0);
const double devicePixelRatio = 2.0; const double devicePixelRatio = 2.0;
const double textScaleFactor = 1.2; const double textScaleFactor = 1.2;
const EdgeInsets padding = EdgeInsets.only(top: 1.0, right: 2.0, left: 3.0, bottom: 4.0); const EdgeInsets padding = EdgeInsets.only(top: 1.0, right: 2.0, left: 3.0, bottom: 4.0);
const EdgeInsets viewInsets = EdgeInsets.only(top: 5.0, right: 6.0, left: 7.0, bottom: 8.0); const EdgeInsets viewInsets = EdgeInsets.only(top: 5.0, right: 6.0, left: 7.0, bottom: 8.0);
MediaQueryData unpadded; MediaQueryData unpadded;
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( MediaQuery(
data: const MediaQueryData( data: const MediaQueryData(
size: size, size: size,
devicePixelRatio: devicePixelRatio, devicePixelRatio: devicePixelRatio,
textScaleFactor: textScaleFactor, textScaleFactor: textScaleFactor,
padding: padding, padding: padding,
viewInsets: viewInsets, viewInsets: viewInsets,
alwaysUse24HourFormat: true, alwaysUse24HourFormat: true,
accessibleNavigation: true, accessibleNavigation: true,
invertColors: true, invertColors: true,
disableAnimations: true, disableAnimations: true,
boldText: true, boldText: true,
), ),
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return MediaQuery.removePadding( return MediaQuery.removePadding(
context: context, context: context,
removeLeft: true, removeLeft: true,
removeTop: true, removeTop: true,
removeRight: true, removeRight: true,
removeBottom: true, removeBottom: true,
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
unpadded = MediaQuery.of(context); unpadded = MediaQuery.of(context);
return Container(); return Container();
} }
), ),
); );
}, },
), ),
) )
); );
expect(unpadded.size, size); expect(unpadded.size, size);
expect(unpadded.devicePixelRatio, devicePixelRatio); expect(unpadded.devicePixelRatio, devicePixelRatio);
expect(unpadded.textScaleFactor, textScaleFactor); expect(unpadded.textScaleFactor, textScaleFactor);
expect(unpadded.padding, EdgeInsets.zero); expect(unpadded.padding, EdgeInsets.zero);
expect(unpadded.viewInsets, viewInsets); expect(unpadded.viewInsets, viewInsets);
expect(unpadded.alwaysUse24HourFormat, true); expect(unpadded.alwaysUse24HourFormat, true);
expect(unpadded.accessibleNavigation, true); expect(unpadded.accessibleNavigation, true);
expect(unpadded.invertColors, true); expect(unpadded.invertColors, true);
expect(unpadded.disableAnimations, true); expect(unpadded.disableAnimations, true);
expect(unpadded.boldText, true); expect(unpadded.boldText, true);
}); });
testWidgets('MediaQuery.removeViewInsets removes specified viewInsets', (WidgetTester tester) async { testWidgets('MediaQuery.removeViewInsets removes specified viewInsets', (WidgetTester tester) async {
...@@ -201,32 +201,32 @@ void main() { ...@@ -201,32 +201,32 @@ void main() {
expect(unpadded.boldText, true); expect(unpadded.boldText, true);
}); });
testWidgets('MediaQuery.textScaleFactorOf', (WidgetTester tester) async { testWidgets('MediaQuery.textScaleFactorOf', (WidgetTester tester) async {
double outsideTextScaleFactor; double outsideTextScaleFactor;
double insideTextScaleFactor; double insideTextScaleFactor;
await tester.pumpWidget( await tester.pumpWidget(
Builder( Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
outsideTextScaleFactor = MediaQuery.textScaleFactorOf(context); outsideTextScaleFactor = MediaQuery.textScaleFactorOf(context);
return MediaQuery( return MediaQuery(
data: const MediaQueryData( data: const MediaQueryData(
textScaleFactor: 4.0, textScaleFactor: 4.0,
), ),
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
insideTextScaleFactor = MediaQuery.textScaleFactorOf(context); insideTextScaleFactor = MediaQuery.textScaleFactorOf(context);
return Container(); return Container();
}, },
), ),
); );
}, },
), ),
); );
expect(outsideTextScaleFactor, 1.0); expect(outsideTextScaleFactor, 1.0);
expect(insideTextScaleFactor, 4.0); expect(insideTextScaleFactor, 4.0);
}); });
testWidgets('MediaQuery.platformBrightnessOf', (WidgetTester tester) async { testWidgets('MediaQuery.platformBrightnessOf', (WidgetTester tester) async {
Brightness outsideBrightness; Brightness outsideBrightness;
......
...@@ -217,23 +217,23 @@ void main() { ...@@ -217,23 +217,23 @@ void main() {
class FirstWidget extends StatelessWidget { class FirstWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.pushNamed(context, '/modal'); Navigator.pushNamed(context, '/modal');
}, },
child: Container( child: Container(
child: const Text('X'), child: const Text('X'),
), ),
); );
} }
} }
class SecondWidget extends StatelessWidget { class SecondWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const ModalBarrier( return const ModalBarrier(
key: ValueKey<String>('barrier'), key: ValueKey<String>('barrier'),
dismissible: true, dismissible: true,
); );
} }
} }
...@@ -40,4 +40,4 @@ void main() { ...@@ -40,4 +40,4 @@ void main() {
final RenderSliver lastRenderSliver = renderViewport.lastChild; final RenderSliver lastRenderSliver = renderViewport.lastChild;
expect(lastRenderSliver.constraints.precedingScrollExtent, double.infinity); expect(lastRenderSliver.constraints.precedingScrollExtent, double.infinity);
}); });
} }
\ No newline at end of file
...@@ -321,7 +321,7 @@ class TestDelegateThatCanThrow extends SliverPersistentHeaderDelegate { ...@@ -321,7 +321,7 @@ class TestDelegateThatCanThrow extends SliverPersistentHeaderDelegate {
@override @override
double get minExtent { double get minExtent {
return shouldThrow ? throw FlutterError('Unavailable minExtent') : 100.0; return shouldThrow ? throw FlutterError('Unavailable minExtent') : 100.0;
} }
@override @override
......
...@@ -247,7 +247,7 @@ void main() { ...@@ -247,7 +247,7 @@ void main() {
expect(localizations is MaterialLocalizationZh, true); expect(localizations is MaterialLocalizationZh, true);
}); });
testWidgets('Serbian resolution', (WidgetTester tester) async { testWidgets('Serbian resolution', (WidgetTester tester) async {
Locale locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: null, countryCode: null); Locale locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: null, countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
MaterialLocalizations localizations = await GlobalMaterialLocalizations.delegate.load(locale); MaterialLocalizations localizations = await GlobalMaterialLocalizations.delegate.load(locale);
......
...@@ -137,7 +137,7 @@ class LabeledTapTargetGuideline extends AccessibilityGuideline { ...@@ -137,7 +137,7 @@ class LabeledTapTargetGuideline extends AccessibilityGuideline {
@override @override
FutureOr<Evaluation> evaluate(WidgetTester tester) { FutureOr<Evaluation> evaluate(WidgetTester tester) {
final SemanticsNode root = tester.binding.pipelineOwner.semanticsOwner.rootSemanticsNode; final SemanticsNode root = tester.binding.pipelineOwner.semanticsOwner.rootSemanticsNode;
Evaluation traverse(SemanticsNode node) { Evaluation traverse(SemanticsNode node) {
Evaluation result = const Evaluation.pass(); Evaluation result = const Evaluation.pass();
node.visitChildren((SemanticsNode child) { node.visitChildren((SemanticsNode child) {
...@@ -262,8 +262,8 @@ class MinimumTextContrastGuideline extends AccessibilityGuideline { ...@@ -262,8 +262,8 @@ class MinimumTextContrastGuideline extends AccessibilityGuideline {
return result; return result;
final List<int> subset = _subsetToRect(byteData, paintBounds, image.width, image.height); final List<int> subset = _subsetToRect(byteData, paintBounds, image.width, image.height);
// Node was too far off screen. // Node was too far off screen.
if (subset.isEmpty) if (subset.isEmpty)
return result; return result;
final _ContrastReport report = _ContrastReport(subset); final _ContrastReport report = _ContrastReport(subset);
final double contrastRatio = report.contrastRatio(); final double contrastRatio = report.contrastRatio();
const double delta = -0.01; const double delta = -0.01;
......
...@@ -1742,4 +1742,4 @@ class _MockHttpHeaders extends HttpHeaders { ...@@ -1742,4 +1742,4 @@ class _MockHttpHeaders extends HttpHeaders {
@override @override
String value(String name) => null; String value(String name) => null;
} }
\ No newline at end of file
...@@ -1327,18 +1327,18 @@ class _RendersOnPhysicalModel extends _MatchRenderObject<RenderPhysicalShape, Re ...@@ -1327,18 +1327,18 @@ class _RendersOnPhysicalModel extends _MatchRenderObject<RenderPhysicalShape, Re
} }
bool assertRoundedRectangle(ShapeBorderClipper shapeClipper, BorderRadius borderRadius, Map<dynamic, dynamic> matchState) { bool assertRoundedRectangle(ShapeBorderClipper shapeClipper, BorderRadius borderRadius, Map<dynamic, dynamic> matchState) {
if (shapeClipper.shape.runtimeType != RoundedRectangleBorder) if (shapeClipper.shape.runtimeType != RoundedRectangleBorder)
return failWithDescription(matchState, 'had shape border: ${shapeClipper.shape}'); return failWithDescription(matchState, 'had shape border: ${shapeClipper.shape}');
final RoundedRectangleBorder border = shapeClipper.shape; final RoundedRectangleBorder border = shapeClipper.shape;
if (border.borderRadius != borderRadius) if (border.borderRadius != borderRadius)
return failWithDescription(matchState, 'had borderRadius: ${border.borderRadius}'); return failWithDescription(matchState, 'had borderRadius: ${border.borderRadius}');
return true; return true;
} }
bool assertCircle(ShapeBorderClipper shapeClipper, Map<dynamic, dynamic> matchState) { bool assertCircle(ShapeBorderClipper shapeClipper, Map<dynamic, dynamic> matchState) {
if (shapeClipper.shape.runtimeType != CircleBorder) if (shapeClipper.shape.runtimeType != CircleBorder)
return failWithDescription(matchState, 'had shape border: ${shapeClipper.shape}'); return failWithDescription(matchState, 'had shape border: ${shapeClipper.shape}');
return true; return true;
} }
@override @override
......
...@@ -339,4 +339,4 @@ class TestWindow implements Window { ...@@ -339,4 +339,4 @@ class TestWindow implements Window {
clearTextScaleFactorTestValue(); clearTextScaleFactorTestValue();
clearViewInsetsTestValue(); clearViewInsetsTestValue();
} }
} }
\ No newline at end of file
...@@ -362,7 +362,7 @@ void main() { ...@@ -362,7 +362,7 @@ void main() {
}); });
}); });
group('Labeled tappable node guideline', () { group('Labeled tappable node guideline', () {
testWidgets('Passes when node is labeled', (WidgetTester tester) async { testWidgets('Passes when node is labeled', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(_boilerplate(Semantics( await tester.pumpWidget(_boilerplate(Semantics(
......
...@@ -253,4 +253,4 @@ class FakeAccessibilityFeatures implements AccessibilityFeatures { ...@@ -253,4 +253,4 @@ class FakeAccessibilityFeatures implements AccessibilityFeatures {
@override @override
final bool reduceMotion; final bool reduceMotion;
} }
\ No newline at end of file
...@@ -98,7 +98,7 @@ class AndroidApk extends ApplicationPackage { ...@@ -98,7 +98,7 @@ class AndroidApk extends ApplicationPackage {
return null; return null;
} }
final List<String> aaptArgs = <String>[ final List<String> aaptArgs = <String>[
aaptPath, aaptPath,
'dump', 'dump',
'xmltree', 'xmltree',
......
...@@ -279,4 +279,4 @@ class BuildScriptGenerator { ...@@ -279,4 +279,4 @@ class BuildScriptGenerator {
/// Whether [child] specifies that it wants to run before [parent]. /// Whether [child] specifies that it wants to run before [parent].
bool _mustRunBefore(BuilderDefinition parent, BuilderDefinition child) => child.runsBefore.contains(parent.key); bool _mustRunBefore(BuilderDefinition parent, BuilderDefinition child) => child.runsBefore.contains(parent.key);
} }
\ No newline at end of file
...@@ -27,4 +27,4 @@ class GenerateCommand extends FlutterCommand { ...@@ -27,4 +27,4 @@ class GenerateCommand extends FlutterCommand {
await codeGenerator.generate(mainPath: argResults['target']); await codeGenerator.generate(mainPath: argResults['target']);
return null; return null;
} }
} }
\ No newline at end of file
...@@ -46,4 +46,4 @@ class Utf8Decoder extends cnv.Utf8Decoder { ...@@ -46,4 +46,4 @@ class Utf8Decoder extends cnv.Utf8Decoder {
} }
return result; return result;
} }
} }
\ No newline at end of file
...@@ -386,20 +386,16 @@ class DevFS { ...@@ -386,20 +386,16 @@ class DevFS {
this.rootDirectory, { this.rootDirectory, {
String packagesFilePath, String packagesFilePath,
}) : _operations = ServiceProtocolDevFSOperations(serviceProtocol), }) : _operations = ServiceProtocolDevFSOperations(serviceProtocol),
_httpWriter = _DevFSHttpWriter(fsName, serviceProtocol) { _httpWriter = _DevFSHttpWriter(fsName, serviceProtocol),
_packagesFilePath = _packagesFilePath = packagesFilePath ?? fs.path.join(rootDirectory.path, kPackagesFileName);
packagesFilePath ?? fs.path.join(rootDirectory.path, kPackagesFileName);
}
DevFS.operations( DevFS.operations(
this._operations, this._operations,
this.fsName, this.fsName,
this.rootDirectory, { this.rootDirectory, {
String packagesFilePath, String packagesFilePath,
}) : _httpWriter = null { }) : _httpWriter = null,
_packagesFilePath = _packagesFilePath = packagesFilePath ?? fs.path.join(rootDirectory.path, kPackagesFileName);
packagesFilePath ?? fs.path.join(rootDirectory.path, kPackagesFileName);
}
final DevFSOperations _operations; final DevFSOperations _operations;
final _DevFSHttpWriter _httpWriter; final _DevFSHttpWriter _httpWriter;
......
...@@ -435,4 +435,4 @@ void _validateFonts(YamlList fonts, List<String> errors) { ...@@ -435,4 +435,4 @@ void _validateFonts(YamlList fonts, List<String> errors) {
} }
} }
} }
} }
\ No newline at end of file
...@@ -39,7 +39,8 @@ class _FuchsiaLogReader extends DeviceLogReader { ...@@ -39,7 +39,8 @@ class _FuchsiaLogReader extends DeviceLogReader {
FuchsiaDevice _device; FuchsiaDevice _device;
ApplicationPackage _app; ApplicationPackage _app;
@override String get name => _device.name; @override
String get name => _device.name;
Stream<String> _logLines; Stream<String> _logLines;
@override @override
......
...@@ -16,13 +16,13 @@ bool _isBundleDirectory(FileSystemEntity entity) => ...@@ -16,13 +16,13 @@ bool _isBundleDirectory(FileSystemEntity entity) =>
abstract class MacOSApp extends ApplicationPackage { abstract class MacOSApp extends ApplicationPackage {
MacOSApp({@required String projectBundleId}) : super(id: projectBundleId); MacOSApp({@required String projectBundleId}) : super(id: projectBundleId);
/// Creates a new [MacOSApp] from an existing app bundle. /// Creates a new [MacOSApp] from an existing app bundle.
/// ///
/// `applicationBinary` is the path to the framework directory created by an /// `applicationBinary` is the path to the framework directory created by an
/// Xcode build. By default, this is located under /// Xcode build. By default, this is located under
/// "~/Library/Developer/Xcode/DerivedData/" and contains an executable /// "~/Library/Developer/Xcode/DerivedData/" and contains an executable
/// which is expected to start the application and send the observatory /// which is expected to start the application and send the observatory
/// port over stdout. /// port over stdout.
factory MacOSApp.fromPrebuiltApp(FileSystemEntity applicationBinary) { factory MacOSApp.fromPrebuiltApp(FileSystemEntity applicationBinary) {
final FileSystemEntityType entityType = fs.typeSync(applicationBinary.path); final FileSystemEntityType entityType = fs.typeSync(applicationBinary.path);
if (entityType == FileSystemEntityType.notFound) { if (entityType == FileSystemEntityType.notFound) {
...@@ -71,7 +71,7 @@ abstract class MacOSApp extends ApplicationPackage { ...@@ -71,7 +71,7 @@ abstract class MacOSApp extends ApplicationPackage {
String get executable; String get executable;
} }
class PrebuiltMacOSApp extends MacOSApp { class PrebuiltMacOSApp extends MacOSApp {
PrebuiltMacOSApp({ PrebuiltMacOSApp({
@required this.bundleDir, @required this.bundleDir,
@required this.bundleName, @required this.bundleName,
......
...@@ -467,7 +467,7 @@ class WebProject { ...@@ -467,7 +467,7 @@ class WebProject {
final FlutterProject parent; final FlutterProject parent;
Future<void> ensureReadyForPlatformSpecificTooling() async { Future<void> ensureReadyForPlatformSpecificTooling() async {
/// Generate index.html in build/web. Eventually we could support /// Generate index.html in build/web. Eventually we could support
/// a custom html under the web sub directory. /// a custom html under the web sub directory.
final Directory outputDir = fs.directory(getWebBuildDirectory()); final Directory outputDir = fs.directory(getWebBuildDirectory());
......
...@@ -33,4 +33,4 @@ void main() { ...@@ -33,4 +33,4 @@ void main() {
}); });
} }
class MockPlatform extends Mock implements Platform {} class MockPlatform extends Mock implements Platform {}
\ No newline at end of file
...@@ -162,4 +162,4 @@ class MockFile extends Mock implements File { ...@@ -162,4 +162,4 @@ class MockFile extends Mock implements File {
class MockRandomAccessFile extends Mock implements RandomAccessFile {} class MockRandomAccessFile extends Mock implements RandomAccessFile {}
class MockCachedArtifact extends Mock implements CachedArtifact {} class MockCachedArtifact extends Mock implements CachedArtifact {}
class MockInternetAddress extends Mock implements InternetAddress {} class MockInternetAddress extends Mock implements InternetAddress {}
class MockCache extends Mock implements Cache {} class MockCache extends Mock implements Cache {}
\ No newline at end of file
...@@ -212,7 +212,7 @@ void main() { ...@@ -212,7 +212,7 @@ void main() {
}); });
group('doctor with fake validators', () { group('doctor with fake validators', () {
testUsingContext('validate non-verbose output format for run without issues', () async { testUsingContext('validate non-verbose output format for run without issues', () async {
expect(await FakeQuietDoctor().diagnose(verbose: false), isTrue); expect(await FakeQuietDoctor().diagnose(verbose: false), isTrue);
expect(testLogger.statusText, equals( expect(testLogger.statusText, equals(
......
...@@ -144,17 +144,16 @@ Future<void> evaluateTrivialExpressions(FlutterTestDriver flutter) async { ...@@ -144,17 +144,16 @@ Future<void> evaluateTrivialExpressions(FlutterTestDriver flutter) async {
Future<void> evaluateComplexExpressions(FlutterTestDriver flutter) async { Future<void> evaluateComplexExpressions(FlutterTestDriver flutter) async {
final InstanceRef res = await flutter.evaluateInFrame('new DateTime.now().year'); final InstanceRef res = await flutter.evaluateInFrame('new DateTime.now().year');
expect(res.kind == InstanceKind.kInt && res.valueAsString == DateTime.now().year.toString(), isTrue); expect(res.kind == InstanceKind.kInt && res.valueAsString == DateTime.now().year.toString(), isTrue);
} }
Future<void> evaluateComplexReturningExpressions(FlutterTestDriver flutter) async { Future<void> evaluateComplexReturningExpressions(FlutterTestDriver flutter) async {
final DateTime now = DateTime.now(); final DateTime now = DateTime.now();
final InstanceRef resp = await flutter.evaluateInFrame('new DateTime.now()'); final InstanceRef resp = await flutter.evaluateInFrame('new DateTime.now()');
expect(resp.classRef.name, equals('DateTime')); expect(resp.classRef.name, equals('DateTime'));
// Ensure we got a reasonable approximation. The more accurate we try to // Ensure we got a reasonable approximation. The more accurate we try to
// make this, the more likely it'll fail due to differences in the time // make this, the more likely it'll fail due to differences in the time
// in the remote VM and the local VM at the time the code runs. // in the remote VM and the local VM at the time the code runs.
final InstanceRef res = await flutter.evaluate(resp.id, r'"$year-$month-$day"'); final InstanceRef res = await flutter.evaluate(resp.id, r'"$year-$month-$day"');
expect(res.valueAsString, expect(res.valueAsString, equals('${now.year}-${now.month}-${now.day}'));
equals('${now.year}-${now.month}-${now.day}'));
} }
...@@ -51,4 +51,4 @@ void main() { ...@@ -51,4 +51,4 @@ void main() {
} }
class MockProcessManager extends Mock implements ProcessManager {} class MockProcessManager extends Mock implements ProcessManager {}
class MockProcess extends Mock implements Process {} class MockProcess extends Mock implements Process {}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment