Skip to content

Commit

Permalink
Merge pull request nextcloud#1141 from nextcloud/feat/neon_dashboard/…
Browse files Browse the repository at this point in the history
…widget-icon-class

feat(neon_dashboard): Support server icons as dashboard widget icons
  • Loading branch information
provokateurin authored Nov 16, 2023
2 parents 0dcf72d + b74c599 commit dd0fdd9
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions packages/neon/neon_dashboard/lib/src/widgets/widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ class DashboardWidget extends StatelessWidget {
),
leading: SizedBox.square(
dimension: largeIconSize,
child: NeonUrlImage(
url: widget.iconUrl,
svgColorFilter: ColorFilter.mode(Theme.of(context).colorScheme.primary, BlendMode.srcIn),
size: const Size.square(largeIconSize),
),
child: _buildWidgetIcon(context),
),
),
const SizedBox(
Expand Down Expand Up @@ -82,6 +78,32 @@ class DashboardWidget extends StatelessWidget {
);
}

Widget? _buildWidgetIcon(final BuildContext context) {
final colorFilter = ColorFilter.mode(Theme.of(context).colorScheme.primary, BlendMode.srcIn);

if (widget.iconUrl.isNotEmpty) {
return NeonUrlImage(
url: widget.iconUrl,
svgColorFilter: colorFilter,
size: const Size.square(largeIconSize),
);
}

if (widget.iconClass.isNotEmpty) {
return NeonServerIcon(
icon: widget.iconClass,
colorFilter: colorFilter,
size: largeIconSize,
);
}

return Icon(
Icons.question_mark,
color: Theme.of(context).colorScheme.primary,
size: largeIconSize,
);
}

Widget? _renderMessage(final String? message) {
if (message == null || message.isEmpty) {
return null;
Expand Down

0 comments on commit dd0fdd9

Please sign in to comment.