Untitled

mail@pastecode.io avatar
unknown
dart
a year ago
687 B
3
Indexable
import 'dart:io';

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

class SingleImageDialog extends StatelessWidget {
  final String path;

  const SingleImageDialog({super.key, required this.path});

  @override
  Widget build(BuildContext context) {
    return Dismissible(
      key: const Key('key'),
      onDismissed: (_) => Get.back(),
      direction: DismissDirection.vertical,
      child: Container(
        decoration: BoxDecoration(
          image: DecorationImage(
            image: path.contains('http') ? NetworkImage(path) : FileImage(File(path)) as ImageProvider,
            fit: BoxFit.fitWidth,
          ),
        ),
      ),
    );
  }
}