Vaani/lib/features/settings/view/simple_settings_page.dart

70 lines
2.4 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:flutter_settings_ui/flutter_settings_ui.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
class SimpleSettingsPage extends HookConsumerWidget {
const SimpleSettingsPage({
super.key,
this.title,
this.sections,
});
final Widget? title;
final List<AbstractSettingsSection>? sections;
@override
Widget build(BuildContext context, WidgetRef ref) {
2026-01-08 17:49:30 +08:00
final colorScheme = Theme.of(context).colorScheme;
return Scaffold(
2026-01-08 17:49:30 +08:00
appBar: AppBar(
title: title,
),
// body: body,
// an app bar which is bigger than the default app bar but on scroll shrinks to the default app bar with the title being animated
body: CustomScrollView(
slivers: [
2026-01-08 17:49:30 +08:00
// SliverAppBar(
// expandedHeight: 100.0,
// floating: false,
// pinned: true,
// flexibleSpace: FlexibleSpaceBar(
// title: title,
// // background: Theme.of(context).primaryColor,
// ),
// ),
if (sections != null)
SliverList(
delegate: SliverChildListDelegate(
[
ClipRRect(
2026-01-08 17:49:30 +08:00
// borderRadius: const BorderRadius.all(Radius.circular(20)),
child: SettingsList(
2026-01-08 17:49:30 +08:00
lightTheme: SettingsThemeData(
settingsListBackground: colorScheme.surface,
settingsSectionBackground: colorScheme.surfaceContainer,
// inactiveTitleColor:
// trailingTextColor: colorScheme.primary,
// settingsTileTextColor:
),
darkTheme: SettingsThemeData(
settingsListBackground: colorScheme.surface,
settingsSectionBackground: colorScheme.surfaceContainer,
),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
sections: sections!,
),
),
],
),
),
// some padding at the bottom
2026-01-08 17:49:30 +08:00
// const SliverPadding(padding: EdgeInsets.only(bottom: 20)),
2026-01-06 17:57:51 +08:00
// SliverToBoxAdapter(child: MiniPlayerBottomPadding()),
],
),
);
}
}