add version text
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/widgets/callbacks.dart';
|
||||
import 'package:fcs/pages/widgets/right_left_page_rout.dart';
|
||||
import 'package:fcs/pages/widgets/show_img.dart';
|
||||
import 'package:fcs/pages/widgets/show_multiple_img.dart';
|
||||
@@ -48,117 +49,142 @@ class _MultiImageFileState extends State<MultiImageFile> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 130,
|
||||
width: 500,
|
||||
child: ListView.separated(
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Colors.black,
|
||||
),
|
||||
itemCount:
|
||||
widget.enabled ? fileContainers.length + 1 : fileContainers.length,
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == fileContainers.length) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
bool camera = false, gallery = false;
|
||||
await _dialog(
|
||||
context, () => camera = true, () => gallery = true);
|
||||
if (camera || gallery) {
|
||||
var selectedFile = await ImagePicker().getImage(
|
||||
source: camera ? ImageSource.camera : ImageSource.gallery,
|
||||
imageQuality: 80,
|
||||
maxWidth: 1000);
|
||||
if (selectedFile != null) {
|
||||
_fileAdded(DisplayImageSource(), File(selectedFile.path));
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
width: 200,
|
||||
height: 130,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: primaryColor,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
child: Icon(SimpleLineIcons.plus),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return InkWell(
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
RightLeftPageRoute(ShowMultiImage(
|
||||
displayImageSources: fileContainers,
|
||||
initialPage: index,
|
||||
))),
|
||||
child: Stack(alignment: Alignment.topLeft, children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
width: 200,
|
||||
height: 130,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: primaryColor,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
child: fileContainers[index].file == null
|
||||
? CachedNetworkImage(
|
||||
width: 50,
|
||||
height: 50,
|
||||
imageUrl: fileContainers[index].url,
|
||||
placeholder: (context, url) => Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 30,
|
||||
height: 30,
|
||||
child: CircularProgressIndicator()),
|
||||
],
|
||||
),
|
||||
errorWidget: (context, url, error) =>
|
||||
Icon(Icons.error),
|
||||
)
|
||||
// Image.network(fileContainers[index].url,
|
||||
// width: 50, height: 50)
|
||||
: Image.file(fileContainers[index].file,
|
||||
width: 50, height: 50),
|
||||
),
|
||||
),
|
||||
widget.enabled
|
||||
? Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
height: 50,
|
||||
return Column(
|
||||
children: [
|
||||
widget.enabled
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => {_openImagePicker(false)},
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: 50,
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
Icons.close,
|
||||
color: primaryColor,
|
||||
),
|
||||
onPressed: () =>
|
||||
{_fileRemove(fileContainers[index])}),
|
||||
height: 50,
|
||||
child: Icon(
|
||||
MaterialCommunityIcons.image,
|
||||
color: primaryColor,
|
||||
size: 35,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
]),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
child: actionIcon(
|
||||
color: Colors.green, iconData: Icons.add))
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => {_openImagePicker(true)},
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
child: Icon(
|
||||
MaterialCommunityIcons.camera,
|
||||
color: primaryColor,
|
||||
size: 35,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
child: actionIcon(
|
||||
color: Colors.green, iconData: Icons.add))
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
Container(
|
||||
height: 100,
|
||||
child: ListView.separated(
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Colors.black,
|
||||
),
|
||||
itemCount: fileContainers.length,
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (context, index) {
|
||||
return InkWell(
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
RightLeftPageRoute(ShowMultiImage(
|
||||
displayImageSources: fileContainers,
|
||||
initialPage: index,
|
||||
))),
|
||||
child: Stack(alignment: Alignment.topLeft, children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: primaryColor,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
child: fileContainers[index].file == null
|
||||
? CachedNetworkImage(
|
||||
fit: BoxFit.cover,
|
||||
width: 50,
|
||||
height: 50,
|
||||
imageUrl: fileContainers[index].url,
|
||||
placeholder: (context, url) => Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 30,
|
||||
height: 30,
|
||||
child: CircularProgressIndicator()),
|
||||
],
|
||||
),
|
||||
errorWidget: (context, url, error) =>
|
||||
Icon(Icons.error),
|
||||
)
|
||||
: FittedBox(
|
||||
fit: BoxFit.cover,
|
||||
child: Image.file(
|
||||
fileContainers[index].file,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
widget.enabled
|
||||
? Positioned(
|
||||
top: 10,
|
||||
right: 0,
|
||||
child: actionIcon(
|
||||
color: Colors.red,
|
||||
iconData: Icons.remove,
|
||||
onTap: () =>
|
||||
{_fileRemove(fileContainers[index])}),
|
||||
)
|
||||
: Container(),
|
||||
]),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_openImagePicker(bool camera) async {
|
||||
var selectedFile = await ImagePicker().getImage(
|
||||
source: camera ? ImageSource.camera : ImageSource.gallery,
|
||||
imageQuality: 80,
|
||||
maxWidth: 1000);
|
||||
if (selectedFile != null) {
|
||||
_fileAdded(DisplayImageSource(), File(selectedFile.path));
|
||||
}
|
||||
}
|
||||
|
||||
_fileAdded(DisplayImageSource fileContainer, File selectedFile) {
|
||||
fileContainer.file = selectedFile;
|
||||
setState(() {
|
||||
@@ -281,4 +307,21 @@ class _MultiImageFileState extends State<MultiImageFile> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget actionIcon({OnTap onTap, Color color, IconData iconData}) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: ClipOval(
|
||||
child: Container(
|
||||
color: color,
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: Icon(
|
||||
iconData,
|
||||
color: Colors.white,
|
||||
size: 15,
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user