stack_wallet/lib/widgets/loading_indicator.dart

57 lines
1.3 KiB
Dart
Raw Permalink Normal View History

2023-05-26 21:21:16 +00:00
/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/
import 'dart:io';
2022-12-21 16:17:53 +00:00
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
2022-08-26 08:11:35 +00:00
import 'package:lottie/lottie.dart';
import '../themes/theme_providers.dart';
import '../utilities/assets.dart';
2022-08-26 08:11:35 +00:00
class LoadingIndicator extends ConsumerWidget {
2022-08-26 08:11:35 +00:00
const LoadingIndicator({
2024-05-27 23:56:22 +00:00
super.key,
2022-08-26 08:11:35 +00:00
this.width,
this.height,
2024-05-27 23:56:22 +00:00
});
2022-08-26 08:11:35 +00:00
final double? width;
final double? height;
@override
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,
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
),
);
}
}