Unverified Commit 6ec3f3b7 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Remove extensions (#91453)

parent 61a0add2
......@@ -307,7 +307,7 @@ class NavigationDestination extends StatelessWidget {
_StatusTransitionWidgetBuilder(
animation: animation,
builder: (BuildContext context, Widget? child) {
return animation.isForwardOrCompleted
return _isForwardOrCompleted(animation)
? selectedIconWidget
: unselectedIconWidget;
},
......@@ -329,7 +329,7 @@ class NavigationDestination extends StatelessWidget {
upperLimit: 1,
child: Text(
label,
style: animation.isForwardOrCompleted
style: _isForwardOrCompleted(animation)
? effectiveSelectedLabelTextStyle
: effectiveUnselectedLabelTextStyle,
),
......@@ -566,7 +566,7 @@ class _NavigationIndicator extends StatelessWidget {
animation: animation,
builder: (BuildContext context, Widget? child) {
return _SelectableAnimatedBuilder(
isSelected: animation.isForwardOrCompleted,
isSelected: _isForwardOrCompleted(animation),
duration: const Duration(milliseconds: 100),
alwaysDoFullAnimation: true,
builder: (BuildContext context, Animation<double> fadeAnimation) {
......@@ -725,7 +725,7 @@ class _NavigationBarDestinationSemantics extends StatelessWidget {
animation: destinationInfo.selectedAnimation,
builder: (BuildContext context, Widget? child) {
return Semantics(
selected: destinationInfo.selectedAnimation.isForwardOrCompleted,
selected: _isForwardOrCompleted(destinationInfo.selectedAnimation),
container: true,
child: child,
);
......@@ -1154,9 +1154,9 @@ class _CurvedAnimationBuilderState extends State<_CurvedAnimationBuilder> {
}
}
/// Convenience static extensions on Animation.
extension _AnimationUtils on Animation<double> {
/// Returns `true` if this animation is ticking forward, or has completed,
/// based on [status].
bool get isForwardOrCompleted => status == AnimationStatus.forward || status == AnimationStatus.completed;
/// Returns `true` if this animation is ticking forward, or has completed,
/// based on [status].
bool _isForwardOrCompleted(Animation<double> animation) {
return animation.status == AnimationStatus.forward
|| animation.status == AnimationStatus.completed;
}
......@@ -15,10 +15,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../image_data.dart';
ByteData testByteData(double scale) => ByteData(8)..setFloat64(0, scale);
extension on ByteData {
double get scale => getFloat64(0);
}
double scaleOf(ByteData data) => data.getFloat64(0);
const String testManifest = '''
{
......@@ -89,9 +86,8 @@ class TestAssetImage extends AssetImage {
ImageStreamCompleter load(AssetBundleImageKey key, DecoderCallback decode) {
late ImageInfo imageInfo;
key.bundle.load(key.name).then<void>((ByteData data) {
final ByteData testData = data;
final ui.Image image = images[testData.scale]!;
assert(image != null, 'Expected ${testData.scale} to have a key in $images');
final ui.Image image = images[scaleOf(data)]!;
assert(image != null, 'Expected ${scaleOf(data)} to have a key in $images');
imageInfo = ImageInfo(image: image, scale: key.scale);
});
return FakeImageStreamCompleter(
......
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