refactor: Update to Dart 3.10 with . shorthands
This commit is contained in:
parent
75a37f3f7c
commit
1ea649f01e
167 changed files with 3351 additions and 3912 deletions
|
|
@ -9,10 +9,7 @@ class PIPView extends StatefulWidget {
|
|||
final double? floatingHeight;
|
||||
final bool avoidKeyboard;
|
||||
|
||||
final Widget Function(
|
||||
BuildContext context,
|
||||
bool isFloating,
|
||||
) builder;
|
||||
final Widget Function(BuildContext context, bool isFloating) builder;
|
||||
|
||||
const PIPView({
|
||||
super.key,
|
||||
|
|
@ -95,10 +92,7 @@ class PIPViewState extends State<PIPView> with TickerProviderStateMixin {
|
|||
void _onPanUpdate(DragUpdateDetails details) {
|
||||
if (!_isDragging) return;
|
||||
setState(() {
|
||||
_dragOffset = _dragOffset.translate(
|
||||
details.delta.dx,
|
||||
details.delta.dy,
|
||||
);
|
||||
_dragOffset = _dragOffset.translate(details.delta.dx, details.delta.dy);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -182,9 +176,7 @@ class PIPViewState extends State<PIPView> with TickerProviderStateMixin {
|
|||
_dragAnimationController,
|
||||
]),
|
||||
builder: (context, child) {
|
||||
final animationCurve = CurveTween(
|
||||
curve: Curves.easeInOutQuad,
|
||||
);
|
||||
final animationCurve = CurveTween(curve: Curves.easeInOutQuad);
|
||||
final dragAnimationValue = animationCurve.transform(
|
||||
_dragAnimationController.value,
|
||||
);
|
||||
|
|
@ -265,21 +257,13 @@ class PIPViewState extends State<PIPView> with TickerProviderStateMixin {
|
|||
}
|
||||
}
|
||||
|
||||
enum PIPViewCorner {
|
||||
topLeft,
|
||||
topRight,
|
||||
bottomLeft,
|
||||
bottomRight,
|
||||
}
|
||||
enum PIPViewCorner { topLeft, topRight, bottomLeft, bottomRight }
|
||||
|
||||
class _CornerDistance {
|
||||
final PIPViewCorner corner;
|
||||
final double distance;
|
||||
|
||||
_CornerDistance({
|
||||
required this.corner,
|
||||
required this.distance,
|
||||
});
|
||||
_CornerDistance({required this.corner, required this.distance});
|
||||
}
|
||||
|
||||
PIPViewCorner _calculateNearestCorner({
|
||||
|
|
@ -288,15 +272,9 @@ PIPViewCorner _calculateNearestCorner({
|
|||
}) {
|
||||
_CornerDistance calculateDistance(PIPViewCorner corner) {
|
||||
final distance = offsets[corner]!
|
||||
.translate(
|
||||
-offset.dx,
|
||||
-offset.dy,
|
||||
)
|
||||
.translate(-offset.dx, -offset.dy)
|
||||
.distanceSquared;
|
||||
return _CornerDistance(
|
||||
corner: corner,
|
||||
distance: distance,
|
||||
);
|
||||
return _CornerDistance(corner: corner, distance: distance);
|
||||
}
|
||||
|
||||
final distances = PIPViewCorner.values.map(calculateDistance).toList();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue