refactor(ui): Refactor SectionTitle

This commit is contained in:
Inex Code 2024-11-06 01:09:59 +03:00
parent 791e895dc7
commit f4d5bb84c7
2 changed files with 9 additions and 12 deletions

View file

@ -3,10 +3,12 @@ import 'package:flutter/material.dart';
class SectionTitle extends StatelessWidget {
const SectionTitle({
required this.title,
this.error = false,
super.key,
});
final String title;
final bool error;
@override
Widget build(final BuildContext context) => Padding(
@ -14,7 +16,9 @@ class SectionTitle extends StatelessWidget {
child: Text(
title,
style: Theme.of(context).textTheme.labelLarge!.copyWith(
color: Theme.of(context).colorScheme.secondary,
color: error
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.secondary,
),
),
);

View file

@ -1,11 +1,11 @@
import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:selfprivacy/config/app_controller/inherited_app_controller.dart';
import 'package:selfprivacy/config/localization.dart';
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
import 'package:selfprivacy/ui/components/buttons/dialog_action_button.dart';
import 'package:selfprivacy/ui/components/list_tiles/section_title.dart';
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
import 'package:selfprivacy/ui/router/router.dart';
@ -38,17 +38,10 @@ class _AppSettingsPageState extends State<AppSettingsPage> {
_LanguagePicker(
key: ValueKey('language_picker'.tr()),
),
const Gap(8),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
'application_settings.dangerous_settings'.tr(),
style: Theme.of(context).textTheme.labelLarge!.copyWith(
color: Theme.of(context).colorScheme.error,
),
),
SectionTitle(
title: 'application_settings.dangerous_settings'.tr(),
error: true,
),
const Gap(4),
_ResetAppTile(
key: ValueKey('reset_app'.tr()),
),