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.
example/lib/main.dart
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) {
// Example data
const imageUrl = "https://example.com/web/image/res.users/1/image_128";
const sessionId = "your_session_id_here";
const accessToken = "your_access_token_here";
const avatarToken = "your_odoo19_avatar_token_here";
return Scaffold(
appBar: AppBar(
title: const Text("Odoo Profile Image Example"),
centerTitle: true,
),
body: Padding(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text("Odoo 17 / 18 Profile Image"),
const SizedBox(height: 8),
OdooProfileImage(
imageUrl: imageUrl,
sessionId: sessionId,
accessToken: accessToken,
size: 160, // default 160pt
borderColor: Colors.blue,
iconColor: Colors.red,
),
const SizedBox(height: 40),
const Text("Odoo 19 Profile Image"),
const SizedBox(height: 8),
Odoo19ProfileImage(
imageUrl: imageUrl,
sessionId: sessionId,
avatarToken: avatarToken,
radius: 80, // 80 radius → 160pt diameter
),
],
),
),
);
}
}