From 120cba33d5bcdc2e1adab7a4fafbf85050f4c5c8 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Mon, 26 Jun 2023 17:51:41 +0200 Subject: [PATCH] neon, neon_files, neon_news, settings: use specific WIdgets instead of containers --- packages/neon/neon/lib/src/widgets/text_settings_tile.dart | 2 +- packages/neon/neon_files/lib/dialogs/choose_folder.dart | 2 +- packages/neon/neon_files/lib/pages/details.dart | 6 +++--- packages/neon/neon_files/lib/widgets/browser_view.dart | 4 ++-- packages/neon/neon_news/lib/widgets/feeds_view.dart | 3 +-- packages/neon/neon_news/lib/widgets/folders_view.dart | 2 +- .../settings/lib/src/widgets/checkbox_settings_tile.dart | 2 +- .../lib/src/widgets/dropdown_button_settings_tile.dart | 2 +- 8 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/neon/neon/lib/src/widgets/text_settings_tile.dart b/packages/neon/neon/lib/src/widgets/text_settings_tile.dart index 68efd525..e5900bdb 100644 --- a/packages/neon/neon/lib/src/widgets/text_settings_tile.dart +++ b/packages/neon/neon/lib/src/widgets/text_settings_tile.dart @@ -14,7 +14,7 @@ class NeonTextSettingsTile extends SettingsTile { final TextStyle? style; @override - Widget build(final BuildContext context) => Container( + Widget build(final BuildContext context) => Padding( padding: const EdgeInsets.symmetric( horizontal: 16, ), diff --git a/packages/neon/neon_files/lib/dialogs/choose_folder.dart b/packages/neon/neon_files/lib/dialogs/choose_folder.dart index 9ca288fd..551f461b 100644 --- a/packages/neon/neon_files/lib/dialogs/choose_folder.dart +++ b/packages/neon/neon_files/lib/dialogs/choose_folder.dart @@ -58,7 +58,7 @@ class FilesChooseFolderDialog extends StatelessWidget { ], ), ) - : Container(), + : const SizedBox(), ), ], ), diff --git a/packages/neon/neon_files/lib/pages/details.dart b/packages/neon/neon_files/lib/pages/details.dart index 413aa62c..eeb44e80 100644 --- a/packages/neon/neon_files/lib/pages/details.dart +++ b/packages/neon/neon_files/lib/pages/details.dart @@ -35,9 +35,9 @@ class FilesDetailsPage extends StatelessWidget { ), DataTable( headingRowHeight: 0, - columns: [ - DataColumn(label: Container()), - DataColumn(label: Container()), + columns: const [ + DataColumn(label: SizedBox()), + DataColumn(label: SizedBox()), ], rows: [ for (final entry in { diff --git a/packages/neon/neon_files/lib/widgets/browser_view.dart b/packages/neon/neon_files/lib/widgets/browser_view.dart index 61a0f450..6bf6a493 100644 --- a/packages/neon/neon_files/lib/widgets/browser_view.dart +++ b/packages/neon/neon_files/lib/widgets/browser_view.dart @@ -43,7 +43,7 @@ class _FilesBrowserViewState extends State { builder: (final context, final downloadTasksSnapshot) => !pathSnapshot.hasData || !uploadTasksSnapshot.hasData || !downloadTasksSnapshot.hasData - ? Container() + ? const SizedBox() : BackButtonListener( onBackButtonPressed: () async { final path = pathSnapshot.requireData; @@ -72,7 +72,7 @@ class _FilesBrowserViewState extends State { stream: uploadTask.progress, builder: (final context, final uploadTaskProgressSnapshot) => !uploadTaskProgressSnapshot.hasData - ? Container() + ? const SizedBox() : _buildFile( context: context, details: FileDetails( diff --git a/packages/neon/neon_news/lib/widgets/feeds_view.dart b/packages/neon/neon_news/lib/widgets/feeds_view.dart index 028c19de..3ea45c39 100644 --- a/packages/neon/neon_news/lib/widgets/feeds_view.dart +++ b/packages/neon/neon_news/lib/widgets/feeds_view.dart @@ -51,8 +51,7 @@ class NewsFeedsView extends StatelessWidget { ? Theme.of(context).textTheme.titleMedium!.copyWith(color: Theme.of(context).disabledColor) : null, ), - subtitle: - feed.unreadCount! > 0 ? Text(AppLocalizations.of(context).articlesUnread(feed.unreadCount!)) : Container(), + subtitle: feed.unreadCount! > 0 ? Text(AppLocalizations.of(context).articlesUnread(feed.unreadCount!)) : null, leading: NewsFeedIcon( feed: feed, borderRadius: const BorderRadius.all(Radius.circular(8)), diff --git a/packages/neon/neon_news/lib/widgets/folders_view.dart b/packages/neon/neon_news/lib/widgets/folders_view.dart index 645f0e68..6e90ba8e 100644 --- a/packages/neon/neon_news/lib/widgets/folders_view.dart +++ b/packages/neon/neon_news/lib/widgets/folders_view.dart @@ -55,7 +55,7 @@ class NewsFoldersView extends StatelessWidget { ? Text( AppLocalizations.of(context).articlesUnread(unreadCount), ) - : Container(), + : null, leading: SizedBox.square( dimension: 48, child: Stack( diff --git a/packages/settings/lib/src/widgets/checkbox_settings_tile.dart b/packages/settings/lib/src/widgets/checkbox_settings_tile.dart index f4496d7e..7bdee8a9 100644 --- a/packages/settings/lib/src/widgets/checkbox_settings_tile.dart +++ b/packages/settings/lib/src/widgets/checkbox_settings_tile.dart @@ -12,7 +12,7 @@ class CheckBoxSettingsTile extends InputSettingsTile { builder: (final context, final value) => StreamBuilder( stream: option.enabled, builder: (final context, final enabledSnapshot) => !enabledSnapshot.hasData - ? Container() + ? const SizedBox() : CheckboxListTile( title: Text(option.label(context)), value: value, diff --git a/packages/settings/lib/src/widgets/dropdown_button_settings_tile.dart b/packages/settings/lib/src/widgets/dropdown_button_settings_tile.dart index 89b9dbcd..ae5b0a5c 100644 --- a/packages/settings/lib/src/widgets/dropdown_button_settings_tile.dart +++ b/packages/settings/lib/src/widgets/dropdown_button_settings_tile.dart @@ -34,7 +34,7 @@ class DropdownButtonSettingsTile extends InputSettingsTile> { : Theme.of(context).textTheme.titleMedium!.copyWith(color: Theme.of(context).disabledColor), ), trailing: valuesSnapshot.hasData - ? Container( + ? ConstrainedBox( constraints: BoxConstraints( maxWidth: constraints.maxWidth * 0.5, ),