network_smart_image 0.0.2 copy "network_smart_image: ^0.0.2" to clipboard
network_smart_image: ^0.0.2 copied to clipboard

A smart network image widget for Flutter.

example/lib/main.dart

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

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

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

  static const imageUrl = 'https://picsum.photos/500/500';

  static const invalidUrl = 'https://invalid-image-url.jpg';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Smart Image Example',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Smart Image Example'),
        ),
        body: ListView(
          padding: const EdgeInsets.all(16),
          children: [
            const Text(
              'Default',
              style: TextStyle(
                fontSize: 18,
                fontWeight: FontWeight.bold,
              ),
            ),
            const SizedBox(height: 12),
            const SmartImage(
              imageUrl: imageUrl,
              width: 200,
              height: 200,
            ),
            const SizedBox(height: 30),
            const Text(
              'Border Radius',
              style: TextStyle(
                fontSize: 18,
                fontWeight: FontWeight.bold,
              ),
            ),
            const SizedBox(height: 12),
            SmartImage(
              imageUrl: imageUrl,
              width: 200,
              height: 200,
              borderRadius: BorderRadius.circular(20),
            ),
            const SizedBox(height: 30),
            const Text(
              'Custom Shimmer Colors',
              style: TextStyle(
                fontSize: 18,
                fontWeight: FontWeight.bold,
              ),
            ),
            const SizedBox(height: 12),
            SmartImage(
              imageUrl: imageUrl,
              width: 200,
              height: 200,
              shimmerBaseColor: Colors.blueGrey,
              shimmerHighlightColor: Colors.white,
            ),
            const SizedBox(height: 30),
            const Text(
              'BoxFit.contain',
              style: TextStyle(
                fontSize: 18,
                fontWeight: FontWeight.bold,
              ),
            ),
            const SizedBox(height: 12),
            Container(
              width: 250,
              height: 150,
              color: Colors.grey.shade200,
              child: const SmartImage(
                imageUrl: imageUrl,
                fit: BoxFit.contain,
              ),
            ),
            const SizedBox(height: 30),
            const Text(
              'Custom Placeholder',
              style: TextStyle(
                fontSize: 18,
                fontWeight: FontWeight.bold,
              ),
            ),
            const SizedBox(height: 12),
            SmartImage(
              imageUrl: imageUrl,
              width: 200,
              height: 200,
              placeholder: const Center(
                child: CircularProgressIndicator(),
              ),
            ),
            const SizedBox(height: 30),
            const Text(
              'Error Handling',
              style: TextStyle(
                fontSize: 18,
                fontWeight: FontWeight.bold,
              ),
            ),
            const SizedBox(height: 12),
            const SmartImage(
              imageUrl: invalidUrl,
              width: 200,
              height: 200,
            ),
            const SizedBox(height: 50),
          ],
        ),
      ),
    );
  }
}
0
likes
125
points
107
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A smart network image widget for Flutter.

Repository (GitHub)

License

unknown (license)

Dependencies

cached_network_image, flutter, shimmer

More

Packages that depend on network_smart_image