updated locking icons and functionality

This commit is contained in:
andrei 2021-11-03 18:07:00 -04:00
parent 055fb7241d
commit aac93df46b
2 changed files with 21 additions and 8 deletions

View File

@ -20,6 +20,7 @@ class BoxChecker extends StatelessWidget {
cardColor: Colors.grey[800],
scaffoldBackgroundColor: Colors.black12,
shadowColor: Colors.black38,
toggleableActiveColor: Colors.blue,
colorScheme: ColorScheme.fromSwatch(
primarySwatch: Colors.blue,
),

View File

@ -56,13 +56,19 @@ class _CheckList extends State<CheckList> {
return Scaffold(
appBar: AppBar(
title: Text((listData != null) ? listData!.name : 'Check List: $id'),
actions: [
(listData != null && listData!.isTemplate! && !_editable)
? IconButton(
onPressed: () => _toggleEditable(), icon: Icon(Icons.edit))
: IconButton(
onPressed: () => _toggleEditable(), icon: Icon(Icons.save)),
],
actions: (listData != null && listData!.isTemplate! && !_editable)
? [
IconButton(
onPressed: () => _toggleEditable(),
icon: const Icon(Icons.lock))
]
: (listData != null && listData!.isTemplate!)
? [
IconButton(
onPressed: () => _toggleEditable(),
icon: const Icon(Icons.lock_open))
]
: [],
),
body: ListView.builder(
itemCount: list.length,
@ -87,9 +93,15 @@ class _CheckList extends State<CheckList> {
),
floatingActionButton: FloatingActionButton(
onPressed: () {
if (listData!.isTemplate! && !_editable) {
ScaffoldMessenger.of(context)
..clearSnackBars()
..showSnackBar(SnackBar(content: Text("Template is locked")));
return;
}
// TODO implment adding items to lists
},
child: const Icon(Icons.check_box),
child: const Icon(Icons.check_box_outlined),
tooltip: "Add Item",
),
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,