@ -17,280 +17,6 @@ import 'package:test_sa/new_views/app_style/app_color.dart';
import ' ../../../new_views/common_widgets/app_dashed_button.dart ' ;
import ' ../../../new_views/common_widgets/app_dashed_button.dart ' ;
import ' multi_image_picker_item.dart ' ;
import ' multi_image_picker_item.dart ' ;
/ / class MultiFilesPicker extends StatefulWidget {
/ / final String label ;
/ / final bool error ;
/ / final List < File > files ;
/ / final List < GenericAttachmentModel > attachment ;
/ /
/ / final bool enabled , onlyImages ;
/ / double ? buttonHeight ;
/ / Widget ? buttonIcon ;
/ / Color ? buttonColor ;
/ / final Function ( List < File > ) ? onChange ;
/ / final bool showAsGrid ;
/ /
/ / MultiFilesPicker (
/ / { Key ? key ,
/ / this . files = const < File > [ ] ,
/ / this . attachment = const < GenericAttachmentModel > [ ] ,
/ / required this . label ,
/ / this . error = false ,
/ / this . buttonHeight ,
/ / this . buttonIcon ,
/ / this . enabled = true ,
/ / this . onlyImages = false ,
/ / this . onChange ,
/ / this . showAsGrid = false ,
/ / this . buttonColor } )
/ / : super ( key: key ) ;
/ /
/ / @ override
/ / State < MultiFilesPicker > createState ( ) = > _MultiFilesPickerState ( ) ;
/ / }
/ /
/ / class _MultiFilesPickerState extends State < MultiFilesPicker > {
/ / @ override
/ / Widget build ( BuildContext context ) {
/ / return Column (
/ / crossAxisAlignment: CrossAxisAlignment . start ,
/ / children: [
/ / if ( widget . enabled ) . . . [
/ / AppDashedButton (
/ / title: widget . label ,
/ / height: widget . buttonHeight ,
/ / buttonColor: widget . buttonColor ,
/ / icon: widget . buttonIcon ,
/ / onPressed: ( widget . enabled = = false )
/ / ? ( ) { }
/ / : widget . showAsGrid
/ / ? showFileSourceSheet
/ / : onFilePicker ) ,
/ / 16. height ,
/ / ] ,
/ / if ( widget . files . isNotEmpty )
/ / Wrap (
/ / spacing: 8. toScreenWidth ,
/ / children: List . generate (
/ / widget . files ! . length ,
/ / ( index ) {
/ / File image = widget . files ! [ index ] ;
/ / return MultiFilesPickerItem (
/ / file: image ,
/ / enabled: widget . enabled ,
/ / onRemoveTap: ( image ) {
/ / if ( ! widget . enabled ) {
/ / return ;
/ / }
/ / widget . files . remove ( image ) ;
/ / if ( widget . onChange ! = null ) {
/ / widget . onChange ! ( widget . files ) ;
/ / }
/ / setState ( ( ) { } ) ;
/ / } ,
/ / ) ;
/ / } ,
/ / ) ,
/ / ) ,
/ / ] ,
/ / ) ;
/ / }
/ /
/ / fromFilePicker ( ) async {
/ / FilePickerResult ? result = await FilePicker . platform . pickFiles (
/ / type: FileType . custom ,
/ / allowMultiple: true ,
/ / allowedExtensions: widget . onlyImages ? [ ' jpg ' , ' jpeg ' , ' png ' ] : [ ' jpg ' , ' jpeg ' , ' png ' , ' pdf ' , ' doc ' , ' docx ' , ' xlsx ' , ' pptx ' ] ,
/ / ) ;
/ / if ( result ! = null ) {
/ / for ( var path in result . paths ) {
/ / widget . files . add ( File ( path ! ) ) ;
/ / if ( widget . onChange ! = null ) {
/ / widget . onChange ! ( widget . files ) ;
/ / }
/ / }
/ / setState ( ( ) { } ) ;
/ / }
/ / }
/ /
/ / void showFileSourceSheet ( ) async {
/ / if ( widget . files . length > = 5 ) {
/ / Fluttertoast . showToast ( msg: context . translation . maxImagesNumberIs5 ) ;
/ / return ;
/ / }
/ /
/ / ImageSource ? source = ( await showModalBottomSheet (
/ / context: context ,
/ / shape: const RoundedRectangleBorder (
/ / borderRadius: BorderRadius . vertical (
/ / top: Radius . circular ( 20 ) ,
/ / ) ,
/ / ) ,
/ / clipBehavior: Clip . antiAliasWithSaveLayer ,
/ / builder: ( BuildContext context ) = > Column (
/ / mainAxisSize: MainAxisSize . min ,
/ / crossAxisAlignment: CrossAxisAlignment . start ,
/ / children: [
/ / " Attach File " . heading4 ( context ) ,
/ / 12. height ,
/ / GridView (
/ / padding: const EdgeInsets . all ( 0 ) ,
/ / shrinkWrap: true ,
/ / physics: const NeverScrollableScrollPhysics ( ) ,
/ / gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount ( crossAxisCount: 3 , childAspectRatio: 1 , crossAxisSpacing: 12 , mainAxisSpacing: 12 ) ,
/ / children: < Widget > [
/ / gridItem ( Icons . camera_enhance_rounded , context . translation . pickFromCamera ) . onPress ( ( ) = > Navigator . of ( context ) . pop ( ImageSource . camera ) ) ,
/ / gridItem ( Icons . image_rounded , context . translation . pickFromGallery ) . onPress ( ( ) = > Navigator . of ( context ) . pop ( ImageSource . gallery ) ) ,
/ / gridItem ( Icons . file_present_rounded , context . translation . pickFromFiles ) . onPress ( ( ) async {
/ / await fromFilePicker ( ) ;
/ / Navigator . pop ( context ) ;
/ / } ) ,
/ / ] ,
/ / ) ,
/ / 12. height ,
/ / ] ,
/ / ) . paddingAll ( 21 ) ,
/ / ) ) as ImageSource ? ;
/ / if ( source = = null ) return ;
/ / final pickedFile = await ImagePicker ( ) . pickImage ( source : source , imageQuality: 70 , maxWidth: 800 , maxHeight: 800 ) ;
/ /
/ / if ( pickedFile ! = null ) {
/ / File fileImage = File ( pickedFile . path ) ;
/ / widget . files . add ( fileImage ) ;
/ / if ( widget . onChange ! = null ) {
/ / widget . onChange ! ( widget . files ) ;
/ / }
/ / setState ( ( ) { } ) ;
/ / }
/ / }
/ /
/ / Widget gridItem ( IconData iconData , String title ) {
/ / return Container (
/ / padding: const EdgeInsets . all ( 12 ) ,
/ / decoration: BoxDecoration (
/ / color: Colors . white ,
/ / borderRadius: BorderRadius . circular ( 12 ) ,
/ / border: Border . all ( color: const Color ( 0xffF1F1F1 ) , width: 1 ) ,
/ / ) ,
/ / child: Column (
/ / crossAxisAlignment: CrossAxisAlignment . start ,
/ / mainAxisAlignment: MainAxisAlignment . spaceBetween ,
/ / children: [
/ / Icon ( iconData , color: const Color ( 0xff7D859A ) , size: 36 ) ,
/ / Text (
/ / title ,
/ / style: const TextStyle ( fontSize: 12 , fontWeight: FontWeight . w500 ) ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / ) ;
/ / }
/ /
/ / onFilePicker ( ) async {
/ / if ( widget . files . length > = 5 ) {
/ / Fluttertoast . showToast ( msg: context . translation . maxImagesNumberIs5 ) ;
/ / return ;
/ / }
/ / ImageSource ? source = await showModalBottomSheet < ImageSource > (
/ / context: context ,
/ / builder: ( BuildContext context ) {
/ / Widget listCard ( { required String icon , required String label , required VoidCallback onTap } ) {
/ / return GestureDetector (
/ / onTap: onTap ,
/ / child: Container (
/ / constraints: BoxConstraints ( minWidth: 111. toScreenWidth , minHeight: 111. toScreenHeight ) ,
/ / padding: EdgeInsets . symmetric ( horizontal: 12. toScreenWidth , vertical: 12. toScreenHeight ) ,
/ / decoration: BoxDecoration ( borderRadius: BorderRadius . circular ( 12 ) , border: Border . all ( width: 1 , color: AppColor . white70 ) ) ,
/ / child: Column (
/ / mainAxisSize: MainAxisSize . min ,
/ / crossAxisAlignment: CrossAxisAlignment . start ,
/ / children: [
/ / icon . toSvgAsset ( ) ,
/ / 24. height ,
/ / label . bodyText2 ( context ) . custom ( color: AppColor . black20 ) ,
/ / ] ,
/ / ) ,
/ / ) ,
/ / ) ;
/ / }
/ /
/ / return Container (
/ / padding: const EdgeInsets . all ( 16.0 ) ,
/ / child: Row (
/ / mainAxisAlignment: MainAxisAlignment . spaceBetween ,
/ / children: < Widget > [
/ / listCard (
/ / icon: ' camera_icon ' ,
/ / label: ' ${ context . translation . open } \n ${ context . translation . camera } ' ,
/ / onTap: ( ) {
/ / Navigator . of ( context ) . pop ( ImageSource . camera ) ;
/ / } ,
/ / ) ,
/ / listCard (
/ / icon: ' gallery_icon ' ,
/ / label: ' ${ context . translation . open } \n ${ context . translation . gallery } ' ,
/ / onTap: ( ) {
/ / Navigator . of ( context ) . pop ( ImageSource . gallery ) ;
/ / } ,
/ / ) ,
/ / listCard (
/ / icon: ' file_icon ' ,
/ / label: ' ${ context . translation . open } \n ${ context . translation . files } ' ,
/ / onTap: ( ) async {
/ / await fromFilePicker ( ) ;
/ / Navigator . pop ( context ) ;
/ / } ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / ) ;
/ / } ,
/ / ) ;
/ / / / ImageSource source = await showDialog (
/ / / / context: context ,
/ / / / builder: ( dialogContext ) = > CupertinoAlertDialog (
/ / / / actions: < Widget > [
/ / / / TextButton (
/ / / / child: Text ( context . translation . pickFromCamera ) ,
/ / / / onPressed: ( ) {
/ / / / Navigator . of ( dialogContext ) . pop ( ImageSource . camera ) ;
/ / / / } ,
/ / / / ) ,
/ / / / TextButton (
/ / / / child: Text ( context . translation . pickFromGallery ) ,
/ / / / onPressed: ( ) {
/ / / / Navigator . of ( dialogContext ) . pop ( ImageSource . gallery ) ;
/ / / / } ,
/ / / / ) ,
/ / / / TextButton (
/ / / / child: Text ( context . translation . pickFromFiles ) ,
/ / / / onPressed: ( ) async {
/ / / / await fromFilePicker ( ) ;
/ / / / Navigator . pop ( context ) ;
/ / / / } ,
/ / / / ) ,
/ / / / ] ,
/ / / / ) ,
/ / / / ) ;
/ / if ( source = = null ) return ;
/ /
/ / final pickedFile = await ImagePicker ( ) . pickImage ( source : source , imageQuality: 70 , maxWidth: 800 , maxHeight: 800 ) ;
/ /
/ / if ( pickedFile ! = null ) {
/ / File fileImage = File ( pickedFile . path ) ;
/ / if ( fileImage ! = null ) {
/ / widget . files . add ( fileImage ) ;
/ / if ( widget . onChange ! = null ) {
/ / widget . onChange ! ( widget . files ) ;
/ / }
/ / setState ( ( ) { } ) ;
/ / }
/ / }
/ /
/ / setState ( ( ) { } ) ;
/ / }
/ / }
class AttachmentModel {
class AttachmentModel {
int id = 0 ;
int id = 0 ;
File ? file ;
File ? file ;
@ -313,6 +39,7 @@ class AttachmentModel {
}
}
class AttachmentPicker extends StatefulWidget {
class AttachmentPicker extends StatefulWidget {
final String pickerTitle ;
final String label ;
final String label ;
final bool error ;
final bool error ;
final List < GenericAttachmentModel > attachment ;
final List < GenericAttachmentModel > attachment ;
@ -322,7 +49,6 @@ class AttachmentPicker extends StatefulWidget {
Widget ? buttonIcon ;
Widget ? buttonIcon ;
Color ? buttonColor ;
Color ? buttonColor ;
final Function ( List < GenericAttachmentModel > ) ? onChange ;
final Function ( List < GenericAttachmentModel > ) ? onChange ;
final bool showAsGrid ;
final bool showAsListView ;
final bool showAsListView ;
final bool pickMultiple ;
final bool pickMultiple ;
Lookup ? documentType ;
Lookup ? documentType ;
@ -333,6 +59,7 @@ class AttachmentPicker extends StatefulWidget {
{ Key ? key ,
{ Key ? key ,
this . attachment = const < GenericAttachmentModel > [ ] ,
this . attachment = const < GenericAttachmentModel > [ ] ,
required this . label ,
required this . label ,
this . pickerTitle = " Attach File " ,
this . error = false ,
this . error = false ,
this . buttonHeight ,
this . buttonHeight ,
this . buttonIcon ,
this . buttonIcon ,
@ -340,7 +67,6 @@ class AttachmentPicker extends StatefulWidget {
this . onlyImages = false ,
this . onlyImages = false ,
this . onChange ,
this . onChange ,
this . documentType ,
this . documentType ,
this . showAsGrid = false ,
this . showAsListView = false ,
this . showAsListView = false ,
this . pickMultiple = false ,
this . pickMultiple = false ,
this . checkQuality = false ,
this . checkQuality = false ,
@ -352,15 +78,29 @@ class AttachmentPicker extends StatefulWidget {
State < AttachmentPicker > createState ( ) = > _AttachmentPickerState ( ) ;
State < AttachmentPicker > createState ( ) = > _AttachmentPickerState ( ) ;
}
}
class _AttachmentPickerState extends State < AttachmentPicker > {
class _AttachmentPickerState extends State < AttachmentPicker > with SingleTickerProviderStateMixin {
late AnimationController _animationController ;
@ override
void initState ( ) {
super . initState ( ) ;
_animationController = AnimationController (
duration: const Duration ( milliseconds: 1200 ) ,
vsync: this ,
) ;
_animationController . forward ( ) ;
}
@ override
void dispose ( ) {
_animationController . dispose ( ) ;
super . dispose ( ) ;
}
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return widget . child ! = null
return widget . child ! = null
? widget . child ! . onPress ( ( widget . enabled = = false )
? widget . child ! . onPress ( ( widget . enabled = = false ) ? ( ) { } : ( ) = > onFilePicker ( widget . checkQuality ) )
? ( ) { }
: widget . showAsGrid
? ( ) = > showFileSourceSheet ( )
: ( ) = > onFilePicker ( widget . checkQuality ) )
: Column (
: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
spacing: 12 ,
spacing: 12 ,
@ -370,11 +110,7 @@ class _AttachmentPickerState extends State<AttachmentPicker> {
height: widget . buttonHeight ,
height: widget . buttonHeight ,
buttonColor: widget . buttonColor ,
buttonColor: widget . buttonColor ,
icon: widget . buttonIcon ,
icon: widget . buttonIcon ,
onPressed: ( widget . enabled = = false )
onPressed: ( widget . enabled = = false ) ? ( ) { } : ( ) = > onFilePicker ( widget . checkQuality ) ) ,
? ( ) { }
: widget . showAsGrid
? ( ) = > showFileSourceSheet ( )
: ( ) = > onFilePicker ( widget . checkQuality ) ) ,
if ( widget . attachment . isNotEmpty )
if ( widget . attachment . isNotEmpty )
widget . showAsListView
widget . showAsListView
? ListView . separated (
? ListView . separated (
@ -446,57 +182,6 @@ class _AttachmentPickerState extends State<AttachmentPicker> {
}
}
}
}
void showFileSourceSheet ( ) async {
ImageSource source = ( await showModalBottomSheet (
context: context ,
shape: const RoundedRectangleBorder (
borderRadius: BorderRadius . vertical (
top: Radius . circular ( 20 ) ,
) ,
) ,
clipBehavior: Clip . antiAliasWithSaveLayer ,
builder: ( BuildContext context ) = > Column (
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
" Attach File " . heading4 ( context ) ,
12. height ,
GridView (
padding: const EdgeInsets . all ( 0 ) ,
shrinkWrap: true ,
physics: const NeverScrollableScrollPhysics ( ) ,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount ( crossAxisCount: 3 , childAspectRatio: 1 , crossAxisSpacing: 12 , mainAxisSpacing: 12 ) ,
children: < Widget > [
gridItem ( Icons . camera_enhance_rounded , context . translation . pickFromCamera ) . onPress ( ( ) = > Navigator . of ( context ) . pop ( ImageSource . camera ) ) ,
gridItem ( Icons . image_rounded , context . translation . pickFromGallery ) . onPress ( ( ) = > Navigator . of ( context ) . pop ( ImageSource . gallery ) ) ,
gridItem ( Icons . file_present_rounded , context . translation . pickFromFiles ) . onPress ( ( ) async {
await fromFilePicker ( ) ;
Navigator . pop ( context ) ;
} ) ,
] ,
) ,
12. height ,
] ,
) . paddingAll ( 21 ) ,
) ) as ImageSource ;
/ / if ( widget . pickMultiple ) {
final pickedFile12 = await ImagePicker ( ) . pickMultiImage ( imageQuality: 70 , maxWidth: 800 , maxHeight: 800 ) ;
/ / / / }
/ /
/ / final pickedFile = await ImagePicker ( ) . pickImage ( source : source , imageQuality: 70 , maxWidth: 800 , maxHeight: 800 ) ;
/ /
/ / if ( pickedFile ! = null ) {
/ / File fileImage = File ( pickedFile . path ) ;
/ / widget . attachment . add ( GenericAttachmentModel ( id: 0 , name: fileImage . path , documentTypeId: widget . documentType ) ) ;
/ / if ( widget . onChange ! = null ) {
/ / widget . onChange ! ( widget . attachment ) ;
/ / }
/ / setState ( ( ) { } ) ;
/ / }
}
Widget gridItem ( IconData iconData , String title ) {
Widget gridItem ( IconData iconData , String title ) {
return Container (
return Container (
padding: const EdgeInsets . all ( 12 ) ,
padding: const EdgeInsets . all ( 12 ) ,
@ -509,7 +194,7 @@ class _AttachmentPickerState extends State<AttachmentPicker> {
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
children: [
Icon ( iconData , color: AppColor . icon2Color ( context ) , size: 24 ) ,
Icon ( iconData , color: AppColor . icon2Color ( context ) , size: 24 ) ,
title . bodyText2 ( context ) . custom ( color: AppColor . labelTextStyleColor ( context ) , fontSize: context . isTablet ( ) ? 10. toScreenWidth : null ) ,
title . bodyText2 ( context ) . custom ( color: AppColor . labelTextStyleColor ( context ) , fontSize: context . isTablet ( ) ? 10. toScreenWidth : null ) ,
/ / Text (
/ / Text (
/ / title ,
/ / title ,
@ -521,6 +206,10 @@ class _AttachmentPickerState extends State<AttachmentPicker> {
}
}
onFilePicker ( bool checkQuality ) async {
onFilePicker ( bool checkQuality ) async {
/ / Reset and restart animation for bottom sheet
_animationController . reset ( ) ;
_animationController . forward ( ) ;
ImageSource ? source = await showModalBottomSheet < ImageSource > (
ImageSource ? source = await showModalBottomSheet < ImageSource > (
context: context ,
context: context ,
builder: ( BuildContext context ) {
builder: ( BuildContext context ) {
@ -536,116 +225,95 @@ class _AttachmentPickerState extends State<AttachmentPicker> {
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
children: [
icon . toSvgAsset ( color: AppColor . icon2Color ( context ) , width: 36 , height: 36 ) ,
icon . toSvgAsset ( width: 24 , height: 24 , color: AppColor . icon2Color ( context ) ) ,
label . bodyText2 ( context ) . custom ( color: AppColor . labelTextStyleColor ( context ) , fontSize: context . isTablet ( ) ? 10. toScreenWidth : null ) ,
label . bodyText2 ( context ) . custom ( color: AppColor . labelTextStyleColor ( context ) , fontSize: context . isTablet ( ) ? 10. toScreenWidth : null ) ,
] ,
] ,
) ,
) ,
) . onPress ( onTap ) ;
) . onPress ( onTap ) ;
}
}
List < Widget > listItems = [
listCard (
icon: ' camera_icon ' ,
label: ' ${ context . translation . open } \n ${ context . translation . camera } ' ,
onTap: ( ) {
Navigator . of ( context ) . pop ( ImageSource . camera ) ;
} ,
) ,
listCard (
icon: ' gallery_icon ' ,
label: ' ${ context . translation . open } \n ${ context . translation . gallery } ' ,
onTap: ( ) {
Navigator . of ( context ) . pop ( ImageSource . gallery ) ;
} ,
) ,
listCard (
icon: ' file_icon ' ,
label: ' ${ context . translation . open } \n ${ context . translation . files } ' ,
onTap: ( ) async {
await fromFilePicker ( ) ;
Navigator . pop ( context ) ;
} ,
) ,
] ;
return SafeArea (
return SafeArea (
top: false ,
top: false ,
child: Container (
child: Container (
width: double . infinity ,
width: double . infinity ,
color: AppColor . background ( context ) ,
color: AppColor . bottomSheetColor ( context ) ,
padding: const EdgeInsets . all ( 16.0 ) ,
child: Column (
child: Column (
mainAxisSize: MainAxisSize . min ,
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
children: [
" Attach File " . heading4 ( context ) ,
widget . pickerTitle . heading4 ( context ) ,
12. height ,
GridView . builder (
GridView (
padding: const EdgeInsets . only ( top: 16 , bottom: 0 ) ,
padding: const EdgeInsets . all ( 0 ) ,
shrinkWrap: true ,
shrinkWrap: true ,
physics: const NeverScrollableScrollPhysics ( ) ,
physics: const NeverScrollableScrollPhysics ( ) ,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount ( crossAxisCount: 3 , childAspectRatio: 1 , crossAxisSpacing: 12 , mainAxisSpacing: 12 ) ,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount ( crossAxisCount: 3 , childAspectRatio: 1 , crossAxisSpacing: 16 , mainAxisSpacing: 16 ) ,
children: < Widget > [
itemCount: listItems . length ,
listCard (
itemBuilder: ( context , index ) {
icon: ' camera_icon ' ,
/ / Calculate staggered animation delay
label: ' ${ context . translation . open } \n ${ context . translation . camera } ' ,
final delay = index * 0.08 ;
onTap: ( ) {
final animation = Tween < double > ( begin: 0.0 , end: 1.0 ) . animate (
Navigator . of ( context ) . pop ( ImageSource . camera ) ;
CurvedAnimation (
} ,
parent: _animationController ,
) ,
curve: Interval (
listCard (
delay . clamp ( 0.0 , 0.8 ) ,
icon: ' gallery_icon ' ,
( delay + 0.3 ) . clamp ( 0.0 , 1.0 ) ,
label: ' ${ context . translation . open } \n ${ context . translation . gallery } ' ,
curve: Curves . easeOut ,
onTap: ( ) {
) ,
Navigator . of ( context ) . pop ( ImageSource . gallery ) ;
) ,
} ,
) ;
) ,
listCard (
final slideAnimation = Tween < Offset > (
icon: ' file_icon ' ,
begin: const Offset ( 0.0 , 0.3 ) ,
label: ' ${ context . translation . open } \n ${ context . translation . files } ' ,
end: Offset . zero ,
onTap: ( ) async {
) . animate (
await fromFilePicker ( ) ;
CurvedAnimation (
Navigator . pop ( context ) ;
parent: _animationController ,
} ,
curve: Interval (
) ,
delay . clamp ( 0.0 , 0.8 ) ,
] ,
( delay + 0.3 ) . clamp ( 0.0 , 1.0 ) ,
curve: Curves . easeOutCubic ,
) ,
) ,
) ;
return FadeTransition (
opacity: animation ,
child: SlideTransition ( position: slideAnimation , child: listItems [ index ] ) ,
) ;
} ,
) ,
) ,
/ / Container (
/ / padding: const EdgeInsets . all ( 16.0 ) ,
/ / child: Row (
/ / mainAxisAlignment: MainAxisAlignment . spaceBetween ,
/ / children: < Widget > [
/ / listCard (
/ / icon: ' camera_icon ' ,
/ / label: ' ${ context . translation . open } \n ${ context . translation . camera } ' ,
/ / onTap: ( ) {
/ / Navigator . of ( context ) . pop ( ImageSource . camera ) ;
/ / } ,
/ / ) ,
/ / listCard (
/ / icon: ' gallery_icon ' ,
/ / label: ' ${ context . translation . open } \n ${ context . translation . gallery } ' ,
/ / onTap: ( ) {
/ / Navigator . of ( context ) . pop ( ImageSource . gallery ) ;
/ / } ,
/ / ) ,
/ / listCard (
/ / icon: ' file_icon ' ,
/ / label: ' ${ context . translation . open } \n ${ context . translation . files } ' ,
/ / onTap: ( ) async {
/ / await fromFilePicker ( ) ;
/ / Navigator . pop ( context ) ;
/ / } ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / ) ,
] ,
] ,
) .paddingAll ( 16 ) ,
) ,
) ,
) ,
) ;
) ;
} ,
} ,
) ;
) ;
/ / ImageSource source = await showDialog (
/ / context: context ,
/ / builder: ( dialogContext ) = > CupertinoAlertDialog (
/ / actions: < Widget > [
/ / TextButton (
/ / child: Text ( context . translation . pickFromCamera ) ,
/ / onPressed: ( ) {
/ / Navigator . of ( dialogContext ) . pop ( ImageSource . camera ) ;
/ / } ,
/ / ) ,
/ / TextButton (
/ / child: Text ( context . translation . pickFromGallery ) ,
/ / onPressed: ( ) {
/ / Navigator . of ( dialogContext ) . pop ( ImageSource . gallery ) ;
/ / } ,
/ / ) ,
/ / TextButton (
/ / child: Text ( context . translation . pickFromFiles ) ,
/ / onPressed: ( ) async {
/ / await fromFilePicker ( ) ;
/ / Navigator . pop ( context ) ;
/ / } ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / ) ;
if ( source = = null ) return ;
if ( source = = null ) return ;
if ( widget . pickMultiple & & source = = ImageSource . gallery ) {
if ( widget . pickMultiple & & source = = ImageSource . gallery ) {