From fda0f759a6fc73f92915869b939ad7c669af8f80 Mon Sep 17 00:00:00 2001 From: marcoabat Date: Mon, 7 Aug 2023 23:06:17 +0200 Subject: [PATCH] Delete button changed --- lib/pages/detail_checklist_page.dart | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/pages/detail_checklist_page.dart b/lib/pages/detail_checklist_page.dart index 22fc0c6..9abf21e 100644 --- a/lib/pages/detail_checklist_page.dart +++ b/lib/pages/detail_checklist_page.dart @@ -198,10 +198,6 @@ class _DetailChecklistPageState extends State { appBar: AppBar( title: _pageTitleBuilder, actions: [ - if (selectedItemIndexes.isNotEmpty && !_titleEditMode) - IconButton( - onPressed: _onDeleteItemsPressed, - icon: const Icon(Icons.delete)), if (_titleEditMode) IconButton( onPressed: () => _onTitleChanged( @@ -220,10 +216,24 @@ class _DetailChecklistPageState extends State { future: _checklistFutures, builder: _futureBuilder, ), - floatingActionButton: FloatingActionButton( + floatingActionButton: _fabBuilder, + ); + } + + FloatingActionButton? get _fabBuilder { + if (_titleEditMode) { + return null; + } + if (selectedItemIndexes.isEmpty) { + return FloatingActionButton( onPressed: _addItemTapped, child: const Icon(Icons.add), - ), + ); + } + return FloatingActionButton( + onPressed: _onDeleteItemsPressed, + backgroundColor: Theme.of(context).colorScheme.error, + child: Icon(Icons.delete, color: Theme.of(context).colorScheme.onError), ); }