22 lines
717 B
Dart
22 lines
717 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class BackgroundLoadingIndicator extends StatelessWidget {
|
|
final bool visible;
|
|
const BackgroundLoadingIndicator({required this.visible, super.key});
|
|
|
|
final Duration animationDuration = const Duration(milliseconds: 200);
|
|
|
|
@override
|
|
Widget build(BuildContext context) => AnimatedSwitcher(
|
|
duration: animationDuration,
|
|
transitionBuilder: (Widget child, Animation<double> animation) => SlideTransition(
|
|
position: Tween<Offset>(
|
|
begin: const Offset(0.0, -1.0),
|
|
end: Offset.zero,
|
|
).animate(animation),
|
|
child: child,
|
|
),
|
|
child: visible ? const LinearProgressIndicator() : const SizedBox.shrink(),
|
|
);
|
|
}
|