Menu

Settings Feature

Relevant source files

The Settings Feature provides a user interface for customizing application preferences and viewing app information. This package primarily handles theme mode selection (light, dark, system) and displays application metadata such as version and license information.

Overview

The Settings Feature is implemented as a standalone feature module with its own UI components, localization resources, and navigation handling. It integrates with the core data layer for theme persistence and accesses build configuration information.

Architecture

Sources:

UI Structure

The Settings Feature implements a structured UI with theme selection options and application information.

Settings Page Layout

Sources:

Core Components

UI Components

The Settings Feature contains several specialized UI components:

  1. SettingPage: The main screen widget that composes the settings interface
  2. SettingSectionTitle: Component for displaying formatted section headers
  3. SettingSectionSpacer: Component for adding consistent spacing between sections

Sources:

The Settings Feature defines a navigation interface to handle screen transitions:

The SettingPageNavigator interface decouples navigation logic from the UI components, making the feature more testable and flexible. The implementation of this navigator is provided by the application that integrates the Settings Feature.

Sources:

Theme Selection Implementation

Theme Mode Selection Flow

The Settings Feature implements theme selection using the following components:

  1. Radio Buttons UI: The UI displays radio buttons for each available theme mode (system, light, dark)
  2. Theme Selection Handler: When a user selects a theme, the selection is processed and persisted
  3. Theme State Management: Theme state is managed via the themeModeNotifierProvider

The theme selection is implemented using RadioListTile widgets in a SliverList.builder:

Sources:

Theme Persistence

When a user selects a new theme, the following occurs:

  1. The onChanged callback is triggered with the selected theme mode
  2. The callback calls changeThemeMode on the themeModeNotifierProvider.notifier
  3. The theme mode selection is persisted via SharedPreferences
  4. The UI automatically updates to reflect the new theme

Sources:

About Section

The About section of the Settings page displays:

  1. Logo: The Yumemi company logo from the feature's assets
  2. Open Source Licenses: A list tile that navigates to the license page
  3. App Version: Displays the current app version from build configuration

Sources:

Localization

The Settings Feature includes built-in localization support through the generated L10n class, which provides translations for:

  • The app bar title
  • Section titles ("Theme Setting", "About")
  • Text for Open Source Licenses
  • Version label

All text displayed in the settings page is localized, making the feature ready for internationalization.

Sources:

Integration

To integrate the Settings Feature in an application:

  1. Provide an implementation of SettingPageNavigator through the settingPageNavigatorProvider
  2. Configure the route to the SettingPage in your application's routing system
  3. Ensure the themeModeNotifierProvider and buildConfigProvider are properly configured

The feature is designed to be loosely coupled with the rest of the application, making it easy to integrate and test independently.

Sources: