Delete button changed

This commit is contained in:
marcoabat
2023-08-07 23:06:17 +02:00
parent 42b902ca7d
commit fda0f759a6

View File

@@ -198,10 +198,6 @@ class _DetailChecklistPageState extends State<DetailChecklistPage> {
appBar: AppBar( appBar: AppBar(
title: _pageTitleBuilder, title: _pageTitleBuilder,
actions: [ actions: [
if (selectedItemIndexes.isNotEmpty && !_titleEditMode)
IconButton(
onPressed: _onDeleteItemsPressed,
icon: const Icon(Icons.delete)),
if (_titleEditMode) if (_titleEditMode)
IconButton( IconButton(
onPressed: () => _onTitleChanged( onPressed: () => _onTitleChanged(
@@ -220,10 +216,24 @@ class _DetailChecklistPageState extends State<DetailChecklistPage> {
future: _checklistFutures, future: _checklistFutures,
builder: _futureBuilder, builder: _futureBuilder,
), ),
floatingActionButton: FloatingActionButton( floatingActionButton: _fabBuilder,
);
}
FloatingActionButton? get _fabBuilder {
if (_titleEditMode) {
return null;
}
if (selectedItemIndexes.isEmpty) {
return FloatingActionButton(
onPressed: _addItemTapped, onPressed: _addItemTapped,
child: const Icon(Icons.add), 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),
); );
} }