diff --git a/packages/neon/lib/src/apps/files/widgets/file_preview.dart b/packages/neon/lib/src/apps/files/widgets/file_preview.dart index 2c3e432f..16822ab0 100644 --- a/packages/neon/lib/src/apps/files/widgets/file_preview.dart +++ b/packages/neon/lib/src/apps/files/widgets/file_preview.dart @@ -76,7 +76,7 @@ class FilePreview extends StatelessWidget { ); if (withBackground) { return ImageWrapper( - backgroundColor: Colors.white, + color: Colors.white, borderRadius: borderRadius, child: child, ); @@ -96,8 +96,10 @@ class FilePreview extends StatelessWidget { ), ], if (previewLoading) ...[ - const Center( - child: CustomLinearProgressIndicator(), + Center( + child: CustomLinearProgressIndicator( + color: color, + ), ), ], ], diff --git a/packages/neon/lib/src/apps/news/widgets/articles_view.dart b/packages/neon/lib/src/apps/news/widgets/articles_view.dart index 039e1c44..65dd67d9 100644 --- a/packages/neon/lib/src/apps/news/widgets/articles_view.dart +++ b/packages/neon/lib/src/apps/news/widgets/articles_view.dart @@ -181,7 +181,6 @@ class _NewsArticlesViewState extends State { if (article.mediaThumbnail != null) ...[ CachedURLImage( url: article.mediaThumbnail!, - account: RxBlocProvider.of(context).activeAccount.value!, width: 100, height: 50, fit: BoxFit.cover, diff --git a/packages/neon/lib/src/apps/news/widgets/feed_icon.dart b/packages/neon/lib/src/apps/news/widgets/feed_icon.dart index 1937da00..86127371 100644 --- a/packages/neon/lib/src/apps/news/widgets/feed_icon.dart +++ b/packages/neon/lib/src/apps/news/widgets/feed_icon.dart @@ -14,16 +14,16 @@ class NewsFeedIcon extends StatelessWidget { @override Widget build(final BuildContext context) => ImageWrapper( - backgroundColor: Colors.white, + color: Colors.white, width: size, height: size, borderRadius: borderRadius, child: feed.faviconLink != null && feed.faviconLink != '' ? CachedURLImage( url: feed.faviconLink!, - account: RxBlocProvider.of(context).activeAccount.value!, height: size, width: size, + iconColor: Theme.of(context).colorScheme.primary, ) : Icon( Icons.rss_feed, diff --git a/packages/neon/lib/src/apps/notifications/app.dart b/packages/neon/lib/src/apps/notifications/app.dart index 10a3dcfd..c2fcb66d 100644 --- a/packages/neon/lib/src/apps/notifications/app.dart +++ b/packages/neon/lib/src/apps/notifications/app.dart @@ -1,12 +1,10 @@ library notifications; import 'package:flutter/material.dart'; -import 'package:flutter_rx_bloc/flutter_rx_bloc.dart'; import 'package:intersperse/intersperse.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/apps/notifications/blocs/notifications.dart'; -import 'package:neon/src/blocs/accounts.dart'; import 'package:neon/src/blocs/apps.dart'; import 'package:neon/src/neon.dart'; import 'package:nextcloud/nextcloud.dart'; diff --git a/packages/neon/lib/src/apps/notifications/pages/main.dart b/packages/neon/lib/src/apps/notifications/pages/main.dart index 952c6916..583e39b8 100644 --- a/packages/neon/lib/src/apps/notifications/pages/main.dart +++ b/packages/neon/lib/src/apps/notifications/pages/main.dart @@ -115,10 +115,9 @@ class _NotificationsMainPageState extends State { height: 40, child: CachedURLImage( url: notification.icon!, - account: RxBlocProvider.of(context).activeAccount.value!, width: 40, height: 40, - color: Theme.of(context).colorScheme.primary, + svgColor: Theme.of(context).colorScheme.primary, ), ), onTap: () async { diff --git a/packages/neon/lib/src/pages/home/home.dart b/packages/neon/lib/src/pages/home/home.dart index 1b31d117..5da102cd 100644 --- a/packages/neon/lib/src/pages/home/home.dart +++ b/packages/neon/lib/src/pages/home/home.dart @@ -444,7 +444,6 @@ class _HomePageState extends State with tray.TrayListener, WindowListe Flexible( child: CachedURLImage( url: capabilitiesData.capabilities!.theming!.logo!, - account: widget.account, ), ), ], @@ -630,7 +629,6 @@ class _HomePageState extends State with tray.TrayListener, WindowListe child: capabilitiesData?.capabilities?.theming?.logo != null ? CachedURLImage( url: capabilitiesData!.capabilities!.theming!.logo!, - account: widget.account, ) : null, ) diff --git a/packages/neon/lib/src/widgets/cached_url_image.dart b/packages/neon/lib/src/widgets/cached_url_image.dart index ddcd36f1..85a700a9 100644 --- a/packages/neon/lib/src/widgets/cached_url_image.dart +++ b/packages/neon/lib/src/widgets/cached_url_image.dart @@ -5,32 +5,28 @@ final _cacheManager = DefaultCacheManager(); class CachedURLImage extends StatelessWidget { const CachedURLImage({ required this.url, - required this.account, this.height, this.width, this.fit, - this.color, + this.svgColor, + this.iconColor, super.key, }); final String url; - final Account account; final double? height; final double? width; final BoxFit? fit; - /// Only works for SVGs - final Color? color; + final Color? svgColor; + final Color? iconColor; @override Widget build(final BuildContext context) => FutureBuilder( // Really weird false positive // ignore: discarded_futures - future: _cacheManager.getSingleFile( - url, - headers: account.client.baseHeaders, - ), + future: _cacheManager.getSingleFile(url), builder: (final context, final fileSnapshot) { if (fileSnapshot.hasData) { final content = fileSnapshot.data!.readAsBytesSync(); @@ -56,7 +52,7 @@ class CachedURLImage extends StatelessWidget { height: height, width: width, fit: fit ?? BoxFit.contain, - color: color, + color: svgColor, ); } @@ -65,17 +61,21 @@ class CachedURLImage extends StatelessWidget { height: height, width: width, fit: fit, + gaplessPlayback: true, ); } if (fileSnapshot.hasError) { return Icon( Icons.error_outline, size: height != null && width != null ? min(height!, width!) : height ?? width, + color: iconColor, ); } return SizedBox( width: width, - child: const CustomLinearProgressIndicator(), + child: CustomLinearProgressIndicator( + color: iconColor, + ), ); }, ); diff --git a/packages/neon/lib/src/widgets/image_wrapper.dart b/packages/neon/lib/src/widgets/image_wrapper.dart index 2c98cb20..b0d33055 100644 --- a/packages/neon/lib/src/widgets/image_wrapper.dart +++ b/packages/neon/lib/src/widgets/image_wrapper.dart @@ -3,7 +3,7 @@ part of '../neon.dart'; class ImageWrapper extends StatelessWidget { const ImageWrapper({ required this.child, - required this.backgroundColor, + required this.color, this.width, this.height, this.borderRadius, @@ -11,7 +11,7 @@ class ImageWrapper extends StatelessWidget { }); final Widget child; - final Color backgroundColor; + final Color color; final double? width; final double? height; final BorderRadius? borderRadius; @@ -20,14 +20,11 @@ class ImageWrapper extends StatelessWidget { Widget build(final BuildContext context) => SizedBox( width: width, height: height, - child: DecoratedBox( - decoration: BoxDecoration( - color: backgroundColor, - borderRadius: borderRadius?.add(const BorderRadius.all(Radius.circular(1))), - ), - child: Center( - child: ClipRRect( - borderRadius: borderRadius ?? BorderRadius.zero, + child: ClipRRect( + borderRadius: borderRadius ?? BorderRadius.zero, + child: ColoredBox( + color: color, + child: Center( child: child, ), ),