x_storage_flutter

A package that provides Flutter widgets and services for XStorage. It includes Flutter-specific features such as image display widgets and audio playback services.

Features

  • XStorageImage: A widget that displays images from XStorage URIs
  • XStorageAudioService: A service that plays audio from XStorage URIs

Getting Started

Installation

dependencies:
  x_storage_flutter: ^0.0.1
  x_storage_core: ^0.0.1

Image Display

import 'package:x_storage_flutter/x_storage_flutter.dart';
import 'package:x_storage_core/x_storage_core.dart';

// Create and configure XStorage instance
final storage = XStorage();
// Register drivers...

// Display an image
XStorageImage(
  uri: XUri.create('my_storage', 'path/to/image.jpg'),
  xStorage: storage,
  width: 200,
  height: 200,
  fit: BoxFit.cover,
)

Audio Playback

import 'package:x_storage_flutter/x_storage_flutter.dart';
import 'package:x_storage_core/x_storage_core.dart';

// Create and configure XStorage instance
final storage = XStorage();
// Register drivers...

// Create audio service
final audioService = XStorageAudioService(storage);

// Play audio
await audioService.play(
  XUri.create('my_storage', 'path/to/audio.mp3'),
);

// Stop playback
await audioService.stop();

Important Notes

  • XStorageImage automatically detects the storage type and displays images accordingly
  • XStorageAudioService currently only supports network-based storage
  • Consider implementing appropriate caching and redraw timing based on your use case

License

This project is licensed under the MIT License - see the LICENSE file for details.

Libraries

x_storage_flutter