add coin control option to mobile more menu + assets fix

This commit is contained in:
julian 2023-03-06 10:34:41 -06:00
parent 27de4d868e
commit 7319f509f0
6 changed files with 147 additions and 62 deletions

View file

@ -50,6 +50,11 @@ class _WalletNavigationBarState extends ConsumerState<WalletNavigationBar> {
@override
Widget build(BuildContext context) {
final showMore = ref.watch(walletsChangeNotifierProvider.select(
(value) => value.getManager(widget.walletId).hasPaynymSupport)) ||
ref.watch(walletsChangeNotifierProvider.select((value) =>
value.getManager(widget.walletId).hasCoinControlSupport));
return Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
@ -97,6 +102,71 @@ class _WalletNavigationBarState extends ConsumerState<WalletNavigationBar> {
// const SizedBox(
// height: 8,
// ),
if (ref.watch(walletsChangeNotifierProvider.select((value) =>
value.getManager(widget.walletId).hasCoinControlSupport)))
AnimatedOpacity(
opacity: scale,
duration: duration,
child: GestureDetector(
onTap: () {
if (mounted) {
Navigator.of(context).pop();
// Navigator.of(context).pushNamed(
// PaynymHomeView.routeName,
// arguments: widget.walletId,
// );
}
},
child: Container(
padding: const EdgeInsets.all(16),
width: 146,
decoration: BoxDecoration(
color:
Theme.of(context).extension<StackColors>()!.popupBG,
boxShadow: [
Theme.of(context)
.extension<StackColors>()!
.standardBoxShadow
],
borderRadius: BorderRadius.circular(
widget.height / 2.0,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Coin control",
style: STextStyles.buttonSmall(context),
),
const SizedBox(
width: 16,
),
SvgPicture.asset(
Assets.svg.coinControl.gamePad,
height: 20,
width: 20,
color: Theme.of(context)
.extension<StackColors>()!
.bottomNavIconIcon,
),
],
),
),
),
),
if (ref.watch(walletsChangeNotifierProvider.select((value) =>
value
.getManager(widget.walletId)
.hasCoinControlSupport)) &&
ref.watch(walletsChangeNotifierProvider.select((value) =>
value.getManager(widget.walletId).hasPaynymSupport)))
const SizedBox(
height: 8,
),
if (ref.watch(walletsChangeNotifierProvider.select((value) =>
value.getManager(widget.walletId).hasPaynymSupport)))
AnimatedOpacity(
opacity: scale,
duration: duration,
@ -159,8 +229,9 @@ class _WalletNavigationBarState extends ConsumerState<WalletNavigationBar> {
padding: const EdgeInsets.all(16),
width: 146,
decoration: BoxDecoration(
color:
Theme.of(context).extension<StackColors>()!.popupBG,
color: Theme.of(context)
.extension<StackColors>()!
.popupBG,
boxShadow: [
Theme.of(context)
.extension<StackColors>()!
@ -410,8 +481,7 @@ class _WalletNavigationBarState extends ConsumerState<WalletNavigationBar> {
),
),
),
if (ref.watch(walletsChangeNotifierProvider.select((value) =>
value.getManager(widget.walletId).hasPaynymSupport)))
if (showMore)
RawMaterialButton(
constraints: const BoxConstraints(
minWidth: 66,

View file

@ -24,6 +24,7 @@ import 'package:stackwallet/services/event_bus/events/global/refresh_percent_cha
import 'package:stackwallet/services/event_bus/events/global/updated_in_background_event.dart';
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
import 'package:stackwallet/services/mixins/coin_control_interface.dart';
import 'package:stackwallet/services/mixins/electrum_x_parsing.dart';
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
import 'package:stackwallet/services/mixins/wallet_cache.dart';
@ -94,7 +95,12 @@ String constructDerivePath({
}
class BitcoinWallet extends CoinServiceAPI
with WalletCache, WalletDB, ElectrumXParsing, PaynymWalletInterface {
with
WalletCache,
WalletDB,
ElectrumXParsing,
PaynymWalletInterface,
CoinControlInterface {
BitcoinWallet({
required String walletId,
required String walletName,

View file

@ -10,6 +10,7 @@ import 'package:stackwallet/services/coins/coin_service.dart';
import 'package:stackwallet/services/event_bus/events/global/node_connection_status_changed_event.dart';
import 'package:stackwallet/services/event_bus/events/global/updated_in_background_event.dart';
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
import 'package:stackwallet/services/mixins/coin_control_interface.dart';
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
@ -229,6 +230,8 @@ class Manager with ChangeNotifier {
bool get hasPaynymSupport => _currentWallet is PaynymWalletInterface;
bool get hasCoinControlSupport => _currentWallet is CoinControlInterface;
int get rescanOnOpenVersion =>
DB.instance.get<dynamic>(
boxName: DB.boxNameDBInfo,

View file

@ -0,0 +1,3 @@
mixin CoinControlInterface {
//
}

View file

@ -60,7 +60,7 @@ class _COIN_CONTROL {
class _SVG {
const _SVG();
static const coinControl = _COIN_CONTROL();
final coinControl = const _COIN_CONTROL();
String? background(BuildContext context) {
switch (Theme.of(context).extension<StackColors>()!.themeType) {

View file

@ -324,6 +324,9 @@ flutter:
# coin icons
- assets/svg/coin_icons/
# coin control icons
- assets/svg/coin_control/
# lottie animations
- assets/lottie/test.json
- assets/lottie/test2.json