2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-27 21:16:48 +00:00
inventree-app/lib/widget/spinner.dart
Oliver c9cad2f89f
Some checks failed
Android / build (push) Has been cancelled
CI / test (push) Has been cancelled
iOS / build (push) Has been cancelled
Change from fontawesome to tabler icons (#516)
* 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
2024-08-08 19:44:44 +10:00

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,
);
}
}