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), ); }