From 6472214a5769b9aafceb09d411d72448b087544c Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Wed, 14 Jun 2023 17:44:26 +0200 Subject: [PATCH] neon, neon_notifications: make AppImplementation.buildIcon a builder --- packages/neon/neon/lib/src/pages/home.dart | 2 +- packages/neon/neon/lib/src/pages/settings.dart | 2 +- .../neon/lib/src/utils/app_implementation.dart | 17 +++++++++-------- .../src/widgets/app_implementation_icon.dart | 1 - .../neon/neon_notifications/lib/pages/main.dart | 1 - 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/neon/neon/lib/src/pages/home.dart b/packages/neon/neon/lib/src/pages/home.dart index b923a9f1..1e080866 100644 --- a/packages/neon/neon/lib/src/pages/home.dart +++ b/packages/neon/neon/lib/src/pages/home.dart @@ -356,7 +356,7 @@ class _HomePageState extends State { ], ], ), - leading: appImplementation.buildIcon(context), + leading: appImplementation.buildIcon(), minLeadingWidth: 0, onTap: () async { await _appsBloc.setActiveApp(appImplementation.id); diff --git a/packages/neon/neon/lib/src/pages/settings.dart b/packages/neon/neon/lib/src/pages/settings.dart index 2033cf5e..a0f5bfde 100644 --- a/packages/neon/neon/lib/src/pages/settings.dart +++ b/packages/neon/neon/lib/src/pages/settings.dart @@ -78,7 +78,7 @@ class _SettingsPageState extends State { for (final appImplementation in appImplementations) ...[ if (appImplementation.options.options.isNotEmpty) ...[ CustomSettingsTile( - leading: appImplementation.buildIcon(context), + leading: appImplementation.buildIcon(), title: Text(appImplementation.name(context)), onTap: () { NextcloudAppSettingsRoute(appid: appImplementation.id).go(context); diff --git a/packages/neon/neon/lib/src/utils/app_implementation.dart b/packages/neon/neon/lib/src/utils/app_implementation.dart index 63b789a5..961e5ca2 100644 --- a/packages/neon/neon/lib/src/utils/app_implementation.dart +++ b/packages/neon/neon/lib/src/utils/app_implementation.dart @@ -41,17 +41,18 @@ abstract class AppImplementation - SizedBox.fromSize( - size: size, - child: SvgPicture.asset( - 'assets/app.svg', - package: 'neon_$id', - colorFilter: ColorFilter.mode(color ?? Theme.of(context).colorScheme.primary, BlendMode.srcIn), + Builder( + builder: (final context) => SizedBox.fromSize( + size: size, + child: SvgPicture.asset( + 'assets/app.svg', + package: 'neon_$id', + colorFilter: ColorFilter.mode(color ?? Theme.of(context).colorScheme.primary, BlendMode.srcIn), + ), ), ); diff --git a/packages/neon/neon/lib/src/widgets/app_implementation_icon.dart b/packages/neon/neon/lib/src/widgets/app_implementation_icon.dart index 8434e778..c76c637a 100644 --- a/packages/neon/neon/lib/src/widgets/app_implementation_icon.dart +++ b/packages/neon/neon/lib/src/widgets/app_implementation_icon.dart @@ -24,7 +24,6 @@ class NeonAppImplementationIcon extends StatelessWidget { Container( margin: const EdgeInsets.all(5), child: appImplementation.buildIcon( - context, size: size, color: color, ), diff --git a/packages/neon/neon_notifications/lib/pages/main.dart b/packages/neon/neon_notifications/lib/pages/main.dart index c807037b..b1048fcd 100644 --- a/packages/neon/neon_notifications/lib/pages/main.dart +++ b/packages/neon/neon_notifications/lib/pages/main.dart @@ -74,7 +74,6 @@ class _NotificationsMainPageState extends State { ), leading: app != null ? app.buildIcon( - context, size: const Size.square(40), ) : SizedBox.fromSize(