|
|
|
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<AttachInsuranceCardImageDialog> {
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
|
|
|
String image;
|
|
|
|
File file;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return SimpleDialog(
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
TranslationBase.of(context).attachInsuraceImage,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Divider(),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(left: 8, right: 8),
|
|
|
|
child: Text(
|
|
|
|
widget.name,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 3,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
TranslationBase.of(context).fileNo + " " + widget.fileNo,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
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),
|
|
|
|
Text(
|
|
|
|
TranslationBase.of(context).selectAttachment.toUpperCase(),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12,
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Image.file(
|
|
|
|
file,
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
height: 250,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 25.0,
|
|
|
|
),
|
|
|
|
Divider(),
|
|
|
|
Row(
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: Container(
|
|
|
|
child: Center(
|
|
|
|
child: Text(
|
|
|
|
TranslationBase.of(context).cancel.toUpperCase(),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12,
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
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: Text(
|
|
|
|
TranslationBase.of(context).ok.toUpperCase(),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12,
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|