Rearranged settings screen files

This commit is contained in:
Vadim 2023-02-19 19:19:56 +03:00
parent c48f2ae373
commit 59287d06bc
27 changed files with 103 additions and 48 deletions

View file

@ -0,0 +1,25 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart';
import 'components/report_issue/widget_list_tile_report_issue.dart';
import 'components/source_code/widget_list_tile_source_code.dart';
import 'components/version/widget_list_tile_version.dart';
import 'components/write_email/widget_list_tile_write_email.dart';
class AboutSettingsSection extends StatelessWidget {
const AboutSettingsSection({super.key});
@override
Widget build(BuildContext context) {
return SettingsSection(
title: S.of(context).about,
children: const [
SourceCodeListTile(),
ReportIssueListTile(),
WriteEmailListTile(),
VersionListTile(),
],
);
}
}

View file

@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart';
import 'components/caffeine/provider_list_tile_caffeine.dart';
import 'components/haptics/provider_list_tile_haptics.dart';
import 'components/language/widget_list_tile_language.dart';
class GeneralSettingsSection extends StatelessWidget {
const GeneralSettingsSection({super.key});
@override
Widget build(BuildContext context) {
return SettingsSection(
title: S.of(context).general,
children: const [
CaffeineListTileProvider(),
HapticsListTileProvider(),
LanguageListTile(),
],
);
}
}

View file

@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart';
import 'components/calibration/widget_list_tile_calibration.dart';
import 'components/fractional_stops/widget_list_tile_fractional_stops.dart';
class MeteringSettingsSection extends StatelessWidget {
const MeteringSettingsSection({super.key});
@override
Widget build(BuildContext context) {
return SettingsSection(
title: S.of(context).metering,
children: const [
StopTypeListTile(),
CalibrationListTile(),
],
);
}
}

View file

@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/models/dynamic_colors_state.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart';
import 'components/dynamic_color/widget_list_tile_dynamic_color.dart';
import 'components/primary_color/widget_list_tile_primary_color.dart';
import 'components/theme_type/widget_list_tile_theme_type.dart';
class ThemeSettingsSection extends StatelessWidget {
const ThemeSettingsSection({super.key});
@override
Widget build(BuildContext context) {
return SettingsSection(
title: S.of(context).theme,
children: [
const ThemeTypeListTile(),
const PrimaryColorListTile(),
if (context.read<DynamicColorState>() != DynamicColorState.unavailable)
const DynamicColorListTile(),
],
);
}
}

View file

@ -1,22 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/dynamic_colors_state.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/res/dimens.dart';
import 'package:provider/provider.dart';
import 'components/caffeine/provider_list_tile_caffeine.dart'; import 'components/about/widget_settings_section_about.dart';
import 'components/calibration/widget_list_tile_calibration.dart'; import 'components/general/widget_settings_section_general.dart';
import 'components/haptics/provider_list_tile_haptics.dart'; import 'components/metering/widget_settings_section_metering.dart';
import 'components/language/widget_list_tile_language.dart'; import 'components/theme/widget_settings_section_theme.dart';
import 'components/primary_color/widget_list_tile_primary_color.dart';
import 'components/report_issue/widget_list_tile_report_issue.dart';
import 'components/shared/settings_section/widget_settings_section.dart';
import 'components/source_code/widget_list_tile_source_code.dart';
import 'components/dynamic_color/widget_list_tile_dynamic_color.dart';
import 'components/theme_type/widget_list_tile_theme_type.dart';
import 'components/version/widget_list_tile_version.dart';
import 'components/fractional_stops/widget_list_tile_fractional_stops.dart';
import 'components/write_email/widget_list_tile_write_email.dart';
class SettingsScreen extends StatelessWidget { class SettingsScreen extends StatelessWidget {
const SettingsScreen({super.key}); const SettingsScreen({super.key});
@ -54,39 +43,10 @@ class SettingsScreen extends StatelessWidget {
SliverList( SliverList(
delegate: SliverChildListDelegate( delegate: SliverChildListDelegate(
<Widget>[ <Widget>[
SettingsSection( const MeteringSettingsSection(),
title: S.of(context).metering, const GeneralSettingsSection(),
children: const [ const ThemeSettingsSection(),
StopTypeListTile(), const AboutSettingsSection(),
CalibrationListTile(),
],
),
SettingsSection(
title: S.of(context).general,
children: const [
CaffeineListTileProvider(),
HapticsListTileProvider(),
LanguageListTile(),
],
),
SettingsSection(
title: S.of(context).theme,
children: [
const ThemeTypeListTile(),
const PrimaryColorListTile(),
if (context.read<DynamicColorState>() != DynamicColorState.unavailable)
const DynamicColorListTile(),
],
),
SettingsSection(
title: S.of(context).about,
children: const [
SourceCodeListTile(),
ReportIssueListTile(),
WriteEmailListTile(),
VersionListTile(),
],
),
SizedBox(height: MediaQuery.of(context).padding.bottom), SizedBox(height: MediaQuery.of(context).padding.bottom),
], ],
), ),