stack_wallet/lib/pages/cashfusion/cashfusion_view.dart
2023-07-26 17:07:06 -05:00

131 lines
4.1 KiB
Dart

/*
* 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 sneurlax on 2023-07-26
*
*/
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/services/mixins/fusion_interface.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/show_loading.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
class CashFusionView extends ConsumerStatefulWidget {
const CashFusionView({
super.key,
required this.walletId,
});
static const routeName = "/cashFusionView";
final String walletId;
@override
ConsumerState<CashFusionView> createState() => _CashFusionViewState();
}
class _CashFusionViewState extends ConsumerState<CashFusionView> {
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Background(
child: SafeArea(
child: Scaffold(
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar(
automaticallyImplyLeading: false,
leading: const AppBarBackButton(),
title: Text(
"CashFusion",
style: STextStyles.navBarTitle(context),
),
titleSpacing: 0,
actions: [
AspectRatio(
aspectRatio: 1,
child: AppBarIconButton(
size: 36,
icon: SvgPicture.asset(
Assets.svg.arrowRotate,
width: 20,
height: 20,
color: Theme.of(context)
.extension<StackColors>()!
.topNavIconPrimary,
),
onPressed: () async {
// show loading for a minimum of 2 seconds on refreshing
await showLoading(
whileFuture: Future.wait<void>([
Future.delayed(const Duration(seconds: 2)),
(ref
.read(walletsChangeNotifierProvider)
.getManager(widget.walletId)
.wallet as FusionInterface)
.refreshFusion()
]),
context: context,
message: "Refreshing...");
},
),
),
],
),
body: Padding(
padding: const EdgeInsets.only(
left: 16,
right: 16,
top: 8,
),
child: Column(
children: [
Expanded(
// child: CashFusionParticipantList(
// walletId: widget.walletId,
// ),
child: Text(
"TODO CashFusionView",
style: STextStyles.desktopTextMedium(context),
),
),
TextButton(
onPressed: () => {
(ref
.read(walletsChangeNotifierProvider)
.getManager(widget.walletId)
.wallet as FusionInterface)
.fuse()
},
child: Text(
"Fuse",
style: STextStyles.desktopTextMedium(context),
),
)
],
),
),
),
),
);
}
}