flutter_img 0.2.1+159 flutter_img: ^0.2.1+159 copied to clipboard
Just another flutter image widget that can handel asset and network png,jpg and svg
import 'package:flutter/material.dart';
import 'package:flutter_img/flutter_img.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'flutter_img',
home: MyHomePage(title: 'flutter_img'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView(
children: [
const Img(
'https://miro.medium.com/v2/resize:fit:4800/0*bDz2chibrm3B6QZE',
fit: BoxFit.fill,
height: 200,
width: 300,
blurHash: 'LGSF|mNH~U?G-oR+Rkt6^%xZD+Ip',
),
const Divider(),
const Img(
'https://raw.githubusercontent.com/shafi-org/portfolio/master/src/assets/flutter-svgrepo-com.svg',
width: 300,
height: 300,
),
const Divider(),
const Img(
'<svg width="317px" height="317px" viewBox="-30.5 0 317 317" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid"> <defs> <linearGradient x1="3.9517088%" y1="26.9930287%" x2="75.8970734%" y2="52.9192657%" id="linearGradient-1"> <stop stop-color="#000000" offset="0%"></stop> <stop stop-color="#000000" stop-opacity="0" offset="100%"></stop> </linearGradient> </defs> <g> <polygon fill="#47C5FB" points="157.665785 0.000549356223 0.000549356223 157.665785 48.8009614 206.466197 255.267708 0.000549356223"></polygon> <polygon fill="#47C5FB" points="156.567183 145.396793 72.1487107 229.815265 121.132608 279.530905 169.842925 230.820587 255.267818 145.396793"></polygon> <polygon fill="#00569E" points="121.133047 279.531124 158.214592 316.61267 255.267159 316.61267 169.842266 230.820807"></polygon> <polygon fill="#00B5F8" points="71.5995742 230.364072 120.401085 181.562561 169.842046 230.821136 121.132827 279.531454"></polygon> <polygon fill-opacity="0.8" fill="url(#linearGradient-1)" points="121.132827 279.531454 161.692896 266.072227 165.721875 234.941308"></polygon> </g> </svg>',
width: 300,
height: 300,
),
const Divider(),
const Img(
'assets/images/lockup_flutter_horizontal.png',
fit: BoxFit.fitWidth,
bgColor: Colors.red,
height: 100,
width: 200,
borderRadius: BorderRadius.all(Radius.circular(3)),
),
const Divider(),
Img(
'assets/images/lockup_flutter_horizontal.png',
fit: BoxFit.fitWidth,
border: Border.all(width: 2),
padding: const EdgeInsets.all(50),
height: 100,
width: 200,
borderRadius: const BorderRadius.all(Radius.circular(3)),
),
const Divider(),
const Img(
'assets/images/flutter-svgrepo-com.svg',
shape: BoxShape.circle,
bgColor: Colors.red,
width: 200,
height: 200,
colorFilter: ColorFilter.mode(
Colors.grey,
BlendMode.saturation,
),
),
const Img(
'https://miro.medium.com/v2/resize:fit:4800/0*bDz2chibrm3B6QZE',
fit: BoxFit.fill,
height: 200,
width: 300,
blurHash: 'LGSF|mNH~U?G-oR+Rkt6^%xZD+Ip',
),
const Divider(),
const Img(
'https://raw.githubusercontent.com/shafi-org/portfolio/master/src/assets/flutter-svgrepo-com.svg',
width: 300,
height: 300,
),
const Divider(),
const Img(
'<svg width="317px" height="317px" viewBox="-30.5 0 317 317" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid"> <defs> <linearGradient x1="3.9517088%" y1="26.9930287%" x2="75.8970734%" y2="52.9192657%" id="linearGradient-1"> <stop stop-color="#000000" offset="0%"></stop> <stop stop-color="#000000" stop-opacity="0" offset="100%"></stop> </linearGradient> </defs> <g> <polygon fill="#47C5FB" points="157.665785 0.000549356223 0.000549356223 157.665785 48.8009614 206.466197 255.267708 0.000549356223"></polygon> <polygon fill="#47C5FB" points="156.567183 145.396793 72.1487107 229.815265 121.132608 279.530905 169.842925 230.820587 255.267818 145.396793"></polygon> <polygon fill="#00569E" points="121.133047 279.531124 158.214592 316.61267 255.267159 316.61267 169.842266 230.820807"></polygon> <polygon fill="#00B5F8" points="71.5995742 230.364072 120.401085 181.562561 169.842046 230.821136 121.132827 279.531454"></polygon> <polygon fill-opacity="0.8" fill="url(#linearGradient-1)" points="121.132827 279.531454 161.692896 266.072227 165.721875 234.941308"></polygon> </g> </svg>',
width: 300,
height: 300,
),
const Divider(),
const Img(
'assets/images/lockup_flutter_horizontal.png',
fit: BoxFit.fitWidth,
bgColor: Colors.red,
height: 100,
width: 200,
borderRadius: BorderRadius.all(Radius.circular(3)),
),
const Divider(),
Img(
'assets/images/lockup_flutter_horizontal.png',
fit: BoxFit.fitWidth,
border: Border.all(width: 2),
padding: const EdgeInsets.all(50),
height: 100,
width: 200,
borderRadius: const BorderRadius.all(Radius.circular(3)),
),
const Divider(),
const Img(
'assets/images/flutter-svgrepo-com.svg',
shape: BoxShape.circle,
bgColor: Colors.red,
width: 200,
height: 200,
colorFilter: ColorFilter.mode(
Colors.grey,
BlendMode.saturation,
),
),
],
),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}