ux: bulk WIP — UxPlugin→XPlugin rename + new anim/core/navi/reactive packages
Catch-all commit for outstanding pre-existing local changes. Mixes several themes that would normally be split: - Rename: UxPlugin → XPlugin across iOS, macOS, Android registrants. - New top-level packages under lib/src/: anim/ (animated values, panes, sheets, dock, measured), core/ (Emitter, ReactiveBuilder scaffolding, presenter/widget/value/dispose primitives), navi/ (Screen/ScreenStack/Router/hero/transitions), reactive/. - Edits across existing plugins (clipboard, crash, file, gallery, keyboard, scanner, sensor, url) to align with the new core. - Test updates and CHANGELOG/README touches accompanying the above.
This commit is contained in:
61
lib/src/anim/animated_double.dart
Normal file
61
lib/src/anim/animated_double.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class AnimatedDouble extends StatefulWidget {
|
||||
const AnimatedDouble({
|
||||
super.key,
|
||||
required this.builder,
|
||||
required this.start,
|
||||
required this.end,
|
||||
this.curve = Curves.linear,
|
||||
this.duration = const Duration(milliseconds: 200),
|
||||
this.child,
|
||||
});
|
||||
|
||||
final ValueWidgetBuilder<double> builder;
|
||||
final Widget? child;
|
||||
final double start;
|
||||
final double end;
|
||||
final Duration duration;
|
||||
final Curve curve;
|
||||
|
||||
@override
|
||||
State<AnimatedDouble> createState() => _AnimatedDoubleState();
|
||||
}
|
||||
|
||||
class _AnimatedDoubleState extends State<AnimatedDouble>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late final AnimationController controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
controller = AnimationController.unbounded(
|
||||
vsync: this, value: widget.start, duration: widget.duration);
|
||||
if (widget.end != widget.start) {
|
||||
controller.animateTo(widget.end);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant AnimatedDouble oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.end != oldWidget.end) {
|
||||
controller.animateTo(widget.end);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ValueListenableBuilder(
|
||||
valueListenable: controller,
|
||||
builder: widget.builder,
|
||||
child: widget.child,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user