From a53e2091bb3f6c209b734056bc823159edaf55e0 Mon Sep 17 00:00:00 2001 From: apoleon33 Date: Thu, 4 Jan 2024 22:14:27 +0100 Subject: [PATCH] 'view as list/card' icon not appearing in settings --- lib/route/home.dart | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/lib/route/home.dart b/lib/route/home.dart index cb854df..de2da95 100644 --- a/lib/route/home.dart +++ b/lib/route/home.dart @@ -73,30 +73,26 @@ class _MyHomePageState extends State { return Scaffold( appBar: AppBar( - // TRY THIS: Try changing the color here to a specific color (to - // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar - // change color while the other colors stay the same. backgroundColor: Theme.of(context).colorScheme.surface, - // Here we take the value from the MyHomePage object that was created by - // the App.build method, and use it to set our appbar title. title: Align( alignment: Alignment.centerLeft, child: Text( widget.title, style: const TextStyle(fontFamily: 'Cloister', fontSize: 24.0), )), - - actions: [ - IconButton( - onPressed: () { - setState(() { - isCard = !isCard; - }); - }, - icon: (!isCard) - ? const Icon(Icons.view_list) - : const Icon(Icons.grid_view)) - ], + actions: (indexPage == 0) + ? [ + IconButton( + onPressed: () { + setState(() { + isCard = !isCard; + }); + }, + icon: (!isCard) + ? const Icon(Icons.view_list) + : const Icon(Icons.grid_view)) + ] + : [], ), body: SingleChildScrollView( child: Column( @@ -104,7 +100,7 @@ class _MyHomePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ albumCards, - [Settings()] + [const Settings()] ][indexPage], ), ),