From b672c904e38b454cf6313869a062fb0ecbafaae0 Mon Sep 17 00:00:00 2001 From: alikhabazian Date: Sun, 17 Mar 2024 03:53:11 +0330 Subject: [PATCH] add useImage feild for change image in every newyear and increase quality --- .../home/widget/connection_button.dart | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/features/home/widget/connection_button.dart b/lib/features/home/widget/connection_button.dart index a659c223..c44f8009 100644 --- a/lib/features/home/widget/connection_button.dart +++ b/lib/features/home/widget/connection_button.dart @@ -25,6 +25,7 @@ class ConnectionButton extends HookConsumerWidget { final connectionStatus = ref.watch(connectionNotifierProvider); final requiresReconnect = ref.watch(configOptionNotifierProvider).valueOrNull; + final today = DateTime.now(); ref.listen( connectionNotifierProvider, @@ -102,7 +103,9 @@ class ConnectionButton extends HookConsumerWidget { AsyncData(value: Disconnected()) || AsyncError() => Assets.images.disconnectNorouz, AsyncData(value: Connected()) => Assets.images.connectNorouz, _ =>Assets.images.disconnectNorouz, - } + }, + useImage:today.day>=19 && today.day<=23 && today.month==3 , + ); } } @@ -114,6 +117,7 @@ class _ConnectionButton extends StatelessWidget { required this.label, required this.buttonColor, required this.image, + required this.useImage, }); final VoidCallback onTap; @@ -121,6 +125,7 @@ class _ConnectionButton extends StatelessWidget { final String label; final Color buttonColor; final AssetGenImage image; + final bool useImage; @override Widget build(BuildContext context) { @@ -156,7 +161,19 @@ class _ConnectionButton extends StatelessWidget { tween: ColorTween(end: buttonColor), duration: const Duration(milliseconds: 250), builder: (context, value, child) { - return image.image(); + if(useImage) { + return image.image( + filterQuality: FilterQuality.medium + ); + } + else{ + return Assets.images.logo.svg( + colorFilter: ColorFilter.mode( + value!, + BlendMode.srcIn, + ), + ); + } }, ), ),