mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
desktop notifications icon fix
This commit is contained in:
parent
9aadf1d80f
commit
1623a4a63c
2 changed files with 38 additions and 24 deletions
|
@ -5,7 +5,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:stackwallet/pages_desktop_specific/home/desktop_menu_item.dart';
|
import 'package:stackwallet/pages_desktop_specific/home/desktop_menu_item.dart';
|
||||||
import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart';
|
import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart';
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
|
@ -191,29 +190,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: SvgPicture.asset(
|
icon: const DesktopNotificationsIcon(),
|
||||||
ref.watch(notificationsProvider.select(
|
|
||||||
(value) => value.hasUnreadNotifications))
|
|
||||||
? Assets.svg.bellNew(context)
|
|
||||||
: Assets.svg.bell,
|
|
||||||
width: 20,
|
|
||||||
height: 20,
|
|
||||||
color: ref.watch(notificationsProvider.select(
|
|
||||||
(value) => value.hasUnreadNotifications))
|
|
||||||
? null
|
|
||||||
: DesktopMenuItemId.notifications ==
|
|
||||||
ref
|
|
||||||
.watch(currentDesktopMenuItemProvider
|
|
||||||
.state)
|
|
||||||
.state
|
|
||||||
? Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.accentColorDark
|
|
||||||
: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.accentColorDark
|
|
||||||
.withOpacity(0.8),
|
|
||||||
),
|
|
||||||
label: "Notifications",
|
label: "Notifications",
|
||||||
value: DesktopMenuItemId.notifications,
|
value: DesktopMenuItemId.notifications,
|
||||||
onChanged: updateSelectedMenuItem,
|
onChanged: updateSelectedMenuItem,
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
import 'package:stackwallet/pages_desktop_specific/home/desktop_menu.dart';
|
||||||
import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart';
|
import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart';
|
||||||
|
import 'package:stackwallet/providers/global/notifications_provider.dart';
|
||||||
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
|
|
||||||
|
@ -11,6 +15,39 @@ class DMIController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DesktopNotificationsIcon extends ConsumerStatefulWidget {
|
||||||
|
const DesktopNotificationsIcon({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
ConsumerState<DesktopNotificationsIcon> createState() =>
|
||||||
|
_DesktopNotificationsIconState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DesktopNotificationsIconState
|
||||||
|
extends ConsumerState<DesktopNotificationsIcon> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SvgPicture.asset(
|
||||||
|
ref.watch(notificationsProvider
|
||||||
|
.select((value) => value.hasUnreadNotifications))
|
||||||
|
? Assets.svg.bellNew(context)
|
||||||
|
: Assets.svg.bell,
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
color: ref.watch(notificationsProvider
|
||||||
|
.select((value) => value.hasUnreadNotifications))
|
||||||
|
? null
|
||||||
|
: DesktopMenuItemId.notifications ==
|
||||||
|
ref.watch(currentDesktopMenuItemProvider.state).state
|
||||||
|
? Theme.of(context).extension<StackColors>()!.accentColorDark
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.accentColorDark
|
||||||
|
.withOpacity(0.8),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class DesktopMenuItem<T> extends ConsumerStatefulWidget {
|
class DesktopMenuItem<T> extends ConsumerStatefulWidget {
|
||||||
const DesktopMenuItem({
|
const DesktopMenuItem({
|
||||||
Key? key,
|
Key? key,
|
||||||
|
|
Loading…
Reference in a new issue