file_system_management 0.2.0 copy "file_system_management: ^0.2.0" to clipboard
file_system_management: ^0.2.0 copied to clipboard

discontinued

A Flutter package for managing file download and upload tasks with progress tracking, customizable handlers, and social media-inspired UI widgets.

example/lib/main.dart

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

import 'screens/chat_demo_screen.dart';
import 'screens/settings_screen.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize directories
  await AppDirectory.init();

  // Initialize the file system controller
  await FileSystemController.instance.initialize();

  runApp(const ExampleApp());
}

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

  @override
  State<ExampleApp> createState() => _ExampleAppState();
}

class _ExampleAppState extends State<ExampleApp> {
  SocialSkin _currentSkin = SocialSkin.whatsapp;
  ThemeMode _themeMode = ThemeMode.light;
  bool _isRtl = true;

  void _onSkinChanged(SocialSkin skin) {
    setState(() => _currentSkin = skin);
  }

  void _onThemeModeChanged(ThemeMode mode) {
    setState(() => _themeMode = mode);
  }

  void _onRtlChanged(bool isRtl) {
    setState(() => _isRtl = isRtl);
  }

  SocialTransferThemeData _getThemeData({bool? isDark}) {
    isDark ??= _themeMode == ThemeMode.dark;

    return switch (_currentSkin) {
      SocialSkin.whatsapp => SocialTransferThemeData.whatsapp(isDark: isDark),
      SocialSkin.telegram => SocialTransferThemeData.telegram(isDark: isDark),
      SocialSkin.instagram => SocialTransferThemeData.instagram(isDark: isDark),
      SocialSkin.custom => SocialTransferThemeData.of(context),
    };
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'File System Management Demo',
      debugShowCheckedModeBanner: false,
      themeMode: _themeMode,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: _getSeedColor()),
        useMaterial3: true,
        extensions: [_getThemeData(isDark: false)],
      ),
      darkTheme: ThemeData(
        colorScheme: ColorScheme.fromSeed(
          seedColor: _getSeedColor(),
          brightness: Brightness.dark,
        ),
        useMaterial3: true,
        extensions: [_getThemeData(isDark: true)],
      ),
      locale: _isRtl ? const Locale('ar') : const Locale('en'),
      builder: (context, child) {
        return Directionality(
          textDirection: _isRtl ? TextDirection.rtl : TextDirection.ltr,
          child: child!,
        );
      },
      home: MainScreen(
        currentSkin: _currentSkin,
        themeMode: _themeMode,
        isRtl: _isRtl,
        onSkinChanged: _onSkinChanged,
        onThemeModeChanged: _onThemeModeChanged,
        onRtlChanged: _onRtlChanged,
      ),
    );
  }

  Color _getSeedColor() {
    return switch (_currentSkin) {
      SocialSkin.whatsapp => const Color(0xFF00A884),
      SocialSkin.telegram => const Color(0xFF3390EC),
      SocialSkin.instagram => const Color(0xFFE1306C),
      SocialSkin.custom => Colors.blue,
    };
  }
}

class MainScreen extends StatefulWidget {
  final SocialSkin currentSkin;
  final ThemeMode themeMode;
  final bool isRtl;
  final ValueChanged<SocialSkin> onSkinChanged;
  final ValueChanged<ThemeMode> onThemeModeChanged;
  final ValueChanged<bool> onRtlChanged;

  const MainScreen({
    super.key,
    required this.currentSkin,
    required this.themeMode,
    required this.isRtl,
    required this.onSkinChanged,
    required this.onThemeModeChanged,
    required this.onRtlChanged,
  });

  @override
  State<MainScreen> createState() => _MainScreenState();
}

class _MainScreenState extends State<MainScreen> {
  int _selectedIndex = 0;

  @override
  Widget build(BuildContext context) {
    final screens = [
      ChatDemoScreen(currentSkin: widget.currentSkin),
      SettingsScreen(
        currentSkin: widget.currentSkin,
        themeMode: widget.themeMode,
        isRtl: widget.isRtl,
        onSkinChanged: widget.onSkinChanged,
        onThemeModeChanged: widget.onThemeModeChanged,
        onRtlChanged: widget.onRtlChanged,
      ),
    ];

    return Scaffold(
      body: screens[_selectedIndex],
      bottomNavigationBar: NavigationBar(
        selectedIndex: _selectedIndex,
        onDestinationSelected: (index) {
          setState(() => _selectedIndex = index);
        },
        destinations: const [
          NavigationDestination(
            icon: Icon(Icons.chat_outlined),
            selectedIcon: Icon(Icons.chat),
            label: 'المحادثات',
          ),
          NavigationDestination(
            icon: Icon(Icons.settings_outlined),
            selectedIcon: Icon(Icons.settings),
            label: 'الإعدادات',
          ),
        ],
      ),
    );
  }
}
1
likes
0
points
40
downloads

Documentation

Documentation

Publisher

unverified uploader

Weekly Downloads

A Flutter package for managing file download and upload tasks with progress tracking, customizable handlers, and social media-inspired UI widgets.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

background_downloader, cached_network_image, collection, crypto, dashed_circular_progress_bar, flutter, path, path_provider

More

Packages that depend on file_system_management