mirror of
https://github.com/inventree/inventree-app.git
synced 2026-04-05 17:30:45 +00:00
* Update flutter version - 3.32.4 to 3.41.6 (stable) * Update version and release notes * Update to modern API
46 lines
1020 B
Dart
46 lines
1020 B
Dart
import "package:flutter/material.dart";
|
|
import "package:inventree/app_colors.dart";
|
|
|
|
class Spinner extends StatefulWidget {
|
|
const Spinner({
|
|
this.color = COLOR_GRAY_LIGHT,
|
|
Key? key,
|
|
required this.icon,
|
|
this.duration = const Duration(milliseconds: 1800),
|
|
}) : super(key: key);
|
|
|
|
final IconData? icon;
|
|
final Duration duration;
|
|
final Color color;
|
|
|
|
@override
|
|
_SpinnerState createState() => _SpinnerState();
|
|
}
|
|
|
|
class _SpinnerState extends State<Spinner> with SingleTickerProviderStateMixin {
|
|
late AnimationController? _controller;
|
|
Widget? _child;
|
|
|
|
@override
|
|
void initState() {
|
|
_controller = AnimationController(
|
|
vsync: this,
|
|
duration: Duration(milliseconds: 2000),
|
|
)..repeat();
|
|
_child = Icon(widget.icon, color: widget.color);
|
|
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_controller!.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return RotationTransition(turns: _controller!, child: _child);
|
|
}
|
|
}
|