refactored lock button
This commit is contained in:
parent
a613292095
commit
d6dbe5234e
|
|
@ -63,6 +63,13 @@ class _CheckList extends State<CheckList> {
|
|||
super.initState();
|
||||
}
|
||||
|
||||
Widget iconButton() {
|
||||
return IconButton(
|
||||
onPressed: () => _toggleEditable(),
|
||||
icon: Icon(_editable ? Icons.lock_open : Icons.lock),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
|
|
@ -70,19 +77,8 @@ class _CheckList extends State<CheckList> {
|
|||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text((listData != null) ? listData!.name : 'Check List: $id'),
|
||||
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))
|
||||
]
|
||||
: [],
|
||||
actions:
|
||||
(listData != null && listData!.isTemplate!) ? [iconButton()] : [],
|
||||
),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
|
|
|
|||
Loading…
Reference in New Issue