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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
2024-05-23 00:37:06 +00:00
|
|
|
import 'sub_widgets/all_wallets.dart';
|
|
|
|
import 'sub_widgets/empty_wallets.dart';
|
|
|
|
import 'sub_widgets/favorite_wallets.dart';
|
|
|
|
import '../../providers/providers.dart';
|
|
|
|
import '../../themes/theme_providers.dart';
|
|
|
|
import '../../wallets/isar/providers/all_wallets_info_provider.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
|
|
|
|
class WalletsView extends ConsumerWidget {
|
|
|
|
const WalletsView({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
static const routeName = "/wallets";
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
debugPrint("BUILD: $runtimeType");
|
2024-01-03 15:47:36 +00:00
|
|
|
final hasWallets = ref.watch(pAllWalletsInfo).isNotEmpty;
|
2022-08-26 08:11:35 +00:00
|
|
|
|
|
|
|
final showFavorites = ref.watch(prefsChangeNotifierProvider
|
|
|
|
.select((value) => value.showFavoriteWallets));
|
|
|
|
|
|
|
|
return SafeArea(
|
|
|
|
child: hasWallets
|
|
|
|
? Padding(
|
2023-02-10 20:06:44 +00:00
|
|
|
padding: EdgeInsets.only(
|
2023-05-09 20:20:29 +00:00
|
|
|
top:
|
|
|
|
ref.watch(themeProvider).themeId == "fruit_sorbet" ? 6 : 20,
|
2022-08-26 08:11:35 +00:00
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
|
|
|
if (showFavorites) const FavoriteWallets(),
|
|
|
|
if (showFavorites)
|
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
const Expanded(
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: 16,
|
|
|
|
),
|
|
|
|
child: AllWallets(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: const Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 20,
|
|
|
|
left: 16,
|
|
|
|
right: 16,
|
|
|
|
),
|
|
|
|
child: EmptyWallets(),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|