mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-27 21:16:48 +00:00
* Change from fontawesome to tabler icons - Consistent with the frontend * Cleanup conflicts * Use double quotes * remove unused import * Update release notes * Migrate some google icons to tabler icons * Icon update * Properly support display of custom icons * Fix lookup
53 lines
1.0 KiB
Dart
53 lines
1.0 KiB
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,
|
|
);
|
|
}
|
|
} |