stack_wallet/lib/themes/theme_providers.dart

52 lines
1.2 KiB
Dart
Raw 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
*
*/
2024-05-14 16:26:03 +00:00
import 'package:flutter/material.dart';
2023-04-20 15:32:50 +00:00
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../models/isar/stack_theme.dart';
import '../wallets/crypto_currency/crypto_currency.dart';
import 'stack_colors.dart';
import 'theme_service.dart';
2023-04-20 15:32:50 +00:00
final applicationThemesDirectoryPathProvider = StateProvider((ref) => "");
2023-04-24 14:36:12 +00:00
final colorProvider = StateProvider<StackColors>(
(ref) => StackColors.fromStackColorTheme(
ref.watch(themeProvider.state).state,
),
);
final themeProvider = StateProvider<StackTheme>(
(ref) => ref.watch(
pThemeService.select(
(value) => value.getTheme(
themeId: "light",
)!,
),
),
);
2023-05-18 18:52:48 +00:00
final themeAssetsProvider = StateProvider<IThemeAssets>(
(ref) => ref.watch(
themeProvider.select(
(value) => value.assets,
),
),
);
2024-05-14 16:26:03 +00:00
2024-05-15 21:20:45 +00:00
final pCoinColor = StateProvider.family<Color, CryptoCurrency>(
2024-05-14 16:26:03 +00:00
(ref, coin) =>
ref.watch(
2024-05-15 21:20:45 +00:00
themeProvider.select((value) => value.coinColors[coin.mainNetId]),
2024-05-14 16:26:03 +00:00
) ??
Colors.deepOrangeAccent,
);