bytes_image_viewer 0.0.4 bytes_image_viewer: ^0.0.4 copied to clipboard
bytes_image_viewer, takes the url which returns the bytes as image. You can implement it with autherization factor.
import 'package:bytes_image_viewer/bytes_image_viewer.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const HomeScreen());
}
class HomeScreen extends StatefulWidget {
const HomeScreen({Key? key}) : super(key: key);
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: const Center(
child: BytesImageViewer(
height: 100, //optional
width: 100, //optional
fit: BoxFit.cover, //optional
apiUrl:
'https://cdn.pixabay.com/photo/2023/11/26/19/09/butterfly-8414148_1280.jpg',
headers: {"Authorization": "Bearer yTiIsInN1YiI6IjEiLC"}, //optional
loadingWidget: CircularProgressIndicator(
color: Colors.red,
), //optional
errorWidget: CircularProgressIndicator(
color: Colors.red,
), //optional
)),
appBar: AppBar(
title: const Text("Bytes image viewer example"),
),
);
}
}