demo_package_123 1.0.4 copy "demo_package_123: ^1.0.4" to clipboard
demo_package_123: ^1.0.4 copied to clipboard

Demo package for testing publishing package

Rhfiles #

Generic badge

Rhfiles is a Flutter package that provides a simple and easy-to-use file picker with a built-in UI. With Rhfiles, you can quickly integrate file selection functionality into your Flutter application and get a list of selected files. Rhfiles supports picking files from the device's file system, camera, gallery, and URL. RhUtils is there which has all the pick functionalities with compressor, cropper, etc.

Features #

  • Supports file picking from the device's file system, camera, gallery, and URL.
  • Provides a built-in UI for file selection.
  • Allows customization of UI elements.
  • File compressor for compressing image and video files with quality controls.
  • Image cropper for cropping of image files.

Installation #

Add the following line to your pubspec.yaml file:

dependencies:
  rhythm_files: ^1.0.0

Usage #

The Rhythm Files package provides a simple way to access and manage files on mobile devices. It includes features like picking files from the device storage, selecting files from the camera or gallery, and uploading files to a server.

To use the Rhythm Files package, you need to first import it in your Dart code using the following import statement:

import 'package:rhythm_files/rhythm_files.dart';

After importing the package, you can create an instance of the RhFiles class using the instance property:

final RhFiles rhFiles = RhFiles.instance;

This instance provides access to various methods of the package.

Picking Files #

To pick files from the device storage, you can use the pick method of the RhFiles instance. It takes several parameters like source, allowMultiple, fileType, and allowedExtensions to customize the file picking process. The method returns a list of File objects that you can use to access the selected files.

Here is an example of picking multiple JPG or PNG files from the device storage:

List<File?> pickedFiles = await rhFiles.pick(
  source: Source.file,
  allowMultiple: true,
  fileType: FileType.custom,
  allowedExtensions: ['jpg', 'png'],
);

Dashboard #

The dashboard method of the RhFiles instance creates a simple file picking UI that you can integrate into your app. The method takes a callback function onPick that is called when the user selects one or more files. The selected files are passed to the callback function as a list of File objects.

Here is an example of using the dashboard method to create a file picking UI:

rhFiles.dashboard(
  onPick: (list) {
    files = list;
    setState(() {});
  },
),
final RhUtils utils = RhUtils.instance;

This creates an instance of the RhUtils class that can be used to call its methods.

Image Cropper #

File? croppedImage = await utils.cropImage(
  imageFile: File('path/to/image.jpg'),
  context: context,
);

This method allows you to crop an image file. The method takes in two required parameters: imageFile, which is the image file to be cropped, and context, which is the build context. It returns the cropped image file as a File object.

File Compressor #

compressFile method compresses a file (image or video) by reducing its size without compromising its quality. It takes in one required parameter, file, which is the original file to be compressed. It returns the compressed file as a File object.

File? compressedFile = await RhUtils.instance.compressFile(
  file: originalFile, // an image or video
);

compressImage method compresses an image file by reducing its size without compromising its quality. It takes in three required parameters: image, which is the image file to be compressed, quality, which is an integer value representing the quality of the compressed image, and percentage, which is the percentage of the original image size that the compressed image should be.

It returns the compressed image file as a File object.

File? compressedFile = await RhUtils.instance.compressImage(image: imageFile, quality: 80, percentage: 50);

compressVideo method compresses a video file by reducing its size without compromising its quality.

It takes in several parameters: video, which is the video file to be compressed, videoQuality, which is an enum representing the quality of the compressed video, deleteOrigin, which is a boolean value indicating whether the original video should be deleted after compression, includeAudio, which is a boolean value indicating whether the audio of the video should be included in the compressed video, frameRate, which is an integer value representing the frame rate of the compressed video, and duration, which is an integer value representing the maximum duration of the compressed video. It returns the compressed video file as a File object.

File? compressedVideo = await RhUtils.instance.compressVideo(
  video: File('/path/to/video.mp4'),
  videoQuality: RhVideoQuality.MediumQuality,
  deleteOrigin: true,
  includeAudio: false,
  frameRate: 30,
  duration: 60,
);
1
likes
120
pub points
0%
popularity

Publisher

unverified uploader

Demo package for testing publishing package

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on demo_package_123