fix wrong settings categories opening when multiple sections exist

This commit is contained in:
Henry Hiles 2026-07-22 15:37:50 -04:00
commit 80b938c0be
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -127,13 +127,13 @@ class SettingsPage extends ConsumerWidget {
), ),
...sections ...sections
.mapTo( .mapTo(
(categoryGroup, categories) => [ (section, categories) => [
SliverToBoxAdapter( SliverToBoxAdapter(
child: Padding( child: Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 16, horizontal: 16,
).copyWith(bottom: 4), ).copyWith(bottom: 4),
child: DividerText(categoryGroup), child: DividerText(section),
), ),
), ),
SliverM3ECardList( SliverM3ECardList(
@ -150,7 +150,14 @@ class SettingsPage extends ConsumerWidget {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
SettingsCategoryPage(index), SettingsCategoryPage(
sections
.values
.flattenedToList
.indexOf(
categories[index],
),
),
), ),
), ),
itemBuilder: (context, index) => ListTile( itemBuilder: (context, index) => ListTile(