Untitled

mail@pastecode.io avatar
unknown
dart
2 years ago
1.5 kB
1
Indexable
Never
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:iketfaa_delivery/App/Common/Utilities/Constants/AppColors.dart';
import 'package:iketfaa_delivery/App/Common/Widgets/Background.dart';
import 'package:iketfaa_delivery/App/Delivery/Utilities/Widgets/primary_app_bar.dart';

class OpenSingleImageFromURL extends StatelessWidget {
  final String imageURL;
  final bool? edit;
  final VoidCallback? editFunction;
  OpenSingleImageFromURL(
      {required this.imageURL, this.edit, this.editFunction});

  @override
  Widget build(BuildContext context) {
    return Dismissible(
      key: const Key('key'),
      onDismissed: (_) => Get.back(),
      direction: DismissDirection.vertical,
      child: Background(
        child: Scaffold(
          appBar: PrimaryAppBar(
            title: 'View Image'.tr,
            function: edit == true
                ? editFunction!
                : () {
                    Get.back();
                  },
            icon: edit == true ? 'assets/svg/greenEdit.svg' : null,
          ),
          backgroundColor: AppColors.white,
          body: Stack(
            children: [
              Center(
                child: Hero(
                  tag: 'imageHero',
                  child: Image.network(
                    imageURL,
                    fit: BoxFit.contain,
                    width: Get.width,
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}