diff --git a/packages/neon/neon/lib/src/models/account.dart b/packages/neon/neon/lib/src/models/account.dart index 98741baa..4effb840 100644 --- a/packages/neon/neon/lib/src/models/account.dart +++ b/packages/neon/neon/lib/src/models/account.dart @@ -34,7 +34,7 @@ Future getAccount( String userAgent(final PackageInfo packageInfo) { var buildNumber = packageInfo.buildNumber; - if (buildNumber == '') { + if (buildNumber.isEmpty) { buildNumber = '1'; } return 'Neon ${packageInfo.version}+$buildNumber'; diff --git a/packages/neon/neon/lib/src/utils/push_utils.dart b/packages/neon/neon/lib/src/utils/push_utils.dart index 04bb9e62..f9a62573 100644 --- a/packages/neon/neon/lib/src/utils/push_utils.dart +++ b/packages/neon/neon/lib/src/utils/push_utils.dart @@ -121,7 +121,7 @@ class PushUtils { if (notification?.shouldNotify ?? true) { final appID = notification?.app ?? pushNotification.subject.app ?? 'nextcloud'; String? appName = localizations.appImplementationName(appID); - if (appName == '') { + if (appName.isEmpty) { debugPrint('Missing app name for $appID'); appName = null; } diff --git a/packages/neon/neon/lib/src/utils/validators.dart b/packages/neon/neon/lib/src/utils/validators.dart index 6a9e9d1e..6aeb7f05 100644 --- a/packages/neon/neon/lib/src/utils/validators.dart +++ b/packages/neon/neon/lib/src/utils/validators.dart @@ -5,7 +5,7 @@ String? validateHttpUrl( final String? input, { final bool httpsOnly = false, }) { - if (input == null || input == '') { + if (input == null || input.isEmpty) { return AppLocalizations.of(context).errorInvalidURL; } try { @@ -22,7 +22,7 @@ String? validateHttpUrl( } String? validateNotEmpty(final BuildContext context, final String? input) { - if (input == null || input == '') { + if (input == null || input.isEmpty) { return AppLocalizations.of(context).errorEmptyField; } diff --git a/packages/neon/neon_news/lib/widgets/feed_icon.dart b/packages/neon/neon_news/lib/widgets/feed_icon.dart index fefdd53d..1c9b7bb0 100644 --- a/packages/neon/neon_news/lib/widgets/feed_icon.dart +++ b/packages/neon/neon_news/lib/widgets/feed_icon.dart @@ -13,20 +13,24 @@ class NewsFeedIcon extends StatelessWidget { final BorderRadius? borderRadius; @override - Widget build(final BuildContext context) => NeonImageWrapper( - color: Colors.white, - size: Size.square(size), - borderRadius: borderRadius, - child: feed.faviconLink != null && feed.faviconLink != '' - ? NeonCachedUrlImage( - url: feed.faviconLink!, - size: Size.square(size), - iconColor: Theme.of(context).colorScheme.primary, - ) - : Icon( - Icons.rss_feed, - size: size, - color: Theme.of(context).colorScheme.primary, - ), - ); + Widget build(final BuildContext context) { + final faviconLink = feed.faviconLink; + + return NeonImageWrapper( + color: Colors.white, + size: Size.square(size), + borderRadius: borderRadius, + child: faviconLink != null && faviconLink.isNotEmpty + ? NeonCachedUrlImage( + url: faviconLink, + size: Size.square(size), + iconColor: Theme.of(context).colorScheme.primary, + ) + : Icon( + Icons.rss_feed, + size: size, + color: Theme.of(context).colorScheme.primary, + ), + ); + } } diff --git a/packages/neon/neon_notes/lib/pages/category.dart b/packages/neon/neon_notes/lib/pages/category.dart index f32a075f..e789b4c0 100644 --- a/packages/neon/neon_notes/lib/pages/category.dart +++ b/packages/neon/neon_notes/lib/pages/category.dart @@ -14,7 +14,7 @@ class NotesCategoryPage extends StatelessWidget { Widget build(final BuildContext context) => Scaffold( resizeToAvoidBottomInset: false, appBar: AppBar( - title: Text(category.name != '' ? category.name : AppLocalizations.of(context).categoryUncategorized), + title: Text(category.name.isNotEmpty ? category.name : AppLocalizations.of(context).categoryUncategorized), ), body: NotesView( bloc: bloc, diff --git a/packages/neon/neon_notes/lib/widgets/categories_view.dart b/packages/neon/neon_notes/lib/widgets/categories_view.dart index 177343d3..e3f13d52 100644 --- a/packages/neon/neon_notes/lib/widgets/categories_view.dart +++ b/packages/neon/neon_notes/lib/widgets/categories_view.dart @@ -41,9 +41,9 @@ class NotesCategoriesView extends StatelessWidget { final NoteCategory category, ) => ListTile( - title: Text(category.name != '' ? category.name : AppLocalizations.of(context).categoryUncategorized), + title: Text(category.name.isNotEmpty ? category.name : AppLocalizations.of(context).categoryUncategorized), subtitle: Text(AppLocalizations.of(context).categoryNotesCount(category.count)), - leading: category.name != '' + leading: category.name.isNotEmpty ? Icon( MdiIcons.tag, size: 40, diff --git a/packages/neon/neon_notes/lib/widgets/category_select.dart b/packages/neon/neon_notes/lib/widgets/category_select.dart index 5bee86f1..4d51d2d3 100644 --- a/packages/neon/neon_notes/lib/widgets/category_select.dart +++ b/packages/neon/neon_notes/lib/widgets/category_select.dart @@ -35,7 +35,7 @@ class NotesCategorySelect extends StatelessWidget { ..._categories, ]; - if (value.text == '') { + if (value.text.isEmpty) { return categories; } return categories.where((final category) => category.toLowerCase().contains(value.text.toLowerCase())); @@ -74,10 +74,10 @@ class NotesCategorySelect extends StatelessWidget { return ListTile( leading: Icon( MdiIcons.tag, - color: option != '' ? NotesCategoryColor.compute(option) : null, + color: option.isNotEmpty ? NotesCategoryColor.compute(option) : null, ), title: Text( - option != '' ? option : AppLocalizations.of(context).categoryUncategorized, + option.isNotEmpty ? option : AppLocalizations.of(context).categoryUncategorized, ), onTap: () { onSelected(option); diff --git a/packages/neon/neon_notes/lib/widgets/notes_view.dart b/packages/neon/neon_notes/lib/widgets/notes_view.dart index eaffc784..3bfab4d4 100644 --- a/packages/neon/neon_notes/lib/widgets/notes_view.dart +++ b/packages/neon/neon_notes/lib/widgets/notes_view.dart @@ -54,7 +54,7 @@ class NotesView extends StatelessWidget { RelativeTime( date: DateTime.fromMillisecondsSinceEpoch(note.modified * 1000), ), - if (note.category != '') ...[ + if (note.category.isNotEmpty) ...[ const SizedBox( width: 8, ),