2023-05-09 16:59:55 +00:00
|
|
|
import 'dart:io';
|
|
|
|
|
2022-12-21 16:17:53 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2023-05-09 16:59:55 +00:00
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:lottie/lottie.dart';
|
2023-05-09 16:59:55 +00:00
|
|
|
import 'package:stackwallet/themes/theme_providers.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:stackwallet/utilities/assets.dart';
|
|
|
|
|
2023-05-09 16:59:55 +00:00
|
|
|
class LoadingIndicator extends ConsumerWidget {
|
2022-08-26 08:11:35 +00:00
|
|
|
const LoadingIndicator({
|
|
|
|
Key? key,
|
|
|
|
this.width,
|
|
|
|
this.height,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final double? width;
|
|
|
|
final double? height;
|
|
|
|
|
|
|
|
@override
|
2023-05-09 16:59:55 +00:00
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
final assetPath = ref.watch(
|
|
|
|
themeProvider.select((value) => value.assets.loadingGif),
|
|
|
|
);
|
2023-04-12 14:41:35 +00:00
|
|
|
|
2022-12-21 16:17:53 +00:00
|
|
|
return Container(
|
|
|
|
color: Colors.transparent,
|
|
|
|
child: Center(
|
|
|
|
child: SizedBox(
|
|
|
|
width: width,
|
|
|
|
height: height,
|
2023-05-09 16:59:55 +00:00
|
|
|
child: assetPath != null
|
|
|
|
? Image.file(
|
|
|
|
File(
|
|
|
|
assetPath,
|
2023-04-12 14:41:35 +00:00
|
|
|
),
|
|
|
|
)
|
|
|
|
: Lottie.asset(
|
|
|
|
Assets.lottie.test2,
|
|
|
|
animate: true,
|
|
|
|
repeat: true,
|
|
|
|
),
|
2022-12-21 16:17:53 +00:00
|
|
|
),
|
2022-08-26 08:11:35 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|