odoo_image_show 2.0.0
odoo_image_show: ^2.0.0 copied to clipboard
A Flutter package to display profile images from the Odoo API with progress indication, error handling, and customization.
π Updated README.md #
# odoo_image_show
`odoo_image_show` is a Flutter package designed to display profile images from Odoo APIs (v17, v18, v19).
It handles authentication (Bearer token or session_id), shows a progress indicator while loading, and displays a fallback icon if the image fails to load. You can also customize the image size, border color, and icon color.
---
## Features
- Fetch and display profile images from Odoo 17, 18, and 19.
- Supports authentication:
- Odoo 17/18 β Bearer `accessToken` (admin) or `sessionId` (portal)
- Odoo 19 β `avatarToken` priority, fallback to `sessionId`
- Displays a circular progress indicator while loading.
- Provides a fallback user icon if the image cannot be loaded.
- Customizable image size, border color, and fallback icon color.
- Easy integration into any Flutter project.
---
## Getting Started
Add the dependency in your `pubspec.yaml`:
```yaml
dependencies:
odoo_image_show:
Then run:
flutter pub get
Usage #
Odoo 17 / 18 (Admin / Portal) #
import 'package:flutter/material.dart';
import 'package:odoo_image_show/odoo_image_show.dart';
OdooProfileImage(
imageUrl: "https://example.com/web/image/res.users/1/image_128",
accessToken: "your_access_token", // optional for admin
sessionId: "your_session_id", // optional for portal
size: 160, // default 160pt
borderColor: Colors.blue,
iconColor: Colors.red,
)
Odoo 19 (avatar_token priority) #
Odoo19ProfileImage(
imageUrl: "https://example.com/web/image/res.users/1/image_128",
avatarToken: "your_avatar_token", // priority
sessionId: "your_session_id", // fallback
radius: 80, // 80 radius β 160pt diameter
)
Example App #
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: 'Odoo Image Show Demo',
theme: ThemeData(primarySwatch: Colors.blue),
home: const ProfilePage(),
);
}
}
class ProfilePage extends StatelessWidget {
const ProfilePage({super.key});
@override
Widget build(BuildContext context) {
const imageUrl = "https://example.com/web/image/res.users/1/image_128";
const accessToken = "your_access_token";
const sessionId = "your_session_id";
const avatarToken = "your_avatar_token";
return Scaffold(
appBar: AppBar(title: const Text("Odoo Profile Image Example")),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text("Odoo 17 / 18 Profile Image"),
const SizedBox(height: 8),
OdooProfileImage(
imageUrl: imageUrl,
accessToken: accessToken,
sessionId: sessionId,
size: 160,
),
const SizedBox(height: 40),
const Text("Odoo 19 Profile Image"),
const SizedBox(height: 8),
Odoo19ProfileImage(
imageUrl: imageUrl,
avatarToken: avatarToken,
sessionId: sessionId,
radius: 80,
),
],
),
),
);
}
}
Additional Information #
- Error Handling: If the image cannot be fetched, the widget displays a fallback icon.
- Progress Indicator: Shows the download progress for Odoo 17/18 images.
- Customization: Adjust image size, circular border color, and fallback icon color.
Contributing #
Contributions are welcome! Fork the repository, open issues, or submit pull requests.
License #
MIT License Β© 2026 Md. Rahul Reza
Author #
Md. Rahul Reza
- Website: rahulreza.com
- Contact: contact@rahulreza.com