|
|
|
|
|
|
|
|
import 'package:farm_tpf/utils/const_color.dart'; |
|
|
import 'package:farm_tpf/utils/const_color.dart'; |
|
|
import 'package:farm_tpf/utils/const_string.dart'; |
|
|
import 'package:farm_tpf/utils/const_string.dart'; |
|
|
import 'package:flutter/cupertino.dart'; |
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
|
|
import 'package:flutter/foundation.dart'; |
|
|
import 'package:flutter/material.dart'; |
|
|
import 'package:flutter/material.dart'; |
|
|
import 'package:image_picker/image_picker.dart'; |
|
|
import 'package:image_picker/image_picker.dart'; |
|
|
import 'package:video_player/video_player.dart'; |
|
|
import 'package:video_player/video_player.dart'; |
|
|
|
|
|
|
|
|
String _retrieveDataError; |
|
|
String _retrieveDataError; |
|
|
|
|
|
|
|
|
final ImagePicker _picker = ImagePicker(); |
|
|
final ImagePicker _picker = ImagePicker(); |
|
|
List<ItemMediaVM> items = [ |
|
|
|
|
|
ItemMediaVM('http://lorempixel.com/640/480', true), |
|
|
|
|
|
ItemMediaVM( |
|
|
|
|
|
'https://s3.amazonaws.com/uifaces/faces/twitter/rickdt/128.jpg', true), |
|
|
|
|
|
ItemMediaVM('http://lorempixel.com/640/480/food', true), |
|
|
|
|
|
ItemMediaVM('http://lorempixel.com/640/480/animals', true), |
|
|
|
|
|
ItemMediaVM('http://lorempixel.com/640/480/fashion', true), |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
List<ItemMediaVM> items = []; |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
|
Widget build(BuildContext context) { |
|
|
Widget build(BuildContext context) { |
|
|
|
|
|
|
|
|
height: 4.0, |
|
|
height: 4.0, |
|
|
), |
|
|
), |
|
|
_buildListPoster(), |
|
|
_buildListPoster(), |
|
|
1 == 1 |
|
|
|
|
|
|
|
|
defaultTargetPlatform == TargetPlatform.android |
|
|
? FutureBuilder<void>( |
|
|
? FutureBuilder<void>( |
|
|
future: retrieveLostData(), |
|
|
future: retrieveLostData(), |
|
|
builder: |
|
|
builder: |
|
|
|
|
|
|
|
|
return retrieveError; |
|
|
return retrieveError; |
|
|
} |
|
|
} |
|
|
if (_imageFile != null) { |
|
|
if (_imageFile != null) { |
|
|
return Image.file(File(_imageFile.path), width: 100, height: 100); |
|
|
|
|
|
|
|
|
var imageResult = |
|
|
|
|
|
Image.file(File(_imageFile.path), width: 100, height: 100); |
|
|
|
|
|
setState(() { |
|
|
|
|
|
items.insert(0, ItemMediaVM(_imageFile.path, false, imageResult)); |
|
|
|
|
|
}); |
|
|
|
|
|
return Container( |
|
|
|
|
|
child: Text("ok"), |
|
|
|
|
|
); |
|
|
} else if (_pickImageError != null) { |
|
|
} else if (_pickImageError != null) { |
|
|
return Text( |
|
|
return Text( |
|
|
'Pick image error: $_pickImageError', |
|
|
'Pick image error: $_pickImageError', |
|
|
|
|
|
|
|
|
Positioned( |
|
|
Positioned( |
|
|
child: ClipRRect( |
|
|
child: ClipRRect( |
|
|
borderRadius: BorderRadius.circular(8), |
|
|
borderRadius: BorderRadius.circular(8), |
|
|
child: ShimmerImage( |
|
|
|
|
|
item.photo, |
|
|
|
|
|
width: 93, |
|
|
|
|
|
height: 124, |
|
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
child: item.image == null |
|
|
|
|
|
? ShimmerImage( |
|
|
|
|
|
item.photo, |
|
|
|
|
|
width: 93, |
|
|
|
|
|
height: 124, |
|
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
|
) |
|
|
|
|
|
: Image.file(File(item.photo), width: 100, height: 100), |
|
|
)), |
|
|
)), |
|
|
Positioned( |
|
|
Positioned( |
|
|
top: -5, |
|
|
top: -5, |
|
|
|
|
|
|
|
|
class ItemMediaVM { |
|
|
class ItemMediaVM { |
|
|
String photo; |
|
|
String photo; |
|
|
bool isVideo; |
|
|
bool isVideo; |
|
|
|
|
|
Image image; |
|
|
|
|
|
|
|
|
ItemMediaVM(this.photo, this.isVideo); |
|
|
|
|
|
|
|
|
ItemMediaVM(this.photo, this.isVideo, this.image); |
|
|
} |
|
|
} |