✨ Create, edit, list publishers
This commit is contained in:
89
lib/widgets/loading_indicator.dart
Normal file
89
lib/widgets/loading_indicator.dart
Normal file
@ -0,0 +1,89 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
|
||||
class LoadingIndicator extends StatefulWidget {
|
||||
final bool isActive;
|
||||
final Color? backgroundColor;
|
||||
|
||||
const LoadingIndicator({
|
||||
super.key,
|
||||
this.isActive = true,
|
||||
this.backgroundColor,
|
||||
});
|
||||
|
||||
@override
|
||||
State<LoadingIndicator> createState() => _LoadingIndicatorState();
|
||||
}
|
||||
|
||||
class _LoadingIndicatorState extends State<LoadingIndicator>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late AnimationController _controller;
|
||||
late Animation<double> _animation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
);
|
||||
|
||||
_animation = CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
|
||||
if (widget.isActive) {
|
||||
_controller.forward();
|
||||
} else {
|
||||
_controller.reverse();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant LoadingIndicator oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
|
||||
if (widget.isActive != oldWidget.isActive) {
|
||||
if (widget.isActive) {
|
||||
_controller.forward();
|
||||
} else {
|
||||
_controller.reverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizeTransition(
|
||||
sizeFactor: _animation,
|
||||
axisAlignment: -1, // Align animation from the top
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 24),
|
||||
child: widget.isActive
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
width: 16,
|
||||
child: CircularProgressIndicator(strokeWidth: 2.5),
|
||||
),
|
||||
const Gap(16),
|
||||
Text('loading').tr(),
|
||||
],
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -16,17 +16,17 @@ class AppNavDestination {
|
||||
|
||||
List<AppNavDestination> appDestinations = [
|
||||
AppNavDestination(
|
||||
icon: Icon(Symbols.home),
|
||||
icon: Icon(Symbols.home, weight: 400, opticalSize: 20),
|
||||
screen: 'home',
|
||||
label: tr('screenHome'),
|
||||
),
|
||||
AppNavDestination(
|
||||
icon: Icon(Symbols.explore),
|
||||
icon: Icon(Symbols.explore, weight: 400, opticalSize: 20),
|
||||
screen: 'explore',
|
||||
label: tr('screenExplore'),
|
||||
),
|
||||
AppNavDestination(
|
||||
icon: Icon(Symbols.account_circle),
|
||||
icon: Icon(Symbols.account_circle, weight: 400, opticalSize: 20),
|
||||
screen: 'account',
|
||||
label: tr('screenAccount'),
|
||||
),
|
||||
|
Reference in New Issue
Block a user