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], cardColor: Colors.grey[800],
scaffoldBackgroundColor: Colors.black12, scaffoldBackgroundColor: Colors.black12,
shadowColor: Colors.black38, shadowColor: Colors.black38,
toggleableActiveColor: Colors.blue,
colorScheme: ColorScheme.fromSwatch( colorScheme: ColorScheme.fromSwatch(
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
), ),

View File

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