import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import '../../../../state/app/modules/settings/bloc/settings_cubit.dart';
import '../widgets/settings_checkbox_tile.dart';

class FilesSection extends StatelessWidget {
  const FilesSection({super.key});

  @override
  Widget build(BuildContext context) {
    final settings = context.watch<SettingsCubit>();
    return Column(
      children: [
        SettingsCheckboxTile(
          icon: Icons.drive_folder_upload_outlined,
          title: 'Ordner in Dateien nach oben sortieren',
          value: settings.val().fileSettings.sortFoldersToTop,
          onChanged: (e) =>
              settings.val(write: true).fileSettings.sortFoldersToTop = e,
        ),
        SettingsCheckboxTile(
          icon: Icons.open_in_new_outlined,
          title: 'Dateien immer mit Systemdialog öffnen',
          value: settings.val().fileViewSettings.alwaysOpenExternally,
          onChanged: (e) =>
              settings.val(write: true).fileViewSettings.alwaysOpenExternally =
                  e,
        ),
      ],
    );
  }
}
