import 'dart:io'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class AttachInsuranceCardImageDialog extends StatefulWidget { final String name; final String fileNo; final Function(File file, String image) image; const AttachInsuranceCardImageDialog( {Key key, this.name, this.fileNo, this.image}) : super(key: key); @override _AttachInsuranceCardImageDialogState createState() => _AttachInsuranceCardImageDialogState(); } class _AttachInsuranceCardImageDialogState extends State { @override void initState() { super.initState(); } String image; File file; @override Widget build(BuildContext context) { return SimpleDialog( children: [ Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Texts(TranslationBase.of(context).attachInsuraceImage), Divider(), Texts(widget.name), SizedBox( height: 3, ), Texts(TranslationBase.of(context).fileNo + " " + widget.fileNo), SizedBox( height: 5.0, ), InkWell( onTap: () { ImageOptions.showImageOptions(context, (String image,File file) { setState(() { this.image = image; this.file = file; }); }); }, child: image == null ? Padding( padding: const EdgeInsets.all(18.0), child: Container( width: double.maxFinite, height: 250, decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), border: Border.all(color: Colors.grey, width: 1.5)), child: Column( crossAxisAlignment: CrossAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment., children: [ SizedBox(height: 25,), Icon( Icons.camera_enhance_rounded, size: 85, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(Icons.attach_file), Texts(TranslationBase.of(context).selectAttachment.toUpperCase()) ], ), ], ), ), ) : Image.file( file, fit: BoxFit.fill, height: 250, ), ), SizedBox( height: 25.0, ), Divider(), Row( children: [ Expanded( flex: 1, child: InkWell( onTap: () { Navigator.pop(context); }, child: Padding( padding: const EdgeInsets.all(8.0), child: Container( child: Center( child: Texts( TranslationBase.of(context).cancel.toUpperCase(), color: Colors.red, ), ), ), ), ), ), Container( width: 1, height: 30, color: Colors.grey[500], ), Expanded( flex: 1, child: InkWell( onTap: () { Navigator.pop(context); widget.image(file, image); }, child: Padding( padding: const EdgeInsets.all(8.0), child: Center( child: Texts( TranslationBase.of(context).ok, fontWeight: FontWeight.w400, )), ), ), ), ], ) ], ) ], ); } }