diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 89222c6..22ac5ec 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -129,7 +129,6 @@ 083B51CCB3E82741428E2D55 /* Pods-Runner.release.xcconfig */, EAB5ED0AB808F923C6D318D5 /* Pods-Runner.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -169,8 +168,9 @@ TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = YS3FKPC7Y7; + DevelopmentTeam = 94BM6VL7L8; LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; }; }; }; @@ -384,8 +384,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = YS3FKPC7Y7; + DEVELOPMENT_TEAM = 94BM6VL7L8; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -397,10 +399,12 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.amanKassaFlutter; + PRODUCT_BUNDLE_IDENTIFIER = com.kz.amankassaflutter; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; @@ -519,8 +523,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = YS3FKPC7Y7; + DEVELOPMENT_TEAM = 94BM6VL7L8; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -532,11 +538,13 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.amanKassaFlutter; + PRODUCT_BUNDLE_IDENTIFIER = com.kz.amankassaflutter; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -547,8 +555,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = YS3FKPC7Y7; + DEVELOPMENT_TEAM = 94BM6VL7L8; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -560,10 +570,12 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.amanKassaFlutter; + PRODUCT_BUNDLE_IDENTIFIER = com.kz.amankassaflutter; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/lib/core/models/money.dart b/lib/core/models/money.dart index a9b42b8..d377b35 100644 --- a/lib/core/models/money.dart +++ b/lib/core/models/money.dart @@ -1,4 +1,5 @@ class Money { final num total; - Money({this.total}); -} \ No newline at end of file + final bool loading; + Money({this.total, this.loading}); +} diff --git a/lib/redux/actions/user_actions.dart b/lib/redux/actions/user_actions.dart index 8a2f375..e7ce7ab 100644 --- a/lib/redux/actions/user_actions.dart +++ b/lib/redux/actions/user_actions.dart @@ -23,6 +23,7 @@ class SetUserStateAction { final UserState userState; SetUserStateAction(this.userState); } + final ApiService _api = locator(); final NavigatorService _navigation = locator(); final DialogService _dialogService = locator(); @@ -30,9 +31,9 @@ final DialogService _dialogService = locator(); Future checkUserAction(Store store) async { store.dispatch(SetUserStateAction(UserState(isLoading: true))); try { - String token = store.state.userState.user?.token; + String token = store.state.userState.user?.token; bool isAuthenticated = false; - if(token!=null) { + if (token != null) { Response session = await _api.isActive(token); isAuthenticated = "OK" == session.body.message; } else { @@ -42,25 +43,22 @@ Future checkUserAction(Store store) async { SetUserStateAction( UserState( isLoading: false, - isAuthenticated: isAuthenticated, + isAuthenticated: isAuthenticated, ), ), ); - if(!isAuthenticated){ + if (!isAuthenticated) { _navigation.replace(LoginViewRoute); } else { _navigation.replace(HomeViewRoute); } - - } catch (error) { print(error); store.dispatch(SetUserStateAction(UserState(isLoading: false))); } } - Future logoutAction(Store store) async { try { store.dispatch( @@ -79,14 +77,21 @@ Future logoutAction(Store store) async { } Future> checkMoney(Store store) async { + store.dispatch(SetUserStateAction(UserState(money: Money(loading: true)))); try { - Response result = await _api.money(store.state.userState.user.token); + Response result = + await _api.money(store.state.userState.user.token); if (result.operation) { - store.dispatch(SetUserStateAction( - UserState(money: Money(total: double.parse(result.body['money']))))); + store.dispatch(SetUserStateAction(UserState( + money: Money( + total: double.parse(result.body['money']), loading: false)))); + } else { + store.dispatch( + SetUserStateAction(UserState(money: Money(loading: false)))); } return result; } catch (error) { + store.dispatch(SetUserStateAction(UserState(money: Money(loading: false)))); return null; } } @@ -95,21 +100,26 @@ ThunkAction authenticateToken(String token) { return (Store store) async { store.dispatch(SetUserStateAction(UserState(isLoading: true))); try { - AuthBody result = await _api.authenticate_token(token, statusCheck: false); + AuthBody result = + await _api.authenticate_token(token, statusCheck: false); store.dispatch(SetUserStateAction(UserState( - isLoading: false, - loginFormMessage: LoginFormMessage(email: result.email?.join(","), password: result.password?.join(","), message: result.message), - user: result.user, - authenticateType: AuthenticateTypeQr, - isAuthenticated: result.user != null, + isLoading: false, + loginFormMessage: LoginFormMessage( + email: result.email?.join(","), + password: result.password?.join(","), + message: result.message), + user: result.user, + authenticateType: AuthenticateTypeQr, + isAuthenticated: result.user != null, ))); - if(result.user == null && result.message!=null){ - _dialogService.showDialog(title: 'Warning', buttonTitle: 'Ok', description: result.message); + if (result.user == null && result.message != null) { + _dialogService.showDialog( + title: 'Warning', buttonTitle: 'Ok', description: result.message); } - if(result.user!=null) { + if (result.user != null) { _navigation.replace(HomeViewRoute); } - } catch(e) { + } catch (e) { print(e); store.dispatch(SetUserStateAction(UserState(isLoading: false))); } @@ -120,23 +130,28 @@ ThunkAction authenticate(String email, String password) { return (Store store) async { store.dispatch(SetUserStateAction(UserState(isLoading: true))); try { - AuthBody result = await _api.authenticate(email, password, statusCheck: false); + AuthBody result = + await _api.authenticate(email, password, statusCheck: false); store.dispatch(SetUserStateAction(UserState( isLoading: false, - loginFormMessage: LoginFormMessage(email: result.email?.join(","), password: result.password?.join(","), message: result.message), + loginFormMessage: LoginFormMessage( + email: result.email?.join(","), + password: result.password?.join(","), + message: result.message), user: result.user, login: email, password: password, authenticateType: AuthenticateTypeLogin, isAuthenticated: result.user != null, ))); - if(result.user == null && result.message!=null){ - _dialogService.showDialog(title: 'Warning', buttonTitle: 'Ok', description: result.message); + if (result.user == null && result.message != null) { + _dialogService.showDialog( + title: 'Warning', buttonTitle: 'Ok', description: result.message); } - if(result.user!=null) { + if (result.user != null) { _navigation.replace(HomeViewRoute); } - } catch(e) { + } catch (e) { print(e); store.dispatch(SetUserStateAction(UserState(isLoading: false))); } @@ -160,7 +175,7 @@ Future openSmena(Store store) async { String token = store.state.userState.user.token; Response result = await _api.openSmena(token); store.dispatch(SetUserStateAction(UserState(smena: result.body))); - if(result.operation){ + if (result.operation) { store.dispatch(checkSmena); store.dispatch(checkMoney); } diff --git a/lib/redux/state/user_state.dart b/lib/redux/state/user_state.dart index 7d4a8e4..d7a1a85 100644 --- a/lib/redux/state/user_state.dart +++ b/lib/redux/state/user_state.dart @@ -38,32 +38,32 @@ class UserState { authenticateType: payload?.authenticateType ?? null, login: payload?.login ?? null, password: payload?.password ?? null, - money: Money(), + money: Money(loading: false), ); - UserState copyWith( - {@required bool isError, - @required bool isLoading, - @required User user, - @required bool isAuthenticated, - @required LoginFormMessage loginFormMessage, - @required Smena smena, - @required String authenticateType, - @required String login, - @required String password, - @required Money money, - }) { + UserState copyWith({ + @required bool isError, + @required bool isLoading, + @required User user, + @required bool isAuthenticated, + @required LoginFormMessage loginFormMessage, + @required Smena smena, + @required String authenticateType, + @required String login, + @required String password, + @required Money money, + }) { return UserState( - isError: isError ?? this.isError, - isLoading: isLoading ?? this.isLoading, - isAuthenticated: isAuthenticated ?? this.isAuthenticated, - user: user ?? this.user, - loginFormMessage: loginFormMessage ?? this.loginFormMessage, - smena: smena ?? this.smena, - authenticateType: authenticateType ?? this.authenticateType, - login: login ?? this.login, - password: password ?? this.password, - money: money ?? this.money, + isError: isError ?? this.isError, + isLoading: isLoading ?? this.isLoading, + isAuthenticated: isAuthenticated ?? this.isAuthenticated, + user: user ?? this.user, + loginFormMessage: loginFormMessage ?? this.loginFormMessage, + smena: smena ?? this.smena, + authenticateType: authenticateType ?? this.authenticateType, + login: login ?? this.login, + password: password ?? this.password, + money: money ?? this.money, ); } @@ -73,8 +73,7 @@ class UserState { user: User.fromJson(json['user']), authenticateType: json['authenticateType'], login: json['login'], - password: json['password'] - ) + password: json['password']) : null; } diff --git a/lib/shared/shared_styles.dart b/lib/shared/shared_styles.dart index 227a428..e1f68fd 100644 --- a/lib/shared/shared_styles.dart +++ b/lib/shared/shared_styles.dart @@ -3,8 +3,8 @@ import 'package:flutter/material.dart'; // Box Decorations -BoxDecoration fieldDecortaion = BoxDecoration( - borderRadius: BorderRadius.circular(5), color: Colors.white); +BoxDecoration fieldDecortaion = + BoxDecoration(borderRadius: BorderRadius.circular(5), color: Colors.white); BoxDecoration disabledFieldDecortaion = BoxDecoration( borderRadius: BorderRadius.circular(5), color: Colors.grey[100]); @@ -20,14 +20,23 @@ const EdgeInsets largeFieldPadding = const EdgeInsets.symmetric(horizontal: 15, vertical: 15); // Text Variables -const TextStyle productTextStyle = const TextStyle(fontWeight: FontWeight.w400, color: Colors.black, fontSize: 15); -const TextStyle buttonTitleTextStyle = const TextStyle(fontWeight: FontWeight.w700, color: whiteColor, fontSize: 15); -const TextStyle buttonBigTitleTextStyle = const TextStyle(fontWeight: FontWeight.w700, color: whiteColor, fontSize: 22, ); - -const TextStyle dropDownTradeTypeTextStyle = TextStyle( color: Colors.black54, fontWeight: FontWeight.bold, fontSize: 24); +const TextStyle productTextStyle = const TextStyle( + fontWeight: FontWeight.w400, color: Colors.black, fontSize: 15); +const TextStyle buttonTitleTextStyle = const TextStyle( + fontWeight: FontWeight.w700, color: whiteColor, fontSize: 14); +const TextStyle buttonBigTitleTextStyle = const TextStyle( + fontWeight: FontWeight.w700, + color: whiteColor, + fontSize: 22, +); +const TextStyle dropDownTradeTypeTextStyle = + TextStyle(color: Colors.black54, fontWeight: FontWeight.bold, fontSize: 24); // Box Shadow -const BoxShadow mainShadowBox = BoxShadow(blurRadius: 16, color: shadowColor, offset: Offset(0, 5)); -const BoxShadow buttonShadowBox = BoxShadow(blurRadius: 5, color: Colors.grey, offset: Offset(0, 1)); -const BoxShadow cardShadowBox = BoxShadow(blurRadius: 5, color: Colors.black26, offset: Offset(0, 5)); \ No newline at end of file +const BoxShadow mainShadowBox = + BoxShadow(blurRadius: 16, color: shadowColor, offset: Offset(0, 5)); +const BoxShadow buttonShadowBox = + BoxShadow(blurRadius: 5, color: Colors.grey, offset: Offset(0, 1)); +const BoxShadow cardShadowBox = + BoxShadow(blurRadius: 5, color: Colors.black26, offset: Offset(0, 5)); diff --git a/lib/views/home/tabs/AdditionalTab.dart b/lib/views/home/tabs/AdditionalTab.dart index e72c440..481012f 100644 --- a/lib/views/home/tabs/AdditionalTab.dart +++ b/lib/views/home/tabs/AdditionalTab.dart @@ -104,7 +104,7 @@ class _AdditionalTabState extends State { Response result = await _api.deposit( Redux.store.state.userState.user.token, response.responseText); _dialog.showDialog(description: result.body['message']); - if(result.operation) { + if (result.operation) { await Redux.store.dispatch(checkMoney); } } @@ -131,7 +131,7 @@ class _AdditionalTabState extends State { Response result = await _api.withdrawal( Redux.store.state.userState.user.token, response.responseText); _dialog.showDialog(description: result.body['message']); - if(result.operation) { + if (result.operation) { await Redux.store.dispatch(checkMoney); } } @@ -149,19 +149,10 @@ class _AdditionalTabState extends State { isMoneyCheckBusy = true; }); try { - Response result = await Redux.store.dispatch(checkMoney); - //await _api.money(.state.userState.user.token); + await Redux.store.dispatch(checkMoney); setState(() { isMoneyCheckBusy = false; }); - if(result != null) { - if (result.operation) { - _dialog.showDialog( - description: 'Денег в кассе: ${result.body['money']}'); - } else { - _dialog.showDialog(description: '${result.body['message']}'); - } - } } catch (e) { print(e); setState(() { @@ -221,17 +212,42 @@ class _AdditionalTabState extends State { 'Денег в кассе:', style: TextStyle(color: primaryColor, fontSize: 15), ), - StoreConnector( - converter: (store) => store.state.userState.money, - builder: (_, vm) { - return Text( - vm.total !=null ? '${vm.total} тенге' : 'нет информации', - style: TextStyle( - color: vm.total !=null ? primaryColor : Colors.grey.withOpacity(0.5), - fontSize: 25, - fontWeight: FontWeight.bold), - ); - } + SizedBox( + height: 50, + width: double.infinity, + child: StoreConnector( + converter: (store) => store.state.userState.money, + builder: (_, vm) { + if (vm.loading == true) { + return Center( + child: SizedBox( + width: 30, + height: 30, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: CircularProgressIndicator( + strokeWidth: 2, + valueColor: new AlwaysStoppedAnimation( + primaryColor), + ), + ), + ), + ); + } + return Center( + child: Text( + vm.total != null + ? '${vm.total} тенге' + : 'нет информации', + style: TextStyle( + color: vm.total != null + ? primaryColor + : Colors.grey.withOpacity(0.5), + fontSize: 25, + fontWeight: FontWeight.bold), + ), + ); + }), ), ], )), diff --git a/lib/views/home/tabs/CalculatorTab.dart b/lib/views/home/tabs/CalculatorTab.dart index 0be063f..cc1166b 100644 --- a/lib/views/home/tabs/CalculatorTab.dart +++ b/lib/views/home/tabs/CalculatorTab.dart @@ -15,10 +15,7 @@ import 'package:aman_kassa_flutter/widgets/components/calculator/calculator-butt import 'package:aman_kassa_flutter/widgets/components/calculator/number-display.dart'; import 'package:flutter_redux/flutter_redux.dart'; - - class CalculatorTab extends StatelessWidget { - NavigatorService _navigatorService = locator(); final int index; @@ -29,53 +26,55 @@ class CalculatorTab extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( body: Column( + children: [ + StoreConnector( + converter: (store) => store.state.calcState, + builder: (context, vm) { + return NumberDisplay( + value: Calculator.parseItems(vm.calcItems, vm.isEqual)); + }), + CalculatorButtons(onTap: _onPress), + Row( children: [ - StoreConnector( - converter: (store) => store.state.calcState, - builder: (context, vm) { - return NumberDisplay(value: Calculator.parseItems(vm.calcItems, vm.isEqual)); - } + Expanded( + child: RaisedButton( + padding: EdgeInsets.all(16.0), + color: redColor, + child: Text( + "возврат", + style: buttonBigTitleTextStyle, + ), + onPressed: () { + _navigatorService.push(PaymentViewRoute, + arguments: PaymentModel( + mode: SettingModeCalc, + operationType: OperationTypeReturn)); + }), ), - CalculatorButtons(onTap: _onPress), - Row( - children: [ - Expanded( - child: RaisedButton( - padding: EdgeInsets.all(8.0), - color: redColor, - child: Text( - "возврат", - style: buttonBigTitleTextStyle, - ), - onPressed: () { - _navigatorService.push(PaymentViewRoute, arguments: PaymentModel(mode: SettingModeCalc, operationType: OperationTypeReturn) ); - } - ), + Expanded( + child: RaisedButton( + padding: EdgeInsets.all(16.0), + color: greenColor, + child: Text( + "оплата", + style: buttonBigTitleTextStyle, ), - Expanded( - child: RaisedButton( - padding: EdgeInsets.all(8.0), - - color: greenColor, - child: Text( - "оплата", - style: buttonBigTitleTextStyle, - ), - onPressed: () { - _navigatorService.push(PaymentViewRoute, arguments: PaymentModel(mode: SettingModeCalc, operationType: OperationTypePay) ); - }, - ), - ), - ], - ) + onPressed: () { + _navigatorService.push(PaymentViewRoute, + arguments: PaymentModel( + mode: SettingModeCalc, + operationType: OperationTypePay)); + }, + ), + ), ], - mainAxisAlignment: MainAxisAlignment.spaceBetween, - )); + ) + ], + mainAxisAlignment: MainAxisAlignment.spaceBetween, + )); } - void _onPress({ String buttonText}) { - Redux.store.dispatch(onTapAction(buttonText)); + void _onPress({String buttonText}) { + Redux.store.dispatch(onTapAction(buttonText)); } - - -} \ No newline at end of file +} diff --git a/lib/widgets/components/calculator/number-display.dart b/lib/widgets/components/calculator/number-display.dart index d660ba6..a1f7fca 100644 --- a/lib/widgets/components/calculator/number-display.dart +++ b/lib/widgets/components/calculator/number-display.dart @@ -1,6 +1,7 @@ import 'dart:math'; import 'package:flutter/material.dart'; +import 'package:auto_size_text/auto_size_text.dart'; class NumberDisplay extends StatelessWidget { NumberDisplay({this.value: ''}); @@ -13,39 +14,43 @@ class NumberDisplay extends StatelessWidget { Widget build(BuildContext context) { return Expanded( child: Padding( - padding: const EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0 ), + padding: const EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0), child: Container( key: stickyKey, alignment: Alignment.topLeft, - child: AnimatedDefaultTextStyle( - duration: const Duration(milliseconds: 200), - style: TextStyle( - fontSize: fontSizeCalc(value: value, context: context), - fontWeight: FontWeight.bold, - color: Colors.black, - ), - child: Text( - value, - ), + child: AutoSizeText( + value, + style: TextStyle(fontSize: 40), ), + // child: AnimatedDefaultTextStyle( + // duration: const Duration(milliseconds: 200), + // style: TextStyle( + // fontSize: fontSizeCalc(value: value), + // fontWeight: FontWeight.bold, + // color: Colors.black, + // ), + // child: Text( + // value, + // ), + // ), )), ); } - double fontSizeCalc({ String value = " ", context }) { + double fontSizeCalc({String value = " ", context}) { const double result = 40.0; try { - double width = MediaQuery.of(context).size.width; + double width = MediaQuery.of(context).size.width; double height = MediaQuery.of(context).size.height; double global = width * height / 2; double scale = (global / value.length); final pixelOfLetter = sqrt(scale); final pixelOfLetterP = pixelOfLetter - (pixelOfLetter * 7) / 100; - if(pixelOfLetterP > result){ + if (pixelOfLetterP > result) { return result; } return pixelOfLetterP; - } catch(e) { + } catch (e) { return result; } } diff --git a/lib/widgets/fields/busy_button.dart b/lib/widgets/fields/busy_button.dart index 0fbc1b4..e1371a9 100644 --- a/lib/widgets/fields/busy_button.dart +++ b/lib/widgets/fields/busy_button.dart @@ -1,6 +1,7 @@ import 'package:aman_kassa_flutter/shared/app_colors.dart'; import 'package:aman_kassa_flutter/shared/shared_styles.dart'; import 'package:aman_kassa_flutter/shared/ui_helpers.dart'; +import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; /// A button that shows a busy indicator in place of title @@ -12,14 +13,12 @@ class BusyButton extends StatefulWidget { final Color mainColor; final IconData icon; const BusyButton( - { - @required this.title, - this.busy = false, - @required this.onPressed, - this.enabled = true, - this.mainColor, - this.icon - }); + {@required this.title, + this.busy = false, + @required this.onPressed, + this.enabled = true, + this.mainColor, + this.icon}); @override _BusyButtonState createState() => _BusyButtonState(); @@ -31,12 +30,12 @@ class _BusyButtonState extends State { return AnimatedContainer( duration: const Duration(milliseconds: 300), decoration: BoxDecoration( - color: widget.enabled ? ( widget.mainColor ?? primaryColor) : widget.mainColor?.withOpacity(0.2) ?? primaryColor.withOpacity(0.2), + color: widget.enabled + ? (widget.mainColor ?? primaryColor) + : widget.mainColor?.withOpacity(0.2) ?? + primaryColor.withOpacity(0.2), borderRadius: BorderRadius.circular(7), - boxShadow: [ - cardShadowBox - ] - ), + boxShadow: [cardShadowBox]), child: Material( type: MaterialType.transparency, child: InkWell( @@ -49,18 +48,27 @@ class _BusyButtonState extends State { margin: EdgeInsets.symmetric( horizontal: widget.busy ? 10 : 25, vertical: widget.busy ? 10 : 15), - child: Row( + child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - widget.icon!=null ? Container(child: (Icon(widget.icon, color: whiteColor,)), margin: const EdgeInsets.only(right: 10.0 ),) : (Container()), + widget.icon != null + ? Container( + child: (Icon( + widget.icon, + color: whiteColor, + )), + margin: const EdgeInsets.only(right: 10.0), + ) + : (Container()), !widget.busy - ? Text( + ? AutoSizeText( widget.title, style: buttonTitleTextStyle, ) : CircularProgressIndicator( strokeWidth: 2, - valueColor: AlwaysStoppedAnimation(Colors.white)), + valueColor: + AlwaysStoppedAnimation(Colors.white)), ], ), ), diff --git a/pubspec.lock b/pubspec.lock index a4b9a29..a0a6afa 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -22,6 +22,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.4.1" + auto_size_text: + dependency: "direct main" + description: + name: auto_size_text + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" barcode_scan: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 92d2438..a41d7eb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -26,6 +26,7 @@ dependencies: barcode_scan: ^3.0.1 device_info: ^0.4.2+4 esys_flutter_share: ^1.0.2 + auto_size_text: ^2.1.0 dev_dependencies: flutter_test: sdk: flutter