passo_mobile_app/lib/screens/profile/shared/multiple_attachment.dart

151 lines
6.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:fluttericon/entypo_icons.dart';
import '../../../model/profile/attachment.dart';
import '../../../theme-data.dart/box_shadow.dart';
import '../../../theme-data.dart/colors.dart';
import '../../../utils/global.dart';
class MultipleAttachments extends StatelessWidget {
final List<Attachment> attachments;
final String eligibilityName;
const MultipleAttachments({
super.key,
required this.attachments,
required this.eligibilityName
});
@override
Widget build(BuildContext context) {
return Row(
children: [
Flexible(
flex:
2,
child: Container(
padding: const EdgeInsets.all(5),
decoration: box1().copyWith(color: Colors.grey.shade300, boxShadow: []),
child: Text(
attachments.first.filename!,
overflow: TextOverflow.ellipsis,
))),
const SizedBox(
width:
8,
),
Flexible(
child:
FittedBox(
child:
Container(
padding:
const EdgeInsets.all(3),
decoration:
box1().copyWith(color: Colors.grey.shade300, boxShadow: []),
child:
InkWell(
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("$eligibilityName Attachments",textAlign: TextAlign.center,),
content: Column(
mainAxisSize: MainAxisSize.min,
children: attachments.map((e) {
String ext = e.filename!.substring(e.filename!.lastIndexOf("."));
return Column(
children: [
Row(
children: [
Flexible(
child: SizedBox(
child: ext == '.pdf'
? SvgPicture.asset(
'assets/svgs/pdf.svg',
height: blockSizeVertical * 5,
allowDrawingOutsideViewBox: true,
)
: ext == '.png'
? SvgPicture.asset(
'assets/svgs/png.svg',
height: blockSizeVertical * 5.5,
allowDrawingOutsideViewBox: true,
)
: ext == '.jpg'
? SvgPicture.asset(
'assets/svgs/jpg.svg',
height: blockSizeVertical * 5,
allowDrawingOutsideViewBox: true,
)
: SvgPicture.asset(
'assets/svgs/jpg.svg',
height: blockSizeVertical * 5,
allowDrawingOutsideViewBox: true,
),
),
),
const SizedBox(width: 8,),
Flexible(
flex: 4,
child: Tooltip(
message: e.filename,
child: Text(
e.filename!,
overflow: TextOverflow.ellipsis,
)),
),
const SizedBox(width: 8,),
Flexible(
child: Row(
children: [
Flexible(
child: IconButton(
icon: const Icon(
Entypo.right_open_mini,
color: Colors.black87,
),
onPressed: () {},
),
),
const SizedBox(width: 8,),
Flexible(
child: IconButton(
icon: const Icon(
Icons.delete,
color: primary,
),
onPressed: () {},
),
),
],
),
),
],
),
const Divider()
],
);
}).toList(),
));
});
},
child: Row(
children: const [
Text(" See more.."),
Icon(
Icons.keyboard_arrow_right,
color: Colors.black54,
),
],
),
),
),
)),
],
);
}
}