From 7b37aa749c5880bbdafb1b4f766306f807224aa9 Mon Sep 17 00:00:00 2001 From: Rico Berger Date: Fri, 2 May 2025 23:41:05 +0200 Subject: [PATCH] Remove Drag Handles from Sources (#260) Remove the drag handle icon from the sources. The icon was used together with the `ReorderableDragStartListener` widget to sort the sources. This can now be done without the icon, because we wrap the source card widget within the `ReorderableDragStartListener` widget. --- app/lib/widgets/source/source_list_item.dart | 103 ++++++++++--------- 1 file changed, 55 insertions(+), 48 deletions(-) diff --git a/app/lib/widgets/source/source_list_item.dart b/app/lib/widgets/source/source_list_item.dart index fa46636..0abe71d 100644 --- a/app/lib/widgets/source/source_list_item.dart +++ b/app/lib/widgets/source/source_list_item.dart @@ -110,57 +110,64 @@ class _SourceListItemState extends State { @override Widget build(BuildContext context) { - return Card( - color: Constants.secondary, - margin: const EdgeInsets.only(bottom: Constants.spacingSmall), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Padding( - padding: const EdgeInsets.all(Constants.spacingMiddle), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - Characters(widget.source.title) - .replaceAll(Characters(''), Characters('\u{200B}')) - .toString(), - maxLines: 1, - style: const TextStyle(overflow: TextOverflow.ellipsis), - ), - Text( - Characters(widget.source.type.toLocalizedString()) - .replaceAll(Characters(''), Characters('\u{200B}')) - .toString(), - maxLines: 1, - style: const TextStyle( - overflow: TextOverflow.ellipsis, - fontSize: 10.0, + return ReorderableDragStartListener( + index: widget.sourceIndex, + child: Card( + color: Constants.secondary, + margin: const EdgeInsets.only(bottom: Constants.spacingSmall), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Padding( + padding: const EdgeInsets.all(Constants.spacingMiddle), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + Characters(widget.source.title) + .replaceAll( + Characters(''), + Characters('\u{200B}'), + ) + .toString(), + maxLines: 1, + style: const TextStyle( + overflow: TextOverflow.ellipsis, + ), ), - ), - ], + Text( + Characters(widget.source.type.toLocalizedString()) + .replaceAll( + Characters(''), + Characters('\u{200B}'), + ) + .toString(), + maxLines: 1, + style: const TextStyle( + overflow: TextOverflow.ellipsis, + fontSize: 10.0, + ), + ), + ], + ), ), - ), - IconButton( - onPressed: () => _showDeleteDialog(), - icon: - _isLoading - ? const ElevatedButtonProgressIndicator() - : const Icon(Icons.delete), - ), - ReorderableDragStartListener( - index: widget.sourceIndex, - child: Icon(Icons.drag_handle), - ), - ], + IconButton( + onPressed: () => _showDeleteDialog(), + icon: + _isLoading + ? const ElevatedButtonProgressIndicator() + : const Icon(Icons.delete), + ), + ], + ), ), - ), - ], + ], + ), ), ); }