From 5dcb99ec67969b833e223b8d401beb0e3838133d Mon Sep 17 00:00:00 2001 From: "Serik.Uvaissov" Date: Thu, 25 Jun 2020 12:31:26 +0600 Subject: [PATCH] global share release --- android/app/build.gradle | 1 - lib/core/models/calc_model.dart | 2 - lib/redux/actions/calc_actions.dart | 3 -- lib/views/check/image_show_container.dart | 42 ++++++++----------- .../tabs/kassaView/ProductAddBottomSheet.dart | 1 - lib/views/payment/payment_view.dart | 1 - lib/views/start_up/start_up_view.dart | 1 - lib/widgets/fields/busy_button.dart | 4 +- 8 files changed, 19 insertions(+), 36 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 849a2c2..d097f46 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -45,7 +45,6 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.aman_kassa_flutter" minSdkVersion 18 targetSdkVersion 28 diff --git a/lib/core/models/calc_model.dart b/lib/core/models/calc_model.dart index e49bb4e..eb35ee4 100644 --- a/lib/core/models/calc_model.dart +++ b/lib/core/models/calc_model.dart @@ -7,8 +7,6 @@ class CalcModel { @override String toString() { - // TODO: implement toString - return 'num1: $num1 num2:$num2 operation:$operation closed:$closed'; } } \ No newline at end of file diff --git a/lib/redux/actions/calc_actions.dart b/lib/redux/actions/calc_actions.dart index 05e745a..a7cfca3 100644 --- a/lib/redux/actions/calc_actions.dart +++ b/lib/redux/actions/calc_actions.dart @@ -38,12 +38,9 @@ Future cleanCalcItems(Store store) async { ThunkAction onTapAction(String value) { return (Store store) async { - if(value == Calculations.EQUAL){ return setEqual(store); } - - //TODO create private methods by operations and values List calcItems = Calculator.action(value: value, items: store.state.calcState.calcItems); calcItems.asMap().forEach((index,element ) { print('#$index: ${element.toString()}'); diff --git a/lib/views/check/image_show_container.dart b/lib/views/check/image_show_container.dart index ac7dfc4..112e8c6 100644 --- a/lib/views/check/image_show_container.dart +++ b/lib/views/check/image_show_container.dart @@ -4,6 +4,7 @@ import 'package:aman_kassa_flutter/shared/ui_helpers.dart'; import 'package:aman_kassa_flutter/widgets/fields/busy_button.dart'; import 'package:flutter/material.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; +import 'package:esys_flutter_share/esys_flutter_share.dart'; //import 'package:flutter/services.dart'; class ImageShowContainer extends StatelessWidget { @@ -21,7 +22,7 @@ class ImageShowContainer extends StatelessWidget { body: ListView( children: [imageFromBase64String(data.data)], ), - floatingActionButton: MyFloatingActionButton(), + floatingActionButton: MyFloatingActionButton(data), ); } @@ -42,6 +43,8 @@ class ImageShowModel { } class MyFloatingActionButton extends StatefulWidget { + final ImageShowModel data; + MyFloatingActionButton(this.data); @override _MyFloatingActionButtonState createState() => _MyFloatingActionButtonState(); } @@ -88,11 +91,11 @@ class _MyFloatingActionButtonState extends State { child: Column( children: [ verticalSpaceSmall, - BusyButton(title: 'Электронная почта', onPressed: () {} , mainColor: primaryColor, icon: Icons.mail, ), + BusyButton(title: 'Электронная почта', onPressed: shareFile , mainColor: primaryColor, icon: Icons.mail, enabled: false, ), verticalSpaceSmall, - BusyButton(title: 'WhatsApp', onPressed: () {} , mainColor: greenColor, icon: MdiIcons.whatsapp, ), + BusyButton(title: 'WhatsApp', onPressed: shareFile , mainColor: greenColor, icon: MdiIcons.whatsapp, enabled: false,), verticalSpaceSmall, - BusyButton(title: '', onPressed: () {} , mainColor: yellowColor, icon: Icons.share,), + BusyButton(title: '', onPressed: shareFile , mainColor: yellowColor, icon: Icons.share,), ], ) )); @@ -103,30 +106,19 @@ class _MyFloatingActionButtonState extends State { }, ): Container() ; } + + void shareFile() async { + try { + await Share.file( + 'Aman Kassa', 'aman_kassa_check.png', base64Decode(widget.data.data), + 'image/png'); + } catch (e) { + print('error: $e'); + } + } void showFoatingActionButton(bool value) { setState(() { showFab = value; }); } } - - -class DecoratedTextField extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - alignment: Alignment.centerLeft, - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), - margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), - decoration: BoxDecoration( - //color: fillColor, borderRadius: BorderRadius.circular(10) - ), - child: TextField( - decoration: InputDecoration( - prefixIcon: Icon(Icons.mail_outline, color: primaryColor,), - labelStyle: TextStyle(color: primaryColor), - labelText: 'Отправить на Email', - ), - )); - } -} \ No newline at end of file diff --git a/lib/views/home/tabs/kassaView/ProductAddBottomSheet.dart b/lib/views/home/tabs/kassaView/ProductAddBottomSheet.dart index 9493342..c1fd944 100644 --- a/lib/views/home/tabs/kassaView/ProductAddBottomSheet.dart +++ b/lib/views/home/tabs/kassaView/ProductAddBottomSheet.dart @@ -22,7 +22,6 @@ class _ProductAddBottomSheetState extends State { @override void initState() { - // TODO: implement initState super.initState(); nameController = new TextEditingController(); countController = new TextEditingController(); diff --git a/lib/views/payment/payment_view.dart b/lib/views/payment/payment_view.dart index 137ad3b..18a994a 100644 --- a/lib/views/payment/payment_view.dart +++ b/lib/views/payment/payment_view.dart @@ -40,7 +40,6 @@ class _PaymentViewState extends State { @override void initState() { - // TODO: implement initState super.initState(); isBusy = false; } diff --git a/lib/views/start_up/start_up_view.dart b/lib/views/start_up/start_up_view.dart index 2bff42d..eaa0b08 100644 --- a/lib/views/start_up/start_up_view.dart +++ b/lib/views/start_up/start_up_view.dart @@ -14,7 +14,6 @@ class _StartUpViewState extends State { @override void initState() { - // TODO: implement initState super.initState(); Redux.store.dispatch(checkUserAction); } diff --git a/lib/widgets/fields/busy_button.dart b/lib/widgets/fields/busy_button.dart index d5328d8..0fbc1b4 100644 --- a/lib/widgets/fields/busy_button.dart +++ b/lib/widgets/fields/busy_button.dart @@ -31,7 +31,7 @@ class _BusyButtonState extends State { return AnimatedContainer( duration: const Duration(milliseconds: 300), decoration: BoxDecoration( - color: widget.enabled ? ( widget.mainColor ?? primaryColor) : blueColorLigth, + color: widget.enabled ? ( widget.mainColor ?? primaryColor) : widget.mainColor?.withOpacity(0.2) ?? primaryColor.withOpacity(0.2), borderRadius: BorderRadius.circular(7), boxShadow: [ cardShadowBox @@ -40,7 +40,7 @@ class _BusyButtonState extends State { child: Material( type: MaterialType.transparency, child: InkWell( - onTap: widget.busy ? () {} : widget.onPressed, + onTap: widget.busy || !widget.enabled ? null : widget.onPressed, child: AnimatedContainer( height: widget.busy ? 40 : 40, //width: widget.busy ? 40 : 40,