Browse Source

Merge pull request #1141 from nextcloud/feat/neon_dashboard/widget-icon-class

feat(neon_dashboard): Support server icons as dashboard widget icons
pull/1140/head
Kate 1 year ago committed by GitHub
parent
commit
dd0fdd9b3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      packages/neon/neon_dashboard/lib/src/widgets/widget.dart

32
packages/neon/neon_dashboard/lib/src/widgets/widget.dart

@ -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(
@ -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;

Loading…
Cancel
Save