diff --git a/assets/amazon_ins.png b/assets/amazon_ins.png new file mode 100644 index 0000000..4281986 Binary files /dev/null and b/assets/amazon_ins.png differ diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index 02e8e7a..3cd6d7b 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -474,13 +474,14 @@ "user_edit.welcome":"Welcome to FCS", "user_edit.name":"Please enter your name", - "user.phone":"My phone number", - "user.fcs_id":"My FCS_ID", - "user.shipping_address":"My USA shipping address", + "user.phone":"MY PHONE NUMBER", + "user.fcs_id":"MY FCS_ID", + "user.shipping_address":"USA SHIPPING ADDRESS", "user.deliveryAddress":"My delivery address", - "user.buying_instruction":"See below instructions to add shipping address", + "user.buying_instruction":"See below instructions to add USA shipping address while shoping online", "buy_online":"Buying online", + "buy_online.title":"BUYING ONLINE", "buy.amazon":"Amazon", "buy.newegg":"Newegg", "buy.macy":"Macy", @@ -495,7 +496,15 @@ "shipment.title":"Shipments", "shipment.add":"New shipment", - "pickup.title": "Pickups", + "pickup": "Pickups", + "pickup.title": "PICKUPS", "pickup.new": "New Pickup", - "pickup.edit.title": "Pickup" + "pickup.edit.title": "Pickup", + + "rate":"Rates", + "rate.title":"RATES", + + "rate.edit.title":"EDIT RATES", + + "rate.cal.title":"CALCULATE RATES" } \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png index dc9ada4..e6687f6 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png index 28c6bf0..493ed61 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png index 2ccbfd9..731dc11 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png index f091b6b..b87fdba 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png index 4cde121..da4b213 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png index d0ef06e..1eaa33f 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png index dcdc230..471d5af 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png index 2ccbfd9..769fc10 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png index c8f9ed8..65743ff 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png index a6d6b86..8d101a5 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png index a6d6b86..db4616c 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png index 75b2d16..7ade517 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png index c4df70d..3fc745e 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png index 6a84f41..5aec957 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png index d0e1f58..8e497de 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/lib/face/face_detection_camera.dart b/lib/face/face_detection_camera.dart deleted file mode 100644 index 2bd1dac..0000000 --- a/lib/face/face_detection_camera.dart +++ /dev/null @@ -1,177 +0,0 @@ -import 'smile_painter.dart'; -import 'package:flutter/material.dart'; -import 'package:camera/camera.dart'; -import 'package:firebase_ml_vision/firebase_ml_vision.dart'; -import 'package:flutter/foundation.dart'; -import 'dart:ui' as ui show Image; -import 'utils.dart'; - -class FaceDetectionFromLiveCamera extends StatefulWidget { - FaceDetectionFromLiveCamera({Key key}) : super(key: key); - - @override - _FaceDetectionFromLiveCameraState createState() => - _FaceDetectionFromLiveCameraState(); -} - -class _FaceDetectionFromLiveCameraState - extends State { - final FaceDetector faceDetector = FirebaseVision.instance.faceDetector(); - List faces; - CameraController _camera; - - bool _isDetecting = false; - CameraLensDirection _direction = CameraLensDirection.back; - - @override - void initState() { - super.initState(); - _initializeCamera(); - } - - void _initializeCamera() async { - CameraDescription description = await getCamera(_direction); - ImageRotation rotation = rotationIntToImageRotation( - description.sensorOrientation, - ); - - _camera = CameraController( - description, - defaultTargetPlatform == TargetPlatform.iOS - ? ResolutionPreset.low - : ResolutionPreset.medium, - ); - await _camera.initialize(); - - _camera.startImageStream((CameraImage image) { - if (_isDetecting) return; - - _isDetecting = true; - - detect( - image, - FirebaseVision.instance - .faceDetector(FaceDetectorOptions( - mode: FaceDetectorMode.accurate, - enableClassification: true)) - .processImage, - rotation) - .then( - (dynamic result) { - setState(() { - faces = result; - }); - - _isDetecting = false; - }, - ).catchError( - (_) { - _isDetecting = false; - }, - ); - }); - } - - Widget _buildResults() { - const Text noResultsText = const Text('No results!'); - const Text multipleFaceText = const Text('Multiple faces!'); - const Text pleaseSmileText = const Text('Please smile!'); - - if (faces == null || _camera == null || !_camera.value.isInitialized) { - return noResultsText; - } - - CustomPainter painter; - - final Size imageSize = Size( - _camera.value.previewSize.height, - _camera.value.previewSize.width, - ); - - if (faces is! List || - faces.isEmpty || - faces == null || - faces.length == 0) return noResultsText; - if (faces.length > 1) return multipleFaceText; - var face = faces[0]; - if (face.smilingProbability == null || face.smilingProbability < 0.8) { - return pleaseSmileText; - } - - painter = SmilePainterLiveCamera(imageSize, faces); - return CustomPaint( - painter: painter, - ); - } - - Widget _buildImage() { - return Container( - constraints: const BoxConstraints.expand(), - child: _camera == null - ? const Center( - child: Text( - 'Initializing Camera...', - style: TextStyle( - color: Colors.green, - fontSize: 30.0, - ), - ), - ) - : Stack( - fit: StackFit.expand, - children: [ - CameraPreview(_camera), - _buildResults(), - Positioned( - bottom: 0.0, - left: 0.0, - right: 0.0, - child: Container( - color: Colors.white, - height: 50.0, - child: ListView( - children: faces - .map((face) => Text( - "${face.boundingBox.center.toString()}, Smile:${face.smilingProbability}")) - .toList(), - ), - ), - ), - ], - ), - ); - } - - void _toggleCameraDirection() async { - if (_direction == CameraLensDirection.back) { - _direction = CameraLensDirection.front; - } else { - _direction = CameraLensDirection.back; - } - - await _camera.stopImageStream(); - await _camera.dispose(); - - setState(() { - _camera = null; - }); - - _initializeCamera(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text("Face Detection with Smile"), - ), - body: _buildImage(), - floatingActionButton: FloatingActionButton( - onPressed: _toggleCameraDirection, - child: _direction == CameraLensDirection.back - ? const Icon(Icons.camera_front) - : const Icon(Icons.camera_rear), - ), - ); - } -} diff --git a/lib/face/face_detection_image.dart b/lib/face/face_detection_image.dart deleted file mode 100644 index eabe94d..0000000 --- a/lib/face/face_detection_image.dart +++ /dev/null @@ -1,59 +0,0 @@ -import 'package:flutter/material.dart'; -import 'dart:io'; -import 'smile_painter.dart'; -import 'package:firebase_ml_vision/firebase_ml_vision.dart'; -import 'dart:ui' as ui show Image; -import 'package:image_picker/image_picker.dart'; - -class FaceDetectionFromImage extends StatefulWidget { - @override - _FaceDetectionFromImageState createState() => _FaceDetectionFromImageState(); -} - -class _FaceDetectionFromImageState extends State { - bool loading = true; - ui.Image image; - List faces; - final FaceDetector faceDetector = FirebaseVision.instance.faceDetector(); - - Future _loadImage(File file) async { - final data = await file.readAsBytes(); - return await decodeImageFromList(data); - } - - void pickAndProcessImage() async { - final File file = await ImagePicker.pickImage(source: ImageSource.gallery); - final FirebaseVisionImage visionImage = FirebaseVisionImage.fromFile(file); - faces = await faceDetector.processImage(visionImage); - image = await _loadImage(file); - setState(() { - loading = false; - }); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text('Face detection with Smile'), - ), - body: Center( - child: loading - ? Text('Press The floating Action Button for load image!') - : FittedBox( - child: SizedBox( - width: image.width.toDouble(), - height: image.height.toDouble(), - child: FacePaint( - painter: SmilePainter(image, faces), - ), - ), - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: pickAndProcessImage, - child: Icon(Icons.image), - ), - ); - } -} diff --git a/lib/face/home.dart b/lib/face/home.dart deleted file mode 100644 index feba004..0000000 --- a/lib/face/home.dart +++ /dev/null @@ -1,40 +0,0 @@ -import 'face_detection_camera.dart'; -import 'face_detection_image.dart'; -import 'package:flutter/material.dart'; - -class HomeScreen extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text('Smile To Face App'), - ), - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - RaisedButton( - child: Text('Add Smile to Face from Image'), - onPressed: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => FaceDetectionFromImage(), - ), - ); - }), - RaisedButton( - child: Text('Add Smile to Face from Live Camera'), - onPressed: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => FaceDetectionFromLiveCamera(), - ), - ); - }), - ], - ), - ), - ); - } -} - diff --git a/lib/face/main.dart b/lib/face/main.dart deleted file mode 100644 index c7d1ff7..0000000 --- a/lib/face/main.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:flutter/material.dart'; -import 'home.dart'; - -void main() => runApp(MyApp()); - -class MyApp extends StatelessWidget { - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - primarySwatch: Colors.blue, - ), - home: HomeScreen(), - ); - } -} \ No newline at end of file diff --git a/lib/face/smile_painter.dart b/lib/face/smile_painter.dart deleted file mode 100644 index 73057b8..0000000 --- a/lib/face/smile_painter.dart +++ /dev/null @@ -1,138 +0,0 @@ -import 'dart:ui' as ui show Image; -import 'dart:math' as Math; -import 'package:firebase_ml_vision/firebase_ml_vision.dart'; -import 'package:flutter/material.dart'; - -class FacePaint extends CustomPaint { - final CustomPainter painter; - - FacePaint({this.painter}) : super(painter: painter); -} - -class SmilePainter extends CustomPainter { - final ui.Image image; - final List faces; - - SmilePainter(this.image, this.faces); - - @override - void paint(Canvas canvas, Size size) { - if (image != null) { - canvas.drawImage(image, Offset.zero, Paint()); - } - - final paintRectStyle = Paint() - ..color = Colors.red - ..strokeWidth = 30.0 - ..style = PaintingStyle.stroke; - - //Draw Body - final paint = Paint()..color = Colors.yellow; - - for (var i = 0; i < faces.length; i++) { - final radius = - Math.min(faces[i].boundingBox.width, faces[i].boundingBox.height) / 2; - final center = faces[i].boundingBox.center; - final smilePaint = Paint() - ..style = PaintingStyle.stroke - ..strokeWidth = radius / 8; - canvas.drawRect(faces[i].boundingBox, paintRectStyle); - canvas.drawCircle(center, radius, paint); - canvas.drawArc( - Rect.fromCircle( - center: center.translate(0, radius / 8), radius: radius / 2), - 0, - Math.pi, - false, - smilePaint); - //Draw the eyes - canvas.drawCircle(Offset(center.dx - radius / 2, center.dy - radius / 2), - radius / 8, Paint()); - canvas.drawCircle(Offset(center.dx + radius / 2, center.dy - radius / 2), - radius / 8, Paint()); - } - } - - @override - bool shouldRepaint(SmilePainter oldDelegate) { - return image != oldDelegate.image || faces != oldDelegate.faces; - } -} - -class SmilePainterLiveCamera extends CustomPainter { - final Size imageSize; - final List faces; - - SmilePainterLiveCamera(this.imageSize, this.faces); - - @override - void paint(Canvas canvas, Size size) { -// final paintRectStyle = Paint() -// ..color = Colors.red -// ..strokeWidth = 10.0 -// ..style = PaintingStyle.stroke; - - final paint = Paint()..color = Colors.yellow; - - for (var i = 0; i < faces.length; i++) { - //Scale rect to image size - final rect = _scaleRect( - rect: faces[i].boundingBox, - imageSize: imageSize, - widgetSize: size, - ); - - //Radius for smile circle - final radius = Math.min(rect.width, rect.height) / 2; - - //Center of face rect - final Offset center = rect.center; - - final smilePaint = Paint() - ..style = PaintingStyle.stroke - ..strokeWidth = radius / 8; - - //Draw rect border - //canvas.drawRect(rect, paintRectStyle); - - //Draw body - canvas.drawCircle(center, radius, paint); - - //Draw mouth - canvas.drawArc( - Rect.fromCircle( - center: center.translate(0, radius / 8), radius: radius / 2), - 0, - Math.pi, - false, - smilePaint); - - //Draw the eyes - canvas.drawCircle(Offset(center.dx - radius / 2, center.dy - radius / 2), - radius / 8, Paint()); - canvas.drawCircle(Offset(center.dx + radius / 2, center.dy - radius / 2), - radius / 8, Paint()); - } - } - - @override - bool shouldRepaint(SmilePainterLiveCamera oldDelegate) { - return imageSize != oldDelegate.imageSize || faces != oldDelegate.faces; - } -} - -Rect _scaleRect({ - @required Rect rect, - @required Size imageSize, - @required Size widgetSize, -}) { - final double scaleX = widgetSize.width / imageSize.width; - final double scaleY = widgetSize.height / imageSize.height; - - return Rect.fromLTRB( - rect.left.toDouble() * scaleX, - rect.top.toDouble() * scaleY, - rect.right.toDouble() * scaleX, - rect.bottom.toDouble() * scaleY, - ); -} diff --git a/lib/face/utils.dart b/lib/face/utils.dart deleted file mode 100644 index b861937..0000000 --- a/lib/face/utils.dart +++ /dev/null @@ -1,69 +0,0 @@ -import 'dart:async'; -import 'dart:typed_data'; -import 'dart:ui'; -import 'package:camera/camera.dart'; -import 'package:firebase_ml_vision/firebase_ml_vision.dart'; -import 'package:flutter/foundation.dart'; - -typedef HandleDetection = Future> Function(FirebaseVisionImage image); - -Future getCamera(CameraLensDirection dir) async { - return await availableCameras().then( - (List cameras) => cameras.firstWhere( - (CameraDescription camera) => camera.lensDirection == dir, - ), - ); -} - -Uint8List concatenatePlanes(List planes) { - final WriteBuffer allBytes = WriteBuffer(); - planes.forEach((Plane plane) => allBytes.putUint8List(plane.bytes)); - return allBytes.done().buffer.asUint8List(); -} - -FirebaseVisionImageMetadata buildMetaData( - CameraImage image, - ImageRotation rotation, - ) { - return FirebaseVisionImageMetadata( - rawFormat: image.format.raw, - size: Size(image.width.toDouble(), image.height.toDouble()), - rotation: rotation, - planeData: image.planes.map( - (Plane plane) { - return FirebaseVisionImagePlaneMetadata( - bytesPerRow: plane.bytesPerRow, - height: plane.height, - width: plane.width, - ); - }, - ).toList(), - ); -} - -Future> detect( - CameraImage image, - HandleDetection handleDetection, - ImageRotation rotation, - ) async { - return handleDetection( - FirebaseVisionImage.fromBytes( - concatenatePlanes(image.planes), - buildMetaData(image, rotation), - ), - ); -} - -ImageRotation rotationIntToImageRotation(int rotation) { - switch (rotation) { - case 0: - return ImageRotation.rotation0; - case 90: - return ImageRotation.rotation90; - case 180: - return ImageRotation.rotation180; - default: - assert(rotation == 270); - return ImageRotation.rotation270; - } -} diff --git a/lib/main-dev.dart b/lib/main-dev.dart index 0913770..cec96f1 100644 --- a/lib/main-dev.dart +++ b/lib/main-dev.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:logging/logging.dart'; import 'package:fcs/config.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import 'app.dart'; diff --git a/lib/model/base_model.dart b/lib/model/base_model.dart index a85bcea..fac0fb9 100644 --- a/lib/model/base_model.dart +++ b/lib/model/base_model.dart @@ -1,9 +1,9 @@ import 'package:flutter/foundation.dart'; import 'package:fcs/model/api_helper.dart'; -import 'package:fcs/model/main_model.dart'; import '../vo/setting.dart'; import '../vo/user.dart'; +import 'main_model.dart'; abstract class BaseModel extends ChangeNotifier { User user; diff --git a/lib/model/chart_model.dart b/lib/model/chart_model.dart index 62e7209..1c08ad9 100644 --- a/lib/model/chart_model.dart +++ b/lib/model/chart_model.dart @@ -10,7 +10,6 @@ import 'package:fcs/vo/revenue.dart'; import 'base_model.dart'; import 'constants.dart'; -import 'firebase_helper.dart'; class ChartModel extends BaseModel { final log = Logger('ChartModel'); diff --git a/lib/model/main_model.dart b/lib/model/main_model.dart index 4378b62..096a548 100644 --- a/lib/model/main_model.dart +++ b/lib/model/main_model.dart @@ -51,7 +51,7 @@ class MainModel extends ChangeNotifier { phoneNumber: '+95 9 444444444', fcsID: 'FCS-0203-390-2', shippingAddress: - '154-19 64th Ave.Flushing, NY 11367 TEL. +1 (929) 215-2247', + '154-19 64th Ave.Flushing, \nNY 11367 \nTEL. +1 (929) 215-2247', deliveryAddress: '39 42th St. Kyaut Ta Thar Township Yangon'); Setting setting; @@ -70,6 +70,23 @@ class MainModel extends ChangeNotifier { // this.isOnline = _isOnline; // notifyListeners(); // }); + _loadFcs(); + } + + _loadFcs() async { + user = await SharedPref.getUser(); + notifyListeners(); + } + + saveUser(String pin, String phone) { + if (pin == "000000") { + user = User(name: "Owner", phoneNumber: phone); + SharedPref.saveUser(user); + } else { + user = User(name: "Customer", phoneNumber: phone); + SharedPref.saveUser(user); + } + notifyListeners(); } resetPinTimer() { @@ -83,7 +100,7 @@ class MainModel extends ChangeNotifier { } bool isLogin() { - return true; + return this.user != null; } bool hasEmail() { @@ -138,7 +155,6 @@ class MainModel extends ChangeNotifier { void addModel(BaseModel model) { models.add(model); - model.mainModel = this; } void _initUser(User user) { @@ -292,6 +308,10 @@ class MainModel extends ChangeNotifier { } Future logout() async { + this.user = null; + notifyListeners(); + return; + if (this.userListener != null) { await this.userListener.cancel(); } diff --git a/lib/model/notification_model.dart b/lib/model/notification_model.dart index 20e3629..a5ed5b6 100644 --- a/lib/model/notification_model.dart +++ b/lib/model/notification_model.dart @@ -11,25 +11,26 @@ class NotificationModel extends BaseModel { int filer = 0; List notifications = [ Notification( - desc: 'A102A-34-#23', - status: 'delivered', + desc: 'Package delivered!', + status: 'A102A-34-#23', time: DateTime(2020, 4, 28, 10, 32)), Notification( - desc: 'A102A-34-#24', - status: 'picked up', + desc: 'Package in transit!', + status: 'A102A-34-#24', time: DateTime(2020, 4, 26, 9, 32)), Notification( - desc: 'A102A-34-#23', - status: 'sorted', + desc: 'Package delivered!', + status: 'A102A-34-#23', time: DateTime(2020, 4, 24, 10, 32)), Notification( - desc: 'ORDER # 114-0725982-9074639', - status: 'audited', + marketPlace: "Macy", + desc: "Audited received goods!", + status: 'ORDER # 114-0725982-9074639', time: DateTime(2020, 4, 22, 12, 30)), Notification( marketPlace: "Amazon", - desc: 'ORDER # 114-0725982-9074639', - status: 'received', + desc: "Receive goods!", + status: 'ORDER # 323-982-2308', time: DateTime(2020, 4, 22, 12, 22)) ]; diff --git a/lib/model/pickup_model.dart b/lib/model/pickup_model.dart index 08a2920..b54e946 100644 --- a/lib/model/pickup_model.dart +++ b/lib/model/pickup_model.dart @@ -14,7 +14,8 @@ class PickUpModel extends BaseModel { var profile = FCSProfile( id: '1', - usaAddress: '154-19 64th Ave.\nFlushing, NY 11367\nTEL. +1 (929) 215-2247', + usaAddress: + '154-19 64th Ave.\nFlushing, NY 11367\nTEL. +1 (929) 215-2247', mmAddress: 'FCS Trading Myanmar\nRoom 333, Yangon', usaContactNumber: '1 (929) 215-2247', mmContactNumber: '+95 9 700224723', @@ -30,7 +31,8 @@ class PickUpModel extends BaseModel { toTime: '3PM', numberOfPackage: 5, weight: 25, - status: 'pickup', + status: 'Pending', + date: DateTime(2020, 5, 1), address: '154-19 64th Ave.\nFlushing, NY 11367\nTEL. +1 (929) 215-2247'), PickUp( @@ -41,7 +43,8 @@ class PickUpModel extends BaseModel { toTime: '3PM', numberOfPackage: 5, weight: 25, - status: 'pickup', + status: 'Assigned', + date: DateTime(2020, 5, 6), address: '154-19 64th Ave.\nFlushing, NY 11367\nTEL. +1 (929) 215-2247'), PickUp( @@ -52,11 +55,100 @@ class PickUpModel extends BaseModel { toTime: '3PM', numberOfPackage: 5, weight: 25, - status: "delivered", + status: "Pickuped", + date: DateTime(2020, 5, 9), + address: + '154-19 64th Ave.\nFlushing, NY 11367\nTEL. +1 (929) 215-2247'), + PickUp( + id: "P200412 - 12 Apr 2020", + userName: "Ko Kyaw Nyi", + phoneNumber: '+959111111111', + fromTime: '1PM', + toTime: '3PM', + numberOfPackage: 5, + weight: 25, + status: 'Pickuped', + date: DateTime(2020, 5, 15), + address: + '154-19 64th Ave.\nFlushing, NY 11367\nTEL. +1 (929) 215-2247'), + PickUp( + id: "P200125 - 12 May 2020", + userName: "Ko Kyaw Nyi", + phoneNumber: '+959111111111', + fromTime: '1PM', + toTime: '3PM', + numberOfPackage: 5, + weight: 25, + status: 'Pickuped', + date: DateTime(2020, 5, 20), + address: + '154-19 64th Ave.\nFlushing, NY 11367\nTEL. +1 (929) 215-2247'), + PickUp( + id: "P200441 - 13 Apr 2020", + userName: "Ko Kyaw Nyi", + phoneNumber: '+959111111111', + fromTime: '1PM', + toTime: '3PM', + numberOfPackage: 5, + weight: 25, + status: "Pickuped", + date: DateTime(2020, 5, 21), + address: + '154-19 64th Ave.\nFlushing, NY 11367\nTEL. +1 (929) 215-2247'), + PickUp( + id: "P200441 - 10 Apr 2020", + userName: "Ko Kyaw Nyi", + phoneNumber: '+959111111111', + fromTime: '1PM', + toTime: '3PM', + numberOfPackage: 5, + weight: 25, + status: "Canceled", + date: DateTime(2020, 5, 25), + address: + '154-19 64th Ave.\nFlushing, NY 11367\nTEL. +1 (929) 215-2247'), + PickUp( + id: "P200441 - 6 Apr 2020", + userName: "Ko Kyaw Nyi", + phoneNumber: '+959111111111', + fromTime: '1PM', + toTime: '3PM', + numberOfPackage: 5, + weight: 25, + status: "Canceled", + date: DateTime(2020, 5, 27), address: '154-19 64th Ave.\nFlushing, NY 11367\nTEL. +1 (929) 215-2247'), ]; + List get canceled { + List _p = pickups.where((e) => e.status == "Canceled").toList() + ..sort((e1, e2) { + return e2.date.compareTo(e1.date); + }); + return _p; + } + + List get completed { + return pickups.where((e) => e.status == "Pickuped").toList() + ..sort((e1, e2) { + return e2.date.compareTo(e1.date); + }); + } + + List get upcoming { + return pickups + .where((e) => + e.status == "Pending" || + e.status == "Assigned" || + e.status == "Processed" || + e.status == "Rescheduled") + .toList() + ..sort((e1, e2) { + return e2.date.compareTo(e1.date); + }); + } + void initUser(user) { super.initUser(user); } diff --git a/lib/model/po_model.dart b/lib/model/po_model.dart index 5bd6a98..2364c1c 100644 --- a/lib/model/po_model.dart +++ b/lib/model/po_model.dart @@ -11,7 +11,6 @@ import 'package:fcs/vo/po.dart'; import 'package:fcs/vo/popup_menu.dart'; import 'base_model.dart'; -import 'constants.dart'; import 'firebase_helper.dart'; class POSubmissionModel extends BaseModel { diff --git a/lib/model/shared_pref.dart b/lib/model/shared_pref.dart index f35f1aa..bc160a1 100644 --- a/lib/model/shared_pref.dart +++ b/lib/model/shared_pref.dart @@ -60,13 +60,21 @@ class SharedPref { } static _read(String key) async { - final prefs = await SharedPreferences.getInstance(); - return json.decode(prefs.getString(key)); + try { + final prefs = await SharedPreferences.getInstance(); + return json.decode(prefs.getString(key)); + } catch (e) { + print("Error:$e"); + } } static _save(String key, value) async { - final prefs = await SharedPreferences.getInstance(); - prefs.setString(key, json.encode(value)); + try { + final prefs = await SharedPreferences.getInstance(); + prefs.setString(key, json.encode(value)); + } catch (e) { + print("Error:$e"); + } } static _remove(String key) async { diff --git a/lib/model/shipment_rate_model.dart b/lib/model/shipment_rate_model.dart index 0df3e3e..42bc577 100644 --- a/lib/model/shipment_rate_model.dart +++ b/lib/model/shipment_rate_model.dart @@ -22,6 +22,8 @@ class ShipmentRateModel extends BaseModel { price: 8), ]; + int freeDeliveryWeight=10; + void initUser(user) { super.initUser(user); } diff --git a/lib/pages/buying_online.dart b/lib/pages/buying_online.dart index 4bbcf2c..22886d7 100644 --- a/lib/pages/buying_online.dart +++ b/lib/pages/buying_online.dart @@ -1,3 +1,5 @@ +import 'package:fcs/pages/util.dart'; +import 'package:fcs/vo/manual.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:fcs/model/main_model.dart'; @@ -7,6 +9,7 @@ import 'package:fcs/widget/progress.dart'; import '../theme/theme.dart'; import '../widget/label_widgets.dart'; import '../widget/local_text.dart'; +import 'instruction.dart'; import 'manual/manual_page.dart'; class BuyingOnlinePage extends StatefulWidget { @@ -36,7 +39,7 @@ class _BuyingOnlinePagetate extends State { "user.deliveryAddress")); final instructionBox = Container( - padding: EdgeInsets.only(top: 30), + padding: EdgeInsets.only(left: 10, top: 30, bottom: 10), child: Center( child: Wrap( children: [ @@ -56,9 +59,10 @@ class _BuyingOnlinePagetate extends State { child: Container( height: 45.0, decoration: BoxDecoration( - color: primaryColor, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(10.0))), + color: primaryColor, + shape: BoxShape.rectangle, + // borderRadius: BorderRadius.all(Radius.circular(10.0)) + ), child: ButtonTheme( minWidth: 900.0, height: 100.0, @@ -67,8 +71,9 @@ class _BuyingOnlinePagetate extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => ManualPage( - marketplace: 'Amazon', + builder: (context) => InstructionPage( + name: 'Amazon', + image: "assets/amazon_ins.png", ))); }, child: LocalText( @@ -88,9 +93,10 @@ class _BuyingOnlinePagetate extends State { child: Container( height: 45.0, decoration: BoxDecoration( - color: primaryColor, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(10.0))), + color: primaryColor, + shape: BoxShape.rectangle, + // borderRadius: BorderRadius.all(Radius.circular(10.0)) + ), child: ButtonTheme( minWidth: 900.0, height: 100.0, @@ -120,9 +126,10 @@ class _BuyingOnlinePagetate extends State { child: Container( height: 45.0, decoration: BoxDecoration( - color: primaryColor, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(10.0))), + color: primaryColor, + shape: BoxShape.rectangle, + // borderRadius: BorderRadius.all(Radius.circular(10.0)) + ), child: ButtonTheme( minWidth: 900.0, height: 100.0, @@ -151,9 +158,14 @@ class _BuyingOnlinePagetate extends State { inAsyncCall: _isLoading, child: Scaffold( appBar: AppBar( + centerTitle: true, + leading: new IconButton( + icon: new Icon(Icons.close), + onPressed: () => Navigator.of(context).pop(), + ), title: LocalText( context, - "buy_online", + "buy_online.title", fontSize: 20, color: Colors.white, ), @@ -163,36 +175,42 @@ class _BuyingOnlinePagetate extends State { shrinkWrap: true, padding: EdgeInsets.only(top: 10, left: 10, right: 10), children: [ - Center( - child: Text( - mainModel.customer.name, - style: TextStyle( - color: secondaryColor, - fontSize: 16, - fontWeight: FontWeight.bold), - )), - Container( - padding: EdgeInsets.only(top: 15), - child: Row( - children: [ - Padding( - padding: const EdgeInsets.only(right: 8.0), - child: phoneBox, + nameWidget(mainModel.customer.name), + phoneWidget(context, mainModel.customer.phoneNumber), + Row( + children: [ + SizedBox( + width: 25, + height: 25, + child: FittedBox( + child: Image.asset("assets/logo.jpg"), + fit: BoxFit.fill, ), - InkWell( - onTap: () {}, - child: Icon( - Icons.open_in_new, - color: Colors.grey, - size: 15, - ), + ), + fcsIdBox, + Padding( + padding: const EdgeInsets.only(left: 7.0, top: 50), + child: Icon( + Icons.content_copy, + color: Colors.grey, ), - ], - ), + ) + ], ), - fcsIdBox, - shippingAddressBox, - deliveryAddressBox, + Row( + children: [ + Icon(Icons.location_on), + shippingAddressBox, + Padding( + padding: const EdgeInsets.only(left: 7.0, top: 50), + child: Icon( + Icons.content_copy, + color: Colors.grey, + ), + ) + ], + ), + // deliveryAddressBox, instructionBox, amazonbutton, neweggbutton, diff --git a/lib/pages/code_page.dart b/lib/pages/code_page.dart index 307560d..96922e8 100644 --- a/lib/pages/code_page.dart +++ b/lib/pages/code_page.dart @@ -1,5 +1,8 @@ import 'dart:async'; +import 'package:fcs/model/main_model.dart'; +import 'package:fcs/model/shared_pref.dart'; +import 'package:fcs/vo/user.dart'; import 'package:flutter/material.dart'; import 'package:pin_input_text_field/pin_input_text_field.dart'; import 'package:provider/provider.dart'; @@ -182,10 +185,12 @@ class _CodePageState extends State { _resend() async {} _verify() async { - Navigator.push( + Provider.of(context).saveUser(pin,widget.phoneNumber); + await Navigator.push( context, MaterialPageRoute(builder: (context) => UserEditPage()), ); + Navigator.pop(context); } _completeResend() { diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index 7632e84..44e2fda 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -1,4 +1,7 @@ +import 'package:fcs/model/main_model.dart'; +import 'package:fcs/widget/bottom_up_page_route.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:intl/intl.dart'; @@ -68,6 +71,8 @@ typedef BtnCallback(); class _HomePageState extends State { final log = Logger('_HomePageState'); + bool login = false; + bool customer = true; @override void initState() { @@ -91,6 +96,7 @@ class _HomePageState extends State { @override Widget build(BuildContext context) { + login=Provider.of(context).isLogin(); final helpBtn = _buildBtn2("manual.title", icon: FontAwesomeIcons.readme, imgIcon: Image.asset( @@ -100,7 +106,7 @@ class _HomePageState extends State { color: primaryColor, ), btnCallback: () => Navigator.of(context) - .push(MaterialPageRoute(builder: (_) => ManualPage())) + .push(BottomUpPageRoute(ManualPage())) // btnCallback: () => Navigator.of(context) // .push(MaterialPageRoute(builder: (_) => TestList())) ); @@ -130,15 +136,15 @@ class _HomePageState extends State { btnCallback: () => Navigator.of(context) .push(MaterialPageRoute(builder: (_) => ReportList()))); - final pickUpBtn = _buildBtn2("pickup.title", - icon: FontAwesomeIcons.directions, + final pickUpBtn = _buildBtn2("pickup", + icon: MaterialCommunityIcons.directions, btnCallback: () => Navigator.of(context) - .push(MaterialPageRoute(builder: (_) => PickUpList()))); + .push(BottomUpPageRoute(PickUpList()))); - final shipmentCostBtn = _buildBtn2("pickup.title", - icon: FontAwesomeIcons.ship, + final shipmentCostBtn = _buildBtn2("rate", + icon: FontAwesomeIcons.calculator, btnCallback: () => Navigator.of(context) - .push(MaterialPageRoute(builder: (_) => ShipmentRates()))); + .push(BottomUpPageRoute(ShipmentRates()))); final fcsProfileBtn = _buildBtn2("profile.title", icon: Icons.account_circle, @@ -173,7 +179,8 @@ class _HomePageState extends State { btnCallback: () => Navigator.of(context) .push(MaterialPageRoute(builder: (_) => DOList()))); - final shipmentBtn = _buildBtn("shipment.title", + final shipmentBtn = _buildBtn2("shipment.title", + icon: Ionicons.ios_airplane, imgIcon: Image.asset( "assets/truck.png", width: 50, @@ -203,7 +210,6 @@ class _HomePageState extends State { btnCallback: () => Navigator.of(context) .push(MaterialPageRoute(builder: (_) => PDList()))); - final termBtn = _buildBtn2("term.title", icon: FontAwesomeIcons.fileContract, imgIcon: Image.asset( @@ -223,16 +229,13 @@ class _HomePageState extends State { ); }); - final signinBtn = _buildBtn2("login", - icon: FontAwesomeIcons.signInAlt, - btnCallback: () => Navigator.of(context) - .push(MaterialPageRoute(builder: (_) => SigninPage()))); - final buyingBtn = - _buildBtn2("buy_online", icon: Icons.person, btnCallback: () { + final buyingBtn = _buildBtn2("buy_online", + icon: MaterialCommunityIcons.cart_outline, btnCallback: () { Navigator.push( context, - MaterialPageRoute(builder: (context) => BuyingOnlinePage()), + BottomUpPageRoute(BuyingOnlinePage()) + // MaterialPageRoute(builder: (context) => BuyingOnlinePage()), ); }); @@ -240,21 +243,15 @@ class _HomePageState extends State { btnCallback: () { Navigator.push( context, - MaterialPageRoute(builder: (context) => NotificationList()), + BottomUpPageRoute(NotificationList()), ); }); - final staffBtn = _buildBtn("staff.title", - imgIcon: Image.asset( - "assets/employee.png", - width: 40, - height: 40, - color: primaryColor, - ), + final staffBtn = _buildBtn2("staff.title", + icon: SimpleLineIcons.people, btnCallback: () => Navigator.of(context) .push(MaterialPageRoute(builder: (_) => StaffList()))); - final _bankAccountsBtn = _buildBtn2("banks.title", icon: FontAwesomeIcons.moneyCheck, btnCallback: () { Navigator.push( @@ -263,15 +260,14 @@ class _HomePageState extends State { ); }); - List widgets = [helpBtn]; - widgets.add(signinBtn); + List widgets = []; widgets.add(buyingBtn); + widgets.add(pickUpBtn); widgets.add(shipmentBtn); widgets.add(notiBtn); widgets.add(staffBtn); // widgets.add(_bankAccountsBtn); widgets.add(announcementBtn); - widgets.add(pickUpBtn); widgets.add(fcsProfileBtn); widgets.add(shipmentCostBtn); widgets.add(reportBtn); @@ -391,28 +387,44 @@ class _HomePageState extends State { child: Image.asset("assets/logo.jpg", height: 40), borderRadius: new BorderRadius.circular(35.0), ), - actions: [ - IconButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Contact()), - ); - }, - iconSize: 30, - icon: Icon(Icons.notifications), - ), - IconButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Profile()), - ); - }, - iconSize: 30, - icon: Icon(Icons.tune), - ), - ]), + actions: login + ? [ + IconButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Contact()), + ); + }, + iconSize: 30, + icon: Icon(Icons.notifications), + ), + IconButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Profile()), + ); + }, + iconSize: 30, + icon: Icon(Icons.tune), + ), + ] + : [ + FlatButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SigninPage()), + ); + }, + // iconSize: 30, + child: Text("Sign in",style: siginButtonStyle,), + ), + ]), body: Container( decoration: BoxDecoration( gradient: @@ -425,17 +437,17 @@ class _HomePageState extends State { // ], // stops: [0.4, 1.0], // ) - LinearGradient( - begin: Alignment.topCenter, - end: Alignment - .bottomCenter, // 10% of the width, so there are ten blinds. - colors: [ - Color(0xd0272262), - Color(0xfa272262), - // Color(0xa0ff4400), - // secondaryColor, - ], // whitish to gray - ), + LinearGradient( + begin: Alignment.topCenter, + end: Alignment + .bottomCenter, // 10% of the width, so there are ten blinds. + colors: [ + Color(0xd0272262), + Color(0xfa272262), + // Color(0xa0ff4400), + // secondaryColor, + ], // whitish to gray + ), // SweepGradient( // center: FractionalOffset.centerLeft, // startAngle: 0.0, @@ -450,12 +462,26 @@ class _HomePageState extends State { // stops: const [0.0, 0.25, 0.5, 0.75, 1.0], // ), ), - child: ListView(children: [ - Wrap( - alignment: WrapAlignment.center, - children: widgets, - ), - ]) + child: Column( + children: [ + Expanded( + child: ListView(children: [ + Wrap( + alignment: WrapAlignment.center, + children: widgets, + ), + ]), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + _buildSmallButton( + "Policies", FontAwesomeIcons.fileContract), + _buildSmallButton("Support", SimpleLineIcons.support), + ], + ) + ], + ) // child: StaggeredGridView.count( // crossAxisCount: 3, // crossAxisSpacing: 12.0, @@ -580,33 +606,61 @@ class _HomePageState extends State { child: InkWell( splashColor: primaryColor, // inkwell color child: SizedBox( - width: 60, height: 60, child:Icon(icon,color: Colors.white, size: 30) - ), + width: 60, + height: 60, + child: Icon(icon, color: Colors.white, size: 30)), onTap: btnCallback, ), ), ), FittedBox( - fit:BoxFit.fitWidth, - child: Text(AppTranslations.of(context).text(title), - style: - languageModel.isEng - ? - TextStyle( + fit: BoxFit.fitWidth, + child: Text(AppTranslations.of(context).text(title), + style: languageModel.isEng + ? TextStyle( color: Colors.white, fontWeight: FontWeight.w500, fontSize: 14.0, fontFamily: "Roboto") - : TextStyle( - color: Colors.white, - fontWeight: FontWeight.w700, - fontSize: 12.0, - fontFamily: "MyanmarUnicode") - ), + : TextStyle( + color: Colors.white, + fontWeight: FontWeight.w700, + fontSize: 12.0, + fontFamily: "MyanmarUnicode")), ), ]), ), ); } + + Widget _buildSmallButton(String text, IconData iconData) { + return InkWell( + onTap: () => {}, + child: Padding( + padding: const EdgeInsets.all(18.0), + child: Row( + children: [ + IconButton( + icon: Icon(iconData, color: Colors.white70), + color: Colors.white70, + onPressed: null), + // RaisedButton(onPressed: ()=>{},child: Row( + // children: [ + // IconButton( + // icon: Icon(iconData, ), + // onPressed: null), + // Text(text), + // ], + // ),color: Colors.transparent, + // focusColor: Colors.transparent,), + Text( + text, + style: subMenuStyle, + ) + ], + ), + ), + ); + } } diff --git a/lib/pages/instruction.dart b/lib/pages/instruction.dart new file mode 100644 index 0000000..4889b97 --- /dev/null +++ b/lib/pages/instruction.dart @@ -0,0 +1,61 @@ +import 'package:fcs/theme/theme.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:fcs/model/language_model.dart'; +import 'package:fcs/model/main_model.dart'; +import 'package:fcs/model/manual_model.dart'; +import 'package:fcs/pages/manual/manual_item_title_dialog.dart'; +import 'package:fcs/pages/util.dart'; +import 'package:fcs/vo/manual.dart'; +import 'package:fcs/widget/local_text.dart'; +import 'package:fcs/widget/progress.dart'; + +class InstructionPage extends StatefulWidget { + final String image; + final String name; + + const InstructionPage({Key key, this.image, this.name}) : super(key: key); + @override + _InstructionPageState createState() => _InstructionPageState(); +} + +class _InstructionPageState extends State { + TextEditingController _manualVersionController = TextEditingController(); + final double dotSize = 10.0; + List helpList = new List(); + bool isEng; + String versionName; + bool _isLoading = false; + + @override + void initState() { + helpList.clear(); + var manualModel = Provider.of(context, listen: false); + var mainModel = Provider.of(context, listen: false); + versionName = manualModel.version; + helpList = manualModel.getHelpList(mainModel.isBuyer()); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return LocalProgress( + inAsyncCall: _isLoading, + child: Scaffold( + appBar: AppBar( + centerTitle: true, + leading: new IconButton( + icon: new Icon(Icons.close, color: secondaryColor), + onPressed: () => Navigator.of(context).pop(), + ), + title: Text(widget.name), + backgroundColor: primaryColor, + ), + body: Container( + child: FittedBox( + child: Image.asset(widget.image), fit: BoxFit.contain), + ), + ), + ); + } +} diff --git a/lib/pages/manual/manual_page.dart b/lib/pages/manual/manual_page.dart index 8f643f1..7d77b9b 100644 --- a/lib/pages/manual/manual_page.dart +++ b/lib/pages/manual/manual_page.dart @@ -49,6 +49,10 @@ class _ManualPageState extends State { inAsyncCall: _isLoading, child: Scaffold( appBar: AppBar( + leading: new IconButton( + icon: new Icon(Icons.close, color: secondaryColor), + onPressed: () => Navigator.of(context).pop(), + ), title: Text(widget.marketplace == null ? '' : widget.marketplace), backgroundColor: primaryColor, ), diff --git a/lib/pages/notification_list.dart b/lib/pages/notification_list.dart index 1f2bc96..ea3d98d 100644 --- a/lib/pages/notification_list.dart +++ b/lib/pages/notification_list.dart @@ -31,6 +31,11 @@ class _NotificationListState extends State { inAsyncCall: _isLoading, child: Scaffold( appBar: AppBar( + centerTitle: true, + leading: new IconButton( + icon: new Icon(Icons.close, ), + onPressed: () => Navigator.of(context).pop(), + ), backgroundColor: primaryColor, title: LocalText( context, @@ -38,68 +43,6 @@ class _NotificationListState extends State { fontSize: 18, color: Colors.white, ), - // actions: [ - // PopupMenuButton( - // elevation: 3.2, - // onSelected: (selected) { - // setState(() { - // this._selectedIndex = selected.index; - // }); - // notificationModel.filter(selected.index); - // }, - // icon: Container( - // width: 30, - // height: 30, - // decoration: new BoxDecoration( - // shape: BoxShape.circle, - // color: Colors.white, - // ), - // child: Stack( - // fit: StackFit.expand, - // children: [ - // Icon( - // Icons.filter_list, - // color: primaryColor, - // ), - // _selectedIndex != 0 - // ? Positioned( - // bottom: 0, - // right: 0, - // child: Container( - // width: 10, - // height: 10, - // decoration: new BoxDecoration( - // shape: BoxShape.circle, - // color: secondaryColor, - // ), - // ), - // ) - // : Container() - // ], - // )), - // itemBuilder: (BuildContext context) { - // return notificationMenu.map((PopupMenu choice) { - // return PopupMenuItem( - // value: choice, - // child: Row( - // children: [ - // Text(choice.status), - // SizedBox( - // width: 10, - // ), - // _selectedIndex != null && - // _selectedIndex == choice.index - // ? Icon( - // Icons.check, - // color: Colors.grey, - // ) - // : Container(), - // ], - // ), - // ); - // }).toList(); - // }), - // ], ), body: new ListView.separated( separatorBuilder: (context, index) => Divider( @@ -133,25 +76,31 @@ class _NotificationListState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - noti.marketPlace == null - ? Container() - : new Text( - noti.marketPlace, - style: new TextStyle( - fontSize: 15.0, - color: secondaryColor), - ), new Text( noti.getDesc, style: new TextStyle( fontSize: 15.0, - color: secondaryColor), + color: primaryColor), ), - new Text( - noti.status == null ? "" : noti.status, - style: new TextStyle( - fontSize: 13.0, - color: secondaryColor), + noti.marketPlace == null + ? Container() + : Padding( + padding: const EdgeInsets.only(top:8.0), + child: new Text( + noti.marketPlace, + style: new TextStyle( + fontSize: 15.0, + color: primaryColor), + ), + ), + Padding( + padding: const EdgeInsets.only(top:8.0), + child: new Text( + noti.status == null ? "" : noti.status, + style: new TextStyle( + fontSize: 16.0, + color: Colors.grey), + ), ), ], ), @@ -174,32 +123,7 @@ class _NotificationListState extends State { ) ], ), - ), - // noti.seen - // ? Container() - // : new Positioned( - // left: 11, - // top: 11, - // child: new Container( - // padding: EdgeInsets.all(2), - // decoration: new BoxDecoration( - // color: Colors.red, - // borderRadius: BorderRadius.circular(6), - // ), - // constraints: BoxConstraints( - // minWidth: 18, - // minHeight: 18, - // ), - // child: Text( - // 'new', - // style: TextStyle( - // color: Colors.white, - // fontSize: 14, - // ), - // textAlign: TextAlign.center, - // ), - // ), - // ) + ), ], ); }), diff --git a/lib/pages/pickup_editor.dart b/lib/pages/pickup_editor.dart index 8e6e103..2041611 100644 --- a/lib/pages/pickup_editor.dart +++ b/lib/pages/pickup_editor.dart @@ -1,5 +1,9 @@ +import 'package:fcs/model/main_model.dart'; import 'package:fcs/model/pickup_model.dart'; +import 'package:fcs/pages/util.dart'; import 'package:fcs/vo/pickup.dart'; +import 'package:flutter_icons/flutter_icons.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; import 'package:fcs/widget/localization/app_translations.dart'; @@ -56,6 +60,7 @@ class _PickUpEditorState extends State { controller: _addressEditingController, cursorColor: primaryColor, style: textStyle, + minLines: 2, decoration: new InputDecoration( labelText: 'Pickup Address', enabledBorder: UnderlineInputBorder( @@ -139,10 +144,17 @@ class _PickUpEditorState extends State { ]), ); + MainModel mainModel = Provider.of(context); + return LocalProgress( inAsyncCall: _isLoading, child: Scaffold( appBar: AppBar( + centerTitle: true, + leading: new IconButton( + icon: new Icon(Icons.close), + onPressed: () => Navigator.of(context).pop(), + ), backgroundColor: primaryColor, title: Text(AppTranslations.of(context).text("pickup.edit.title")), ), @@ -153,23 +165,54 @@ class _PickUpEditorState extends State { child: Padding( padding: const EdgeInsets.all(20.0), child: ListView(children: [ - Text( - "U Aung Zaw", - style: TextStyle(fontSize: 15.0), + Center(child: nameWidget(mainModel.customer.name)), + phoneWidget(context, mainModel.customer.phoneNumber), + Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: Icon(Icons.location_on), + ), + Expanded(child: pickUpAddress), + ], ), - Text( - "+82054857695", - style: TextStyle(fontSize: 15.0), + SizedBox(height: 25), + Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: Icon(Icons.timer), + ), + Text('Pickup Time', + style: TextStyle(color: Colors.grey, fontSize: 18)), + ], + ), + SizedBox(height: 5), + Padding( + padding: const EdgeInsets.only(left: 33), + child: pickupTime, ), - pickUpAddress, SizedBox(height: 15), - Text('Pickup Time'), - SizedBox(height: 15), - pickupTime, - SizedBox(height: 15), - noOfPackageBox, - SizedBox(height: 15), - weightBox + Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: Icon(Octicons.package), + ), + Expanded(child: noOfPackageBox), + ], + ), + SizedBox( + height: 15, + ), + fcsInput("Total Weight (lb)", FontAwesomeIcons.weightHanging), + SizedBox( + height: 15, + ), + widget.pickUp != null + ? fcsDropDown("Assigned", MaterialCommunityIcons.worker) + : Container(), + fcsInput("Remark", MaterialCommunityIcons.note) ]), )), widget.pickUp == null @@ -179,9 +222,7 @@ class _PickUpEditorState extends State { child: Container( width: 250, child: FlatButton( - shape: new RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(10)), - child: Text('Request'), + child: Text('Request for pickup'), color: primaryColor, textColor: Colors.white, onPressed: () { @@ -198,10 +239,7 @@ class _PickUpEditorState extends State { child: Container( width: 250, child: FlatButton( - shape: new RoundedRectangleBorder( - borderRadius: - new BorderRadius.circular(10)), - child: Text('Pickuped'), + child: Text('Update'), color: primaryColor, textColor: Colors.white, onPressed: () { @@ -215,11 +253,8 @@ class _PickUpEditorState extends State { child: Container( width: 250, child: FlatButton( - shape: new RoundedRectangleBorder( - borderRadius: - new BorderRadius.circular(10)), - child: Text('Cancel'), - color: Colors.blue, + child: Text('Cancel Pickup'), + color: Colors.grey[600], textColor: Colors.white, onPressed: () { Navigator.pop(context); diff --git a/lib/pages/pickup_list.dart b/lib/pages/pickup_list.dart index 8f2f414..1ec9237 100644 --- a/lib/pages/pickup_list.dart +++ b/lib/pages/pickup_list.dart @@ -38,133 +38,127 @@ class _PickUpListState extends State { @override Widget build(BuildContext context) { - var pickupModel = Provider.of(context); - return LocalProgress( inAsyncCall: _isLoading, - child: Scaffold( - appBar: AppBar( - backgroundColor: primaryColor, - title: Text(AppTranslations.of(context).text("pickup.title")), - actions: [ - IconButton( - icon: Icon( - Icons.search, - color: Colors.white, + child: DefaultTabController( + length: 3, + child: Scaffold( + appBar: AppBar( + centerTitle: true, + leading: new IconButton( + icon: new Icon(Icons.close), + onPressed: () => Navigator.of(context).pop(), ), - iconSize: 30, - onPressed: () => showPlacesSearch(context), - ), - PopupMenuButton( - elevation: 3.2, - onSelected: (selected) {}, - icon: Container( - width: 30, - height: 30, - decoration: new BoxDecoration( - shape: BoxShape.circle, - color: Colors.white, - ), - child: Stack( - fit: StackFit.expand, - children: [ - Icon( - Icons.sort, - color: primaryColor, - ), - ], - )), - itemBuilder: (BuildContext context) { - return userMenu.map((PopupMenu choice) { - return PopupMenuItem( - value: choice, - child: Container( - padding: EdgeInsets.only(left: 8), - child: Row( - children: [ - Text(choice.status), - SizedBox( - width: 10, - ), - ], - ), - ), - ); - }).toList(); - }), - PopupMenuButton( - elevation: 3.2, - onSelected: (selected) { - String status; - }, - icon: Container( - width: 30, - height: 30, - decoration: new BoxDecoration( - shape: BoxShape.circle, - color: Colors.white, - ), - child: Stack( - fit: StackFit.expand, - children: [ - Icon( - Icons.filter_list, - color: primaryColor, - ), - ], - )), - itemBuilder: (BuildContext context) { - return buyerStatusMenu.map((PopupMenu choice) { - return PopupMenuItem( - value: choice, - child: Row( - children: [ - Text(choice.status), - SizedBox( - width: 10, - ), - ], - ), - ); - }).toList(); - }), - ], - ), - body: Column( - children: [ - Expanded( - child: new ListView.builder( - scrollDirection: Axis.vertical, - padding: EdgeInsets.only(top: 15), - shrinkWrap: true, - itemCount: pickupModel.pickups.length, - itemBuilder: (BuildContext context, int index) { - return PickupListRow(pickUp: pickupModel.pickups[index]); - }), - ), - Align( - alignment: Alignment.bottomCenter, - child: Center( - child: Container( - width: 250, - child: FlatButton( - shape: new RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(10)), - child: Text(AppTranslations.of(context).text("pickup.new")), - color: primaryColor, - textColor: Colors.white, - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => new PickUpEditor()), - ); - }, + backgroundColor: primaryColor, + title: Text(AppTranslations.of(context).text("pickup.title")), + actions: [ + IconButton( + icon: Icon( + Icons.search, + color: Colors.white, ), - ))) - ], - ), + iconSize: 30, + onPressed: () => showPlacesSearch(context), + ), + ], + bottom: TabBar( + unselectedLabelColor: Colors.grey, + tabs: [ + Tab( + text: "Upcoming", + ), + Tab(text: "Completed"), + Tab(text: "Canceled"), + ], + ), + ), + floatingActionButton: FloatingActionButton.extended( + onPressed: () { + _newPickup(); + }, + icon: Icon(Icons.add), + label: Text(AppTranslations.of(context).text("pickup.new")), + backgroundColor: primaryColor, + ), + body: TabBarView( + children: [ + //Icon(Icons.directions_car), + _upComing(), + _completed(), + _canceled() + ], + )), ), ); } + + _newPickup() { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => new PickUpEditor()), + ); + } + + Widget _upComing() { + var pickupModel = Provider.of(context); + return Column( + children: [ + Expanded( + child: new ListView.separated( + separatorBuilder: (context, index) => Divider( + color: Colors.black, + ), + scrollDirection: Axis.vertical, + padding: EdgeInsets.only(top: 15), + shrinkWrap: true, + itemCount: pickupModel.upcoming.length, + itemBuilder: (BuildContext context, int index) { + return PickupListRow(pickUp: pickupModel.upcoming[index]); + }), + ), + ], + ); + } + + Widget _completed() { + var pickupModel = Provider.of(context); + return Column( + children: [ + Expanded( + child: new ListView.separated( + separatorBuilder: (context, index) => Divider( + color: Colors.black, + ), + scrollDirection: Axis.vertical, + padding: EdgeInsets.only(top: 15), + shrinkWrap: true, + itemCount: pickupModel.completed.length, + itemBuilder: (BuildContext context, int index) { + return PickupListRow(pickUp: pickupModel.completed[index]); + }), + ), + ], + ); + } + + Widget _canceled() { + var pickupModel = Provider.of(context); + return Column( + children: [ + Expanded( + child: new ListView.separated( + separatorBuilder: (context, index) => Divider( + color: Colors.black, + ), + scrollDirection: Axis.vertical, + padding: EdgeInsets.only(top: 15), + shrinkWrap: true, + itemCount: pickupModel.canceled.length, + itemBuilder: (BuildContext context, int index) { + return PickupListRow(pickUp: pickupModel.canceled[index]); + }), + ), + ], + ); + } } diff --git a/lib/pages/pickup_list_row.dart b/lib/pages/pickup_list_row.dart index c8a9890..94f3703 100644 --- a/lib/pages/pickup_list_row.dart +++ b/lib/pages/pickup_list_row.dart @@ -41,75 +41,78 @@ class _PickupListRowState extends State { print('_pickup $_pickUp'); return Container( padding: EdgeInsets.only(left: 15, right: 15), - child: Card( - elevation: 10, - color: Colors.white, - child: InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PickUpEditor(pickUp: _pickUp)), - ); - }, - child: Row( - children: [ - Expanded( - child: new Padding( - padding: const EdgeInsets.symmetric(vertical: 16.0), - child: new Row( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PickUpEditor(pickUp: _pickUp)), + ); + }, + child: Row( + children: [ + Expanded( + child: new Padding( + padding: const EdgeInsets.symmetric(vertical: 16.0), + child: new Row( + children: [ + new Expanded( + child: new Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0), + child: new Text( + _pickUp.id == null ? '' : _pickUp.id, + style: new TextStyle( + fontSize: 15.0, color: Colors.black), + ), + ), + Padding( + padding: const EdgeInsets.only(left: 10.0, top: 10), + child: new Text( + _pickUp.id == null ? '' : "Last ${_pickUp.last} days" , + style: new TextStyle( + fontSize: 15.0, color: Colors.grey), + ), + ) + ], + ), + ), + ], + ), + ), + ), + Column( + children: [ + Padding( + padding: const EdgeInsets.all(0), + child: getStatus(_pickUp.status), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0,top:5,bottom: 5), + child: Row( children: [ - new Expanded( - child: new Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.only(left: 8.0), - child: new Text( - _pickUp.id == null ? '' : _pickUp.id, - style: new TextStyle( - fontSize: 15.0, color: Colors.black), - ), - ), - Padding( - padding: const EdgeInsets.only(left: 8.0), - child: Row( - children: [ - new Text( - _pickUp.weight == null - ? '' - : _pickUp.weight.toString() + 'lb - ', - style: new TextStyle( - fontSize: 15.0, color: Colors.grey), - ), - new Text( - _pickUp.numberOfPackage == null - ? "" - : _pickUp.numberOfPackage.toString() + - ' packages', - style: new TextStyle( - fontSize: 15.0, color: Colors.grey), - ), - ], - ), - ), - ], - ), + new Text( + _pickUp.weight == null + ? '' + : _pickUp.weight.toString() + 'lb - ', + style: + new TextStyle(fontSize: 15.0, color: Colors.grey), + ), + new Text( + _pickUp.numberOfPackage == null + ? "" + : _pickUp.numberOfPackage.toString() + ' packages', + style: + new TextStyle(fontSize: 15.0, color: Colors.grey), ), ], ), ), - ), - Row( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: getStatus(_pickUp.status), - ), - ], - ) - ], - ), + ], + ) + ], ), ), ); diff --git a/lib/pages/profile_page.dart b/lib/pages/profile_page.dart index b7ec792..29ab14d 100644 --- a/lib/pages/profile_page.dart +++ b/lib/pages/profile_page.dart @@ -223,6 +223,8 @@ class _ProfileState extends State { _isLoading = true; }); await mainModel.logout(); + Navigator.pop(context); + // Navigator.of(context) // .pushNamedAndRemoveUntil("/", ModalRoute.withName('/')); Future.delayed(Duration(seconds: 1), () { diff --git a/lib/pages/shipment_rates.dart b/lib/pages/shipment_rates.dart index 977e633..a7c8b36 100644 --- a/lib/pages/shipment_rates.dart +++ b/lib/pages/shipment_rates.dart @@ -1,5 +1,7 @@ import 'package:fcs/model/pickup_model.dart'; import 'package:fcs/model/shipment_rate_model.dart'; +import 'package:fcs/pages/shipment_rates_calculate.dart'; +import 'package:fcs/pages/shipment_rates_edit.dart'; import 'package:fcs/vo/pickup.dart'; import 'package:provider/provider.dart'; import 'package:fcs/widget/localization/app_translations.dart'; @@ -8,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:fcs/widget/progress.dart'; import '../theme/theme.dart'; +import 'util.dart'; class ShipmentRates extends StatefulWidget { final PickUp pickUp; @@ -28,6 +31,14 @@ class _ShipmentRatesState extends State { PickUp _pickUp; bool _isLoading = false; + List texts = [ + "Minimum shipping weight is 1lbs.", + "Oversized goods, Light weight/Large volume items, laptops, phones, tablets may incur extra charges based on specifications. Please contact us for pricing.", + "Goods with lithium battary needs extra packaging and declaration. Please inform us ahead of time so that we can process your package accordingly.", + "Loose Batteries, Drones, and Prescription medicines are not allowed on aircraft.", + "Payment: We accept money orders, any US bank transfers via Zelle, AYA, KBZ and CB. No COD except for pick-ups.", + "Payments made in Myanmar will incur 2% tranfer fee" + ]; @override void initState() { @@ -51,6 +62,13 @@ class _ShipmentRatesState extends State { Widget build(BuildContext context) { var shipmentRateModel = Provider.of(context); + var textList = texts + .map( + (e) => TextSpan( + text: "\n * " + e + "\n", + style: TextStyle(fontWeight: FontWeight.normal, fontSize: 13)), + ) + .toList(); final usaAddress = Container( child: TextFormField( maxLines: null, @@ -66,240 +84,91 @@ class _ShipmentRatesState extends State { ), )); - final mmAddress = Container( - height: 50.0, - child: Row(children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text('Yangon, Myanmar Office'), - ), - Expanded( - child: TextFormField( - controller: _noOfPackageEditingController, - cursorColor: primaryColor, - textAlign: TextAlign.left, - decoration: InputDecoration( - contentPadding: EdgeInsets.all(10.0), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey[300], width: 2), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: primaryColor, width: 2.0), - ), - ), - )), - ]), - ); - - final contactNumber = Container( - height: 50.0, - child: Row(children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text('USA contact number'), - ), - Expanded( - child: TextFormField( - controller: _weightEditingController, - cursorColor: primaryColor, - textAlign: TextAlign.left, - decoration: InputDecoration( - contentPadding: EdgeInsets.all(10.0), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey[300], width: 2), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: primaryColor, width: 2.0), - ), - ), - )), - ]), - ); - - final mmContactNumber = Container( - height: 50.0, - child: Row(children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text('Myanmar contact number'), - ), - Expanded( - child: TextFormField( - controller: _weightEditingController, - cursorColor: primaryColor, - textAlign: TextAlign.left, - decoration: InputDecoration( - contentPadding: EdgeInsets.all(10.0), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey[300], width: 2), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: primaryColor, width: 2.0), - ), - ), - )), - ]), - ); - - final mailBox = Container( - height: 50.0, - child: Row(children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text('Email Address'), - ), - Expanded( - child: TextFormField( - controller: _weightEditingController, - cursorColor: primaryColor, - textAlign: TextAlign.left, - decoration: InputDecoration( - contentPadding: EdgeInsets.all(10.0), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey[300], width: 2), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: primaryColor, width: 2.0), - ), - ), - )), - ]), - ); - - final fbLinkBox = Container( - height: 50.0, - child: Row(children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text('Facebook Link'), - ), - Expanded( - child: TextFormField( - controller: _weightEditingController, - cursorColor: primaryColor, - textAlign: TextAlign.left, - decoration: InputDecoration( - contentPadding: EdgeInsets.all(10.0), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey[300], width: 2), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: primaryColor, width: 2.0), - ), - ), - )), - ]), - ); - return LocalProgress( inAsyncCall: _isLoading, child: Scaffold( appBar: AppBar( + centerTitle: true, + leading: new IconButton( + icon: new Icon( + Icons.close, + ), + onPressed: () => Navigator.of(context).pop(), + ), backgroundColor: primaryColor, - title: Text(AppTranslations.of(context).text("pickup.edit.title")), + title: Text(AppTranslations.of(context).text("rate.title")), ), - body: Card( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + body: Padding( + padding: const EdgeInsets.all(8.0), + child: ListView( + // crossAxisAlignment: CrossAxisAlignment.center, children: [ - SizedBox( - height: 250, - // child: Image.asset( - // 'assets/logo.jpg', - // ), - ), - Padding( - padding: const EdgeInsets.only(left: 20.0), - child: Text('Rates', - style: - TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - Padding( - padding: const EdgeInsets.only(left: 20.0), - child: Text('Most affortable rate', - style: TextStyle(fontSize: 14.0)), - ), Container( - height: 100, - child: Padding( - padding: const EdgeInsets.all(20.0), - child: ListView.builder( - itemCount: shipmentRateModel.rates.length, - itemBuilder: (context, index) { - return Container( - child: Row( - children: [ - Text( - '${shipmentRateModel.rates[index].description} - '), - Text( - '\$${shipmentRateModel.rates[index].price} per lb', - style: TextStyle(color: Colors.blueAccent), - ) - ], - )); - })), + height: 135, + child: ListView.builder( + itemCount: shipmentRateModel.rates.length, + itemBuilder: (context, index) { + return _row( + shipmentRateModel.rates[index].description, + "\$ " +shipmentRateModel.rates[index].price.toString(), + 'per pound'); + }), ), - widget.pickUp == null - ? Align( - alignment: Alignment.bottomCenter, - child: Center( - child: Container( - width: 250, - child: FlatButton( - shape: new RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(10)), - child: Text('Calculate my packages'), - color: primaryColor, - textColor: Colors.white, - onPressed: () { - Navigator.pop(context); - }, - ), - ))) - : Container( - child: Column( - children: [ - Align( - alignment: Alignment.bottomCenter, - child: Center( - child: Container( - width: 250, - child: FlatButton( - shape: new RoundedRectangleBorder( - borderRadius: - new BorderRadius.circular(10)), - child: Text('Pickuped'), - color: primaryColor, - textColor: Colors.white, - onPressed: () { - Navigator.pop(context); - }, - ), - ))), - Align( - alignment: Alignment.bottomCenter, - child: Center( - child: Container( - width: 250, - child: FlatButton( - shape: new RoundedRectangleBorder( - borderRadius: - new BorderRadius.circular(10)), - child: Text('Cancel'), - color: primaryColor, - textColor: Colors.white, - onPressed: () { - Navigator.pop(context); - }, - ), - ))) - ], - )) + _row("Free delivery within Yangon \nfor shipments over","10","pounds"), + _row("Delivery fees","\$ 5","below 10 pounds"), + Padding( + padding: const EdgeInsets.only(left: 18.0, right: 18), + child: RichText( + // overflow: TextOverflow.fade, + text: TextSpan( + style: TextStyle(color: primaryColor), + children: textList, + ), + ), + ), + fcsButton(context, "Calculate", callack: () { + Navigator.of(context) + .push(MaterialPageRoute(builder: (_) => ShipmentRatesCal())); + }), + fcsButton(context, "Edit", callack: () { + Navigator.of(context) + .push(MaterialPageRoute(builder: (_) => ShipmentRatesEdit())); + }), + SizedBox(height:10) ], ), ), ), ); } + + _row(String desc, String price, String unit) { + return Container( + padding: EdgeInsets.only(left: 25, top: 5, bottom: 5), + child: Row( + children: [ + Text('$desc ', style: TextStyle(fontSize: 15)), + Spacer(), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 3.0), + child: Text( + '$price', + style: TextStyle(color: primaryColor, fontSize: 14), + ), + ), + Text( + '$unit', + style: TextStyle(color: Colors.grey, fontSize: 14), + ), + ], + ), + SizedBox( + width: 50, + ), + ], + )); + } } diff --git a/lib/pages/shipment_rates_calculate.dart b/lib/pages/shipment_rates_calculate.dart new file mode 100644 index 0000000..045c7b2 --- /dev/null +++ b/lib/pages/shipment_rates_calculate.dart @@ -0,0 +1,127 @@ +import 'package:fcs/model/pickup_model.dart'; +import 'package:fcs/model/shipment_rate_model.dart'; +import 'package:fcs/pages/shipment_rates_calculate.dart'; +import 'package:fcs/pages/shipment_rates_edit.dart'; +import 'package:fcs/vo/pickup.dart'; +import 'package:provider/provider.dart'; +import 'package:fcs/widget/localization/app_translations.dart'; + +import 'package:flutter/material.dart'; +import 'package:fcs/widget/progress.dart'; + +import '../theme/theme.dart'; +import 'util.dart'; + +class ShipmentRatesCal extends StatefulWidget { + final PickUp pickUp; + ShipmentRatesCal({this.pickUp}); + + @override + _ShipmentRatesCalState createState() => _ShipmentRatesCalState(); +} + +class _ShipmentRatesCalState extends State { + TextEditingController _addressEditingController = new TextEditingController(); + TextEditingController _fromTimeEditingController = + new TextEditingController(); + TextEditingController _toTimeEditingController = new TextEditingController(); + TextEditingController _noOfPackageEditingController = + new TextEditingController(); + TextEditingController _weightEditingController = new TextEditingController(); + + PickUp _pickUp; + bool _isLoading = false; + + @override + void initState() { + super.initState(); + if (widget.pickUp != null) { + _pickUp = widget.pickUp; + _addressEditingController.text = _pickUp.address; + _fromTimeEditingController.text = _pickUp.fromTime; + _toTimeEditingController.text = _pickUp.toTime; + _noOfPackageEditingController.text = _pickUp.numberOfPackage.toString(); + _weightEditingController.text = _pickUp.weight.toString(); + } + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + var shipmentRateModel = Provider.of(context); + return LocalProgress( + inAsyncCall: _isLoading, + child: Scaffold( + appBar: AppBar( + centerTitle: true, + backgroundColor: primaryColor, + title: Text(AppTranslations.of(context).text("rate.title")), + ), + body: Padding( + padding: const EdgeInsets.all(8.0), + child: ListView( + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + height: 185, + child: ListView.builder( + itemCount: shipmentRateModel.rates.length, + itemBuilder: (context, index) { + return _row( + shipmentRateModel.rates[index].description + + "\n\$ " + + shipmentRateModel.rates[index].price.toString() + + " per pound", + '', + "",input: true); + }), + ), + SizedBox(height: 50), + Center(child: Text("Delivery fee:\$ 5",style: TextStyle(color:primaryColor,fontSize:16),)), + SizedBox(height: 20), + Center(child: Text("Total estimated amount:\$ 38",style: TextStyle(color:primaryColor,fontSize:20),)) + ], + ), + ), + ), + ); + } + + _row(String desc, String price, String unit,{bool input}) { + return Container( + padding: EdgeInsets.only(left: 25, top: 5, bottom: 5), + child: Row( + children: [ + Text('$desc ', style: TextStyle(fontSize: 15)), + Spacer(), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 3.0), + child: Text( + '$price', + style: TextStyle(color: primaryColor, fontSize: 14), + ), + ), + Text( + '$unit', + style: TextStyle(color: Colors.grey, fontSize: 14), + ), + // TextFormField(), + ], + ), + SizedBox( + width: 50, + ), + Container( + width: 70, + child: TextField(textAlign: TextAlign.end,)), + ], + )); + } +} diff --git a/lib/pages/shipment_rates_edit.dart b/lib/pages/shipment_rates_edit.dart new file mode 100644 index 0000000..2bc1af1 --- /dev/null +++ b/lib/pages/shipment_rates_edit.dart @@ -0,0 +1,154 @@ +import 'package:fcs/model/pickup_model.dart'; +import 'package:fcs/model/shipment_rate_model.dart'; +import 'package:fcs/vo/pickup.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; +import 'package:fcs/widget/localization/app_translations.dart'; + +import 'package:flutter/material.dart'; +import 'package:fcs/widget/progress.dart'; + +import '../theme/theme.dart'; +import 'util.dart'; + +class ShipmentRatesEdit extends StatefulWidget { + final PickUp pickUp; + ShipmentRatesEdit({this.pickUp}); + + @override + _ShipmentRatesEditState createState() => _ShipmentRatesEditState(); +} + +class _ShipmentRatesEditState extends State { + TextEditingController _addressEditingController = new TextEditingController(); + TextEditingController _fromTimeEditingController = + new TextEditingController(); + TextEditingController _toTimeEditingController = new TextEditingController(); + TextEditingController _noOfPackageEditingController = + new TextEditingController(); + TextEditingController _weightEditingController = new TextEditingController(); + + PickUp _pickUp; + bool _isLoading = false; + List texts = [ + "Minimum shipping weight is 1lbs.", + "Oversized goods, Light weight/Large volume items, laptops, phones, tablets may incur extra charges based on specifications. Please contact us for pricing.", + "Goods with lithium battary needs extra packaging and declaration. Please inform us ahead of time so that we can process your package accordingly.", + "Loose Batteries, Drones, and Prescription medicines are not allowed on aircraft.", + "Payment: We accept money orders, any US bank transfers via Zelle, AYA, KBZ and CB. No COD except for pick-ups.", + "Payments made in Myanmar will incur 2% tranfer fee" + ]; + + @override + void initState() { + super.initState(); + if (widget.pickUp != null) { + _pickUp = widget.pickUp; + _addressEditingController.text = _pickUp.address; + _fromTimeEditingController.text = _pickUp.fromTime; + _toTimeEditingController.text = _pickUp.toTime; + _noOfPackageEditingController.text = _pickUp.numberOfPackage.toString(); + _weightEditingController.text = _pickUp.weight.toString(); + } + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + var shipmentRateModel = Provider.of(context); + + var textList = texts + .map( + (e) => TextSpan( + text: "\n * " + e + "\n", + style: TextStyle(fontWeight: FontWeight.normal, fontSize: 13)), + ) + .toList(); + + return LocalProgress( + inAsyncCall: _isLoading, + child: Scaffold( + appBar: AppBar( + centerTitle: true, + leading: new IconButton( + icon: new Icon( + Icons.close, + ), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: primaryColor, + title: Text(AppTranslations.of(context).text("rate.edit.title")), + ), + body: Container( + padding: EdgeInsets.all(18), + child: ListView( + children: [ + Container( + height: 145, + child: ListView.builder( + itemCount: shipmentRateModel.rates.length, + itemBuilder: (context, index) { + return fcsInput( + shipmentRateModel.rates[index].description, + Icons.attach_money, + value: + shipmentRateModel.rates[index].price.toString()); + }), + ), + fcsInput("Min Weight for Free delivery within Yangon", + FontAwesomeIcons.weightHanging, + value: "10"), + fcsInput("Delivery fees", Icons.attach_money, value: "5"), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8), + child: RichText( + // overflow: TextOverflow.fade, + text: TextSpan( + style: TextStyle(color: primaryColor), + children: textList, + ), + ), + ), + fcsButton(context, "Save", callack: () {}), + SizedBox(height: 10) + ], + ), + ), + ), + ); + } + + _row(String desc, String price, String unit) { + return Container( + padding: EdgeInsets.only(left: 25, top: 5, bottom: 5), + child: Row( + children: [ + Text('$desc ', style: TextStyle(fontSize: 15)), + Spacer(), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 3.0), + child: Text( + '$price', + style: TextStyle(color: primaryColor, fontSize: 14), + ), + ), + Text( + '$unit', + style: TextStyle(color: Colors.grey, fontSize: 14), + ), + ], + ), + SizedBox( + width: 50, + ), + ], + )); + } +} diff --git a/lib/pages/signin_page.dart b/lib/pages/signin_page.dart index 7a8f67c..cb6728b 100644 --- a/lib/pages/signin_page.dart +++ b/lib/pages/signin_page.dart @@ -162,11 +162,12 @@ class _SigninPageState extends State { : phoneNumber; phoneNumber = dialCode + phoneNumber; - Navigator.push( + await Navigator.push( context, MaterialPageRoute( builder: (context) => CodePage(phoneNumber: phoneNumber))); - + Navigator.pop(context); + if (exp != null) throw exp; } catch (e) { showMsgDialog(context, "Error", e.toString()); diff --git a/lib/pages/splash.dart b/lib/pages/splash.dart index 9f3ad71..ef1fbae 100644 --- a/lib/pages/splash.dart +++ b/lib/pages/splash.dart @@ -1,16 +1,12 @@ import 'dart:async'; -import 'dart:io' show Platform; -import 'dart:io'; -import 'package:flutter/material.dart'; -import 'package:google_api_availability/google_api_availability.dart'; -import 'package:logging/logging.dart'; -import 'package:provider/provider.dart'; import 'package:fcs/model/main_model.dart'; -import 'package:fcs/model/shared_pref.dart'; import 'package:fcs/theme/theme.dart'; import 'package:fcs/widget/local_text.dart'; import 'package:fcs/widget/localization/app_translations.dart'; +import 'package:flutter/material.dart'; +import 'package:logging/logging.dart'; +import 'package:provider/provider.dart'; class SplashScreen extends StatefulWidget { @override @@ -30,7 +26,7 @@ class _SplashScreenState extends State { Timer timer; startTime() async { - var _duration = new Duration(milliseconds: 500); + var _duration = new Duration(milliseconds: 1000); this.timer = new Timer.periodic(_duration, navigationPage); } @@ -55,7 +51,7 @@ class _SplashScreenState extends State { if (_loaded) { timer.cancel(); - Navigator.of(context).pushReplacementNamed('/home'); + Navigator.of(context).pushReplacementNamed('/home'); // if (_isSupport) { // if (_isLogin) { // if (!_isAgree) { @@ -92,7 +88,7 @@ class _SplashScreenState extends State { MainModel mainModel = Provider.of(context); this._loaded = mainModel.isLoaded; - this._isSupport = mainModel.isSupport(); + this._isSupport = true; this._isLogin = mainModel.isLogin(); this._isAgree = mainModel.agreedTerm(); this._hasEmail = mainModel.hasEmail(); @@ -105,13 +101,25 @@ class _SplashScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ new Image.asset( - "assets/logo.png", + "assets/logo.jpg", width: 180, ), SizedBox(height: 50), - CircularProgressIndicator( - valueColor: new AlwaysStoppedAnimation(primaryColor), + Column( + children: [ + Text( + "Cargo Services", + style: welcomeLabelStyle, + ), + Text( + "by FCS Trading", + style: welcomeSubLabelStyle, + ), + ], ), + // CircularProgressIndicator( + // valueColor: new AlwaysStoppedAnimation(primaryColor), + // ), SizedBox(height: 30), _isOnline ? Container() diff --git a/lib/pages/user_edit.dart b/lib/pages/user_edit.dart index 8c90ec2..c7cd89c 100644 --- a/lib/pages/user_edit.dart +++ b/lib/pages/user_edit.dart @@ -1,3 +1,4 @@ +import 'package:fcs/model/shared_pref.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -108,5 +109,7 @@ class _UserEditPageState extends State { ); } - _submit() async {} + _submit() async { + Navigator.pop(context); + } } diff --git a/lib/pages/util.dart b/lib/pages/util.dart index 85638ba..8102ea5 100644 --- a/lib/pages/util.dart +++ b/lib/pages/util.dart @@ -1,3 +1,4 @@ +import 'package:fcs/widget/label_widgets.dart'; import 'package:flutter/material.dart'; import 'package:flutter_colorpicker/flutter_colorpicker.dart'; import 'package:logging/logging.dart'; @@ -234,22 +235,66 @@ Widget getStatus(String status) { status, style: TextStyle(color: Colors.white, fontSize: 12), )) - : status == "pickup" + : status == "Pickuped" ? Text( status, - style: TextStyle(color: Colors.red, fontSize: 12), + style: TextStyle( + color: primaryColor, + fontSize: 18, + fontWeight: FontWeight.bold), ) - : status == "delivered" - ? Text( - status, - style: TextStyle(color: Colors.green, fontSize: 12), + : status == "Pending" || status == "Rescheduled" + ? Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Icon(Icons.schedule), + ), + Text( + status, + style: TextStyle( + color: primaryColor, + fontSize: 18, + fontWeight: FontWeight.bold), + ) + ], ) - : Chip( - avatar: Icon( - Icons.check, - size: 14, - ), - label: Text(status)); + : status == "Assigned" + ? Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Icon(Icons.check), + ), + Text( + status, + style: TextStyle( + color: primaryColor, + fontSize: 18, + fontWeight: FontWeight.bold), + ) + ], + ) + : status == "Canceled" + ? Text( + status, + style: TextStyle( + color: primaryColor, + fontSize: 18, + fontWeight: FontWeight.bold), + ) + : status == "Delivered" + ? Text( + status, + style: TextStyle( + color: Colors.green, fontSize: 12), + ) + : Chip( + avatar: Icon( + Icons.check, + size: 14, + ), + label: Text(status)); } call(BuildContext context, String phone) { @@ -325,3 +370,131 @@ Future displayNotiContent( showMsgDialog(context, "Error", "Notification item not found!"); } finally {} } + +Widget nameWidget(String name) { + return Center( + child: Padding( + padding: const EdgeInsets.only(left: 10.0, top: 8), + child: Text( + name, + style: TextStyle( + color: Colors.black87, fontSize: 18, fontWeight: FontWeight.bold), + ), + ), + ); +} + +Widget phoneWidget(BuildContext context, String phone) { + return Container( + padding: EdgeInsets.only(top: 10), + child: Row( + children: [ + Icon(Icons.phone), + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: labeledText(context, phone, "user.phone"), + ), + ], + ), + ); +} + +Widget fcsInput(String label, IconData iconData, + {TextEditingController controller,String value}) { + return Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: Icon(iconData), + ), + Expanded( + child: Container( + height: 50.0, + child: Row(children: [ + Expanded( + child: TextFormField( + initialValue: value, + controller: controller, + cursorColor: primaryColor, + textAlign: TextAlign.left, + decoration: new InputDecoration( + contentPadding: EdgeInsets.only(top: 8), + labelText: label, + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: primaryColor, width: 1.0)), + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: primaryColor, width: 1.0)), + ), + )), + ]), + )), + ], + ); +} + +Widget fcsDropDown(String label, IconData iconData, + {TextEditingController controller}) { + return Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: Icon(iconData), + ), + Expanded( + child: Container( + height: 50.0, + child: Row(children: [ + Expanded(child: _dropDown()), + ]), + )), + ], + ); +} + +Widget _dropDown() { + return DropdownButton( + value: "Ko Nge", + icon: Icon(Icons.arrow_downward), + iconSize: 24, + elevation: 16, + // style: TextStyle(color: Colors.deepPurple), + underline: Container( + height: 2, + color: primaryColor, + ), + onChanged: (String newValue) {}, + items: ['Ko Nge', 'Two', 'Free', 'Four'] + .map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ); +} + +Widget fcsButton(BuildContext context, String text,{Function callack}) { + return Container( + padding: EdgeInsets.only(left: 10, right: 10, top: 10), + child: Container( + height: 45.0, + decoration: BoxDecoration( + color: primaryColor, + shape: BoxShape.rectangle, + ), + child: ButtonTheme( + minWidth: 900.0, + height: 100.0, + child: FlatButton( + onPressed: callack, + child: Text(text, + style: TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: FontWeight.bold, + )), + ), + ), + ), + ); +} diff --git a/lib/theme/theme.dart b/lib/theme/theme.dart index 5d70c2d..d24fa3a 100644 --- a/lib/theme/theme.dart +++ b/lib/theme/theme.dart @@ -4,7 +4,7 @@ import 'package:flutter/cupertino.dart'; const primaryColor = const Color(0xff272262); const secondaryColor = const Color(0xffff4400); -const thirdColor = const Color(0xFF0700f1); +const thirdColor = const Color(0xf0ff4444); const nextColor = const Color(0xFFfa833d); const buttonColor = const Color(0xFFFFFFFF); const buttonBkColor = const Color(0xFF268944); @@ -12,6 +12,16 @@ const labelColor = const Color(0xFF757575); const TextStyle labelStyle = TextStyle(fontSize: 13, color: Colors.grey, fontWeight: FontWeight.w500); + +const TextStyle welcomeLabelStyle = + TextStyle(fontSize: 23, color: primaryColor, fontWeight: FontWeight.w500); +const TextStyle welcomeSubLabelStyle = + TextStyle(fontSize: 18, color: primaryColor, fontWeight: FontWeight.w500); +const TextStyle subMenuStyle = + TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500); +const TextStyle siginButtonStyle = + TextStyle(fontSize: 18, color: Colors.white, fontWeight: FontWeight.w800); + const TextStyle labelStyleMM = TextStyle( fontSize: 13, color: Colors.grey, @@ -48,7 +58,7 @@ const TextStyle photoLabelStyle = const TextStyle photoLabelStyleMM = TextStyle( color: Colors.black, fontSize: 13.0, fontFamily: "MyanmarUnicode"); const TextStyle textStyle = - TextStyle(fontSize: 15, color: Colors.black87, fontWeight: FontWeight.w500); + TextStyle(fontSize: 18, color: Colors.black87, fontWeight: FontWeight.w500); const TextStyle textStyleOdd = TextStyle( fontSize: 15, color: Colors.blueAccent, fontWeight: FontWeight.w500); const TextStyle textStrikeStyle = TextStyle( diff --git a/lib/vo/pickup.dart b/lib/vo/pickup.dart index cbe080c..3e45ef7 100644 --- a/lib/vo/pickup.dart +++ b/lib/vo/pickup.dart @@ -8,6 +8,7 @@ class PickUp { int weight; String address; String status; + DateTime date; PickUp( {this.id, @@ -18,7 +19,10 @@ class PickUp { this.numberOfPackage, this.weight, this.address, - this.status}); + this.status, + this.date}); + + int get last => DateTime.now().difference(date).inDays; factory PickUp.fromMap(Map map, String id) { return PickUp( diff --git a/lib/widget/bottom_up_page_route.dart b/lib/widget/bottom_up_page_route.dart new file mode 100644 index 0000000..cd27cd9 --- /dev/null +++ b/lib/widget/bottom_up_page_route.dart @@ -0,0 +1,23 @@ +import 'package:flutter/cupertino.dart'; + +class BottomUpPageRoute extends PageRouteBuilder { + final Widget child; + + BottomUpPageRoute(this.child) + : super( + pageBuilder: (context, animation, secondaryAnimation) => child, + transitionsBuilder: (context, animation, secondaryAnimation, child) { + var begin = Offset(0.0, 1.0); + var end = Offset.zero; + var curve = Curves.ease; + + var tween = + Tween(begin: begin, end: end).chain(CurveTween(curve: curve)); + + return SlideTransition( + position: animation.drive(tween), + child: child, + ); + }, + ); +} diff --git a/lib/widget/label_widgets.dart b/lib/widget/label_widgets.dart index af7dba4..df8c56b 100644 --- a/lib/widget/label_widgets.dart +++ b/lib/widget/label_widgets.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; import 'package:fcs/theme/theme.dart'; @@ -11,14 +13,20 @@ Widget labeledText(BuildContext context, String text, String label, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocalText( - context, - label, - fontSize: 15, + Padding( + padding: const EdgeInsets.only(top:8.0), + child: LocalText( + context, + label, + fontSize: 16, + color:primaryColor, + fontWeight: FontWeight.bold, + ), ), + // number ? Spacer() : Container(), Container( - // padding: EdgeInsets.only(left: 10), + padding: EdgeInsets.only(top: 10), // alignment: number ? Alignment.topRight : null, child: Text( text == null ? "" : text, diff --git a/lib/widget/products.dart b/lib/widget/products.dart index cebd99b..f51eb96 100644 --- a/lib/widget/products.dart +++ b/lib/widget/products.dart @@ -1,3 +1,4 @@ +import 'package:fcs/model/product_model.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:intl/intl.dart'; @@ -5,7 +6,6 @@ import 'package:progress/progress.dart'; import 'package:provider/provider.dart'; import 'package:fcs/charts/lines.dart'; import 'package:fcs/model/main_model.dart'; -import 'package:fcs/model/product_model.dart'; import 'package:fcs/pages/po/po_submission_form.dart'; import 'package:fcs/theme/theme.dart'; import 'package:fcs/vo/product.dart'; diff --git a/lib/widget/products_price_table.dart b/lib/widget/products_price_table.dart index 0703f33..50399ac 100644 --- a/lib/widget/products_price_table.dart +++ b/lib/widget/products_price_table.dart @@ -1,9 +1,9 @@ +import 'package:fcs/model/product_model.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; import 'package:fcs/model/language_model.dart'; -import 'package:fcs/model/product_model.dart'; import 'package:fcs/theme/theme.dart'; import 'package:fcs/vo/product.dart'; import 'package:fcs/widget/local_text.dart'; diff --git a/pubspec.lock b/pubspec.lock index 1ecefae..f8c6bc0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -119,7 +119,7 @@ packages: name: country_code_picker url: "https://pub.dartlang.org" source: hosted - version: "1.3.14" + version: "1.3.15" crypto: dependency: transitive description: @@ -218,13 +218,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.0.16" - firebase_ml_vision: - dependency: "direct main" - description: - name: firebase_ml_vision - url: "https://pub.dartlang.org" - source: hosted - version: "0.6.0+2" firebase_storage: dependency: "direct main" description: @@ -258,6 +251,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.4.4" + flutter_icons: + dependency: "direct main" + description: + name: flutter_icons + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" flutter_launcher_icons: dependency: "direct main" description: @@ -617,7 +617,28 @@ packages: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" + version: "0.5.7+3" + shared_preferences_macos: + dependency: transitive + description: + name: shared_preferences_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+9" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2+7" sky_engine: dependency: transitive description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 9b14325..ab6f2fb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: flutter_launcher_icons: "^0.7.2" qr_flutter: ^2.1.0+55 image_picker: ^0.6.0+9 - shared_preferences: ^0.4.3 + shared_preferences: ^0.5.7+3 http_parser: ^3.1.3 progress: path: @@ -47,7 +47,6 @@ dependencies: http_server: ^0.9.8+3 archive: ^2.0.11 http: ^0.12.0+4 - firebase_ml_vision: ^0.6.0+2 camera: ^0.4.2 faker: ^1.2.0 url_launcher: ^5.4.1 @@ -65,6 +64,7 @@ dependencies: permission_handler: ^4.0.0 country_code_picker: ^1.3.12 pin_input_text_field: + flutter_icons: ^1.1.0 dev_dependencies: flutter_test: