Skip to main content

recollect 2.1.12 copy "recollect: ^2.1.12" to clipboard
recollect: ^2.1.12 copied to clipboard

A complete toolkit for Windows development

example/lib/main.dart

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

void main() {
  runApp(const MainApp());
}

class MainApp extends StatefulWidget {
  const MainApp({super.key});

  @override
  State<MainApp> createState() => _MainAppState();
}

class _MainAppState extends State<MainApp> {
  bool bAutosave = false;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: AppTheme.dark(),
      themeMode: ThemeMode.dark,
      darkTheme: AppTheme.dark(),
      home: Scaffold(
        body: Center(
          child: SurfaceContainer(
            height: 200,
            width: 800,
            child: SettingsSection(
              section: 'Logging',
              settings: [
                ActionSwitch(
                  label: 'Autosave',
                  value: bAutosave,
                  gap: 14,
                  checkSize: 8,
                  style: ActionSwitchStyle.checkbox,
                  boxSize: 10,
                  enabled: true,
                  description:
                      'Should the active document save at a select interval during editing',
                  onChanged: (val) {
                    setState(() => bAutosave = val);
                  },
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

class SettingsSection extends StatelessWidget {
  final String section;
  final List<Widget> settings;

  const SettingsSection({
    super.key,
    required this.section,
    required this.settings,
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Row(
          mainAxisSize: MainAxisSize.max,
          children: [
            SizedBox(
              width: 30,
              child: Divider(color: AppTheme.border(context)),
            ),
            SizedBox(width: 15),
            Word.title(section),
            SizedBox(width: 15),
            Expanded(child: Divider(color: AppTheme.border(context))),
          ],
        ),
        const SizedBox(height: 5),
        ...settings,
      ],
    );
  }
}