diff --git a/lib/check_list.dart b/lib/check_list.dart index 2f28ecc..05c29a0 100644 --- a/lib/check_list.dart +++ b/lib/check_list.dart @@ -63,6 +63,13 @@ class _CheckList extends State { 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 { 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 {