fix
This commit is contained in:
@@ -13,6 +13,7 @@ import 'package:fcs/pages/widgets/show_img.dart';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class PaymentPage extends StatefulWidget {
|
class PaymentPage extends StatefulWidget {
|
||||||
@@ -57,15 +58,20 @@ class _PaymentPageState extends State<PaymentPage> {
|
|||||||
|
|
||||||
final receiptFileBox = Row(children: [
|
final receiptFileBox = Row(children: [
|
||||||
LocalText(context, 'pm.attachment', fontSize: 16, color: Colors.grey),
|
LocalText(context, 'pm.attachment', fontSize: 16, color: Colors.grey),
|
||||||
IconButton(
|
_file != null
|
||||||
|
? InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
await _dialog(context);
|
||||||
|
},
|
||||||
|
child: Chip(
|
||||||
|
label: Icon(Icons.image, color: primaryColor),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: IconButton(
|
||||||
icon: Icon(Icons.attachment, color: primaryColor),
|
icon: Icon(Icons.attachment, color: primaryColor),
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
modelBottomSheet(context, onFile: (file) {
|
await _dialog(context);
|
||||||
setState(() {
|
}),
|
||||||
_file = file;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
final payBox = Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
final payBox = Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||||
@@ -140,11 +146,16 @@ class _PaymentPageState extends State<PaymentPage> {
|
|||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => ShowImage(
|
builder: (context) => ShowImage(
|
||||||
|
// localImage: attachment.value.fileUrl,
|
||||||
localImage: 'assets/logo.jpg',
|
localImage: 'assets/logo.jpg',
|
||||||
url: null,
|
url: null,
|
||||||
fileName: 'image')));
|
fileName: 'image')));
|
||||||
},
|
},
|
||||||
child: Icon(Icons.attachment, color: primaryColor))),
|
child: Chip(
|
||||||
|
label: Icon(Icons.image, color: primaryColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
Expanded(flex: 1, child: Center(child: Text('pending'))),
|
Expanded(flex: 1, child: Center(child: Text('pending'))),
|
||||||
Expanded(flex: 1, child: Center(child: Text('\$ ${r.amount}'))),
|
Expanded(flex: 1, child: Center(child: Text('\$ ${r.amount}'))),
|
||||||
],
|
],
|
||||||
@@ -218,4 +229,73 @@ class _PaymentPageState extends State<PaymentPage> {
|
|||||||
));
|
));
|
||||||
return dataRow;
|
return dataRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _dialog(BuildContext context) {
|
||||||
|
return showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
content: Container(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.camera,
|
||||||
|
size: 30,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// cameraPress();
|
||||||
|
var selectedFile =
|
||||||
|
await pickImage(ImageSource.camera);
|
||||||
|
setState(() {
|
||||||
|
_file = selectedFile;
|
||||||
|
});
|
||||||
|
Navigator.pop(context);
|
||||||
|
}),
|
||||||
|
Text("Camera")
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.photo_library,
|
||||||
|
size: 30,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// photoPress();
|
||||||
|
var selectedFile =
|
||||||
|
await pickImage(ImageSource.gallery);
|
||||||
|
setState(() {
|
||||||
|
_file = selectedFile;
|
||||||
|
});
|
||||||
|
Navigator.pop(context);
|
||||||
|
}),
|
||||||
|
Text("Gallery")
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
pickImage(ImageSource source) async {
|
||||||
|
var tempImage = await ImagePicker.pickImage(source: source);
|
||||||
|
return tempImage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/main/model/main_model.dart';
|
import 'package:fcs/pages/main/model/main_model.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/services.dart';
|
||||||
import 'package:flutter_pdfview/flutter_pdfview.dart';
|
import 'package:flutter_pdfview/flutter_pdfview.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:share/share.dart';
|
import 'package:share/share.dart';
|
||||||
|
|
||||||
@@ -45,8 +48,8 @@ class _PaymentPDFScreenState extends State<PaymentPDFScreen>
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.file_download),
|
icon: Icon(Icons.file_download),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
// var _dir = (await getApplicationDocumentsDirectory()).path;
|
var file = await copyAsset();
|
||||||
// _downloadFile(widget.path, 'invoice.pdf', _dir);
|
print('file=> $file');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -93,12 +96,6 @@ class _PaymentPDFScreenState extends State<PaymentPDFScreen>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<File> _downloadFile(String url, String filename, String dir) async {
|
|
||||||
var req = await http.Client().get(Uri.parse(url));
|
|
||||||
var file = File('$dir/$filename');
|
|
||||||
return file.writeAsBytes(req.bodyBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
_share(String url) async {
|
_share(String url) async {
|
||||||
MainModel mainModel = Provider.of<MainModel>(context, listen: false);
|
MainModel mainModel = Provider.of<MainModel>(context, listen: false);
|
||||||
String appUrl = mainModel.setting.appUrl;
|
String appUrl = mainModel.setting.appUrl;
|
||||||
@@ -108,4 +105,13 @@ class _PaymentPDFScreenState extends State<PaymentPDFScreen>
|
|||||||
subject: "Invitation to FCS Logistics App",
|
subject: "Invitation to FCS Logistics App",
|
||||||
sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size);
|
sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<File> copyAsset() async {
|
||||||
|
Directory tempDir = await getTemporaryDirectory();
|
||||||
|
String tempPath = tempDir.path;
|
||||||
|
File tempFile = File('$tempPath/Invoice-A092(A)-32.pdf');
|
||||||
|
ByteData bd = await rootBundle.load('assets/Invoice-A092(A)-32.pdf');
|
||||||
|
await tempFile.writeAsBytes(bd.buffer.asUint8List(), flush: true);
|
||||||
|
return tempFile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
TextEditingController _discountController = new TextEditingController();
|
TextEditingController _discountController = new TextEditingController();
|
||||||
|
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
bool _isNew = false;
|
bool _isNew;
|
||||||
DiscountByWeight _discountByWeight = new DiscountByWeight();
|
DiscountByWeight _discountByWeight = new DiscountByWeight();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -33,6 +33,9 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
_discountByWeight = widget.discountByWeight;
|
_discountByWeight = widget.discountByWeight;
|
||||||
_weightController.text = _discountByWeight.weight.toString();
|
_weightController.text = _discountByWeight.weight.toString();
|
||||||
_discountController.text = _discountByWeight.discount.toString();
|
_discountController.text = _discountByWeight.discount.toString();
|
||||||
|
_isNew = false;
|
||||||
|
} else {
|
||||||
|
_isNew = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +134,8 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
try {
|
try {
|
||||||
var shipmentRateModel =
|
var shipmentRateModel =
|
||||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||||
await shipmentRateModel.deleteDiscountByWeight(widget.discountByWeight.id);
|
await shipmentRateModel
|
||||||
|
.deleteDiscountByWeight(widget.discountByWeight.id);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showMsgDialog(context, "Error", e.toString());
|
showMsgDialog(context, "Error", e.toString());
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
|
|||||||
import 'package:fcs/pages/widgets/display_text.dart';
|
import 'package:fcs/pages/widgets/display_text.dart';
|
||||||
import 'package:fcs/pages/widgets/input_text.dart';
|
import 'package:fcs/pages/widgets/input_text.dart';
|
||||||
import 'package:fcs/pages/widgets/length_picker.dart';
|
import 'package:fcs/pages/widgets/length_picker.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_dropdown.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
import 'package:fcs/pages/widgets/progress.dart';
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
@@ -79,6 +80,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var shipmentRateModel = Provider.of<ShipmentRateModel>(context);
|
var shipmentRateModel = Provider.of<ShipmentRateModel>(context);
|
||||||
|
List<CargoType> cargos = shipmentRateModel.rate.cargoTypes;
|
||||||
|
|
||||||
final lengthBox = LengthPicker(
|
final lengthBox = LengthPicker(
|
||||||
controller: _lengthController,
|
controller: _lengthController,
|
||||||
@@ -119,6 +121,18 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
|||||||
textInputType: TextInputType.number,
|
textInputType: TextInputType.number,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var cargoTypeBox = LocalDropdown<CargoType>(
|
||||||
|
callback: (v) {
|
||||||
|
setState(() {
|
||||||
|
_cargoType = v;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
labelKey: "cargo.type",
|
||||||
|
iconData: Icons.text_format,
|
||||||
|
selectedValue: _cargoType,
|
||||||
|
values: cargos,
|
||||||
|
);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@@ -137,38 +151,8 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
cargoTypeBox,
|
||||||
padding: EdgeInsets.only(top: 5, left: 25),
|
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: LocalText(context, 'rate.cargo.type',
|
|
||||||
color: Colors.grey, fontSize: 15)),
|
|
||||||
Container(
|
|
||||||
width: 150.0,
|
|
||||||
child: DropdownButtonFormField(
|
|
||||||
value: _cargoType,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
fillColor: Colors.white,
|
|
||||||
hintText: shipmentRateModel.rate.cargoTypes[0].name,
|
|
||||||
hintStyle: TextStyle(color: Colors.black87)),
|
|
||||||
items: shipmentRateModel.rate.cargoTypes
|
|
||||||
.map((e) =>
|
|
||||||
DropdownMenuItem(child: Text(e.name), value: e))
|
|
||||||
.toList(),
|
|
||||||
onChanged: (selected) => {
|
|
||||||
setState(() {
|
|
||||||
_cargoType = selected;
|
|
||||||
_calShipmentWeight();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actualWeightBox,
|
actualWeightBox,
|
||||||
// LocalTitle(textKey: "box.dimension"),
|
|
||||||
dimBox,
|
dimBox,
|
||||||
shipmentWeightBox,
|
shipmentWeightBox,
|
||||||
SizedBox(height: 50),
|
SizedBox(height: 50),
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class _ImageFileState extends State<ImageFile> {
|
|||||||
backgroundColor: Colors.green,
|
backgroundColor: Colors.green,
|
||||||
child: Icon(MaterialIcons.insert_photo, color: Colors.white),
|
child: Icon(MaterialIcons.insert_photo, color: Colors.white),
|
||||||
),
|
),
|
||||||
title: LocalText(context, "profile.gallery",
|
title: LocalText(context, "pm.gallery",
|
||||||
color: Colors.black87, fontSize: 15),
|
color: Colors.black87, fontSize: 15),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
@@ -52,7 +52,7 @@ class _ImageFileState extends State<ImageFile> {
|
|||||||
radius: 20,
|
radius: 20,
|
||||||
child: Center(child: Icon(AntDesign.camera, color: Colors.white)),
|
child: Center(child: Icon(AntDesign.camera, color: Colors.white)),
|
||||||
),
|
),
|
||||||
title: LocalText(context, "profile.camera",
|
title: LocalText(context, "pm.camera",
|
||||||
color: Colors.black87, fontSize: 15),
|
color: Colors.black87, fontSize: 15),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
@@ -67,7 +67,7 @@ class _ImageFileState extends State<ImageFile> {
|
|||||||
radius: 20,
|
radius: 20,
|
||||||
child: Icon(Icons.delete, color: Colors.white),
|
child: Icon(Icons.delete, color: Colors.white),
|
||||||
),
|
),
|
||||||
title: LocalText(context, "profile.remove_photo",
|
title: LocalText(context, "pm.remove_photo",
|
||||||
color: Colors.black87, fontSize: 15),
|
color: Colors.black87, fontSize: 15),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
|||||||
Reference in New Issue
Block a user