implicit-casts:false in examples (#45805)
This commit is contained in:
parent
c6fe7bb9e1
commit
ec0842e0d3
@ -122,7 +122,7 @@ class ListModel<E> {
|
||||
_items = initialItems?.toList() ?? <E>[];
|
||||
|
||||
final GlobalKey<AnimatedListState> listKey;
|
||||
final dynamic removedItemBuilder;
|
||||
final Widget Function(E item, BuildContext context, Animation<double> animation) removedItemBuilder;
|
||||
final List<E> _items;
|
||||
|
||||
AnimatedListState get _animatedList => listKey.currentState;
|
||||
|
@ -64,7 +64,7 @@ class _RenderStatusBarPaddingSliver extends RenderSliver {
|
||||
|
||||
@override
|
||||
void performLayout() {
|
||||
final double height = (maxHeight - constraints.scrollOffset / scrollFactor).clamp(0.0, maxHeight);
|
||||
final double height = (maxHeight - constraints.scrollOffset / scrollFactor).clamp(0.0, maxHeight) as double;
|
||||
geometry = SliverGeometry(
|
||||
paintExtent: math.min(height, constraints.remainingPaintExtent),
|
||||
scrollExtent: maxHeight,
|
||||
@ -285,7 +285,7 @@ class _AllSectionsView extends AnimatedWidget {
|
||||
final List<Widget> sectionCards;
|
||||
|
||||
double _selectedIndexDelta(int index) {
|
||||
return (index.toDouble() - selectedIndex.value).abs().clamp(0.0, 1.0);
|
||||
return (index.toDouble() - selectedIndex.value).abs().clamp(0.0, 1.0) as double;
|
||||
}
|
||||
|
||||
Widget _build(BuildContext context, BoxConstraints constraints) {
|
||||
@ -498,7 +498,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
|
||||
return ListTile.divideTiles(context: context, tiles: detailItems);
|
||||
}
|
||||
|
||||
Iterable<Widget> _allHeadingItems(double maxHeight, double midScrollOffset) {
|
||||
List<Widget> _allHeadingItems(double maxHeight, double midScrollOffset) {
|
||||
final List<Widget> sectionCards = <Widget>[];
|
||||
for (int index = 0; index < allSections.length; index++) {
|
||||
sectionCards.add(LayoutId(
|
||||
|
@ -44,10 +44,8 @@ class Section {
|
||||
|
||||
@override
|
||||
bool operator==(Object other) {
|
||||
if (other is! Section)
|
||||
return false;
|
||||
final Section otherSection = other;
|
||||
return title == otherSection.title;
|
||||
return other is Section
|
||||
&& other.title == title;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -287,7 +287,7 @@ class CalcExpression {
|
||||
// multiplication or division symbols.
|
||||
num currentTermValue = removeNextTerm(list);
|
||||
while (list.isNotEmpty) {
|
||||
final OperationToken opToken = list.removeAt(0);
|
||||
final OperationToken opToken = list.removeAt(0) as OperationToken;
|
||||
final num nextTermValue = removeNextTerm(list);
|
||||
switch (opToken.operation) {
|
||||
case Operation.Addition:
|
||||
@ -313,11 +313,11 @@ class CalcExpression {
|
||||
/// and division symbols.
|
||||
static num removeNextTerm(List<ExpressionToken> list) {
|
||||
assert(list != null && list.isNotEmpty);
|
||||
final NumberToken firstNumToken = list.removeAt(0);
|
||||
final NumberToken firstNumToken = list.removeAt(0) as NumberToken;
|
||||
num currentValue = firstNumToken.number;
|
||||
while (list.isNotEmpty) {
|
||||
bool isDivision = false;
|
||||
final OperationToken nextOpToken = list.first;
|
||||
final OperationToken nextOpToken = list.first as OperationToken;
|
||||
switch (nextOpToken.operation) {
|
||||
case Operation.Addition:
|
||||
case Operation.Subtraction:
|
||||
@ -331,7 +331,7 @@ class CalcExpression {
|
||||
// Remove the operation token.
|
||||
list.removeAt(0);
|
||||
// Remove the next number token.
|
||||
final NumberToken nextNumToken = list.removeAt(0);
|
||||
final NumberToken nextNumToken = list.removeAt(0) as NumberToken;
|
||||
final num nextNumber = nextNumToken.number;
|
||||
if (isDivision)
|
||||
currentValue /= nextNumber;
|
||||
|
@ -293,9 +293,9 @@ class Tab1ItemPageState extends State<Tab1ItemPage> {
|
||||
final math.Random random = math.Random();
|
||||
return Color.fromARGB(
|
||||
255,
|
||||
(widget.color.red + random.nextInt(100) - 50).clamp(0, 255),
|
||||
(widget.color.green + random.nextInt(100) - 50).clamp(0, 255),
|
||||
(widget.color.blue + random.nextInt(100) - 50).clamp(0, 255),
|
||||
(widget.color.red + random.nextInt(100) - 50).clamp(0, 255) as int,
|
||||
(widget.color.green + random.nextInt(100) - 50).clamp(0, 255) as int,
|
||||
(widget.color.blue + random.nextInt(100) - 50).clamp(0, 255) as int,
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -635,9 +635,9 @@ class Tab2ConversationAvatar extends StatelessWidget {
|
||||
color,
|
||||
Color.fromARGB(
|
||||
color.alpha,
|
||||
(color.red - 60).clamp(0, 255),
|
||||
(color.green - 60).clamp(0, 255),
|
||||
(color.blue - 60).clamp(0, 255),
|
||||
(color.red - 60).clamp(0, 255) as int,
|
||||
(color.green - 60).clamp(0, 255) as int,
|
||||
(color.blue - 60).clamp(0, 255) as int,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -205,12 +205,12 @@ class BackdropPanel extends StatelessWidget {
|
||||
class BackdropTitle extends AnimatedWidget {
|
||||
const BackdropTitle({
|
||||
Key key,
|
||||
Listenable listenable,
|
||||
Animation<double> listenable,
|
||||
}) : super(key: key, listenable: listenable);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Animation<double> animation = listenable;
|
||||
final Animation<double> animation = listenable as Animation<double>;
|
||||
return DefaultTextStyle(
|
||||
style: Theme.of(context).primaryTextTheme.title,
|
||||
softWrap: false,
|
||||
@ -283,7 +283,7 @@ class _BackdropDemoState extends State<BackdropDemo> with SingleTickerProviderSt
|
||||
}
|
||||
|
||||
double get _backdropHeight {
|
||||
final RenderBox renderBox = _backdropKey.currentContext.findRenderObject();
|
||||
final RenderBox renderBox = _backdropKey.currentContext.findRenderObject() as RenderBox;
|
||||
return renderBox.size.height;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,10 @@ class _GridPhotoViewerState extends State<GridPhotoViewer> with SingleTickerProv
|
||||
Offset _clampOffset(Offset offset) {
|
||||
final Size size = context.size;
|
||||
final Offset minOffset = Offset(size.width, size.height) * (1.0 - _scale);
|
||||
return Offset(offset.dx.clamp(minOffset.dx, 0.0), offset.dy.clamp(minOffset.dy, 0.0));
|
||||
return Offset(
|
||||
offset.dx.clamp(minOffset.dx, 0.0) as double,
|
||||
offset.dy.clamp(minOffset.dy, 0.0) as double,
|
||||
);
|
||||
}
|
||||
|
||||
void _handleFlingAnimation() {
|
||||
@ -107,7 +110,7 @@ class _GridPhotoViewerState extends State<GridPhotoViewer> with SingleTickerProv
|
||||
|
||||
void _handleOnScaleUpdate(ScaleUpdateDetails details) {
|
||||
setState(() {
|
||||
_scale = (_previousScale * details.scale).clamp(1.0, 4.0);
|
||||
_scale = (_previousScale * details.scale).clamp(1.0, 4.0) as double;
|
||||
// Ensure that image location under the focal point stays in the same place despite scaling.
|
||||
_offset = _clampOffset(details.focalPoint - _normalizedOffset * _scale);
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ class _PageSelector extends StatelessWidget {
|
||||
void _handleArrowButtonPress(BuildContext context, int delta) {
|
||||
final TabController controller = DefaultTabController.of(context);
|
||||
if (!controller.indexIsChanging)
|
||||
controller.animateTo((controller.index + delta).clamp(0, icons.length - 1));
|
||||
controller.animateTo((controller.index + delta).clamp(0, icons.length - 1) as int);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -257,7 +257,7 @@ class _SlidersState extends State<_Sliders> {
|
||||
final double newValue = double.tryParse(value);
|
||||
if (newValue != null && newValue != _continuousValue) {
|
||||
setState(() {
|
||||
_continuousValue = newValue.clamp(0, 100);
|
||||
_continuousValue = newValue.clamp(0.0, 100.0) as double;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -129,7 +129,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
|
||||
bottom: extraPadding,
|
||||
),
|
||||
child: Center(
|
||||
child: PestoLogo(height: logoHeight, t: t.clamp(0.0, 1.0)),
|
||||
child: PestoLogo(height: logoHeight, t: t.clamp(0.0, 1.0) as double),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -111,7 +111,7 @@ class _FrontLayer extends StatelessWidget {
|
||||
class _BackdropTitle extends AnimatedWidget {
|
||||
const _BackdropTitle({
|
||||
Key key,
|
||||
Listenable listenable,
|
||||
Animation<double> listenable,
|
||||
this.onPress,
|
||||
@required this.frontTitle,
|
||||
@required this.backTitle,
|
||||
@ -119,14 +119,14 @@ class _BackdropTitle extends AnimatedWidget {
|
||||
assert(backTitle != null),
|
||||
super(key: key, listenable: listenable);
|
||||
|
||||
final Function onPress;
|
||||
final void Function() onPress;
|
||||
final Widget frontTitle;
|
||||
final Widget backTitle;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Animation<double> animation = CurvedAnimation(
|
||||
parent: listenable,
|
||||
parent: listenable as Animation<double>,
|
||||
curve: const Interval(0.0, 0.78),
|
||||
);
|
||||
|
||||
|
@ -604,7 +604,7 @@ class _ListModel {
|
||||
_items = initialItems?.toList() ?? <int>[];
|
||||
|
||||
final GlobalKey<AnimatedListState> listKey;
|
||||
final dynamic removedItemBuilder;
|
||||
final Widget Function(int item, BuildContext context, Animation<double> animation) removedItemBuilder;
|
||||
final List<int> _items;
|
||||
|
||||
AnimatedListState get _animatedList => listKey.currentState;
|
||||
|
@ -270,8 +270,9 @@ class BoardPoint {
|
||||
if (other.runtimeType != runtimeType) {
|
||||
return false;
|
||||
}
|
||||
final BoardPoint boardPoint = other;
|
||||
return boardPoint.q == q && boardPoint.r == r;
|
||||
return other is BoardPoint
|
||||
&& other.q == q
|
||||
&& other.r == r;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -183,7 +183,7 @@ class _GestureTransformableState extends State<GestureTransformable> with Ticker
|
||||
// Get the offset of the current widget from the global screen coordinates.
|
||||
// TODO(justinmc): Protect against calling this during first build.
|
||||
static Offset getOffset(BuildContext context) {
|
||||
final RenderBox renderObject = context.findRenderObject();
|
||||
final RenderBox renderObject = context.findRenderObject() as RenderBox;
|
||||
return renderObject.localToGlobal(Offset.zero);
|
||||
}
|
||||
|
||||
@ -377,7 +377,7 @@ class _GestureTransformableState extends State<GestureTransformable> with Ticker
|
||||
final double clampedTotalScale = totalScale.clamp(
|
||||
widget.minScale,
|
||||
widget.maxScale,
|
||||
);
|
||||
) as double;
|
||||
final double clampedScale = clampedTotalScale / currentScale;
|
||||
return matrix..scale(clampedScale);
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ class _ConnectivityOverlayState extends State<ConnectivityOverlay> {
|
||||
StreamSubscription<ConnectivityResult> connectivitySubscription;
|
||||
bool connected = true;
|
||||
|
||||
static const Widget errorSnackBar = SnackBar(
|
||||
static const SnackBar errorSnackBar = SnackBar(
|
||||
backgroundColor: Colors.red,
|
||||
content: ListTile(
|
||||
title: Text('No network'),
|
||||
|
@ -53,8 +53,8 @@ class _GalleryAppState extends State<GalleryApp> {
|
||||
// https://docs.flutter.io/flutter/widgets/Navigator-class.html
|
||||
return Map<String, WidgetBuilder>.fromIterable(
|
||||
kAllGalleryDemos,
|
||||
key: (dynamic demo) => '${demo.routeName}',
|
||||
value: (dynamic demo) => demo.buildRoute,
|
||||
key: (dynamic demo) => '${(demo as GalleryDemo).routeName}',
|
||||
value: (dynamic demo) => (demo as GalleryDemo).buildRoute,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class _CrossFadeTransition extends AnimatedWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Animation<double> progress = listenable;
|
||||
final Animation<double> progress = listenable as Animation<double>;
|
||||
|
||||
final double opacity1 = CurvedAnimation(
|
||||
parent: ReverseAnimation(progress),
|
||||
@ -227,7 +227,7 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
|
||||
double get _backdropHeight {
|
||||
// Warning: this can be safely called from the event handlers but it may
|
||||
// not be called at build time.
|
||||
final RenderBox renderBox = _backdropKey.currentContext.findRenderObject();
|
||||
final RenderBox renderBox = _backdropKey.currentContext.findRenderObject() as RenderBox;
|
||||
return math.max(0.0, renderBox.size.height - _kBackAppBarHeight - _kFrontClosedHeight);
|
||||
}
|
||||
|
||||
|
@ -31,10 +31,10 @@ class ComponentDemoTabData {
|
||||
bool operator==(Object other) {
|
||||
if (other.runtimeType != runtimeType)
|
||||
return false;
|
||||
final ComponentDemoTabData typedOther = other;
|
||||
return typedOther.tabName == tabName
|
||||
&& typedOther.description == description
|
||||
&& typedOther.documentationUrl == documentationUrl;
|
||||
return other is ComponentDemoTabData
|
||||
&& other.tabName == tabName
|
||||
&& other.description == description
|
||||
&& other.documentationUrl == documentationUrl;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -22,8 +22,8 @@ class GalleryDemoCategory {
|
||||
return true;
|
||||
if (runtimeType != other.runtimeType)
|
||||
return false;
|
||||
final GalleryDemoCategory typedOther = other;
|
||||
return typedOther.name == name && typedOther.icon == icon;
|
||||
return other is GalleryDemoCategory
|
||||
&& other.name == name && other.icon == icon;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -582,6 +582,6 @@ final Map<GalleryDemoCategory, List<GalleryDemo>> kGalleryCategoryToDemos =
|
||||
final Map<String, String> kDemoDocumentationUrl =
|
||||
Map<String, String>.fromIterable(
|
||||
kAllGalleryDemos.where((GalleryDemo demo) => demo.documentationUrl != null),
|
||||
key: (dynamic demo) => demo.routeName,
|
||||
value: (dynamic demo) => demo.documentationUrl,
|
||||
key: (dynamic demo) => (demo as GalleryDemo).routeName,
|
||||
value: (dynamic demo) => (demo as GalleryDemo).documentationUrl,
|
||||
);
|
||||
|
@ -134,7 +134,7 @@ class _CategoriesPage extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: List<Widget>.generate(rowCount, (int rowIndex) {
|
||||
final int columnCountForRow = rowIndex == rowCount - 1
|
||||
? categories.length - columnCount * math.max(0, rowCount - 1)
|
||||
? categories.length - columnCount * math.max<int>(0, rowCount - 1)
|
||||
: columnCount;
|
||||
|
||||
return Row(
|
||||
|
@ -54,14 +54,14 @@ class GalleryOptions {
|
||||
bool operator ==(dynamic other) {
|
||||
if (runtimeType != other.runtimeType)
|
||||
return false;
|
||||
final GalleryOptions typedOther = other;
|
||||
return themeMode == typedOther.themeMode
|
||||
&& textScaleFactor == typedOther.textScaleFactor
|
||||
&& textDirection == typedOther.textDirection
|
||||
&& platform == typedOther.platform
|
||||
&& showPerformanceOverlay == typedOther.showPerformanceOverlay
|
||||
&& showRasterCacheImagesCheckerboard == typedOther.showRasterCacheImagesCheckerboard
|
||||
&& showOffscreenLayersCheckerboard == typedOther.showRasterCacheImagesCheckerboard;
|
||||
return other is GalleryOptions
|
||||
&& other.themeMode == themeMode
|
||||
&& other.textScaleFactor == textScaleFactor
|
||||
&& other.textDirection == textDirection
|
||||
&& other.platform == platform
|
||||
&& other.showPerformanceOverlay == showPerformanceOverlay
|
||||
&& other.showRasterCacheImagesCheckerboard == showRasterCacheImagesCheckerboard
|
||||
&& other.showOffscreenLayersCheckerboard == showRasterCacheImagesCheckerboard;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -14,8 +14,9 @@ class GalleryTextScaleValue {
|
||||
bool operator ==(dynamic other) {
|
||||
if (runtimeType != other.runtimeType)
|
||||
return false;
|
||||
final GalleryTextScaleValue typedOther = other;
|
||||
return scale == typedOther.scale && label == typedOther.label;
|
||||
return other is GalleryTextScaleValue
|
||||
&& other.scale == scale
|
||||
&& other.label == label;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -7,7 +7,7 @@ import 'package:flutter_gallery/demo/calculator_demo.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized() as TestWidgetsFlutterBinding;
|
||||
if (binding is LiveTestWidgetsFlutterBinding)
|
||||
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
|
||||
|
||||
|
@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter_gallery/gallery/app.dart';
|
||||
|
||||
void main() {
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized() as TestWidgetsFlutterBinding;
|
||||
if (binding is LiveTestWidgetsFlutterBinding)
|
||||
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
|
||||
|
||||
@ -31,7 +31,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Verify theme settings
|
||||
MaterialApp app = find.byType(MaterialApp).evaluate().first.widget;
|
||||
MaterialApp app = find.byType(MaterialApp).evaluate().first.widget as MaterialApp;
|
||||
expect(app.theme.brightness, equals(Brightness.light));
|
||||
expect(app.darkTheme.brightness, equals(Brightness.dark));
|
||||
|
||||
@ -40,7 +40,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Dark'));
|
||||
await tester.pumpAndSettle();
|
||||
app = find.byType(MaterialApp).evaluate().first.widget;
|
||||
app = find.byType(MaterialApp).evaluate().first.widget as MaterialApp;
|
||||
expect(app.themeMode, ThemeMode.dark);
|
||||
|
||||
// Switch to the light theme: first menu button, choose 'Light'
|
||||
@ -48,7 +48,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Light'));
|
||||
await tester.pumpAndSettle();
|
||||
app = find.byType(MaterialApp).evaluate().first.widget;
|
||||
app = find.byType(MaterialApp).evaluate().first.widget as MaterialApp;
|
||||
expect(app.themeMode, ThemeMode.light);
|
||||
|
||||
// Switch back to system theme setting: first menu button, choose 'System Default'
|
||||
@ -56,7 +56,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('System Default').at(1));
|
||||
await tester.pumpAndSettle();
|
||||
app = find.byType(MaterialApp).evaluate().first.widget;
|
||||
app = find.byType(MaterialApp).evaluate().first.widget as MaterialApp;
|
||||
expect(app.themeMode, ThemeMode.system);
|
||||
|
||||
// Verify platform settings
|
||||
@ -67,7 +67,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Cupertino').at(1));
|
||||
await tester.pumpAndSettle();
|
||||
app = find.byType(MaterialApp).evaluate().first.widget;
|
||||
app = find.byType(MaterialApp).evaluate().first.widget as MaterialApp;
|
||||
expect(app.theme.platform, equals(TargetPlatform.iOS));
|
||||
|
||||
// Verify the font scale.
|
||||
|
@ -7,7 +7,7 @@ import 'package:flutter_gallery/gallery/app.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized() as TestWidgetsFlutterBinding;
|
||||
if (binding is LiveTestWidgetsFlutterBinding)
|
||||
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
|
||||
|
||||
|
@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter_gallery/gallery/app.dart';
|
||||
|
||||
void main() {
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized() as TestWidgetsFlutterBinding;
|
||||
if (binding is LiveTestWidgetsFlutterBinding)
|
||||
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
|
||||
|
||||
|
@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter_gallery/gallery/app.dart' show GalleryApp;
|
||||
|
||||
void main() {
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized() as TestWidgetsFlutterBinding;
|
||||
if (binding is LiveTestWidgetsFlutterBinding)
|
||||
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
|
||||
|
||||
|
@ -11,7 +11,7 @@ Future<String> mockUpdateUrlFetcher() {
|
||||
}
|
||||
|
||||
void main() {
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
|
||||
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized() as TestWidgetsFlutterBinding;
|
||||
if (binding is LiveTestWidgetsFlutterBinding)
|
||||
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert' show JsonEncoder, JsonDecoder;
|
||||
import 'dart:convert' show JsonEncoder, json;
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/local.dart';
|
||||
@ -69,14 +69,14 @@ Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
|
||||
|
||||
// Save the duration of the first frame after each 'Start Transition' event.
|
||||
for (Map<String, dynamic> event in events) {
|
||||
final String eventName = event['name'];
|
||||
final String eventName = event['name'] as String;
|
||||
if (eventName == 'Start Transition') {
|
||||
assert(startEvent == null);
|
||||
startEvent = event;
|
||||
} else if (startEvent != null && eventName == 'Frame') {
|
||||
final String routeName = startEvent['args']['to'];
|
||||
final String routeName = startEvent['args']['to'] as String;
|
||||
durations[routeName] ??= <int>[];
|
||||
durations[routeName].add(event['dur']);
|
||||
durations[routeName].add(event['dur'] as int);
|
||||
startEvent = null;
|
||||
}
|
||||
}
|
||||
@ -101,13 +101,13 @@ Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
|
||||
String lastEventName = '';
|
||||
String lastRouteName = '';
|
||||
while (eventIter.moveNext()) {
|
||||
final String eventName = eventIter.current['name'];
|
||||
final String eventName = eventIter.current['name'] as String;
|
||||
|
||||
if (!<String>['Start Transition', 'Frame'].contains(eventName))
|
||||
continue;
|
||||
|
||||
final String routeName = eventName == 'Start Transition'
|
||||
? eventIter.current['args']['to']
|
||||
? eventIter.current['args']['to'] as String
|
||||
: '';
|
||||
|
||||
if (eventName == lastEventName && routeName == lastRouteName) {
|
||||
@ -192,7 +192,7 @@ void main([List<String> args = const <String>[]]) {
|
||||
}
|
||||
|
||||
// See _handleMessages() in transitions_perf.dart.
|
||||
_allDemos = List<String>.from(const JsonDecoder().convert(await driver.requestData('demoNames')));
|
||||
_allDemos = List<String>.from(json.decode(await driver.requestData('demoNames')) as List<dynamic>);
|
||||
if (_allDemos.isEmpty)
|
||||
throw 'no demo names found';
|
||||
});
|
||||
@ -221,7 +221,7 @@ void main([List<String> args = const <String>[]]) {
|
||||
await summary.writeSummaryToFile('transitions', pretty: true);
|
||||
final String histogramPath = path.join(testOutputsDirectory, 'transition_durations.timeline.json');
|
||||
await saveDurationsHistogram(
|
||||
List<Map<String, dynamic>>.from(timeline.json['traceEvents']),
|
||||
List<Map<String, dynamic>>.from(timeline.json['traceEvents'] as List<dynamic>),
|
||||
histogramPath);
|
||||
|
||||
// Execute the remaining tests.
|
||||
|
@ -48,7 +48,7 @@ void main() {
|
||||
subrow.add(RenderSolidColorBox(const Color(0x7FCCFFFF), desiredSize: const Size(30.0, 40.0)));
|
||||
row.add(subrow);
|
||||
table.add(row);
|
||||
final FlexParentData rowParentData = row.parentData;
|
||||
final FlexParentData rowParentData = row.parentData as FlexParentData;
|
||||
rowParentData.flex = 1;
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ void main() {
|
||||
row.add(RenderSolidColorBox(const Color(0xFFCCCCFF), desiredSize: const Size(160.0, 60.0)));
|
||||
row.mainAxisAlignment = justify;
|
||||
table.add(row);
|
||||
final FlexParentData rowParentData = row.parentData;
|
||||
final FlexParentData rowParentData = row.parentData as FlexParentData;
|
||||
rowParentData.flex = 1;
|
||||
}
|
||||
|
||||
|
@ -31,11 +31,11 @@ class SectorConstraints extends Constraints {
|
||||
final double maxDeltaTheta;
|
||||
|
||||
double constrainDeltaRadius(double deltaRadius) {
|
||||
return deltaRadius.clamp(minDeltaRadius, maxDeltaRadius);
|
||||
return deltaRadius.clamp(minDeltaRadius, maxDeltaRadius) as double;
|
||||
}
|
||||
|
||||
double constrainDeltaTheta(double deltaTheta) {
|
||||
return deltaTheta.clamp(minDeltaTheta, maxDeltaTheta);
|
||||
return deltaTheta.clamp(minDeltaTheta, maxDeltaTheta) as double;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -100,14 +100,14 @@ abstract class RenderSector extends RenderObject {
|
||||
// RenderSectors always use SectorParentData subclasses, as they need to be
|
||||
// able to read their position information for painting and hit testing.
|
||||
@override
|
||||
SectorParentData get parentData => super.parentData;
|
||||
SectorParentData get parentData => super.parentData as SectorParentData;
|
||||
|
||||
SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) {
|
||||
return SectorDimensions.withConstraints(constraints);
|
||||
}
|
||||
|
||||
@override
|
||||
SectorConstraints get constraints => super.constraints;
|
||||
SectorConstraints get constraints => super.constraints as SectorConstraints;
|
||||
|
||||
@override
|
||||
void debugAssertDoesMeetConstraints() {
|
||||
@ -208,7 +208,7 @@ class RenderSectorWithChildren extends RenderDecoratedSector with ContainerRende
|
||||
while (child != null) {
|
||||
if (child.hitTest(result, radius: radius, theta: theta))
|
||||
return;
|
||||
final SectorChildListParentData childParentData = child.parentData;
|
||||
final SectorChildListParentData childParentData = child.parentData as SectorChildListParentData;
|
||||
child = childParentData.previousSibling;
|
||||
}
|
||||
}
|
||||
@ -218,7 +218,7 @@ class RenderSectorWithChildren extends RenderDecoratedSector with ContainerRende
|
||||
RenderSector child = lastChild;
|
||||
while (child != null) {
|
||||
visitor(child);
|
||||
final SectorChildListParentData childParentData = child.parentData;
|
||||
final SectorChildListParentData childParentData = child.parentData as SectorChildListParentData;
|
||||
child = childParentData.previousSibling;
|
||||
}
|
||||
}
|
||||
@ -282,7 +282,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
|
||||
final SectorDimensions childDimensions = child.getIntrinsicDimensions(innerConstraints, childRadius);
|
||||
innerTheta += childDimensions.deltaTheta;
|
||||
remainingDeltaTheta -= childDimensions.deltaTheta;
|
||||
final SectorChildListParentData childParentData = child.parentData;
|
||||
final SectorChildListParentData childParentData = child.parentData as SectorChildListParentData;
|
||||
child = childParentData.nextSibling;
|
||||
if (child != null) {
|
||||
innerTheta += paddingTheta;
|
||||
@ -316,7 +316,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
|
||||
child.layout(innerConstraints, parentUsesSize: true);
|
||||
innerTheta += child.deltaTheta;
|
||||
remainingDeltaTheta -= child.deltaTheta;
|
||||
final SectorChildListParentData childParentData = child.parentData;
|
||||
final SectorChildListParentData childParentData = child.parentData as SectorChildListParentData;
|
||||
child = childParentData.nextSibling;
|
||||
if (child != null) {
|
||||
innerTheta += paddingTheta;
|
||||
@ -335,7 +335,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
|
||||
RenderSector child = firstChild;
|
||||
while (child != null) {
|
||||
context.paintChild(child, offset);
|
||||
final SectorChildListParentData childParentData = child.parentData;
|
||||
final SectorChildListParentData childParentData = child.parentData as SectorChildListParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
@ -396,7 +396,7 @@ class RenderSectorSlice extends RenderSectorWithChildren {
|
||||
final SectorDimensions childDimensions = child.getIntrinsicDimensions(innerConstraints, childRadius);
|
||||
childRadius += childDimensions.deltaRadius;
|
||||
remainingDeltaRadius -= childDimensions.deltaRadius;
|
||||
final SectorChildListParentData childParentData = child.parentData;
|
||||
final SectorChildListParentData childParentData = child.parentData as SectorChildListParentData;
|
||||
child = childParentData.nextSibling;
|
||||
childRadius += padding;
|
||||
remainingDeltaRadius -= padding;
|
||||
@ -427,7 +427,7 @@ class RenderSectorSlice extends RenderSectorWithChildren {
|
||||
child.layout(innerConstraints, parentUsesSize: true);
|
||||
childRadius += child.deltaRadius;
|
||||
remainingDeltaRadius -= child.deltaRadius;
|
||||
final SectorChildListParentData childParentData = child.parentData;
|
||||
final SectorChildListParentData childParentData = child.parentData as SectorChildListParentData;
|
||||
child = childParentData.nextSibling;
|
||||
childRadius += padding;
|
||||
remainingDeltaRadius -= padding;
|
||||
@ -445,7 +445,7 @@ class RenderSectorSlice extends RenderSectorWithChildren {
|
||||
while (child != null) {
|
||||
assert(child.parentData is SectorChildListParentData);
|
||||
context.paintChild(child, offset);
|
||||
final SectorChildListParentData childParentData = child.parentData;
|
||||
final SectorChildListParentData childParentData = child.parentData as SectorChildListParentData;
|
||||
child = childParentData.nextSibling;
|
||||
}
|
||||
}
|
||||
@ -638,7 +638,7 @@ class SectorHitTestEntry extends HitTestEntry {
|
||||
super(target);
|
||||
|
||||
@override
|
||||
RenderSector get target => super.target;
|
||||
RenderSector get target => super.target as RenderSector;
|
||||
|
||||
/// The radius component of the hit test position in the local coordinates of
|
||||
/// [target].
|
||||
|
@ -65,7 +65,7 @@ class RenderDots extends RenderBox {
|
||||
@override
|
||||
void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
|
||||
if (event is PointerDownEvent) {
|
||||
final Color color = _kColors[event.pointer.remainder(_kColors.length)];
|
||||
final Color color = _kColors[event.pointer.remainder(_kColors.length) as int];
|
||||
_dots[event.pointer] = Dot(color: color)..update(event);
|
||||
// We call markNeedsPaint to indicate that our painting commands have
|
||||
// changed and that paint needs to be called before displaying a new frame
|
||||
@ -126,7 +126,7 @@ void main() {
|
||||
//
|
||||
// We use the StackParentData of the paragraph to position the text in the top
|
||||
// left corner of the screen.
|
||||
final StackParentData paragraphParentData = paragraph.parentData;
|
||||
final StackParentData paragraphParentData = paragraph.parentData as StackParentData;
|
||||
paragraphParentData
|
||||
..top = 40.0
|
||||
..left = 20.0;
|
||||
|
@ -44,7 +44,7 @@ class Calculator {
|
||||
}
|
||||
);
|
||||
try {
|
||||
final List<dynamic> result = decoder.convert(_data);
|
||||
final List<dynamic> result = decoder.convert(_data) as List<dynamic>;
|
||||
final int n = result.length;
|
||||
onResultListener('Decoded $n results');
|
||||
} catch (e, stack) {
|
||||
|
@ -9,7 +9,7 @@ import 'package:flutter/rendering.dart';
|
||||
|
||||
import '../rendering/src/sector_layout.dart';
|
||||
|
||||
RenderBox initCircle() {
|
||||
RenderBoxToRenderSectorAdapter initCircle() {
|
||||
return RenderBoxToRenderSectorAdapter(
|
||||
innerRadius: 25.0,
|
||||
child: RenderSectorRing(padding: 0.0),
|
||||
@ -54,7 +54,7 @@ class SectorAppState extends State<SectorApp> {
|
||||
int index = 0;
|
||||
while (index < actualSectorSizes.length && index < wantedSectorSizes.length && actualSectorSizes[index] == wantedSectorSizes[index])
|
||||
index += 1;
|
||||
final RenderSectorRing ring = sectors.child;
|
||||
final RenderSectorRing ring = sectors.child as RenderSectorRing;
|
||||
while (index < actualSectorSizes.length) {
|
||||
ring.remove(ring.lastChild);
|
||||
actualSectorSizes.removeLast();
|
||||
@ -67,7 +67,7 @@ class SectorAppState extends State<SectorApp> {
|
||||
}
|
||||
}
|
||||
|
||||
static RenderBox initSector(Color color) {
|
||||
static RenderBoxToRenderSectorAdapter initSector(Color color) {
|
||||
final RenderSectorRing ring = RenderSectorRing(padding: 1.0);
|
||||
ring.add(RenderSolidColor(const Color(0xFF909090), desiredDeltaTheta: kTwoPi * 0.15));
|
||||
ring.add(RenderSolidColor(const Color(0xFF909090), desiredDeltaTheta: kTwoPi * 0.15));
|
||||
|
@ -11,7 +11,7 @@ import '../rendering/src/solid_color_box.dart';
|
||||
void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex = 0 }) {
|
||||
final RenderSolidColorBox child = RenderSolidColorBox(backgroundColor);
|
||||
parent.add(child);
|
||||
final FlexParentData childParentData = child.parentData;
|
||||
final FlexParentData childParentData = child.parentData as FlexParentData;
|
||||
childParentData.flex = flex;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class StocksAppState extends State<StocksApp> {
|
||||
|
||||
Route<dynamic> _getRoute(RouteSettings settings) {
|
||||
if (settings.name == '/stock') {
|
||||
final String symbol = settings.arguments;
|
||||
final String symbol = settings.arguments as String;
|
||||
return MaterialPageRoute<void>(
|
||||
settings: settings,
|
||||
builder: (BuildContext context) => StockSymbolPage(symbol: symbol, stocks: stocks),
|
||||
|
@ -49,14 +49,14 @@ class StockData extends ChangeNotifier {
|
||||
final List<String> _symbols = <String>[];
|
||||
final Map<String, Stock> _stocks = <String, Stock>{};
|
||||
|
||||
Iterable<String> get allSymbols => _symbols;
|
||||
List<String> get allSymbols => _symbols;
|
||||
|
||||
Stock operator [](String symbol) => _stocks[symbol];
|
||||
|
||||
bool get loading => _httpClient != null;
|
||||
|
||||
void add(List<dynamic> data) {
|
||||
for (List<dynamic> fields in data) {
|
||||
for (List<dynamic> fields in data.cast<List<dynamic>>()) {
|
||||
final Stock stock = Stock.fromFields(fields.cast<String>());
|
||||
_symbols.add(stock.symbol);
|
||||
_stocks[stock.symbol] = stock;
|
||||
@ -85,7 +85,7 @@ class StockData extends ChangeNotifier {
|
||||
return;
|
||||
}
|
||||
const JsonDecoder decoder = JsonDecoder();
|
||||
add(decoder.convert(json));
|
||||
add(decoder.convert(json) as List<dynamic>);
|
||||
if (_nextChunk < _chunkCount) {
|
||||
_fetchNextChunk();
|
||||
} else {
|
||||
|
@ -188,7 +188,7 @@ class StockHomeState extends State<StockHome> {
|
||||
showAboutDialog(context: context);
|
||||
}
|
||||
|
||||
Widget buildAppBar() {
|
||||
AppBar buildAppBar() {
|
||||
return AppBar(
|
||||
elevation: 0.0,
|
||||
title: Text(StockStrings.of(context).title),
|
||||
@ -283,7 +283,7 @@ class StockHomeState extends State<StockHome> {
|
||||
|
||||
static const List<String> portfolioSymbols = <String>['AAPL','FIZZ', 'FIVE', 'FLAT', 'ZINC', 'ZNGA'];
|
||||
|
||||
Widget buildSearchBar() {
|
||||
AppBar buildSearchBar() {
|
||||
return AppBar(
|
||||
leading: BackButton(
|
||||
color: Theme.of(context).accentColor,
|
||||
|
@ -97,7 +97,7 @@ class StockSettingsState extends State<StockSettings> {
|
||||
widget.updater(value);
|
||||
}
|
||||
|
||||
Widget buildAppBar(BuildContext context) {
|
||||
AppBar buildAppBar(BuildContext context) {
|
||||
return AppBar(
|
||||
title: const Text('Settings'),
|
||||
);
|
||||
|
@ -41,7 +41,7 @@ void checkIconColor(WidgetTester tester, String label, Color color) {
|
||||
final Element listTile = findElementOfExactWidgetTypeGoingUp(tester.element(find.text(label)), ListTile);
|
||||
expect(listTile, isNotNull);
|
||||
final Element asset = findElementOfExactWidgetTypeGoingDown(listTile, RichText);
|
||||
final RichText richText = asset.widget;
|
||||
final RichText richText = asset.widget as RichText;
|
||||
expect(richText.text.style.color, equals(color));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user