imagex_flutter 0.0.1 copy "imagex_flutter: ^0.0.1" to clipboard
imagex_flutter: ^0.0.1 copied to clipboard

A reusable Flutter image widget for asset, network, SVG, and file images.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:imagex_flutter/imagex_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'ImageX Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
        useMaterial3: true,
      ),
      home: const ImageXExample(),
    );
  }
}

class ImageXExample extends StatelessWidget {
  const ImageXExample({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('ImageX Example'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: const SingleChildScrollView(
        padding: EdgeInsets.all(16.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text(
              'Network Image',
              style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
            ),
            SizedBox(height: 8),
            ImageX(
              path:
                  'https://raw.githubusercontent.com/saurabhkumar-sk/imagex_flutter/main/example/assets/demo_image.png',
              height: 200,
              width: double.infinity,
              fit: BoxFit.cover,
              borderRadius: 12,
              useImageViewer: true,
            ),
            SizedBox(height: 24),
            Text(
              'SVG Image (Network)',
              style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
            ),
            SizedBox(height: 8),
            ImageX(
              path:
                  'https://raw.githubusercontent.com/dnfield/flutter_svg/7d374d7107561aa038166d1363666579df646091/example/assets/flutter_logo.svg',
              height: 100,
              width: 100,
            ),
            SizedBox(height: 24),
            Text(
              'Image with Viewer (Gallery)',
              style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
            ),
            SizedBox(height: 8),
            ImageX(
              path: 'https://picsum.photos/id/237/400/300',
              height: 200,
              width: double.infinity,
              fit: BoxFit.cover,
              borderRadius: 12,
              useImageViewer: true,
              imageList: [
                'https://picsum.photos/id/237/800/600',
                'https://picsum.photos/id/238/800/600',
                'https://picsum.photos/id/239/800/600',
              ],
            ),
            SizedBox(height: 24),
            Text(
              'Error Handling',
              style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
            ),
            SizedBox(height: 8),
            ImageX(
              path: 'https://invalid-url.com/image.png',
              height: 100,
              width: 100,
              borderRadius: 8,
            ),
            SizedBox(height: 40),
            Center(
              child: Text(
                'Note: Asset and File images require setup in pubspec.yaml and local files.',
                textAlign: TextAlign.center,
                style: TextStyle(color: Colors.grey),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
4
likes
0
points
163
downloads

Publisher

unverified uploader

Weekly Downloads

A reusable Flutter image widget for asset, network, SVG, and file images.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cached_network_image, flutter, flutter_svg

More

Packages that depend on imagex_flutter