From bcf21d90ac6e8ffd8b44944d2c9d2e6a7aa19569 Mon Sep 17 00:00:00 2001 From: peima Date: Thu, 30 Jun 2022 03:47:47 -0400 Subject: [PATCH] updated new flutter version --- lib/constants.dart | 4 +- lib/dialog/logout_dialog.dart | 4 +- lib/utils/utils.dart | 6 +- .../desktop_change_mobile_or_email.dart | 7 +- .../desktop/desktop_change_password.dart | 8 +- lib/widgets/desktop/desktop_checkout.dart | 26 +- lib/widgets/desktop/desktop_coupons.dart | 12 +- lib/widgets/desktop/desktop_edit_address.dart | 8 +- .../desktop/desktop_forgot_password.dart | 6 +- lib/widgets/desktop/desktop_login.dart | 10 +- lib/widgets/desktop/desktop_my_cards.dart | 8 +- lib/widgets/desktop/desktop_new_address.dart | 2 +- lib/widgets/desktop/desktop_new_comment.dart | 14 +- lib/widgets/desktop/desktop_new_ticket.dart | 16 +- lib/widgets/desktop/desktop_new_user.dart | 7 +- lib/widgets/desktop/desktop_order_detail.dart | 16 +- lib/widgets/desktop/desktop_orders.dart | 22 +- .../desktop/desktop_reset_password.dart | 8 +- lib/widgets/desktop/desktop_set_password.dart | 8 +- lib/widgets/desktop/desktop_user_profile.dart | 5 +- lib/widgets/desktop/desktop_view_ticket.dart | 16 +- .../desktop/shop_backup_dec_19_2021.dart | 2372 ----------------- lib/widgets/general/add_remove_button.dart | 82 +- lib/widgets/general/download_item.dart | 17 +- .../payment_verification_code_dialog.dart | 4 +- lib/widgets/general/sliding_up_panel.dart | 4 +- .../mobile/mobile_attribute_selection.dart | 8 +- .../mobile/mobile_change_mobile_or_email.dart | 6 +- .../mobile/mobile_change_password.dart | 8 +- lib/widgets/mobile/mobile_checkout.dart | 26 +- lib/widgets/mobile/mobile_coupons.dart | 12 +- lib/widgets/mobile/mobile_edit_address.dart | 8 +- .../mobile/mobile_forgot_password.dart | 6 +- lib/widgets/mobile/mobile_login.dart | 10 +- lib/widgets/mobile/mobile_me.dart | 14 +- lib/widgets/mobile/mobile_my_cards.dart | 8 +- lib/widgets/mobile/mobile_new_address.dart | 2 +- lib/widgets/mobile/mobile_new_comment.dart | 8 +- lib/widgets/mobile/mobile_new_ticket.dart | 16 +- lib/widgets/mobile/mobile_new_user.dart | 6 +- lib/widgets/mobile/mobile_order_detail.dart | 16 +- lib/widgets/mobile/mobile_orders.dart | 22 +- lib/widgets/mobile/mobile_reset_password.dart | 8 +- lib/widgets/mobile/mobile_set_password.dart | 8 +- lib/widgets/mobile/mobile_user_profile.dart | 4 +- lib/widgets/mobile/mobile_view_ticket.dart | 16 +- lib/widgets/mobile/shop.dart | 2 +- linux/flutter/generated_plugins.cmake | 8 + pubspec.lock | 76 +- windows/flutter/generated_plugins.cmake | 8 + 50 files changed, 360 insertions(+), 2638 deletions(-) delete mode 100644 lib/widgets/desktop/shop_backup_dec_19_2021.dart diff --git a/lib/constants.dart b/lib/constants.dart index 063f413..37b5eb7 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -1,6 +1,7 @@ class Constants { + static const bool DEBUG = false; static const bool ENABLE_NATIVE_PAY = false; static const bool isPreview = false; @@ -20,10 +21,9 @@ class Constants { static const int FONT_WISETRONIC = 0xe812; static const int FONT_TOPTONS = 0xe813; - static const bool DEBUG = false; static const int BUSINESS_ID = 310; //310, 680, 357(notjust), 651(kiosk); static const String APP_TITLE = 'MiniPOS Ponit of Sale System'; - static const String BASE_API_URL = 'https://api.minipos.us/'; //'https://sandbox.minipos.us/', 'https://api.minipos.us/' + static const String BASE_API_URL = DEBUG ? 'https://sandbox.minipos.us/' : 'https://api.minipos.us/'; //'https://sandbox.minipos.us/', 'https://api.minipos.us/' static const String TUTORIAL_URL = 'https://archive.wisetronic.com/wisetronic-products-documentation/'; static const String API_SECRET = 'pei326sami1223HellowWorldabcdEd'; static const KEY_USER_ID = 'user_id'; diff --git a/lib/dialog/logout_dialog.dart b/lib/dialog/logout_dialog.dart index c546594..d9bf24a 100644 --- a/lib/dialog/logout_dialog.dart +++ b/lib/dialog/logout_dialog.dart @@ -19,7 +19,7 @@ AlertDialog logoutDialog(BuildContext context) { .of(context) .are_you_sure_to_logout), actions: [ - FlatButton( + TextButton( child: Text(S .of(context) .cancel), @@ -27,7 +27,7 @@ AlertDialog logoutDialog(BuildContext context) { Navigator.of(context).pop(); }, ), - FlatButton( + TextButton( child: Text(S .of(context) .yes_i_am_sure), diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 44dda2f..ee277c7 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -525,7 +525,7 @@ class Utils { content: Text(message), actions: actions == null ? [ - FlatButton( + TextButton( child: Text(S.of(context).ok), onPressed: onOk == null ? () { @@ -740,13 +740,13 @@ class Utils { title: Text(S.of(context).warning), content: Text(S.of(context).are_you_sure_to_empty_basket), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).cancel), onPressed: () { Navigator.of(context).pop(); }, ), - FlatButton( + TextButton( child: Text(S.of(context).yes_i_am_sure), onPressed: () { store.dispatch(new UpdateCartInfo( diff --git a/lib/widgets/desktop/desktop_change_mobile_or_email.dart b/lib/widgets/desktop/desktop_change_mobile_or_email.dart index fae755a..290998e 100644 --- a/lib/widgets/desktop/desktop_change_mobile_or_email.dart +++ b/lib/widgets/desktop/desktop_change_mobile_or_email.dart @@ -4,7 +4,6 @@ import 'package:countdown/countdown.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_wisetronic/widgets/general/breadcrumbs.dart'; import 'package:fluttertoast/fluttertoast.dart'; import '../../generated/l10n.dart'; @@ -216,8 +215,10 @@ class DesktopChangeMobileOrEmailState extends State margin: EdgeInsets.only(top: 0.0, right: 16.0), child: Align( alignment: Alignment.centerRight, - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).submit_to_change, style: TextStyle( diff --git a/lib/widgets/desktop/desktop_change_password.dart b/lib/widgets/desktop/desktop_change_password.dart index 4263e4b..4b13861 100644 --- a/lib/widgets/desktop/desktop_change_password.dart +++ b/lib/widgets/desktop/desktop_change_password.dart @@ -280,8 +280,10 @@ class DesktopChangePasswordState extends State { padding: EdgeInsets.only(right: 16.0, top: 16.0), child: Align( alignment: Alignment.centerRight, - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).submit, style: TextStyle( @@ -319,7 +321,7 @@ class DesktopChangePasswordState extends State { title: Text(S.of(context).success), content: Text(S.of(context).password_has_been_changed), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).ok), onPressed: () { Navigator.of(context).pop(); diff --git a/lib/widgets/desktop/desktop_checkout.dart b/lib/widgets/desktop/desktop_checkout.dart index da47598..322cfa6 100644 --- a/lib/widgets/desktop/desktop_checkout.dart +++ b/lib/widgets/desktop/desktop_checkout.dart @@ -125,8 +125,10 @@ class DesktopCheckoutState extends State with SingleTickerProvi Text( S.of(context).no_delivery_method, ), - RaisedButton( - color: Theme.of(context).primaryColor, + ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).ok, style: TextStyle( @@ -1215,7 +1217,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).cancel), onPressed: () { panelController.close(); @@ -1280,7 +1282,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).cancel), onPressed: () { panelController.close(); @@ -1385,7 +1387,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).close), onPressed: () { panelController.close(); @@ -1431,7 +1433,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).cancel), onPressed: () { panelController.close(); @@ -1605,7 +1607,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).cancel), onPressed: () { panelController.close(); @@ -1657,7 +1659,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi ), Container( margin: EdgeInsets.only(left: 5.0), - child: RaisedButton( + child: ElevatedButton( child: Text( S.of(context).get_coupon, ), @@ -1951,7 +1953,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi )); for (int i = 0; i < cartInfo.businessInfo.quickInputs.length; i++) { String qi = cartInfo.businessInfo.quickInputs[i].value; - w.children.add(FlatButton( + w.children.add(TextButton( child: Text( qi, style: TextStyle( @@ -1993,7 +1995,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).cancel), onPressed: () { panelController.close(); @@ -2002,7 +2004,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).save), onPressed: () { if (mounted) { @@ -2069,7 +2071,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).cancel), onPressed: () { panelController.close(); diff --git a/lib/widgets/desktop/desktop_coupons.dart b/lib/widgets/desktop/desktop_coupons.dart index 8f9c89b..95c8edf 100644 --- a/lib/widgets/desktop/desktop_coupons.dart +++ b/lib/widgets/desktop/desktop_coupons.dart @@ -269,17 +269,19 @@ class DesktopCouponsState extends State { ), ), Container( - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20.0), + ), + ), child: Text( S.of(context).redeem_coupon, style: TextStyle( color: Colors.white, ), ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(20.0), - ), onPressed: () { if (coupon.store != null) { Routes.router.navigateTo(context, '/shop/${coupon.store.id}/na/na/na'); diff --git a/lib/widgets/desktop/desktop_edit_address.dart b/lib/widgets/desktop/desktop_edit_address.dart index c58a44e..bc3704d 100644 --- a/lib/widgets/desktop/desktop_edit_address.dart +++ b/lib/widgets/desktop/desktop_edit_address.dart @@ -434,7 +434,7 @@ class DesktopEditAddressState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - FlatButton( + TextButton( child: Text( S .of(context) @@ -452,7 +452,7 @@ class DesktopEditAddressState extends State { .of(context) .are_you_sure_to_delete_the_address), actions: [ - FlatButton( + TextButton( child: Text(S .of(context) .cancel), @@ -460,7 +460,7 @@ class DesktopEditAddressState extends State { Navigator.of(context).pop(); }, ), - FlatButton( + TextButton( child: Text(S .of(context) .yes_i_am_sure), @@ -475,7 +475,7 @@ class DesktopEditAddressState extends State { ); }, ), - FlatButton( + TextButton( child: Text( S .of(context) diff --git a/lib/widgets/desktop/desktop_forgot_password.dart b/lib/widgets/desktop/desktop_forgot_password.dart index 06c8989..34f8a75 100644 --- a/lib/widgets/desktop/desktop_forgot_password.dart +++ b/lib/widgets/desktop/desktop_forgot_password.dart @@ -197,8 +197,10 @@ class DesktopForgotPasswordState extends State { margin: EdgeInsets.only(top: 0.0, right: 16.0), child: Align( alignment: Alignment.centerRight, - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).verify, style: TextStyle( diff --git a/lib/widgets/desktop/desktop_login.dart b/lib/widgets/desktop/desktop_login.dart index d850323..0f20745 100644 --- a/lib/widgets/desktop/desktop_login.dart +++ b/lib/widgets/desktop/desktop_login.dart @@ -211,7 +211,7 @@ class DesktopLoginState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - FlatButton( + TextButton( child: Text( S.of(context).new_user_question, style: TextStyle( @@ -226,7 +226,7 @@ class DesktopLoginState extends State { child: Text(''), ), Container( - child: FlatButton( + child: TextButton( child: Text( S.of(context).forgot_password_question, style: TextStyle( @@ -246,8 +246,10 @@ class DesktopLoginState extends State { child: Container( padding: EdgeInsets.only( top: 20.0, left: 16.0, right: 16.0, bottom: 20.0), - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).login, style: TextStyle( diff --git a/lib/widgets/desktop/desktop_my_cards.dart b/lib/widgets/desktop/desktop_my_cards.dart index 241b443..d043c3c 100644 --- a/lib/widgets/desktop/desktop_my_cards.dart +++ b/lib/widgets/desktop/desktop_my_cards.dart @@ -139,14 +139,16 @@ class MyCardsState extends State { S.of(context).are_you_sure_to_remove_the_card, ), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).cancel), - color: Theme.of(context).primaryColor, onPressed: () { Navigator.of(context).pop(); }, + style: TextButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), ), - FlatButton( + TextButton( child: Text(S.of(context).yes_i_am_sure), onPressed: () { Navigator.of(context).pop(); diff --git a/lib/widgets/desktop/desktop_new_address.dart b/lib/widgets/desktop/desktop_new_address.dart index 2aa38b7..5080060 100644 --- a/lib/widgets/desktop/desktop_new_address.dart +++ b/lib/widgets/desktop/desktop_new_address.dart @@ -358,7 +358,7 @@ class DesktopNewAddressState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ SizedBox(), - FlatButton( + TextButton( child: Text( S.of(context).save ), diff --git a/lib/widgets/desktop/desktop_new_comment.dart b/lib/widgets/desktop/desktop_new_comment.dart index 03e48b4..267a8ca 100644 --- a/lib/widgets/desktop/desktop_new_comment.dart +++ b/lib/widgets/desktop/desktop_new_comment.dart @@ -167,14 +167,16 @@ class DesktopNewCommentState extends State { child: SizedBox( width: 150.0, height: 36.0, - child: RaisedButton( + child: ElevatedButton( child: Text( S.of(context).submit, style: TextStyle( color: Colors.white, ), ), - color: Theme.of(context).primaryColor, + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), onPressed: () { _submit(); }, @@ -238,14 +240,16 @@ class DesktopNewCommentState extends State { title: Text(S.of(context).warning), content: Text(S.of(context).are_you_sure_to_remove_the_picture), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).cancel), onPressed: () { Navigator.of(context).pop(); }, - color: Theme.of(context).primaryColor, + style: TextButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), ), - FlatButton( + TextButton( child: Text(S.of(context).yes_i_am_sure), onPressed: () { Navigator.of(context).pop(); diff --git a/lib/widgets/desktop/desktop_new_ticket.dart b/lib/widgets/desktop/desktop_new_ticket.dart index 86d58de..424604a 100644 --- a/lib/widgets/desktop/desktop_new_ticket.dart +++ b/lib/widgets/desktop/desktop_new_ticket.dart @@ -208,8 +208,10 @@ class DesktopNewTicketState extends State { alignment: Alignment.centerRight, child: Container( padding: EdgeInsets.only(top: 20.0, left: 16.0, right: 16.0, bottom: 20.0), - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).login, style: TextStyle( @@ -389,15 +391,17 @@ class DesktopNewTicketState extends State { title: Text(S.of(context).warning), content: Text(S.of(context).are_you_sure_to_remove_the_picture), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).cancel), onPressed: () { Navigator.of(context).pop(); }, ), - RaisedButton( + ElevatedButton( child: Text(S.of(context).yes_i_am_sure), - color: Theme.of(context).primaryColor, + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), onPressed: () { Navigator.of(context).pop(); setState(() { @@ -439,7 +443,7 @@ class DesktopNewTicketState extends State { title: Text(S.of(context).success), content: Text(S.of(context).ticket_created_success), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).ok), onPressed: () { Routes.router.navigateTo(context, '/my-support/${widget.businessId}', replace: true); diff --git a/lib/widgets/desktop/desktop_new_user.dart b/lib/widgets/desktop/desktop_new_user.dart index f99ab70..f7a077f 100644 --- a/lib/widgets/desktop/desktop_new_user.dart +++ b/lib/widgets/desktop/desktop_new_user.dart @@ -2,7 +2,6 @@ import 'package:countdown/countdown.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_wisetronic/widgets/general/breadcrumbs.dart'; import 'package:fluttertoast/fluttertoast.dart'; import '../../constants.dart'; @@ -195,8 +194,10 @@ class DesktopNewUserState extends State { margin: EdgeInsets.only(top: 0.0, right: 16.0), child: Align( alignment: Alignment.centerRight, - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).register, style: TextStyle( diff --git a/lib/widgets/desktop/desktop_order_detail.dart b/lib/widgets/desktop/desktop_order_detail.dart index be3bfc6..a2d473e 100644 --- a/lib/widgets/desktop/desktop_order_detail.dart +++ b/lib/widgets/desktop/desktop_order_detail.dart @@ -1001,7 +1001,7 @@ class DesktopOrderDetailState extends State { Container( padding: EdgeInsets.only(right: 10.0), child: order.status == Constants.STATUS_PENDING && order.paymentStatus == Constants.PAYMENT_STATUS_UNPAID ? - FlatButton( + TextButton( child: Text( S.of(context).cancel_order, style: TextStyle( @@ -1015,7 +1015,7 @@ class DesktopOrderDetailState extends State { ) : SizedBox.shrink(), ), Container( - child: order.status == Constants.STATUS_COMPLETE && !order.hasComment ? RaisedButton( + child: order.status == Constants.STATUS_COMPLETE && !order.hasComment ? ElevatedButton( child: Text( S.of(context).comment, style: TextStyle( @@ -1033,7 +1033,7 @@ class DesktopOrderDetailState extends State { child: order.paymentStatus != Constants.PAYMENT_STATUS_PAID && order.status != Constants.STATUS_CANCELLED && order.status != Constants.STATUS_COMPLETE ? - FlatButton( + TextButton( child: Text( S.of(context).pay_now, style: TextStyle( @@ -1044,7 +1044,7 @@ class DesktopOrderDetailState extends State { onPressed: () { Routes.router.navigateTo(context, '/paynow/${order.id}'); }, - ) : FlatButton( + ) : TextButton( child: Text( S.of(context).order_again, style: TextStyle( @@ -1172,16 +1172,18 @@ class DesktopOrderDetailState extends State { title: Text(S.of(context).warning), content: Text(S.of(context).are_you_sure_to_cancel_the_order), actions: [ - FlatButton( + TextButton( child: Text( S.of(context).no, ), - color: Theme.of(context).primaryColor, + style: TextButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), onPressed: () { Navigator.of(context).pop(); }, ), - FlatButton( + TextButton( child: Text( S.of(context).yes_i_am_sure, ), diff --git a/lib/widgets/desktop/desktop_orders.dart b/lib/widgets/desktop/desktop_orders.dart index c67951e..bda47c1 100644 --- a/lib/widgets/desktop/desktop_orders.dart +++ b/lib/widgets/desktop/desktop_orders.dart @@ -216,7 +216,7 @@ class DesktopOrdersState extends State with SingleTickerProviderS Row row3 = Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - RaisedButton( + ElevatedButton( child: Text( S.of(context).detail, ), @@ -232,7 +232,7 @@ class DesktopOrdersState extends State with SingleTickerProviderS row3.children.add( Padding( padding: EdgeInsets.only(left: 10.0), - child: RaisedButton( + child: ElevatedButton( child: Text( S.of(context).comment, ), @@ -254,7 +254,7 @@ class DesktopOrdersState extends State with SingleTickerProviderS if (order.paymentStatus != Constants.PAYMENT_STATUS_PAID && order.status != Constants.STATUS_CANCELLED && order.status != Constants.STATUS_COMPLETE) { - row2.children.add(RaisedButton( + row2.children.add(ElevatedButton( child: Text( S.of(context) .pay_now, @@ -262,20 +262,24 @@ class DesktopOrdersState extends State with SingleTickerProviderS color: Colors.white, ), ), - color: Colors.redAccent, + style: ElevatedButton.styleFrom( + primary: Colors.redAccent, + ), onPressed: () { Routes.router.navigateTo(context, '/paynow/${order.id}'); }, )); } else { - row2.children.add(RaisedButton( + row2.children.add(ElevatedButton( child: Text( S.of(context).order_again, style: TextStyle( color: Colors.white, ), ), - color: Theme.of(context).primaryColor, + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), onPressed: () { Utils.orderAgain(context, order.cartInfo); }, @@ -283,14 +287,16 @@ class DesktopOrdersState extends State with SingleTickerProviderS } } else { row2.children.add(row3); - row2.children.add(RaisedButton( + row2.children.add(ElevatedButton( child: Text( S.of(context).order_again, style: TextStyle( color: Colors.white, ), ), - color: Theme.of(context).primaryColor, + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), onPressed: () { Utils.orderAgain(context, order.cartInfo); }, diff --git a/lib/widgets/desktop/desktop_reset_password.dart b/lib/widgets/desktop/desktop_reset_password.dart index a9c81a1..4312eb2 100644 --- a/lib/widgets/desktop/desktop_reset_password.dart +++ b/lib/widgets/desktop/desktop_reset_password.dart @@ -177,8 +177,10 @@ class DesktopResetPasswordState extends State { padding: EdgeInsets.only(right: 0.0, top: 16.0), child: Align( alignment: Alignment.centerRight, - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).submit, style: TextStyle( @@ -276,7 +278,7 @@ class DesktopResetPasswordState extends State { title: Text(S.of(context).success), content: Text(S.of(context).reset_password_success), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).ok), onPressed: () { Routes.router.navigateTo(context, '/login', replace: true, clearStack: false); diff --git a/lib/widgets/desktop/desktop_set_password.dart b/lib/widgets/desktop/desktop_set_password.dart index d00acf3..99bebd0 100644 --- a/lib/widgets/desktop/desktop_set_password.dart +++ b/lib/widgets/desktop/desktop_set_password.dart @@ -177,8 +177,10 @@ class DesktopSetPasswordState extends State { padding: EdgeInsets.only(right: 16.0, top: 16.0), child: Align( alignment: Alignment.centerRight, - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).submit, style: TextStyle( @@ -276,7 +278,7 @@ class DesktopSetPasswordState extends State { title: Text(S.of(context).success), content: Text(S.of(context).reset_password_success), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).ok), onPressed: () { Routes.router.navigateTo(context, '/login', replace: true, clearStack: false); diff --git a/lib/widgets/desktop/desktop_user_profile.dart b/lib/widgets/desktop/desktop_user_profile.dart index e0d9b88..6024399 100644 --- a/lib/widgets/desktop/desktop_user_profile.dart +++ b/lib/widgets/desktop/desktop_user_profile.dart @@ -13,7 +13,6 @@ import '../../store/store.dart'; import '../../utils/http_util.dart'; import '../../utils/util_web.dart' if (dart.library.io) '../../utils/util_io.dart'; import '../../utils/utils.dart'; -import '../../widgets/general/breadcrumbs.dart'; class DesktopUserProfile extends StatefulWidget { final Key key; @@ -435,7 +434,7 @@ class DesktopUserProfileState extends State { ), ), actions: [ - FlatButton( + TextButton( child: Text( S.of(context).cancel ), @@ -443,7 +442,7 @@ class DesktopUserProfileState extends State { Navigator.of(context).pop(); }, ), - FlatButton( + TextButton( child: Text( S.of(context).submit_to_change, ), diff --git a/lib/widgets/desktop/desktop_view_ticket.dart b/lib/widgets/desktop/desktop_view_ticket.dart index f2e8211..614e33a 100644 --- a/lib/widgets/desktop/desktop_view_ticket.dart +++ b/lib/widgets/desktop/desktop_view_ticket.dart @@ -192,8 +192,10 @@ class DesktopViewTicketState extends State { alignment: Alignment.centerRight, child: Container( padding: EdgeInsets.only(top: 20.0, left: 16.0, right: 16.0, bottom: 20.0), - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).reply, style: TextStyle( @@ -633,15 +635,17 @@ class DesktopViewTicketState extends State { title: Text(S.of(context).warning), content: Text(S.of(context).are_you_sure_to_remove_the_picture), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).cancel), onPressed: () { Navigator.of(context).pop(); }, ), - RaisedButton( + ElevatedButton( child: Text(S.of(context).yes_i_am_sure), - color: Theme.of(context).primaryColor, + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), onPressed: () { Navigator.of(context).pop(); setState(() { @@ -685,7 +689,7 @@ class DesktopViewTicketState extends State { title: Text(S.of(context).success), content: Text(S.of(context).ticket_created_success), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).ok), onPressed: () { Routes.router.navigateTo(context, diff --git a/lib/widgets/desktop/shop_backup_dec_19_2021.dart b/lib/widgets/desktop/shop_backup_dec_19_2021.dart deleted file mode 100644 index 6534af1..0000000 --- a/lib/widgets/desktop/shop_backup_dec_19_2021.dart +++ /dev/null @@ -1,2372 +0,0 @@ - -import 'dart:math'; - -import 'package:badges/badges.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_spinkit/flutter_spinkit.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; -import 'package:smooth_star_rating/smooth_star_rating.dart'; - -import '../../constants.dart'; -import '../../events/eventbus.dart'; -import '../../events/events.dart'; -import '../../generated/l10n.dart'; -import '../../models/business.dart'; -import '../../models/cart_info.dart'; -import '../../models/cart_line_item.dart'; -import '../../models/category_products.dart'; -import '../../models/comment.dart'; -import '../../models/product.dart'; -import '../../models/product_image.dart'; -import '../../pages/product_detail_page.dart'; -import '../../store/store.dart'; -import '../../utils/http_util.dart'; -import '../../utils/shop_scroll_controller.dart'; -import '../../utils/shop_scroll_coordinator.dart'; -import '../../utils/util_io.dart' if (dart.library.html) '../../utils/util_web.dart'; -import '../../utils/utils.dart'; -import '../../widgets/general/add_remove_button.dart'; -import '../../widgets/general/bottom_nav.dart'; -import '../../widgets/general/breadcrumbs.dart'; -import '../../widgets/general/carousel.dart'; -import '../../widgets/general/navigationbar.dart'; -import '../../widgets/general/read_more_text.dart'; -import '../../widgets/general/show_price.dart'; -import '../../widgets/general/sliding_up_panel.dart'; -import '../../widgets/mobile/shopping_cart_bar.dart'; -import 'product_item.dart'; -import 'shopping_cart_widget.dart'; - -class Shop extends StatefulWidget { - final int businessId; - - const Shop({Key key, this.businessId}) : super(key: key); - - @override - State createState() => ShopState(); -} - -MediaQueryData mediaQuery; -double statusBarHeight; -double screenWidth; -double screenHeight; - -class ShopState extends State - with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { - GlobalKey _scaffoldKey = new GlobalKey(); - - Business _business; - List _categoryProducts; - List _featuredProducts; - List _hotSaleProducts; - - List _prompts = []; - bool checkCloseFlag = false; - - bool displayProductByCategoryClick = false; - String displayProductByCategoryClickIndicator = ''; - int categoryId = 0; - int _productCurrentPage = 1; - - static const num _categoryHeight = 50.0; - static const num _categoryDescHeight = 50.0; - static const num _productHeight = 266.0; - - int _categoryIndex = 0; - bool _categoryIndexChange = false; - bool _isLoading = false; - - bool refresh = false; - - double sideSpace = 0; - double mainSpace = 1200; - double rate = 1; - - ShopScrollCoordinator _shopCoordinator; - ShopScrollController _pageScrollController; - TabController _tabController; - final double _sliverAppBarInitHeight = 150.0; - final double _tabBarHeight = 50.0; - double _sliverAppBarMaxHeight; - - ShopScrollController _listScrollController1; - ShopScrollController _listScrollController2; - ShopScrollController _listScrollController3; - - GlobalKey stackKey = GlobalKey(); - GlobalKey endKey = GlobalKey(); - - List comments; - int _commentPage = 1; - int _commentPageCount = 1; - bool _commentLoadingFinish = false; - RefreshController _commentRefreshController = - RefreshController(initialRefresh: true); - - PanelController panelController = PanelController(); - SlidingUpPanel _slidUpShoppingCart; - - SliverPersistentHeader promotHeader; - - Carousel slidingGellery; - - // StreamSubscription onProductWillAddToCartSubscription; - // StreamSubscription onProductWillRemoveFromCartSubscription; - - double lastProductListScrollPositionPixel = 0; - - final TextEditingController _searchController = new TextEditingController(); - Widget searchFieldPlaceHolder; - Icon searchIcon = new Icon( - Icons.search, - color: Colors.blue, - ); - bool _isSearching = false; - String _searchText = ""; - - dynamic responseData; - - ShopState() { - _searchController.addListener(() { - if (_searchController.text.isEmpty) { - setState(() { - // _isSearching = false; - _searchText = ""; - if (responseData != null) { - _categoryProducts.clear(); - _categoryProducts = (responseData['category_products'] as List) - .map((i) => CategoryProducts.fromJson(i)) - .toList(); - } else { - categoryId = 0; - loadProducts(); - } - }); - } else { - if (!displayProductByCategoryClick) { - setState(() { - _isSearching = true; - _searchText = _searchController.text; - }); - } - } - }); - } - - void _onCommentRefresh() { - if (_commentPage - 1 > 1) { - _commentPage -= 1; - } else { - _commentPage = 1; - } - _commentRefreshController.resetNoData(); - _loadComment(true); - } - - void _onCommentLoadMore() { - if (_commentPageCount > _commentPage) { - _commentPage += 1; - _loadComment(false); - } else { - _commentRefreshController.loadNoData(); - } - } - - _loadComment(bool isRefresh) { - _commentLoadingFinish = false; - HttpUtil.httpGet( - 'v1/get-comments', - queryParameters: { - 'page': _commentPage.toString(), - 'size': Constants.ORDERS_PER_PAGE.toString(), - }, - businessId: _business.id, - ).then((data) { - if (isRefresh) { - _commentRefreshController.refreshCompleted(); - } else { - _commentRefreshController.loadComplete(); - } - _commentPage = int.parse(data['_meta']['currentPage'].toString()); - _commentPageCount = int.parse(data['_meta']['pageCount'].toString()); - - if (mounted) { - setState(() { - comments = - (data['items'] as List).map((e) => Comment.fromJson(e)).toList(); - }); - } - }).catchError((error) { - Utils.showMessageDialog(context, error); - }); - } - - @override - Widget build(BuildContext context) { - if (_business == null) { - return new Scaffold( - body: Center( - child: SpinKitWave( - color: Colors.lightBlueAccent, - size: 40.0, - ), - ), - ); - } - - mediaQuery ??= MediaQuery.of(context); - screenWidth ??= mediaQuery.size.width; - screenHeight ??= mediaQuery.size.height; - statusBarHeight ??= mediaQuery.padding.top; - - _sliverAppBarMaxHeight ??= screenHeight - 150.0; - - _pageScrollController ??= _shopCoordinator - .pageScrollController(_sliverAppBarMaxHeight - _sliverAppBarInitHeight); - - _shopCoordinator.pinnedHeaderSliverHeightBuilder ??= () { - return statusBarHeight + kToolbarHeight + _tabBarHeight; - }; - - if (MediaQuery.of(context).size.width <= 1200) { - mainSpace = MediaQuery.of(context).size.width; - sideSpace = 0; - } else { - mainSpace = 1200; - sideSpace = (MediaQuery.of(context).size.width - 1200) / 2; - } - rate = mainSpace / 1200; - - refresh = false; - - _slidUpShoppingCart = SlidingUpPanel( - controller: panelController, - minHeight: 0.0, - maxHeight: 250.0, - isDraggable: false, - backdropEnabled: true, - slideDirection: SlideDirection.DOWN, - panel: ShoppingCartBar( - business: _business, - endKey: endKey, - barAtBottom: true, - hasPicture: true, - onEmptyCartListener: () { - Future.delayed(Duration(seconds: 1), () { - panelController.close(); - }); - }, - onPanelOpenCloseRequest: () { - if (panelController.isPanelOpen) { - panelController.close(); - } else { - panelController.open(); - } - }, - ), - ); - - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - if (_productCurrentPage == 1) { - _pageScrollController.animateTo( - 0, duration: Duration(milliseconds: 100), curve: Curves.easeInOut); - } - }); - - Row promotRow = Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [], - ); - for (var i = 0; i < _business.promoProducts.length; i++) { - promotRow.children.add(Container( - padding: EdgeInsets.only( - left: 10.0, - top: 10.0, - bottom: 10.0, - right: 10.0, - ), - margin: EdgeInsets.symmetric(horizontal: 5.0, vertical: 5.0), - width: 220.0, - height: 220.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(5.0)), - color: Colors.white, - border: Border( - top: BorderSide( - width: 1.0, - color: Colors.black12, - ), - bottom: BorderSide( - width: 1.0, - color: Colors.black12, - ), - left: BorderSide( - width: 1.0, - color: Colors.black12, - ), - right: BorderSide( - width: 1.0, - color: Colors.black12, - ), - ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - child: Container( - child: Util.showImage( - _business.promoProducts[i].imagePath, - width: 120.0, - ), - ), - onTap: () { - _showProductDetail(_business.promoProducts[i]); - }, - ), - Container( - child: Text( - _business.promoProducts[i].name, - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 14.0), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - ShowPrice( - _business.promoProducts[i].price, - currencySign: '\$', - fontWeight: FontWeight.bold, - smallFontSize: 15, - largeFontSize: 24, - regularPrice: _business.promoProducts[i].regularPrice, - ), - Container( - child: AddRemoveButton( - product: _business.promoProducts[i], - business: _business, - addOnly: true, - ), - ) - ], - ) - ], - ), - )); - } - - if (promotRow.children.length > 0) { - promotHeader = SliverPersistentHeader( - pinned: false, - floating: true, - delegate: _SliverAppBarDelegate2( - minHeight: 260.0, - maxHeight: 260.0, - child: Row( - children: [ - Container( - width: sideSpace, - ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.only(left: 10.0, top: 5.0), - child: Text( - S.of(context).promotions, - style: TextStyle(fontSize: 15.0), - ), - ), - Container( - padding: EdgeInsets.only(right: 10.0), - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: promotRow, - ), - ), - ], - ), - ), - Container( - width: sideSpace, - ), - ], - ), - ), - ); - } else { - promotHeader = SliverPersistentHeader( - pinned: false, - floating: true, - delegate: _SliverAppBarDelegate2( - minHeight: 0.0, - maxHeight: 0.0, - child: Center( - child: Text(''), - )), - ); - } - - SliverPersistentHeader bulletin; - if (_business.bulletin != null && _business.bulletin.isNotEmpty) { - bulletin = SliverPersistentHeader( - pinned: false, - floating: true, - delegate: _SliverAppBarDelegate2( - minHeight: 30, - maxHeight: 100, - child: Row( - children: [ - Container( - width: sideSpace, - ), - Expanded( - child: Container( - padding: EdgeInsets.only(top: 10, left: 16.0, right: 16.0, bottom: 10.0), - child: Text( - '${_business.bulletin}', - overflow: TextOverflow.ellipsis, - maxLines: 3, - ), - decoration: BoxDecoration( - border: Border.all( - color: Colors.red[500], - width: 1.0, - ), - borderRadius: BorderRadius.all(Radius.circular(16)), - ), - ), - ), - Container( - width: sideSpace, - ), - ], - ), - ), - ); - } else { - bulletin = SliverPersistentHeader( - pinned: false, - floating: true, - delegate: _SliverAppBarDelegate2( - minHeight: 0.0, - maxHeight: 0.0, - child: Center( - child: Text(''), - )), - ); - } - - Widget listener = Listener( - onPointerUp: _shopCoordinator.onPointerUp, - onPointerSignal: (ps) { - if (ps is PointerScrollEvent) { - final newOffset = _pageScrollController.offset + ps.scrollDelta.dy; - if (ps.scrollDelta.dy.isNegative) { - _pageScrollController.jumpTo(max(0, newOffset)); - if (max(0, newOffset) == 0) { - _listScrollController1.jumpTo(max(0, _listScrollController1.offset - 10)); - } - } else { - _pageScrollController - .jumpTo(min(_pageScrollController.position.maxScrollExtent, newOffset)); - if (newOffset > _pageScrollController.position.maxScrollExtent) { - _listScrollController1.jumpTo(min(_listScrollController1.position.maxScrollExtent, _listScrollController1.offset + 10)); - - } - } - - // if (ps.scrollDelta.dy.isNegative) { - // _listScrollController2.jumpTo(max(0, newOffset)); - // } else { - // _listScrollController2 - // .jumpTo(min(_listScrollController2.position.maxScrollExtent, newOffset)); - // } - } - }, - child: CustomScrollView( - controller: _pageScrollController, - physics: ClampingScrollPhysics(), - slivers: [ - SliverPersistentHeader( - pinned: true, - floating: true, - delegate: _SliverAppBarDelegate2( - minHeight: 98, - maxHeight: 98, - child: Column( - children: [ - MiniNavigationBar( - title: S.of(context).shop, - back: true, - breadCrumbs: [ - BreadCrumb(S.of(context).shop, null), - // BreadCrumb(null, null, - // item: Container( - // margin: EdgeInsets.only(left: 20.0), - // child: Row( - // children: [ - // Container( - // child: Icon( - // Icons.search, - // size: 24, - // color: Colors.blue, - // ), - // ), - // Container( - // child: Text( - // S.of(context).search_product, - // ), - // ), - // ], - // ), - // ), - // onTap: () { - // // Navigator.push(context, - // // MaterialPageRoute(builder: (BuildContext context) { - // // return ProductSearch(_business); - // // })); - // }, - // ), - BreadCrumb( - null, null, - item: Container( - width: 280.0, - padding: EdgeInsets.only(left: 20.0, right: 20.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - MouseRegion( - cursor: SystemMouseCursors.click, - child: GestureDetector( - child: Container( - padding: EdgeInsets.only(right: 10.0), - child: Icon( - searchIcon.icon, - size: 20.0, - color: Colors.blue, - ), - ), - onTap: () { - onSearchTap(); - }, - ), - ), - Expanded(child: searchFieldPlaceHolder == null ? MouseRegion( - cursor: SystemMouseCursors.click, - child: GestureDetector( - child: Text( - S.of(context).search_products, - style: new TextStyle(color: Colors.blue), - ), - onTap: () { - onSearchTap(); - }, - ), - ) : searchFieldPlaceHolder), - ], - ), - ), - ) - ], - breadCrumbHeight: Constants.BREADCRUMB_HEIGHT, - shoppingCart: ShoppingCartWidget( - business: _business, - onTap: () { - if (panelController.isPanelClosed) { - panelController.open(); - } - }, - ), - ), - ], - ), - ), - ), - promotHeader, - bulletin, - SliverPersistentHeader( - pinned: true, - floating: false, - delegate: _SliverAppBarDelegate2( - minHeight: _tabBarHeight, - maxHeight: _tabBarHeight, - child: Container( - color: Colors.white, - child: TabBar( - labelColor: new Color(0xFF3190E8), - unselectedLabelColor: new Color(0xFF666666), - indicatorColor: new Color(0xFF3190E8), - indicatorSize: TabBarIndicatorSize.label, - labelStyle: new TextStyle( - fontSize: 16.0, - ), - controller: _tabController, - tabs: [ - Tab( - text: S.of(context).products, - ), - Tab( - child: Badge( - badgeContent: Text( - '${_business.commentsCount}', - style: TextStyle(color: Colors.white, fontSize: 11.0), - ), - badgeColor: Colors.lightBlueAccent, - child: Text(S.of(context).comments), - ), - ), - ], - ), - ), - ), - ), - SliverFillRemaining( - child: Row( - children: [ - Container( - width: sideSpace, - ), - Expanded( - child: TabBarView( - controller: _tabController, - children: [ - _buildMainContent(), - _buildCommentList(), - ], - ), - ), - Container( - width: sideSpace, - ), - ], - ), - ), - ], - ), - ); - - Widget mainBody = listener; - - Widget widget = Scaffold( - key: _scaffoldKey, - body: WillPopScope( - child: mainBody, - onWillPop: () async { - return true; - }, - ), - bottomNavigationBar: BottomNav(), - ); - - List children = [ - Positioned( - top: 0.0, - right: 0.0, - bottom: 0.0, - left: 0.0, - child: widget, - ), - _slidUpShoppingCart, - ]; - - Stack stack = Stack( - key: stackKey, - children: [], - ); - - stack.children.addAll(children); - - if (!_business.isPublic) { - stack.children.add( - Positioned( - top: 0, - right: 0, - left: screenWidth - 100, - bottom: screenHeight - 100, - child: Image.asset( - 'assets/images/under_renovation.png', - width: 200.0, - height: 200.0, - fit: BoxFit.fill, - ), - ), - ); - } - - return stack; - } - - SnackBar commentImageSnackBar(String url) { - return SnackBar( - elevation: 0.0, - action: SnackBarAction( - label: S.of(context).close, - onPressed: () { - _scaffoldKey.currentState.hideCurrentSnackBar(); - }, - ), - content: Container( - height: 260.0, - child: Util.showImage( - '$url', - width: 180.0, - height: 180.0, - fit: BoxFit.fill, - ), - ), - ); - } - - CupertinoActionSheet commentImageActionSheet(String url) { - return CupertinoActionSheet( - message: Container( - height: 280.0, - child: Util.showImage( - '$url', - fit: BoxFit.fill, - ), - ), - cancelButton: CupertinoActionSheetAction( - child: Text(S.of(context).close), - onPressed: () { - Navigator.of(context).maybePop(); - }, - ), - ); - } - - Widget _buildCommentList() { - Widget commentWidget = Center( - child: Text(S.of(context).no_comments_yet), - ); - if (comments != null && comments.length > 0) { - commentWidget = ListView.builder( - controller: _listScrollController3, - itemCount: comments.length, - itemBuilder: (BuildContext context, int position) { - Comment comment = comments[position]; - Row imageRow = Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [], - ); - if (comment.images.length > 0) { - for (ProductImage image in comment.images) { - imageRow.children.add( - GestureDetector( - child: Container( - padding: EdgeInsets.all(5.0), - child: Util.showImage( - 'https:${image.image}', - width: 40.0, - height: 40.0, - fit: BoxFit.fill, - ), - ), - onTap: () { -// _scaffoldKey.currentState.showSnackBar(commentImageSnackBar('https:${image.image}')); - showCupertinoModalPopup( - context: context, - builder: (BuildContext context) { - return commentImageActionSheet( - 'https:${image.image}'); - }); - }, - ), - ); - } - } - Widget replyWidget = SizedBox.shrink(); - if (comment.replyFromStore != null && - comment.replyFromStore.isNotEmpty) { - replyWidget = Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.only(top: 10.0, bottom: 5.0), - child: Text( - S.of(context).response_from_store, - style: TextStyle( - fontSize: 12.0, - color: Colors.black38, - ), - ), - ), - Container( - padding: EdgeInsets.only(bottom: 16.0), - child: ReadMoreText( - comment.replyFromStore, - style: TextStyle( - fontSize: 13.0, - color: Colors.black54, - ), - trimLines: 2, - trimLength: 40, - colorClickableText: Colors.black, - trimMode: TrimMode.Line, - trimCollapsedText: S.of(context).show_more, - trimExpandedText: S.of(context).show_less, - ), - ) - ], - ), - ); - } - return Container( - padding: EdgeInsets.only( - left: 16.0, right: 16.0, top: 16.0, bottom: 16.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.only(bottom: 10.0), - margin: EdgeInsets.only(bottom: 5.0), - width: double.infinity, - child: ReadMoreText( - comment.content, - trimLines: 3, - trimLength: 66, - colorClickableText: Colors.blue, - trimMode: TrimMode.Length, - trimCollapsedText: S.of(context).show_more, - trimExpandedText: S.of(context).show_less, - ), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - color: Colors.black12, - ), - ), - ), - ), - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: SmoothStarRating( - starCount: 5, - rating: comment.rating.toDouble(), - size: 12.0, - filledIconData: Icons.star, - color: Colors.green, - ), - ), - Container( - child: Text( - Utils.safeString(comment.contact) + - ' ' + - Utils.utcDatetimeStringToLocalDatetimeString( - context, comment.createdAt), - style: TextStyle( - fontSize: 12.0, - color: Colors.black26, - ), - ), - ), - ], - ), - ), - Container( - child: imageRow, - ), - replyWidget, - ], - ), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 10.0, - color: Colors.black12, - ), - ), - ), - ); - }); - } - - return SmartRefresher( - enablePullUp: true, - enablePullDown: true, - header: WaterDropHeader(), - footer: CustomFooter( - builder: (BuildContext context, LoadStatus mode) { - Widget footer; - if (mode == LoadStatus.idle) { - footer = Text(S.of(context).pull_up_to_load_more); - } else if (mode == LoadStatus.loading) { - footer = CircularProgressIndicator(); - } else if (mode == LoadStatus.failed) { - footer = Text(S.of(context).load_failed_retry); - } else if (mode == LoadStatus.canLoading) { - footer = Text(S.of(context).release_to_load_more); - } else if (mode == LoadStatus.noMore) { - footer = Text(S.of(context).no_more_record); - } else { - footer = Text('...'); - } - return Container( - height: 55.0, - child: Center( - child: footer, - ), - ); - }, - ), - controller: _commentRefreshController, - onRefresh: _onCommentRefresh, - onLoading: _onCommentLoadMore, - child: commentWidget, - ); - } - - Widget _buildAppbar(BuildContext context) { - var addressRow = new Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [], - ); - addressRow.children.add(new Icon( - Icons.location_on, - size: 14.0, - color: const Color(0xFFEEEEEE), - )); - var addressColumn = new Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [], - ); - addressColumn.children.add(new Text( - _business.address.addressLine1 + - (_business.address.addressLine2.isNotEmpty - ? ' ' + _business.address.addressLine2 - : ''), - style: new TextStyle(fontSize: 13.0, color: const Color(0xFFEEEEEE)), - )); - addressColumn.children.add(new Text( - _business.address.city + - ', ' + - _business.address.state + - ', ' + - _business.address.zip, - style: new TextStyle(fontSize: 13.0, color: const Color(0xFFEEEEEE)), - )); - - addressRow.children.add(addressColumn); - - var distanceRow = new Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [], - ); - if (_business.distanceInfo != null) { - distanceRow.children.add(new Icon( - Icons.directions_car, - size: 14.0, - color: Colors.white, - )); - distanceRow.children.add(new Text( - _business.distanceInfo.distance != null - ? _business.distanceInfo.distance.text - : '***' + ' / ', - style: new TextStyle(color: const Color(0xFFEEEEEE), fontSize: 13.0), - )); - var duration = Duration( - seconds: (_business.distanceInfo.duration != null - ? _business.distanceInfo.duration.value - : 30) + - _business.shippingTime * 60); - var hours = duration.inHours.remainder(60); - var minutes = duration.inMinutes.remainder(60); - distanceRow.children.add(new Text( - hours > 0 ? S.of(context).hour_token(hours) : '', - style: new TextStyle(color: const Color(0xFFEEEEEE), fontSize: 13.0), - )); - distanceRow.children.add(new Text( - minutes > 0 - ? (hours > 0 ? ' ' : '') + S.of(context).minute_token(minutes) - : '', - style: new TextStyle(color: const Color(0xFFEEEEEE), fontSize: 13.0), - )); - distanceRow.children.add( - new Text( - ' / ' + - S.of(context).min_order_amount_token(_business.minPrice) + - ' ', - style: new TextStyle(fontSize: 13.0, color: const Color(0xFFEEEEEE)), - ), - ); - } - - Widget widget = new PreferredSize( - preferredSize: new Size.fromHeight(90.0), - child: new Container( - height: 90.0, - padding: new EdgeInsets.all(10.0), - child: new Row( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - new Container( - width: 72.0, - height: 72.0, - margin: new EdgeInsets.only(right: 10.0), - child: Stack( - children: [ - Positioned( - top: 0.0, - left: 0.0, - right: 0.0, - bottom: 0.0, - child: GestureDetector( - child: Util.showImage( - '${_business.picUrl}', - width: 72.0, - height: 72.0, - fit: BoxFit.fill, - ), - onTap: () { - // Utils.addRemoveFavorite(_business.id); - }, - ), - ), - Positioned( - top: 0.0, - left: 0.0, - right: -50.0, - bottom: -50.0, - child: Icon( - Icons.favorite, - color: Colors.transparent, - ), - ), - ], - ), - ), - new Expanded( - child: new Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - addressRow, - new Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - new Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - new Icon( - Icons.phone, - size: 14.0, - color: Colors.white, - ), - new Text( - _business.phone, - style: new TextStyle( - fontSize: 13.0, color: const Color(0xFFEEEEEE)), - ) - ], - ), - new Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - new Icon( - Icons.av_timer, - size: 14.0, - color: Colors.white, - ), - new Text( - _business.openingTime[0].openTime + - ':00 - ' + - _business.openingTime[0].closeTime + - ':00', - style: new TextStyle( - fontSize: 13.0, color: const Color(0xFFEEEEEE)), - ) - ], - ) - ], - ), - distanceRow, - ], - ), - ) - ], - ), - ), - ); - - List galleryPages = _buildBanners(context); - slidingGellery = Carousel( - height: 168.0, - pages: galleryPages, - autoPlay: true, - ); - - Widget column = new Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - _business.bulletin.isNotEmpty ? Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: - EdgeInsets.only(left: 10.0, right: 5.0, bottom: 10.0), - child: Icon( - Icons.announcement, - size: 14.0, - color: Colors.white, - )), - Container( - width: mediaQuery.size.width - 30.0, - padding: EdgeInsets.only(right: 10.0, bottom: 10.0), - child: new Text( - _business.bulletin.isEmpty ? '' : _business.bulletin, - softWrap: true, - style: new TextStyle( - fontSize: 12.0, color: const Color(0xFFDDDDDD)), -// overflow: TextOverflow.ellipsis, - ), - ), - ], - ) : SizedBox.shrink(), - _business.description.isNotEmpty ? Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - padding: EdgeInsets.only(left: 10.0, right: 5.0, bottom: 10.0), - child: Icon( - Icons.store, - size: 14.0, - color: Colors.white, - )), - Container( - padding: EdgeInsets.only(right: 10.0, bottom: 10.0), - child: new Text( - S.of(context).store_introduction, - style: new TextStyle( - fontSize: 13.0, - color: const Color(0xFFDDDDDD), - ), - overflow: TextOverflow.ellipsis, - ), - ), - ], - ), - Container( - padding: - EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 5.0), - child: Text( - _business.description, - style: TextStyle( - color: Colors.lightGreen, - fontSize: 12.0, - ), - ), - ), - ], - ) : SizedBox.shrink(), - galleryPages.isNotEmpty ? Container( - padding: EdgeInsets.only(left: 10.0, right: 10.0, bottom: 10.0), - child: slidingGellery, - ) : SizedBox.shrink(), - _business.policy.isNotEmpty ? Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - padding: EdgeInsets.only(left: 10.0, right: 5.0, bottom: 10.0), - child: Icon( - Icons.store, - size: 14.0, - color: Colors.white, - )), - Container( - padding: EdgeInsets.only(right: 10.0, bottom: 10.0), - child: new Text( - S.of(context).store_policy, - style: new TextStyle( - fontSize: 13.0, - color: const Color(0xFFDDDDDD), - ), - overflow: TextOverflow.ellipsis, - ), - ), - ], - ), - Container( - padding: EdgeInsets.only(left: 10.0, right: 10.0, bottom: 10.0), - child: SingleChildScrollView( - child: Text( - _business.policy, - softWrap: true, - style: TextStyle( - fontSize: 10.0, - color: const Color(0xFFEEEEEE), - ), - ), - ), - ), - ], - ) : SizedBox.shrink(), - ], - ); - - return Stack( - children: [ - Positioned( - top: 0, - left: 0, - right: 0, - bottom: 0, - child: Util.showImage( - _business.bannerImageUrl, - fit: BoxFit.cover, - ), - ), - Positioned( - top: 0, - left: 0, - right: 0, - bottom: 0, - child: Container( - color: Color(0x88000000), - ), - ), - Positioned( - top: kToolbarHeight + 20.0, - left: 0, - right: 0, - child: widget, - ), - Positioned( - top: kToolbarHeight + 20.0 + 90.0, - left: 0, - right: 0, - bottom: 0, - child: Container( - child: SingleChildScrollView( - child: column, - ), - ), - ), - ], - ); - } - - List _buildBanners(BuildContext context) { - var pages = []; - for (var i = 0; i < _business.slideImages.length; i++) { - pages.add(new GestureDetector( - child: new Container( - child: Util.showImage( - _business.slideImages[i].imageUrl, - fit: BoxFit.cover, - ), - ), - onTap: () {}, - )); - } - return pages; - } - - Widget _buildMainContent() { - return new Row( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - _buildCategories(), - Expanded( - child: _buildProducts(), - ) - ], - ); - } - - Widget _buildCategories() { - return new Container( - width: 200.0, - color: new Color(0xFFF5F5F5), - child: new SizedBox.expand( - child: Listener( - onPointerSignal: (ps) { - if (ps is PointerScrollEvent) { - final newOffset = _listScrollController2.offset + ps.scrollDelta.dy; - if (ps.scrollDelta.dy.isNegative) { - _listScrollController2.jumpTo(max(0, newOffset)); - } else { - _listScrollController2 - .jumpTo(min(_listScrollController2.position.maxScrollExtent, newOffset)); - } - } - }, - child: ListView.builder( - physics: ClampingScrollPhysics(), - controller: _listScrollController2, - itemCount: _categoryProducts == null ? 0 : _categoryProducts.length, - itemBuilder: (BuildContext context, int i) { - CategoryProducts cp = _categoryProducts[i]; - int qtyInCategory = 0; - CartInfo cartInfo = - Utils.getCartInfoByBusiness(store.state.cartInfos, _business); - if (cartInfo != null && - cartInfo.businessInfo.id == _business.id && - cartInfo.productList != null) { - for (var i = 0; i < cartInfo.productList.length; i++) { - if (cartInfo.productList[i].product.categoryId == cp.id) { - qtyInCategory += cartInfo.productList[i].quantity.ceil(); - } - } - } - Row categoryRow = Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [], - ); - categoryRow.children.add( - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.only(top: 5.0, bottom: 5.0), - child: Text( - cp.name, - style: TextStyle( - fontSize: 13.0, - fontWeight: (cp.id == Constants.FEATURED_PRODUCT_ID || - cp.id == Constants.HOT_SALE_ID) - ? FontWeight.bold - : FontWeight.normal, - color: (cp.id == Constants.HOT_SALE_ID) - ? Colors.redAccent - : ((cp.id == Constants.FEATURED_PRODUCT_ID) - ? Colors.lightGreen - : Colors.black87)), -// overflow: kIsWeb ? null : TextOverflow.ellipsis, - overflow: TextOverflow.ellipsis, - softWrap: true, - maxLines: 2, - ), - ), - ), - ); - if (qtyInCategory > 0) { - categoryRow.children.add( - new Badge( - badgeContent: Text( - '$qtyInCategory', - style: TextStyle( - color: Colors.white, - fontSize: 11.0, - ), - ), - animationType: BadgeAnimationType.scale, - ), - ); - } else { - categoryRow.children.add(SizedBox.shrink()); - } - return new GestureDetector( - child: new Container( - height: 70.0, - padding: new EdgeInsets.symmetric(horizontal: 10.0), - decoration: new BoxDecoration( - color: _categoryIndex == i ? Colors.white : null, - border: new Border( - bottom: - new BorderSide(color: new Color(0xFFEBEBEB)))), - child: categoryRow, - ), - onTap: () => _selectCategory(i), - ); - } - ), - ), - ), - ); - } - - void _selectCategory(int index) { - if (displayProductByCategoryClick && _categoryProducts[index].id > 0) { - categoryId = _categoryProducts[index].id; - loadProducts(); - return; - } - double height = 0.0; - double d = getProductCountInRow(); - for (int i = 0; i < index; ++i) { - height += _categoryDescHeight + - (_categoryProducts[i].products.length / d).ceil() * _productHeight; - } - if (height > _listScrollController1.position.maxScrollExtent) { - height = _listScrollController1.position.maxScrollExtent; - } - _categoryIndexChange = true; - _listScrollController1 - .animateTo(height, - duration: new Duration( - microseconds: 200, - ), - curve: Curves.linear) - .then((value) { - _categoryIndexChange = false; - }); - print( - 'height: $height, index: $index, ${_categoryProducts[0].products.length}'); - if (mounted) { - setState(() { - _categoryIndex = index; - }); - } - } - - CategoryProducts getCategoryProductByCategoryId(int cid) { - for (CategoryProducts cp in _categoryProducts) { - if (cp.id == cid) { - return cp; - } - } - return null; - } - - void _resetProductListScroll() { - if (_listScrollController1 != null && - _listScrollController1.positions.isNotEmpty) { - _listScrollController1.animateTo( - 0, - duration: new Duration( - microseconds: 200, - ), - curve: Curves.linear, - ); - } - } - - int _getCategoryIndexByRightScrollHeight(double height) { - double cHeight = 0.0; - double d = getProductCountInRow(); - if (height > 0) { - for (int i = 0; i < _categoryProducts.length; ++i) { - double categoryHeight = _categoryDescHeight + - (_categoryProducts[i].products.length / d).round() * _productHeight; - if (height >= cHeight && height < cHeight + categoryHeight) { - return i; - } - cHeight += categoryHeight; - } - } - if (height > cHeight) { - return _categoryProducts.length - 1; - } - return -1; - } - - void _setCategoryByProductScrolledIndex(int index) { - if (index == _categoryIndex) { - return; - } - double height = 0.0; - for (int i = 0; i < index; ++i) { - height += _categoryHeight; - } - if (height > _listScrollController2.position.maxScrollExtent) { - height = _listScrollController2.position.maxScrollExtent; - } - _listScrollController2.animateTo(height, - duration: new Duration( - milliseconds: 200, - ), - curve: Curves.linear); - if (mounted) { - setState(() { - _categoryIndex = index; - }); - } - } - - int numCategoriesHasProducts() { - int num = 0; - for (CategoryProducts cp in _categoryProducts) { - if (cp.products.length > 0) { - num += 1; - } - } - return num; - } - - Widget _buildProducts() { - return new SizedBox.expand( - child: NotificationListener( - onNotification: (ScrollUpdateNotification notification) { - if (!displayProductByCategoryClick) { - if (_categoryIndexChange) { - return; - } - int index = _getCategoryIndexByRightScrollHeight( - notification.metrics.pixels); - _setCategoryByProductScrolledIndex(index); - } - return; - }, - child: Listener( - onPointerSignal: (ps) { - if (ps is PointerScrollEvent) { - final newOffset = _listScrollController1.offset + ps.scrollDelta.dy; - if (ps.scrollDelta.dy.isNegative) { - _listScrollController1.jumpTo(max(0, newOffset)); - } else { - _listScrollController1 - .jumpTo(min(_listScrollController1.position.maxScrollExtent, newOffset)); - } - } - }, - child: ListView.builder( - physics: ClampingScrollPhysics(), - controller: _listScrollController1, - // itemCount: displayProductByCategoryClick ? 1 : (_categoryProducts == null ? 0 : _categoryProducts.length), - itemCount: - _categoryProducts == null ? 0 : numCategoriesHasProducts(), - itemBuilder: (BuildContext context, int i) { - CategoryProducts cp; - cp = _categoryProducts[i]; - - int index = -1; - if (displayProductByCategoryClick) { - if (categoryId > 0) { - for (var j = 0; j < _categoryProducts.length; j++) { - if (_categoryProducts[j].id == categoryId) { - cp = _categoryProducts[j]; - index = j; - break; - } - } - if (cp == null) { - index = 0; - cp = _categoryProducts[0]; - } - } - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - _setCategoryByProductScrolledIndex(index); - }); - } - - if (cp.products.length == 0) { - return SizedBox.shrink(); - } - - Column col = new Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [], - ); - col.children.add(new Container( - height: _categoryDescHeight, - padding: new EdgeInsets.symmetric(horizontal: 10.0), - color: new Color(0xFFF5F5F5), - child: new Row( - children: [ - new Expanded( - child: new Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - textBaseline: TextBaseline.alphabetic, - children: [ - new Padding( - padding: new EdgeInsets.only(right: 5.0), - child: new Text( - cp.name, - style: new TextStyle( - fontSize: 16.0, - fontWeight: - (cp.id == Constants.FEATURED_PRODUCT_ID || - cp.id == Constants.HOT_SALE_ID) - ? FontWeight.bold - : FontWeight.normal, - color: (cp.id == Constants.HOT_SALE_ID) - ? Colors.redAccent - : ((cp.id == - Constants.FEATURED_PRODUCT_ID) - ? Colors.lightGreen - : Colors.black87)), - overflow: TextOverflow.ellipsis, - ), - ), - new Visibility( - visible: cp.description.isNotEmpty, - child: new Text( - cp.description, - overflow: TextOverflow.ellipsis, - style: new TextStyle( - fontSize: 10.0, - color: new Color(0xFF999999)), - ), - replacement: const SizedBox.shrink()), - ], - )) - ], - ))); - - var it = cp.products.iterator; - for (int i = 0; i < cp.products.length; i++) { - var r1 = Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [], - ); - double d = getProductCountInRow(); - int c = int.parse(d.toString()); - while (d > 0) { - if (it.moveNext()) { - r1.children.add( - Container( - width: (mainSpace - 200) / c - 4.0, - margin: EdgeInsets.only(top: 2.0, bottom: 2.0, left: 2.0, right: 2.0), - child: ProductItem( - it.current, - _business, - ), - ), - ); - } - d -= 1; - } - col.children.add(r1); - } - - // for (var p in cp.products) { - // var pStack = new Stack( - // children: [], - // ); - // - // pStack.children.add(new ProductItem( - // product: p, - // business: _business, - // )); - // - // col.children.add(pStack); - // } - if (displayProductByCategoryClick) { - if (displayProductByCategoryClickIndicator.isNotEmpty) { - col.children.add( - Container( - padding: EdgeInsets.all(12.0), - child: Center( - child: Text( - displayProductByCategoryClickIndicator, - style: TextStyle( - color: Colors.black54, - ), - ), - ), - ), - ); - } else if (categoryId > 0) { - if (cp.products.length < Constants.ORDERS_PER_PAGE) { - lastProductListScrollPositionPixel = 0; - col.children.add( - Container( - padding: EdgeInsets.all(12.0), - child: Center( - child: Text( - S - .of(context) - .end_of_the_list, - style: TextStyle( - color: Colors.black54, - ), - ), - ), - ), - ); - } else { - col.children.add( - Container( - padding: EdgeInsets.all(12.0), - child: Center( - child: Text( - S - .of(context) - .pull_up_to_load_more, - style: TextStyle( - color: Colors.black54, - ), - ), - ), - ), - ); - } - } - } - return col; - } - ), - ), - ), - ); - } - - double getProductCountInRow() { - double d = 2; - if (mainSpace >= 800 && mainSpace < 1000) { - d = 3; - } else if (mainSpace >= 1000) { - d = 4; - } - return d; - } - - @override - void initState() { - super.initState(); - - _shopCoordinator = ShopScrollCoordinator(); - _tabController = TabController(vsync: this, length: 2); - - refresh = false; - - _listScrollController1 = _shopCoordinator.newChildScrollController(); - _listScrollController2 = _shopCoordinator.newChildScrollController(); - _listScrollController3 = _shopCoordinator.newChildScrollController(); - - _listScrollController1.addListener(() { - if (_listScrollController1.position.atEdge) { - if (_listScrollController1.position.pixels == 0) { - print('product list at top'); - } else { - print('product list at bottom, $displayProductByCategoryClick, ' - '$_productCurrentPage, ' - 'pixels: ${_listScrollController1.position.pixels}'); - - if (displayProductByCategoryClick && _productCurrentPage != 0 - && _listScrollController1.position.pixels > lastProductListScrollPositionPixel) { - lastProductListScrollPositionPixel = _listScrollController1.position.pixels; - loadMoreProducts(); - } - } - } - }); - - eventBus.on().listen((event) { - if (mounted) { - setState(() { - refresh = true; - }); - } - }); - - loadProducts(); - } - - void loadProducts() { - if (categoryId < 0) { - return; - } - if (_categoryProducts != null) { - _isLoading = true; - Utils.showLoadingDialog(context, message: S.of(context).loading); - } - lastProductListScrollPositionPixel = 0; - _productCurrentPage = 1; - Utils.loadProducts( - widget.businessId, categoryId, _productCurrentPage, false, - (value) { - if (_isLoading) { - _isLoading = false; - Navigator.of(context).pop(); - } - if (mounted) { - setState(() { - - _isSearching = false; - - if (_searchController.text.isEmpty) { - responseData = value; - } - displayProductByCategoryClick = - value['display_product_by_category_click']; - displayProductByCategoryClickIndicator = ''; - _business = Business.fromJson(value['business']); - _categoryProducts = (value['category_products'] as List) - .map((i) => CategoryProducts.fromJson(i)) - .toList(); - - // _featuredProducts = (value['featured_products'] as List) - // .map((i) => Product.fromJson(i)) - // .toList(); - // _hotSaleProducts = (value['hot_sale_products'] as List) - // .map((i) => Product.fromJson(i)) - // .toList(); - _featuredProducts = []; - _hotSaleProducts = []; - _prompts = value['prompt'] as List; - - if (_hotSaleProducts.length > 0) { - CategoryProducts hs = CategoryProducts( - Constants.HOT_SALE_ID, - widget.businessId, - S.of(context).hot_sale, - '', - '', - _hotSaleProducts); - _categoryProducts.insert(0, hs); - } - - if (_featuredProducts.length > 0) { - CategoryProducts fe = CategoryProducts( - Constants.FEATURED_PRODUCT_ID, - widget.businessId, - S.of(context).featured_product, - '', - '', - _featuredProducts); - _categoryProducts.insert(0, fe); - } - - checkActionAndClose(context); - - if (displayProductByCategoryClick) { - _resetProductListScroll(); - } - }); - } - }, - (error) { - print('error: $error'); - _isSearching = false; - if (_isLoading) { - _isLoading = false; - Navigator.of(context).maybePop(); - } - if (mounted) { - setState(() {}); - } - Utils.showMessageDialog(context, error); - }, featuredCount: 5, hotSaleCount: 0, keyword: _searchController.text - ); - } - - void loadMoreProducts() { - if (_productCurrentPage == 0 || categoryId <= 0) { - return; - } - _productCurrentPage += 1; - Utils.loadProducts(widget.businessId, categoryId, _productCurrentPage, true, - (value) { - if (_isLoading) { - _isLoading = false; - Navigator.of(context).maybePop(); - } - if (mounted) { - setState(() { - List moreCategoryProducts = - (value as List).map((i) => CategoryProducts.fromJson(i)).toList(); - if (moreCategoryProducts.isEmpty) { - _productCurrentPage = 0; - displayProductByCategoryClickIndicator = - S.of(context).end_of_the_list; - } else { - if (moreCategoryProducts[0].products.length < Constants.ORDERS_PER_PAGE) { - _productCurrentPage = 0; - displayProductByCategoryClickIndicator = - S.of(context).end_of_the_list; - } else { - displayProductByCategoryClickIndicator = - S.of(context).pull_up_to_load_more; - } - CategoryProducts currentCp = - getCategoryProductByCategoryId(categoryId); - if (currentCp != null) { - currentCp.products.addAll(moreCategoryProducts[0].products); - } else { - _productCurrentPage = 0; - displayProductByCategoryClickIndicator = - S.of(context).end_of_the_list; - } - } - }); - } - }, - (error) { - print('error: $error'); - if (_isLoading) { - _isLoading = false; - Navigator.of(context).maybePop(); - } - Utils.showMessageDialog(context, error); - }, keyword: _searchController.text - ); - } - - CartLineItem _newCartLineItem( - {int id, - double price, - Product product, - String name, - String description, - double quantity}) { - CartLineItem lineItem = CartLineItem(); - lineItem.unitPrice = price; - lineItem.product = product; - lineItem.name = product.name; - lineItem.description = description; - lineItem.quantity = quantity; - return lineItem; - } - - @override - void dispose() { - print('Shop disposed!!!'); - // onProductWillAddToCartSubscription?.cancel(); - // onProductWillRemoveFromCartSubscription?.cancel(); - _tabController?.dispose(); - _pageScrollController?.dispose(); - _commentRefreshController?.dispose(); - _listScrollController1?.dispose(); - _listScrollController2?.dispose(); - _listScrollController3?.dispose(); - super.dispose(); - } - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - } - - void _showProductDetail(Product p) { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ProductDetailPage( - product: p, - business: _business, - )), - ); - } - - void checkActionAndClose(BuildContext mainContext) { - // if (widget.action == Constants.ACTION_COUPON && store.state.referrerContactId != null && store.state.referrerContactId > 0) { - // showDialog( - // context: context, - // barrierDismissible: false, - // builder: (BuildContext context) { - // return AlertDialog( - // title: Text(S.of(context).coupon), - // content: Text( - // S.of(context).a_friend_send_you_a_coupon - // ), - // actions: [ - // FlatButton( - // child: Text(S.of(context).no_thanks), - // onPressed: () { - // Navigator.of(context).pop(); - // checkClose(mainContext, _business); - // }, - // ), - // RaisedButton( - // child: Text( - // S.of(context).yes, - // style: TextStyle( - // color: Colors.white, - // ), - // ), - // color: Theme.of(context).primaryColor, - // onPressed: () { - // Utils.showLoadingDialog(mainContext, message: S.of(context).processing); - // HttpUtil.httpGet('v1/get-referrer-coupon', - // businessId: _business.id, - // queryParameters: { - // 'referrer_contact_id': store.state.referrerContactId, - // } - // ).then((data) { - // Navigator.of(context).pop(); - // Coupon coupon = Coupon.fromJson(data); - // showDialog( - // context: mainContext, - // barrierDismissible: false, - // builder: (BuildContext context) { - // return AlertDialog( - // title: Text( - // S.of(context).congratulation, - // ), - // content: Text( - // S.of(context).got_a_coupon_token(coupon.valueAmount) - // ), - // actions: [ - // FlatButton( - // child: Text( - // S.of(context).close, - // ), - // onPressed: () { - // Navigator.of(context).pop(); - // Navigator.of(context).pop(); - // }, - // ), - // ], - // ); - // } - // ); - // }).catchError((error) { - // Navigator.of(context).pop(); - // Navigator.of(context).pop(); - // if (error is DioError) { - // if (error.response.data['code'] == 1013) { - // showDialog( - // context: mainContext, - // barrierDismissible: false, - // builder: (BuildContext context) { - // return AlertDialog( - // title: Text(S.of(context).error), - // content: Text(error.response.data['message']), - // actions: [ - // FlatButton( - // child: Text(S.of(context).cancel), - // onPressed: () { - // Navigator.of(context).pop(); - // }, - // ), - // RaisedButton( - // color: Theme.of(context).primaryColor, - // child: Text( - // S.of(context).login, - // style: TextStyle( - // color: Colors.white, - // ), - // ), - // onPressed: () { - // Navigator.of(context).pop(); - // store.dispatch(UpdateRedirectRoute('/shop/${widget.businessId}/${widget.deviceId}/${widget.tableNo}/${widget.action}')); - // Routes.router.navigateTo(context, '/login'); - // }, - // ), - // ], - // ); - // } - // ); - // } else { - // Utils.showMessageDialog(mainContext, error); - // } - // } else { - // Utils.showMessageDialog(mainContext, error); - // } - // }); - // }, - // ) - // ], - // ); - // } - // ); - // } else { - // checkClose(context, _business); - // } - } - - void checkClose(BuildContext context, Business business) { - if (checkCloseFlag) { - return; - } - checkCloseFlag = true; - if (business.forceClose) { - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: Text(S.of(context).warning), - content: Text( - S.of(context).store_closed, - ), - actions: [ - TextButton( - child: Text(S.of(context).ok), - onPressed: () { - Navigator.of(context).maybePop(); - showPrompt(0); - }, - ) - ], - ); - }); - } else { - DateTime now = DateTime.now(); - if (!(now.hour >= business.todayOpen && - now.hour <= business.todayClose)) { - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( -// title: Text( -// S.of(context).warning, -// ), - content: Container( - height: 170.0, - child: Center( - child: Column( - children: [ - Container( - child: Icon( - Icons.add_shopping_cart, - size: 100.0, - color: Colors.black12, - ), - ), - Container( - child: Text( - S.of(context).closed, - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.bold, - ), - ), - ), - Container( - child: Text( - S.of(context).book_now_delivery_later_token( - business.todayOpen), - style: TextStyle( - color: Colors.black38, - ), - ), - ), - ], - ), - ), - ), - actions: [ - TextButton( - child: Text(S.of(context).ok), - onPressed: () { - Navigator.of(context).maybePop(); - showPrompt(0); - }, - ) - ], - ); - }); - } else { - showPrompt(0); - } - } - } - - void showPrompt(int idx) { - if (_prompts.length > idx) { - Map _prompt = _prompts[idx] as Map; - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: Text(_prompt['title']), - content: Text(_prompt['message']), - actions: [ - TextButton( - child: Text(S.of(context).ok), - onPressed: () { - Navigator.of(context).pop(); - showPrompt(idx + 1); - }, - ), - ], - ); - }); - } - } - - @override - bool get wantKeepAlive => true; - - void onSearchTap() { - setState(() { - if (searchIcon.icon == Icons.search) { - searchIcon = new Icon( - Icons.close, - color: Colors.white, - ); - if (displayProductByCategoryClick) { - searchFieldPlaceHolder = Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: - TextField( - controller: _searchController, - textInputAction: TextInputAction.search, - onSubmitted: (value) { - onSearchButtonTap(); - }, - style: TextStyle( - color: Colors.black87, - ), - decoration: new InputDecoration( - hintText: S - .of(context) - .enter_keyword, - hintStyle: TextStyle(color: Colors.black26)), - onChanged: searchOperation, - ), - ), - SizedBox(width: 5,), - ElevatedButton.icon( - style: ElevatedButton.styleFrom( - primary: Colors.redAccent, - onPrimary: Colors.white, - padding: EdgeInsets.only(left: 5, right: 5, top: 5, bottom: 5), - elevation: 2.0, - shape: new RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(5.0), - ), - ), - onPressed: onSearchButtonTap, - icon: Icon( - Icons.search, - size: 16, - color: Colors.green, - ), - label: Text( - S.of(context).search, - style: TextStyle( - color: Colors.green, - ), - ), - ), - ], - ); - } else { - searchFieldPlaceHolder = TextField( - controller: _searchController, - style: TextStyle( - color: Colors.black87, - ), - decoration: new InputDecoration( - hintText: S - .of(context) - .enter_keyword, - hintStyle: TextStyle(color: Colors.black26)), - onChanged: searchOperation, - ); - _handleSearchStart(); - } - } else { - _handleSearchEnd(); - } - }); - } - - void _handleSearchStart() { - setState(() { - _isSearching = true; - }); - } - - void _handleSearchEnd() { - setState(() { - searchIcon = new Icon( - Icons.search, - color: Colors.blue, - ); - searchFieldPlaceHolder = MouseRegion( - cursor: SystemMouseCursors.click, - child: GestureDetector( - child: Text( - S.of(context).search_products, - style: new TextStyle(color: Colors.blue), - ), - onTap: () { - onSearchTap(); - }, - ), - ); - _isSearching = false; - _searchController.clear(); - if (displayProductByCategoryClick) { - categoryId = 0; - loadProducts(); - } - }); - } - - void searchOperation(String searchText) { - if (displayProductByCategoryClick) { - - } else { - if (responseData != null) { - _categoryProducts.clear(); - List cps = (responseData['category_products'] as List) - .map((i) { - CategoryProducts cp = CategoryProducts.fromJson(i); - List ps = []; - for (Product p in cp.products) { - if (p.name.toLowerCase().contains(searchText.toLowerCase()) || - p.description.toLowerCase().contains(searchText.toLowerCase()) || - (p.detailDescription != null && p.detailDescription.toLowerCase().contains(searchText.toLowerCase()))) { - ps.add(p); - } - } - if (ps.length > 0) { - cp.products = ps; - return cp; - } - }).toList(); - for (CategoryProducts cp in cps) { - if (cp != null) { - _categoryProducts.add(cp); - } - } - print('$searchText, count: ${_categoryProducts.length}'); - setState(() {}); - } - } - } - - void onSearchButtonTap() { - String kw = _searchController.text; - if (kw.isNotEmpty) { - _handleSearchStart(); - loadProducts(); - } - } -} - -class _SliverAppBarDelegate2 extends SliverPersistentHeaderDelegate { - _SliverAppBarDelegate2({ - @required this.minHeight, - @required this.maxHeight, - @required this.child, - }); - - final double minHeight; - final double maxHeight; - final Widget child; - - @override - double get minExtent => this.minHeight; - - @override - double get maxExtent => max(maxHeight, minHeight); - - @override - Widget build( - BuildContext context, double shrinkOffset, bool overlapsContent) { - return SizedBox.expand(child: child); - } - - @override - bool shouldRebuild(_SliverAppBarDelegate2 oldDelegate) { - return maxHeight != oldDelegate.maxHeight || - minHeight != oldDelegate.minHeight || - child != oldDelegate.child; - } -} diff --git a/lib/widgets/general/add_remove_button.dart b/lib/widgets/general/add_remove_button.dart index 4d3f82b..fe407bb 100644 --- a/lib/widgets/general/add_remove_button.dart +++ b/lib/widgets/general/add_remove_button.dart @@ -22,6 +22,7 @@ class AddRemoveButton extends StatefulWidget { final bool addOnly; final int cartLineItemIndex; final bool addToBasket; + final bool onHovor; AddRemoveButton({ this.product, @@ -29,6 +30,7 @@ class AddRemoveButton extends StatefulWidget { this.addOnly = false, this.cartLineItemIndex = -1, this.addToBasket = false, + this.onHovor = false, }); @override @@ -72,7 +74,7 @@ class AddRemoveButtonState extends State { return Container( padding: EdgeInsets.only(top: 5.0, bottom: 5.0, left: 32.0, right: 32.0), child: Text( - 'x$_qty' + 'x$_qty' ), ); } @@ -121,13 +123,16 @@ class AddRemoveButtonState extends State { padding: EdgeInsets.all(10), position: BadgePosition.topEnd(top: -15, end: -10), badgeColor: Colors.lightBlueAccent, - child: RaisedButton.icon( - padding: EdgeInsets.only(left: 32, right: 32, top: 20, bottom: 20), - elevation: 2.0, - shape: new RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(10.0), + child: ElevatedButton.icon( + style: ElevatedButton.styleFrom( + primary: Colors.redAccent, + onPrimary: Colors.white, + padding: EdgeInsets.only(left: 32, right: 32, top: 20, bottom: 20), + elevation: 2.0, + shape: new RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0), + ), ), - color: Colors.redAccent, icon: Icon( Icons.shopping_basket_outlined, size: 32.0, @@ -147,13 +152,15 @@ class AddRemoveButtonState extends State { ), ); } else { - return RaisedButton.icon( - padding: EdgeInsets.only(left: 32, right: 32, top: 20, bottom: 20), - elevation: 2.0, - shape: new RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(10.0), + return ElevatedButton.icon( + style: ElevatedButton.styleFrom( + primary: Colors.redAccent, + padding: EdgeInsets.only(left: 32, right: 32, top: 20, bottom: 20), + elevation: 2.0, + shape: new RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0), + ), ), - color: Colors.redAccent, icon: Icon( Icons.shopping_basket_outlined, size: 32.0, @@ -172,7 +179,7 @@ class AddRemoveButtonState extends State { }, ); } - }else if (widget.addOnly) { + } else if (widget.addOnly) { return Container( key: startKey, padding: EdgeInsets.all(0.0), @@ -235,6 +242,9 @@ class AddRemoveButtonState extends State { ], ); } else { + if (!widget.onHovor && _qty == 0) { + return SizedBox.shrink(); + } return new Row( key: startKey, crossAxisAlignment: CrossAxisAlignment.end, @@ -337,28 +347,28 @@ class AddRemoveButtonState extends State { if (widget.cartLineItemIndex != -1) { if (cartInfo.productList[widget.cartLineItemIndex].quantity <= 1) { showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: Text(S.of(context).warning), - content: Text(S.of(context).are_you_sure_to_remove_the_item), - actions: [ - FlatButton( - child: Text(S.of(context).cancel), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - FlatButton( - child: Text(S.of(context).yes_i_am_sure), - onPressed: () { - _removeCartLineItem(); - Navigator.of(context).pop(); - }, - ), - ], - ); - } + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text(S.of(context).warning), + content: Text(S.of(context).are_you_sure_to_remove_the_item), + actions: [ + TextButton( + child: Text(S.of(context).cancel), + onPressed: () { + Navigator.of(context).maybePop(); + }, + ), + TextButton( + child: Text(S.of(context).yes_i_am_sure), + onPressed: () { + _removeCartLineItem(); + Navigator.of(context).maybePop(); + }, + ), + ], + ); + } ); } else { _removeCartLineItem(); diff --git a/lib/widgets/general/download_item.dart b/lib/widgets/general/download_item.dart index 3000612..fac7d0f 100644 --- a/lib/widgets/general/download_item.dart +++ b/lib/widgets/general/download_item.dart @@ -1,14 +1,13 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import '../../widgets/general/text_link.dart'; import 'package:url_launcher/url_launcher.dart'; -import '../../generated/l10n.dart'; -import '../../utils/utils.dart'; -import '../../utils/extensions.dart'; -import 'package:universal_io/io.dart'; + import '../../constants.dart'; +import '../../generated/l10n.dart'; +import '../../utils/extensions.dart'; import '../../utils/util_web.dart' if (dart.library.io) '../../utils/util_io.dart'; +import '../../utils/utils.dart'; class DownloadItem extends StatefulWidget { final dynamic desc; @@ -242,9 +241,11 @@ class DownloadItemState extends State { ), ); } else if (downloadUrl != null && downloadUrl.isNotEmpty) { - return RaisedButton( - color: Theme.of(context).primaryColor, - padding: EdgeInsets.all(8.0), + return ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + padding: EdgeInsets.all(8) + ), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/widgets/general/payment_verification_code_dialog.dart b/lib/widgets/general/payment_verification_code_dialog.dart index b6b2cac..0321372 100644 --- a/lib/widgets/general/payment_verification_code_dialog.dart +++ b/lib/widgets/general/payment_verification_code_dialog.dart @@ -95,7 +95,7 @@ class PaymentVerificationCodeDialogState extends State with SingleTickerProvid ScrollController _sc; bool _scrollingEnabled = false; - VelocityTracker _vt = new VelocityTracker(); + VelocityTracker _vt = VelocityTracker.withKind(PointerDeviceKind.touch); bool _isPanelVisible = true; @@ -312,7 +312,7 @@ class _SlidingUpPanelState extends State with SingleTickerProvid ); }, child: Stack( - overflow: Overflow.visible, + clipBehavior: Clip.none, children: [ //open panel diff --git a/lib/widgets/mobile/mobile_attribute_selection.dart b/lib/widgets/mobile/mobile_attribute_selection.dart index 708d8d2..16e9fbb 100644 --- a/lib/widgets/mobile/mobile_attribute_selection.dart +++ b/lib/widgets/mobile/mobile_attribute_selection.dart @@ -35,8 +35,8 @@ class MobileAttributeSelection extends StatefulWidget { class MobileAttributeSelectionState extends State { Product product; int index; - FlatButton previousButton; - FlatButton nextButton; + TextButton previousButton; + TextButton nextButton; bool previousButtonEnable; bool nextButtonEnable; @@ -159,12 +159,12 @@ class MobileAttributeSelectionState extends State { } Widget _getProductContent() { - previousButton = new FlatButton( + previousButton = TextButton( onPressed: previousButtonEnable ? _goPrevious : null, child: new Text(S.of(context).previous), ); - nextButton = new FlatButton( + nextButton = TextButton( onPressed: nextButtonEnable ? _goNext : null, child: new Text( product.productAttributes.length > index + 1 ? nextText : finishText diff --git a/lib/widgets/mobile/mobile_change_mobile_or_email.dart b/lib/widgets/mobile/mobile_change_mobile_or_email.dart index ef14b1f..ba21651 100644 --- a/lib/widgets/mobile/mobile_change_mobile_or_email.dart +++ b/lib/widgets/mobile/mobile_change_mobile_or_email.dart @@ -221,8 +221,10 @@ class MobileChangeMobileOrEmailState extends State { margin: EdgeInsets.only(top: 0.0, right: 16.0), child: Align( alignment: Alignment.centerRight, - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).submit_to_change, style: TextStyle( diff --git a/lib/widgets/mobile/mobile_change_password.dart b/lib/widgets/mobile/mobile_change_password.dart index 5d10c0e..4cc40f6 100644 --- a/lib/widgets/mobile/mobile_change_password.dart +++ b/lib/widgets/mobile/mobile_change_password.dart @@ -230,8 +230,10 @@ class MobileChangePasswordState extends State { padding: EdgeInsets.only(right: 16.0, top: 16.0, bottom: 20.0), child: Align( alignment: Alignment.centerRight, - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).submit, style: TextStyle( @@ -257,7 +259,7 @@ class MobileChangePasswordState extends State { title: Text(S.of(context).success), content: Text(S.of(context).password_has_been_changed), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).ok), onPressed: () { Navigator.of(context).pop(); diff --git a/lib/widgets/mobile/mobile_checkout.dart b/lib/widgets/mobile/mobile_checkout.dart index 30398cb..8d3dd9c 100644 --- a/lib/widgets/mobile/mobile_checkout.dart +++ b/lib/widgets/mobile/mobile_checkout.dart @@ -112,8 +112,10 @@ class MobileCheckoutState extends State with SingleTickerProvide Text( S.of(context).no_delivery_method, ), - RaisedButton( - color: Theme.of(context).primaryColor, + ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).ok, style: TextStyle( @@ -1195,7 +1197,7 @@ class MobileCheckoutState extends State with SingleTickerProvide ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).cancel), onPressed: () { panelController.close(); @@ -1260,7 +1262,7 @@ class MobileCheckoutState extends State with SingleTickerProvide ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).cancel), onPressed: () { panelController.close(); @@ -1365,7 +1367,7 @@ class MobileCheckoutState extends State with SingleTickerProvide ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).close), onPressed: () { panelController.close(); @@ -1411,7 +1413,7 @@ class MobileCheckoutState extends State with SingleTickerProvide ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).cancel), onPressed: () { panelController.close(); @@ -1585,7 +1587,7 @@ class MobileCheckoutState extends State with SingleTickerProvide ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).cancel), onPressed: () { panelController.close(); @@ -1637,7 +1639,7 @@ class MobileCheckoutState extends State with SingleTickerProvide ), Container( margin: EdgeInsets.only(left: 5.0), - child: RaisedButton( + child: ElevatedButton( child: Text( S.of(context).get_coupon, ), @@ -1931,7 +1933,7 @@ class MobileCheckoutState extends State with SingleTickerProvide )); for (int i = 0; i < cartInfo.businessInfo.quickInputs.length; i++) { String qi = cartInfo.businessInfo.quickInputs[i].value; - w.children.add(FlatButton( + w.children.add(TextButton( child: Text( qi, style: TextStyle( @@ -1973,7 +1975,7 @@ class MobileCheckoutState extends State with SingleTickerProvide ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).cancel), onPressed: () { panelController.close(); @@ -1982,7 +1984,7 @@ class MobileCheckoutState extends State with SingleTickerProvide ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).save), onPressed: () { if (mounted) { @@ -2049,7 +2051,7 @@ class MobileCheckoutState extends State with SingleTickerProvide ), Container( padding: EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), - child: FlatButton( + child: TextButton( child: Text(S.of(context).cancel), onPressed: () { panelController.close(); diff --git a/lib/widgets/mobile/mobile_coupons.dart b/lib/widgets/mobile/mobile_coupons.dart index 47bb473..073aa2f 100644 --- a/lib/widgets/mobile/mobile_coupons.dart +++ b/lib/widgets/mobile/mobile_coupons.dart @@ -246,17 +246,19 @@ class MobileCouponsState extends State { ), ), Container( - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + ), child: Text( S.of(context).redeem_coupon, style: TextStyle( color: Colors.white, ), ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(20.0), - ), onPressed: () { if (coupon.store != null) { Routes.router.navigateTo(context, '/shop/${coupon.store.id}/na/na/na'); diff --git a/lib/widgets/mobile/mobile_edit_address.dart b/lib/widgets/mobile/mobile_edit_address.dart index 83b3313..24aacf3 100644 --- a/lib/widgets/mobile/mobile_edit_address.dart +++ b/lib/widgets/mobile/mobile_edit_address.dart @@ -410,7 +410,7 @@ class MobileEditAddressState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - FlatButton( + TextButton( child: Text( S .of(context) @@ -428,7 +428,7 @@ class MobileEditAddressState extends State { .of(context) .are_you_sure_to_delete_the_address), actions: [ - FlatButton( + TextButton( child: Text(S .of(context) .cancel), @@ -436,7 +436,7 @@ class MobileEditAddressState extends State { Navigator.of(context).pop(); }, ), - FlatButton( + TextButton( child: Text(S .of(context) .yes_i_am_sure), @@ -451,7 +451,7 @@ class MobileEditAddressState extends State { ); }, ), - FlatButton( + TextButton( child: Text( S .of(context) diff --git a/lib/widgets/mobile/mobile_forgot_password.dart b/lib/widgets/mobile/mobile_forgot_password.dart index 495680f..68e59b4 100644 --- a/lib/widgets/mobile/mobile_forgot_password.dart +++ b/lib/widgets/mobile/mobile_forgot_password.dart @@ -204,8 +204,10 @@ class MobileForgotPasswordState extends State { margin: EdgeInsets.only(top: 0.0, right: 16.0), child: Align( alignment: Alignment.centerRight, - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).verify, style: TextStyle( diff --git a/lib/widgets/mobile/mobile_login.dart b/lib/widgets/mobile/mobile_login.dart index 1cd5318..c048645 100644 --- a/lib/widgets/mobile/mobile_login.dart +++ b/lib/widgets/mobile/mobile_login.dart @@ -160,7 +160,7 @@ class MobileLoginState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - FlatButton( + TextButton( child: Text( S.of(context).new_user_question, style: TextStyle( @@ -175,7 +175,7 @@ class MobileLoginState extends State { child: Text(''), ), Container( - child: FlatButton( + child: TextButton( child: Text( S.of(context).forgot_password_question, style: TextStyle( @@ -194,8 +194,10 @@ class MobileLoginState extends State { alignment: Alignment.centerRight, child: Container( padding: EdgeInsets.only(top: 20.0, left: 16.0, right: 16.0, bottom: 20.0), - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).login, style: TextStyle( diff --git a/lib/widgets/mobile/mobile_me.dart b/lib/widgets/mobile/mobile_me.dart index a8c8861..e5a0ff1 100644 --- a/lib/widgets/mobile/mobile_me.dart +++ b/lib/widgets/mobile/mobile_me.dart @@ -405,7 +405,7 @@ class MobileMeState extends State { S.of(context).feature_not_available_web, ), actions: [ - FlatButton( + TextButton( onPressed: () { Routes.router.pop(context); }, @@ -679,15 +679,19 @@ class MobileMeState extends State { title: Text(S.of(context).warning), content: Text(S.of(context).email_needed), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).cancel), onPressed: () { Navigator.of(context).pop(); }, ), - RaisedButton( - color: Theme.of(context).primaryColor, - textColor: Colors.white, + ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + textStyle: TextStyle( + color: Colors.white, + ), + ), child: Text(S.of(context).ok), onPressed: () { Navigator.of(context).pop(); diff --git a/lib/widgets/mobile/mobile_my_cards.dart b/lib/widgets/mobile/mobile_my_cards.dart index 77a8571..38481bb 100644 --- a/lib/widgets/mobile/mobile_my_cards.dart +++ b/lib/widgets/mobile/mobile_my_cards.dart @@ -113,14 +113,16 @@ class MyCardsState extends State { S.of(context).are_you_sure_to_remove_the_card, ), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).cancel), - color: Theme.of(context).primaryColor, + style: TextButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), onPressed: () { Navigator.of(context).pop(); }, ), - FlatButton( + TextButton( child: Text(S.of(context).yes_i_am_sure), onPressed: () { Navigator.of(context).pop(); diff --git a/lib/widgets/mobile/mobile_new_address.dart b/lib/widgets/mobile/mobile_new_address.dart index efc8d8c..229e2a1 100644 --- a/lib/widgets/mobile/mobile_new_address.dart +++ b/lib/widgets/mobile/mobile_new_address.dart @@ -329,7 +329,7 @@ class MobileNewAddressState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ SizedBox(), - FlatButton( + TextButton( child: Text( S.of(context).save ), diff --git a/lib/widgets/mobile/mobile_new_comment.dart b/lib/widgets/mobile/mobile_new_comment.dart index 8d58445..a315ebf 100644 --- a/lib/widgets/mobile/mobile_new_comment.dart +++ b/lib/widgets/mobile/mobile_new_comment.dart @@ -204,14 +204,16 @@ class MobileNewCommentState extends State { title: Text(S.of(context).warning), content: Text(S.of(context).are_you_sure_to_remove_the_picture), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).cancel), onPressed: () { Navigator.of(context).pop(); }, - color: Theme.of(context).primaryColor, + style: TextButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), ), - FlatButton( + TextButton( child: Text(S.of(context).yes_i_am_sure), onPressed: () { Navigator.of(context).pop(); diff --git a/lib/widgets/mobile/mobile_new_ticket.dart b/lib/widgets/mobile/mobile_new_ticket.dart index eac2d5d..05ec49a 100644 --- a/lib/widgets/mobile/mobile_new_ticket.dart +++ b/lib/widgets/mobile/mobile_new_ticket.dart @@ -160,8 +160,10 @@ class MobileNewTicketState extends State { alignment: Alignment.centerRight, child: Container( padding: EdgeInsets.only(top: 20.0, left: 16.0, right: 16.0, bottom: 20.0), - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).submit, style: TextStyle( @@ -233,7 +235,7 @@ class MobileNewTicketState extends State { title: Text(S.of(context).success), content: Text(S.of(context).ticket_created_success), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).ok), onPressed: () { Routes.router.navigateTo(context, '/my-support/${widget.businessId}', replace: true); @@ -363,15 +365,17 @@ class MobileNewTicketState extends State { title: Text(S.of(context).warning), content: Text(S.of(context).are_you_sure_to_remove_the_picture), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).cancel), onPressed: () { Navigator.of(context).pop(); }, ), - RaisedButton( + ElevatedButton( child: Text(S.of(context).yes_i_am_sure), - color: Theme.of(context).primaryColor, + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), onPressed: () { Navigator.of(context).pop(); setState(() { diff --git a/lib/widgets/mobile/mobile_new_user.dart b/lib/widgets/mobile/mobile_new_user.dart index 3d5e987..1fd66a0 100644 --- a/lib/widgets/mobile/mobile_new_user.dart +++ b/lib/widgets/mobile/mobile_new_user.dart @@ -201,8 +201,10 @@ class MobileNewUserState extends State { margin: EdgeInsets.only(top: 0.0, right: 16.0), child: Align( alignment: Alignment.centerRight, - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).register, style: TextStyle( diff --git a/lib/widgets/mobile/mobile_order_detail.dart b/lib/widgets/mobile/mobile_order_detail.dart index 910c153..da9704e 100644 --- a/lib/widgets/mobile/mobile_order_detail.dart +++ b/lib/widgets/mobile/mobile_order_detail.dart @@ -984,7 +984,7 @@ class MobileOrderDetailState extends State { Container( padding: EdgeInsets.only(right: 10.0), child: order.status == Constants.STATUS_PENDING && order.paymentStatus == Constants.PAYMENT_STATUS_UNPAID ? - FlatButton( + TextButton( child: Text( S.of(context).cancel_order, ), @@ -994,7 +994,7 @@ class MobileOrderDetailState extends State { ) : SizedBox.shrink(), ), Container( - child: order.status == Constants.STATUS_COMPLETE && !order.hasComment ? RaisedButton( + child: order.status == Constants.STATUS_COMPLETE && !order.hasComment ? ElevatedButton( child: Text( S.of(context).comment, ), @@ -1009,14 +1009,14 @@ class MobileOrderDetailState extends State { child: order.paymentStatus != Constants.PAYMENT_STATUS_PAID && order.status != Constants.STATUS_CANCELLED && order.status != Constants.STATUS_COMPLETE ? - FlatButton( + TextButton( child: Text( S.of(context).pay_now, ), onPressed: () { Routes.router.navigateTo(context, '/paynow/${order.id}'); }, - ) : FlatButton( + ) : TextButton( child: Text( S.of(context).order_again, ), @@ -1140,16 +1140,18 @@ class MobileOrderDetailState extends State { title: Text(S.of(context).warning), content: Text(S.of(context).are_you_sure_to_cancel_the_order), actions: [ - FlatButton( + TextButton( child: Text( S.of(context).no, ), - color: Theme.of(context).primaryColor, + style: TextButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), onPressed: () { Navigator.of(context).pop(); }, ), - FlatButton( + TextButton( child: Text( S.of(context).yes_i_am_sure, ), diff --git a/lib/widgets/mobile/mobile_orders.dart b/lib/widgets/mobile/mobile_orders.dart index e379c1f..66d077a 100644 --- a/lib/widgets/mobile/mobile_orders.dart +++ b/lib/widgets/mobile/mobile_orders.dart @@ -187,7 +187,7 @@ class MobileOrdersState extends State with SingleTickerProviderSta Row row3 = Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - RaisedButton( + ElevatedButton( child: Text( S.of(context).detail, ), @@ -203,7 +203,7 @@ class MobileOrdersState extends State with SingleTickerProviderSta row3.children.add( Padding( padding: EdgeInsets.only(left: 10.0), - child: RaisedButton( + child: ElevatedButton( child: Text( S.of(context).comment, ), @@ -225,7 +225,7 @@ class MobileOrdersState extends State with SingleTickerProviderSta if (order.paymentStatus != Constants.PAYMENT_STATUS_PAID && order.status != Constants.STATUS_CANCELLED && order.status != Constants.STATUS_COMPLETE) { - row2.children.add(RaisedButton( + row2.children.add(ElevatedButton( child: Text( S.of(context) .pay_now, @@ -233,20 +233,24 @@ class MobileOrdersState extends State with SingleTickerProviderSta color: Colors.white, ), ), - color: Colors.redAccent, + style: ElevatedButton.styleFrom( + primary: Colors.redAccent, + ), onPressed: () { Routes.router.navigateTo(context, '/paynow/${order.id}'); }, )); } else { - row2.children.add(RaisedButton( + row2.children.add(ElevatedButton( child: Text( S.of(context).order_again, style: TextStyle( color: Colors.white, ), ), - color: Theme.of(context).primaryColor, + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), onPressed: () { Utils.orderAgain(context, order.cartInfo); }, @@ -254,14 +258,16 @@ class MobileOrdersState extends State with SingleTickerProviderSta } } else { row2.children.add(row3); - row2.children.add(RaisedButton( + row2.children.add(ElevatedButton( child: Text( S.of(context).order_again, style: TextStyle( color: Colors.white, ), ), - color: Theme.of(context).primaryColor, + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), onPressed: () { Utils.orderAgain(context, order.cartInfo); }, diff --git a/lib/widgets/mobile/mobile_reset_password.dart b/lib/widgets/mobile/mobile_reset_password.dart index 7ea0d2d..12256ef 100644 --- a/lib/widgets/mobile/mobile_reset_password.dart +++ b/lib/widgets/mobile/mobile_reset_password.dart @@ -193,8 +193,10 @@ class MobileResetPasswordState extends State { padding: EdgeInsets.only(right: 16.0, top: 16.0), child: Align( alignment: Alignment.centerRight, - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).submit, style: TextStyle( @@ -220,7 +222,7 @@ class MobileResetPasswordState extends State { title: Text(S.of(context).success), content: Text(S.of(context).reset_password_success), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).ok), onPressed: () { Routes.router.navigateTo(context, '/login', replace: true, clearStack: false); diff --git a/lib/widgets/mobile/mobile_set_password.dart b/lib/widgets/mobile/mobile_set_password.dart index f4c1e48..2b26784 100644 --- a/lib/widgets/mobile/mobile_set_password.dart +++ b/lib/widgets/mobile/mobile_set_password.dart @@ -194,8 +194,10 @@ class MobileSetPasswordState extends State { padding: EdgeInsets.only(right: 16.0, top: 16.0), child: Align( alignment: Alignment.centerRight, - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).submit, style: TextStyle( @@ -221,7 +223,7 @@ class MobileSetPasswordState extends State { title: Text(S.of(context).success), content: Text(S.of(context).user_account_created_success), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).ok), onPressed: () { Routes.router.navigateTo(context, '/login', replace: true, clearStack: false); diff --git a/lib/widgets/mobile/mobile_user_profile.dart b/lib/widgets/mobile/mobile_user_profile.dart index b9d0769..433be3d 100644 --- a/lib/widgets/mobile/mobile_user_profile.dart +++ b/lib/widgets/mobile/mobile_user_profile.dart @@ -402,7 +402,7 @@ class MobileUserProfileState extends State { ), ), actions: [ - FlatButton( + TextButton( child: Text( S.of(context).cancel ), @@ -410,7 +410,7 @@ class MobileUserProfileState extends State { Navigator.of(context).pop(); }, ), - FlatButton( + TextButton( child: Text( S.of(context).submit_to_change, ), diff --git a/lib/widgets/mobile/mobile_view_ticket.dart b/lib/widgets/mobile/mobile_view_ticket.dart index 6042162..f4326c2 100644 --- a/lib/widgets/mobile/mobile_view_ticket.dart +++ b/lib/widgets/mobile/mobile_view_ticket.dart @@ -337,8 +337,10 @@ class MobileViewTicketState extends State { alignment: Alignment.centerRight, child: Container( padding: EdgeInsets.only(top: 20.0, left: 16.0, right: 16.0, bottom: 20.0), - child: RaisedButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), child: Text( S.of(context).reply, style: TextStyle( @@ -631,15 +633,17 @@ class MobileViewTicketState extends State { title: Text(S.of(context).warning), content: Text(S.of(context).are_you_sure_to_remove_the_picture), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).cancel), onPressed: () { Navigator.of(context).pop(); }, ), - RaisedButton( + ElevatedButton( child: Text(S.of(context).yes_i_am_sure), - color: Theme.of(context).primaryColor, + style: ElevatedButton.styleFrom( + primary: Theme.of(context).primaryColor, + ), onPressed: () { Navigator.of(context).pop(); setState(() { @@ -683,7 +687,7 @@ class MobileViewTicketState extends State { title: Text(S.of(context).success), content: Text(S.of(context).ticket_created_success), actions: [ - FlatButton( + TextButton( child: Text(S.of(context).ok), onPressed: () { Routes.router.navigateTo(context, diff --git a/lib/widgets/mobile/shop.dart b/lib/widgets/mobile/shop.dart index 24137f0..ab43892 100644 --- a/lib/widgets/mobile/shop.dart +++ b/lib/widgets/mobile/shop.dart @@ -534,7 +534,7 @@ class ShopState extends State action: SnackBarAction( label: S.of(context).close, onPressed: () { - _scaffoldKey.currentState.hideCurrentSnackBar(); + ScaffoldMessenger.of(context).hideCurrentSnackBar(); }, ), content: Container( diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 8cae7e6..faffff3 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -7,6 +7,9 @@ list(APPEND FLUTTER_PLUGIN_LIST url_launcher_linux ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -15,3 +18,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/pubspec.lock b/pubspec.lock index 6db5071..f03d928 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -36,13 +36,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" cached_network_image: dependency: "direct main" description: @@ -84,7 +77,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" charcode: dependency: transitive description: @@ -119,7 +112,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" countdown: dependency: "direct main" description: @@ -232,13 +225,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" - fake_async: - dependency: transitive - description: - name: fake_async - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" ffi: dependency: "direct main" description: @@ -403,11 +389,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.22.0" - flutter_test: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" flutter_web_plugins: dependency: "direct main" description: flutter @@ -566,7 +547,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" logging: dependency: transitive description: @@ -602,13 +583,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" mime: dependency: transitive description: @@ -692,7 +680,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" path_drawing: dependency: transitive description: @@ -929,13 +917,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.10.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" stream_transform: dependency: transitive description: @@ -994,13 +975,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.3" timezone: dependency: transitive description: @@ -1119,28 +1093,42 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" video_player: dependency: transitive description: name: video_player url: "https://pub.dartlang.org" source: hosted - version: "2.1.12" + version: "2.2.19" + video_player_android: + dependency: transitive + description: + name: video_player_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.4" + video_player_avfoundation: + dependency: transitive + description: + name: video_player_avfoundation + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.5" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "4.1.0" + version: "5.0.0" video_player_web: dependency: transitive description: name: video_player_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.10" wakelock: dependency: transitive description: @@ -1219,5 +1207,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.14.0 <3.0.0" - flutter: ">=2.2.0" + dart: ">=2.17.0-0 <3.0.0" + flutter: ">=2.8.0" diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 330048d..3e2cef5 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -7,6 +7,9 @@ list(APPEND FLUTTER_PLUGIN_LIST url_launcher_windows ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -15,3 +18,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin)