odoo_image_show 0.0.5
odoo_image_show: ^0.0.5 copied to clipboard
A Flutter package to display profile images from the Odoo API with progress indication, error handling, and customization.
# odoo_image_show
`odoo_image_show` is a Flutter package designed to display profile images by fetching them from a URL. It shows a progress indicator while loading the image and displays an error icon if the image fails to load. The package also provides customization options such as image size, border color, and icon color.
## Features
- Fetches and displays profile images directly from a URL.
- Displays a progress bar with percentage as the image is loaded.
- Provides a fallback icon (user icon) in case of error or empty image.
- Allows customization of the image's size, border color, and icon color.
- Easy to integrate into Flutter projects with minimal setup.
## Getting Started
To get started with `odoo_image_show`, you need to add it as a dependency in your Flutter project:
1. Add the following dependency to your `pubspec.yaml` file:
```yaml
dependencies:
odoo_image_show:
Run flutter pub get
to install the package.
flutter pub get
Usage #
Hereβs how to use the ProfileImageShowWidget
to display a profile image:
-
Import the package:
import 'package:odoo_image_show/odoo_image_show.dart';
-
Use the widget in your app:
ProfileImageShowWidget( imageUrl: "https://example.com/profile-image.jpg", // URL of the image sessionId: "your_session_id", // Your session ID accessToken: "your_access_token", // Your access token size: 80, // Optional: Size of the image (default is 80) iconColor: Colors.red, // Optional: Color for the fallback icon borderColor: Colors.green, // Optional: Border color for the image )
-
Example:
import 'package:flutter/material.dart'; import 'package:odoo_image_show/odoo_image_show.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Oddo Image Show Demo', theme: ThemeData(primarySwatch: Colors.blue), home: const ProfilePage(), ); } } class ProfilePage extends StatelessWidget { const ProfilePage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text("Profile Image Example")), body: Center( child: ProfileImageShowWidget( imageUrl: "https://example.com/profile-image.jpg", sessionId: "your_session_id", accessToken: "your_access_token", ), ), ); } }
Additional Information #
-
Error Handling: If the image cannot be fetched, the widget displays an error message via a
SnackBar
and shows a fallback icon instead of the image. -
Customization: You can adjust the size of the image, the color of the fallback icon, and the border color around the image to suit your needs.
-
Contributing: Contributions are welcome! Please feel free to fork the repository, open issues, and submit pull requests.
-
License: This package is open-source and available under the MIT License.
π¨βπ» Author #
Md. Rahul Reza
- Website: rahulreza.com
- Contact: contact@rahulreza.com