stack_wallet/lib/pages/loading_view.dart

69 lines
2.2 KiB
Dart
Raw Normal View History

import 'dart:io';
2022-08-26 08:11:35 +00:00
import 'dart:math';
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 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/themes/theme_providers.dart';
2022-08-26 08:11:35 +00:00
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/widgets/background.dart';
2023-02-23 17:25:32 +00:00
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/rounded_container.dart';
2022-08-26 08:11:35 +00:00
class LoadingView extends ConsumerWidget {
2022-08-26 08:11:35 +00:00
const LoadingView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context, WidgetRef ref) {
2022-08-26 08:11:35 +00:00
final size = MediaQuery.of(context).size;
2023-02-23 17:25:32 +00:00
final width = min(size.width, size.height) * 0.5;
final assetPath = ref.watch(
themeProvider.select((value) => value.assets.loadingGif),
);
return Background(
child: Scaffold(
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
body: Container(
color: Theme.of(context).extension<StackColors>()!.background,
child: Center(
2023-02-23 17:25:32 +00:00
child: ConditionalParent(
condition: Theme.of(context).extension<StackColors>()!.themeId ==
"oled_black",
2023-02-23 17:25:32 +00:00
builder: (child) => RoundedContainer(
color: const Color(0xFFDEDEDE),
radiusMultiplier: 100,
width: width * 1.35,
height: width * 1.35,
child: child,
),
child: SizedBox(
width: width,
child: assetPath != null
? Image.file(
File(
assetPath,
),
)
: Lottie.asset(
Assets.lottie.test2,
animate: true,
repeat: true,
),
),
2022-08-26 08:11:35 +00:00
),
// child: Image(
// image: AssetImage(
// Assets.png.splash,
// ),
// width: MediaQuery.of(context).size.width * 0.5,
// ),
2022-08-26 08:11:35 +00:00
),
),
),
);
}
}