add version text
This commit is contained in:
@@ -511,14 +511,14 @@
|
|||||||
"receiving.info":"Receiving",
|
"receiving.info":"Receiving",
|
||||||
"receiving.new":"New receiving",
|
"receiving.new":"New receiving",
|
||||||
"receiving.create":"New Receiving",
|
"receiving.create":"New Receiving",
|
||||||
"receiving.update":"Update Reveiving",
|
"receiving.update":"Update Receiving",
|
||||||
"receiving.tracking.id":"Tracking ID",
|
"receiving.tracking.id":"Tracking ID",
|
||||||
"receiving.remark":"Remark",
|
"receiving.remark":"Remark",
|
||||||
"receiving.fcs.id":"FCS ID",
|
"receiving.fcs.id":"FCS ID",
|
||||||
"receiving.name":"Customer name",
|
"receiving.name":"Customer name",
|
||||||
"receiving.phone":"Phone number",
|
"receiving.phone":"Phone number",
|
||||||
"receiving.create_btn":"Complete receiving",
|
"receiving.create_btn":"Complete receiving",
|
||||||
"receiving.update_btn":"Update reveiving",
|
"receiving.update_btn":"Update receiving",
|
||||||
"receiving.delete.confirm":"Delete this receiving?",
|
"receiving.delete.confirm":"Delete this receiving?",
|
||||||
"receiving.return.btn":"Return package",
|
"receiving.return.btn":"Return package",
|
||||||
"receiving.return.confirm":"Return package?",
|
"receiving.return.confirm":"Return package?",
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ class AuthFb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<fcs.AuthResult> signInWithPhoneNumber(String smsCode) async {
|
Future<fcs.AuthResult> signInWithPhoneNumber(String smsCode) async {
|
||||||
User user;
|
|
||||||
try {
|
try {
|
||||||
final AuthCredential credential = PhoneAuthProvider.getCredential(
|
final AuthCredential credential = PhoneAuthProvider.getCredential(
|
||||||
verificationId: _verificationId,
|
verificationId: _verificationId,
|
||||||
@@ -102,7 +101,6 @@ class AuthFb {
|
|||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
return Future.error(SigninException(e.toString()));
|
return Future.error(SigninException(e.toString()));
|
||||||
}
|
}
|
||||||
if (user == null) Future.error(SigninException("No current user!"));
|
|
||||||
return Future.value(fcs.AuthResult(authStatus: AuthStatus.AUTH_VERIFIED));
|
return Future.value(fcs.AuthResult(authStatus: AuthStatus.AUTH_VERIFIED));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
const uploadPhotoLimit = 10;
|
||||||
|
|
||||||
const config_collection = "configs";
|
const config_collection = "configs";
|
||||||
const user_collection = "users";
|
const user_collection = "users";
|
||||||
const invitations_collection = "invitations";
|
const invitations_collection = "invitations";
|
||||||
|
|||||||
@@ -96,8 +96,9 @@ class Package {
|
|||||||
desc: map['desc'],
|
desc: map['desc'],
|
||||||
status: map['status'],
|
status: map['status'],
|
||||||
deliveryAddress: _da,
|
deliveryAddress: _da,
|
||||||
currentStatusDate:
|
currentStatusDate: _currentStatusDate != null
|
||||||
_currentStatusDate != null ? _currentStatusDate.toDate() : null,
|
? _currentStatusDate.toDate().toLocal()
|
||||||
|
: null,
|
||||||
photoUrls: _photoUrls,
|
photoUrls: _photoUrls,
|
||||||
shipmentHistory: _shipmentStatus);
|
shipmentHistory: _shipmentStatus);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
User user = Provider.of<MainModel>(context).user;
|
User user = Provider.of<MainModel>(context).user;
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
Future.microtask(
|
Future.microtask(
|
||||||
() => Navigator.pushNamedAndRemoveUntil(context, "/", (r) => false));
|
() => Navigator.pushNamedAndRemoveUntil(context, "/", (r) => false));
|
||||||
|
|||||||
@@ -66,9 +66,12 @@ class _SplashScreenState extends State<SplashScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Image.asset(
|
Container(
|
||||||
"assets/logo.jpg",
|
height: 180,
|
||||||
width: 180,
|
width: 180,
|
||||||
|
child: new Image.asset(
|
||||||
|
"assets/logo.jpg",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 50),
|
SizedBox(height: 50),
|
||||||
Column(
|
Column(
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class PackageModel extends BaseModel {
|
|||||||
if (forCustomer) {
|
if (forCustomer) {
|
||||||
q = q.where("user_id", isEqualTo: user.id);
|
q = q.where("user_id", isEqualTo: user.id);
|
||||||
}
|
}
|
||||||
q = q.orderBy("tracking_id", descending: false);
|
q = q.orderBy("update_time", descending: true);
|
||||||
listener = q.snapshots().listen((QuerySnapshot snapshot) {
|
listener = q.snapshots().listen((QuerySnapshot snapshot) {
|
||||||
_packages.clear();
|
_packages.clear();
|
||||||
_packages = snapshot.documents.map((documentSnapshot) {
|
_packages = snapshot.documents.map((documentSnapshot) {
|
||||||
@@ -139,6 +139,25 @@ class PackageModel extends BaseModel {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<Package> getPackageByTrackingID(String trackingID) async {
|
||||||
|
if (user == null) return null;
|
||||||
|
String path = "/$packages_collection";
|
||||||
|
try {
|
||||||
|
var snaps = await Firestore.instance
|
||||||
|
.collection("$path")
|
||||||
|
.where("tracking_id", isEqualTo: trackingID)
|
||||||
|
.getDocuments(source: Source.server);
|
||||||
|
if (snaps.documents.length == 1) {
|
||||||
|
var snap = snaps.documents[0];
|
||||||
|
var package = Package.fromMap(snap.data, snap.documentID);
|
||||||
|
return package;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
log.warning("Error!! $e");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Future<Package> lookupPackage(String trackingID) async {
|
Future<Package> lookupPackage(String trackingID) async {
|
||||||
if (user == null) return null;
|
if (user == null) return null;
|
||||||
String path = "/$packages_collection";
|
String path = "/$packages_collection";
|
||||||
@@ -201,8 +220,15 @@ class PackageModel extends BaseModel {
|
|||||||
return Services.instance.userService.searchUser(term);
|
return Services.instance.userService.searchUser(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Package>> searchPackage(String term) {
|
Future<List<Package>> searchPackage(String term) async {
|
||||||
return Services.instance.packageService.searchPackage(term);
|
List<Package> packages =
|
||||||
|
await Services.instance.packageService.searchPackage(term);
|
||||||
|
|
||||||
|
Package pkg = await getPackageByTrackingID(term);
|
||||||
|
if (pkg != null && !packages.contains(pkg)) {
|
||||||
|
packages.insert(0, pkg);
|
||||||
|
}
|
||||||
|
return packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> createPackages(User user, List<Package> packages) {
|
Future<void> createPackages(User user, List<Package> packages) {
|
||||||
@@ -216,7 +242,8 @@ class PackageModel extends BaseModel {
|
|||||||
package.fcsID = user.fcsID;
|
package.fcsID = user.fcsID;
|
||||||
}
|
}
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
if (files.length > 5) throw Exception("Exceed number of file upload");
|
if (files.length > uploadPhotoLimit)
|
||||||
|
throw Exception("Exceed number of file upload");
|
||||||
package.photoUrls = package.photoUrls == null ? [] : package.photoUrls;
|
package.photoUrls = package.photoUrls == null ? [] : package.photoUrls;
|
||||||
for (File f in files) {
|
for (File f in files) {
|
||||||
String path = Path.join(pkg_files_path);
|
String path = Path.join(pkg_files_path);
|
||||||
@@ -240,7 +267,12 @@ class PackageModel extends BaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
if (files.length > 5) throw Exception("Exceed number of file upload");
|
var count = (package.photoUrls?.length ?? 0) +
|
||||||
|
files.length -
|
||||||
|
(deletedUrls?.length ?? 0);
|
||||||
|
|
||||||
|
if (count > uploadPhotoLimit)
|
||||||
|
throw Exception("Exceed number of file upload");
|
||||||
package.photoUrls = package.photoUrls == null ? [] : package.photoUrls;
|
package.photoUrls = package.photoUrls == null ? [] : package.photoUrls;
|
||||||
for (File f in files) {
|
for (File f in files) {
|
||||||
String path = Path.join(pkg_files_path);
|
String path = Path.join(pkg_files_path);
|
||||||
@@ -265,7 +297,12 @@ class PackageModel extends BaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
if (files.length > 5) throw Exception("Exceed number of file upload");
|
var count = (package.photoUrls?.length ?? 0) +
|
||||||
|
files.length -
|
||||||
|
(deletedUrls?.length ?? 0);
|
||||||
|
|
||||||
|
if (count > uploadPhotoLimit)
|
||||||
|
throw Exception("Exceed number of file upload");
|
||||||
package.photoUrls = package.photoUrls == null ? [] : package.photoUrls;
|
package.photoUrls = package.photoUrls == null ? [] : package.photoUrls;
|
||||||
for (File f in files) {
|
for (File f in files) {
|
||||||
String path = Path.join(pkg_files_path);
|
String path = Path.join(pkg_files_path);
|
||||||
|
|||||||
@@ -52,6 +52,17 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
} else {
|
} else {
|
||||||
package = new Package();
|
package = new Package();
|
||||||
}
|
}
|
||||||
|
_trackingIDCtl.addListener(() {
|
||||||
|
var text = _trackingIDCtl.text;
|
||||||
|
if (text.contains(RegExp(r'[a-z ]'))) {
|
||||||
|
text = text.toUpperCase().replaceAll(" ", "");
|
||||||
|
_trackingIDCtl.value = _trackingIDCtl.value.copyWith(
|
||||||
|
text: text,
|
||||||
|
selection:
|
||||||
|
TextSelection(baseOffset: text.length, extentOffset: text.length),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -158,7 +169,9 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
remarkBox,
|
remarkBox,
|
||||||
|
Divider(),
|
||||||
img,
|
img,
|
||||||
|
Divider(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -9,6 +9,14 @@ Future<String> scanBarcode() async {
|
|||||||
if (barcode.contains(gs)) {
|
if (barcode.contains(gs)) {
|
||||||
var codes = barcode.split(gs);
|
var codes = barcode.split(gs);
|
||||||
barcode = codes.length >= 2 ? codes[1] : barcode;
|
barcode = codes.length >= 2 ? codes[1] : barcode;
|
||||||
|
} else if (barcode.startsWith("96")) {
|
||||||
|
if (barcode.length == 34) {
|
||||||
|
int start = barcode.length - 12;
|
||||||
|
barcode = barcode.substring(start);
|
||||||
|
} else if (barcode.length == 22) {
|
||||||
|
int start = barcode.length - 15;
|
||||||
|
barcode = barcode.substring(start);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return barcode;
|
return barcode;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -1,32 +1,46 @@
|
|||||||
import 'package:fcs/pages/contact/contact_page.dart';
|
import 'package:fcs/pages/contact/contact_page.dart';
|
||||||
|
import 'package:fcs/pages/main/model/main_model.dart';
|
||||||
import 'package:fcs/pages/term/term_page.dart';
|
import 'package:fcs/pages/term/term_page.dart';
|
||||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_icons/flutter_icons.dart';
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class BottomWidgets extends StatelessWidget {
|
class BottomWidgets extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
var pkgInfo = Provider.of<MainModel>(context).packageInfo;
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
final versionBox = Text(
|
||||||
children: <Widget>[
|
"v${pkgInfo.version}+${pkgInfo.buildNumber}",
|
||||||
InkWell(
|
style: TextStyle(color: Colors.white30),
|
||||||
onTap: () {
|
);
|
||||||
Navigator.of(context)
|
return Column(
|
||||||
.push(CupertinoPageRoute(builder: (context) => ContactPage()));
|
children: [
|
||||||
},
|
Row(
|
||||||
child: _buildSmallButton(
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
context, "contact.btn", SimpleLineIcons.support),
|
children: <Widget>[
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
CupertinoPageRoute(builder: (context) => ContactPage()));
|
||||||
|
},
|
||||||
|
child: _buildSmallButton(
|
||||||
|
context, "contact.btn", SimpleLineIcons.support),
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context)
|
||||||
|
.push(CupertinoPageRoute(builder: (context) => TermPage()));
|
||||||
|
},
|
||||||
|
child: _buildSmallButton(context, "term.btn", Icons.info_outline),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
InkWell(
|
Padding(
|
||||||
onTap: () {
|
padding: const EdgeInsets.only(bottom: 8.0),
|
||||||
Navigator.of(context)
|
child: versionBox,
|
||||||
.push(CupertinoPageRoute(builder: (context) => TermPage()));
|
|
||||||
},
|
|
||||||
child: _buildSmallButton(context, "term.btn", Icons.info_outline),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:fcs/helpers/theme.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/right_left_page_rout.dart';
|
||||||
import 'package:fcs/pages/widgets/show_img.dart';
|
import 'package:fcs/pages/widgets/show_img.dart';
|
||||||
import 'package:fcs/pages/widgets/show_multiple_img.dart';
|
import 'package:fcs/pages/widgets/show_multiple_img.dart';
|
||||||
@@ -48,117 +49,142 @@ class _MultiImageFileState extends State<MultiImageFile> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Column(
|
||||||
height: 130,
|
children: [
|
||||||
width: 500,
|
widget.enabled
|
||||||
child: ListView.separated(
|
? Row(
|
||||||
separatorBuilder: (context, index) => Divider(
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
color: Colors.black,
|
children: [
|
||||||
),
|
InkWell(
|
||||||
itemCount:
|
onTap: () => {_openImagePicker(false)},
|
||||||
widget.enabled ? fileContainers.length + 1 : fileContainers.length,
|
child: Stack(
|
||||||
scrollDirection: Axis.horizontal,
|
children: [
|
||||||
itemBuilder: (context, index) {
|
Container(
|
||||||
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,
|
|
||||||
width: 50,
|
width: 50,
|
||||||
child: IconButton(
|
height: 50,
|
||||||
icon: Icon(
|
child: Icon(
|
||||||
Icons.close,
|
MaterialCommunityIcons.image,
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
),
|
size: 35,
|
||||||
onPressed: () =>
|
),
|
||||||
{_fileRemove(fileContainers[index])}),
|
|
||||||
),
|
),
|
||||||
)
|
Positioned(
|
||||||
: Container(),
|
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) {
|
_fileAdded(DisplayImageSource fileContainer, File selectedFile) {
|
||||||
fileContainer.file = selectedFile;
|
fileContainer.file = selectedFile;
|
||||||
setState(() {
|
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,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: fcs
|
|||||||
description: FCS Logistics
|
description: FCS Logistics
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 1.0.0+4
|
version: 1.0.5+7
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user