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