WIP: Add settings page #46

Draft
Henry-Hiles wants to merge 11 commits from settings-page into main
Showing only changes of commit f0c3d4376f - Show all commits

add searchbar

Henry Hiles 2026-06-26 16:16:36 -04:00
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -46,64 +46,6 @@ class SettingsPage extends ConsumerWidget {
),
]),
),
.new(
title: "Appearance",
icon: Icons.brush,
settings: .new([
.new(
title: "Dark Mode",
description:
"Toggle between Light Mode, Dark Mode, and System themes.",
widget: DialogListTile<ThemeMode>(
icon: Icon(Icons.palette),
title: "Dark Mode",
initialValue: ThemeMode.system,
options: ThemeMode.values,
getName: (option) => toBeginningOfSentenceCase(option.name),
onChanged: (value) {},
),
),
.new(
title: "Use Client Side Decorations",
description:
"On desktop, toggle between client-side or server-side decorations",
widget: SwitchListTile(
title: Text("Client Side Decorations"),
value: true,
onChanged: (value) {},
),
),
]),
),
.new(
title: "Appearance",
icon: Icons.brush,
settings: .new([
.new(
title: "Dark Mode",
description:
"Toggle between Light Mode, Dark Mode, and System themes.",
widget: DialogListTile<ThemeMode>(
icon: Icon(Icons.palette),
title: "Dark Mode",
initialValue: ThemeMode.system,
options: ThemeMode.values,
getName: (option) => toBeginningOfSentenceCase(option.name),
onChanged: (value) {},
),
),
.new(
title: "Use Client Side Decorations",
description:
"On desktop, toggle between client-side or server-side decorations",
widget: SwitchListTile(
title: Text("Client Side Decorations"),
value: true,
onChanged: (value) {},
),
),
]),
),
]),
});
@ -115,33 +57,35 @@ class SettingsPage extends ConsumerWidget {
final selected = useState(0);
final settingsContent = Scaffold(
appBar: AppBar(
title: Text("Settings"),
actionsPadding: .symmetric(horizontal: 12),
actions: [
SearchAnchor(
builder: (_, controller) => IconButton(
icon: const Icon(Icons.search),
onPressed: controller.openView,
),
final searchBar = SearchAnchor.bar(
barHintText: "Search...",
suggestionsBuilder: (context, controller) {
// TODO
return [];
},
),
],
);
final settingsContent = Scaffold(
appBar: AppBar(
title: Text("Settings"),
actionsPadding: .symmetric(horizontal: 12),
),
body: categoriesArePages
? CustomScrollView(
slivers: settingsCategoryGroups
.mapTo(
(categoryGroup, categories) => [
SliverToBoxAdapter(
child: Padding(
padding: EdgeInsets.all(12).copyWith(bottom: 4),
child: searchBar,
),
),
SliverToBoxAdapter(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 16,
).copyWith(top: 8, bottom: 4),
).copyWith(bottom: 4),
child: DividerText(categoryGroup),
),
),
@ -175,6 +119,8 @@ class SettingsPage extends ConsumerWidget {
children: [
NavigationRailM3E(
type: .alwaysExpand,
trailing: searchBar,
scrollable: true,
sections: settingsCategoryGroups
.mapTo(
(categoryGroup, categories) =>