added settings sections

This commit is contained in:
Vadim 2023-01-23 20:36:40 +03:00
parent e42982f63b
commit d1d7e23cf9
3 changed files with 82 additions and 4 deletions

View file

@ -25,6 +25,7 @@
"themeDark": "Dark",
"themeSystemDefault": "System default",
"sourceCode": "Source code",
"about": "About",
"version": "Version: {version} ({buildNumber})",
"@version": {
"placeholders": {

View file

@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
class VersionListTile extends StatelessWidget {
const VersionListTile({super.key});
@override
Widget build(BuildContext context) {
return ListTile(
leading: const Icon(Icons.info_outline),
title: Text(S.of(context).version('', '')),
);
}
}

View file

@ -4,6 +4,7 @@ import 'package:lightmeter/res/dimens.dart';
import 'components/haptics/provider_list_tile_haptics.dart';
import 'components/source_code/widget_list_tile_source_code.dart';
import 'components/version/widget_list_tile_version.dart';
import 'components/widget_list_tile_fractional_stops.dart';
import 'components/theme/widget_settings_theme.dart';
import 'components/widget_label_version.dart';
@ -40,10 +41,31 @@ class SettingsScreen extends StatelessWidget {
SliverList(
delegate: SliverChildListDelegate(
[
const StopTypeListTile(),
const HapticsListTileProvider(),
const ThemeSettings(),
const SourceCodeListTile(),
_Section(
title: S.of(context).theme,
children: [
const StopTypeListTile(),
],
),
_Section(
title: S.of(context).theme,
children: [
const HapticsListTileProvider(),
],
),
_Section(
title: S.of(context).theme,
children: [
const ThemeSettings(),
],
),
_Section(
title: S.of(context).about,
children: [
const SourceCodeListTile(),
const VersionListTile(),
],
),
],
),
),
@ -60,3 +82,43 @@ class SettingsScreen extends StatelessWidget {
);
}
}
class _Section extends StatelessWidget {
final String title;
final List<Widget> children;
const _Section({required this.title, required this.children});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(
Dimens.paddingM,
0,
Dimens.paddingM,
Dimens.paddingM,
),
child: Material(
borderRadius: BorderRadius.circular(Dimens.borderRadiusL),
color: Theme.of(context).colorScheme.primaryContainer,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: Dimens.paddingM),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.only(left: Dimens.paddingM),
child: Text(
title,
style: Theme.of(context).textTheme.labelLarge,
),
),
...children,
],
),
),
),
);
}
}