Add cool zs spinning logo

This commit is contained in:
franzap
2024-10-15 15:53:33 -03:00
parent c1407cbd43
commit 24297bb62a
2 changed files with 51 additions and 1 deletions
+2 -1
View File
@@ -16,6 +16,7 @@ import 'package:zapstore/screens/search_screen.dart';
import 'package:zapstore/screens/settings_screen.dart';
import 'package:zapstore/screens/updates_screen.dart';
import 'package:zapstore/widgets/error_container.dart';
import 'package:zapstore/widgets/spinning_logo.dart';
/// Application navigation.
/// - Initializes Go Router, dispatches routes
@@ -126,7 +127,7 @@ class ScaffoldWithNestedNavigation extends HookConsumerWidget {
errorHandler(e, stack);
return ErrorContainer(exception: e, stack: stack);
},
loading: () => const Center(child: CircularProgressIndicator()),
loading: () => Center(child: SpinningLogo()),
),
);
}
+49
View File
@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
class SpinningLogo extends StatefulWidget {
const SpinningLogo({super.key});
@override
SpinningLogoState createState() => SpinningLogoState();
}
class SpinningLogoState extends State<SpinningLogo>
with TickerProviderStateMixin {
late AnimationController _controller;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: Duration(seconds: 2),
)..repeat(); // Repeat the animation indefinitely
}
@override
void dispose() {
_controller.dispose(); // Dispose of the controller when done
super.dispose();
}
@override
Widget build(BuildContext context) {
return Center(
child: AnimatedBuilder(
animation: _controller,
builder: (context, child) {
return Transform.rotate(
angle:
_controller.value * 2.0 * 3.14159, // Full rotation in radians
child: child,
);
},
child: Image.asset(
'assets/images/logo-fg.png',
height: 200,
width: 200,
), // Adjust size as needed
),
);
}
}