|
|
|
|
@ -3,71 +3,9 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
|
|
|
|
|
|
class CircularAnimationWithProgressIndicator extends StatefulWidget {
|
|
|
|
|
Widget child;
|
|
|
|
|
CircularAnimationWithProgressIndicator({Key key, this.child}) : super(key: key);
|
|
|
|
|
@override
|
|
|
|
|
_CircularAnimationWithProgressIndicatorState createState() =>
|
|
|
|
|
_CircularAnimationWithProgressIndicatorState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _CircularAnimationWithProgressIndicatorState
|
|
|
|
|
extends State<CircularAnimationWithProgressIndicator>
|
|
|
|
|
with SingleTickerProviderStateMixin {
|
|
|
|
|
AnimationController _controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
|
|
// Animation controller for progress indicator
|
|
|
|
|
_controller = AnimationController(
|
|
|
|
|
vsync: this,
|
|
|
|
|
duration: const Duration(seconds: 40), // Duration of one full rotation
|
|
|
|
|
)..repeat(); // Repeat animation continuously
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
_controller.dispose();
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Center(
|
|
|
|
|
child: Stack(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
// Animated CircularProgressIndicator
|
|
|
|
|
AnimatedBuilder(
|
|
|
|
|
animation: _controller,
|
|
|
|
|
builder: (context, child) {
|
|
|
|
|
return Transform.rotate(
|
|
|
|
|
angle: _controller.value * 2 * 3.1416, // Full rotation
|
|
|
|
|
child: child,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
width: 100.toScreenHeight,
|
|
|
|
|
height: 100.toScreenWidth,
|
|
|
|
|
child: const CircularProgressIndicator(
|
|
|
|
|
strokeWidth: 3.0,
|
|
|
|
|
backgroundColor: AppColor.primary30,
|
|
|
|
|
|
|
|
|
|
value: null, // Infinite animation
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// Static container in the center
|
|
|
|
|
widget.child?? const SizedBox(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class CircularAnimatedContainer extends StatefulWidget {
|
|
|
|
|
Widget child;
|
|
|
|
|
|