From 71ce8d22e364ca7de5376d546c26c41b8ab6cbe5 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 4 Jan 2022 15:09:28 +0200 Subject: [PATCH] fix the size of the button inside the app --- lib/UpdatePage.dart | 8 +- lib/config/config.dart | 2 +- .../auth/verification_methods_screen.dart | 7 +- .../patient_profile_screen.dart | 25 +- .../radiology/radiology_details_page.dart | 9 +- .../bottom_sheet_dialog_button.dart | 3 - .../soap_update/update_soap_index.dart | 29 +- .../RegisterSearchPatientPage.dart | 4 +- .../shared/buttons/app_buttons_widget.dart | 8 +- .../shared/buttons/secondary_button.dart | 259 ------------------ 10 files changed, 41 insertions(+), 313 deletions(-) delete mode 100644 lib/widgets/shared/buttons/secondary_button.dart diff --git a/lib/UpdatePage.dart b/lib/UpdatePage.dart index 749b4298..44f96f4a 100644 --- a/lib/UpdatePage.dart +++ b/lib/UpdatePage.dart @@ -5,11 +5,11 @@ import 'dart:io' show Platform; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'widgets/shared/buttons/secondary_button.dart'; class UpdatePage extends StatelessWidget { final String message; @@ -62,15 +62,15 @@ class UpdatePage extends StatelessWidget { child: Container( // padding: const EdgeInsets.all(8.0), margin: EdgeInsets.all(15), - child: SecondaryButton( + child: AppButton( color: Colors.red[800], - onTap: () { + onPressed: () { if (Platform.isIOS) launch(iosLink); else launch(androidLink); }, - label: TranslationBase.of(context).updateNow.toUpperCase(), + title: TranslationBase.of(context).updateNow.toUpperCase(), ), ), ), diff --git a/lib/config/config.dart b/lib/config/config.dart index e4d46d02..2301eab0 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -436,7 +436,7 @@ const TRANSACTION_NO = 0; const LANGUAGE_ID = 2; const STAMP = '2020-04-27T12:17:17.721Z'; const IP_ADDRESS = '9.9.9.9'; -const VERSION_ID = 6.7; +const VERSION_ID = 6.5; const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index e1f2f49b..c4f9a6ce 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -13,7 +13,6 @@ import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/secondary_button.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -468,12 +467,12 @@ class _VerificationMethodsScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ - SecondaryButton( - label: + AppButton( + title: TranslationBase.of(context).useAnotherAccount ?? '', color: Color(0xFFD02127), //fontWeight: FontWeight.w700, - onTap: () { + onPressed: () { authenticationViewModel.deleteUser(); authenticationViewModel .setAppStatus(APP_STATUS.UNAUTHENTICATED); diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index 6cf1acb0..0c12b913 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/service/VideoCallService.dart'; @@ -242,14 +243,16 @@ class _PatientProfileScreenState extends State title: "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}", color: isFromLiveCare || isInpatient - ? Colors.red.shade700 + ? AppGlobal.appRedColor : patient.patientStatusType == 43 - ? Colors.red.shade700 - : Colors.grey.shade700, + ? AppGlobal.appRedColor + : AppGlobal.appRedColor, fontColor: Colors.white, - vPadding: 8, + // vPadding: 8, + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 9 : 6), radius: 30, - hPadding: 20, + hPadding: 25, fontWeight: FontWeight.normal, fontSize: 12, icon: SvgPicture.asset( @@ -278,14 +281,16 @@ class _PatientProfileScreenState extends State color: ((isInpatient) || isFromLiveCare) && model.state != ViewState.BusyLocal - ? Colors.red.shade700 + ? AppGlobal.appRedColor : patient.patientStatusType == 43 - ? Colors.red.shade700 - : Colors.grey.shade700, + ?AppGlobal.appRedColor + : AppGlobal.appRedColor, fontColor: Colors.white, - vPadding: 8, + // vPadding: 8, + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 9 : 6), radius: 30, - hPadding: 20, + hPadding: 25, fontWeight: FontWeight.normal, fontSize: 12, icon: SvgPicture.asset( diff --git a/lib/screens/patients/profile/radiology/radiology_details_page.dart b/lib/screens/patients/profile/radiology/radiology_details_page.dart index 7f1fa507..df3bbb06 100644 --- a/lib/screens/patients/profile/radiology/radiology_details_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_details_page.dart @@ -7,7 +7,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/secondary_button.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -101,18 +101,17 @@ class RadiologyDetailsPage extends StatelessWidget { child: Container( margin: EdgeInsets.only(left: 35, right: 35, top: 12, bottom: 12), - child: SecondaryButton( + child: AppButton( color: Color(0xffD02127), disabled: finalRadiology.dIAPACSURL == "", - textColor: Color(0xffFFFFFF), - onTap: () async { + onPressed: () async { await locator().logEvent( eventCategory: "RadiologyDetailsPage", eventAction: "Open Radiology Image", ); launch(model.radImageURL); }, - label: TranslationBase.of(context).openRad, + title: TranslationBase.of(context).openRad, ), ), ) diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart index 835dd225..92275fb4 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart @@ -32,10 +32,7 @@ class BottomSheetDialogButton extends StatelessWidget { widthFactor: .80, child: Center( child: AppButton( - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), title: label, - padding: 10, color: Color(0xFF359846), onPressed: onTap, ), diff --git a/lib/screens/patients/profile/soap_update/update_soap_index.dart b/lib/screens/patients/profile/soap_update/update_soap_index.dart index c2dcf103..fd6a62d8 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -169,9 +169,6 @@ class _UpdateSoapIndexState extends State child: AppButton( title: TranslationBase.of(context).next, fontWeight: FontWeight.w600, - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, color: Colors.red[700], onPressed: () async { model.nextOnSubjectPage(model); @@ -189,9 +186,9 @@ class _UpdateSoapIndexState extends State child: AppButton( title: TranslationBase.of(context).previous, color: Colors.grey[300], - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, + // height: SizeConfig.heightMultiplier * + // (SizeConfig.isHeightVeryShort ? 8 : 6), + // padding: 10, fontColor: Colors.black, fontWeight: FontWeight.w600, onPressed: () { @@ -211,9 +208,9 @@ class _UpdateSoapIndexState extends State : TranslationBase.of(context).next, fontWeight: FontWeight.w600, color: Colors.red[700], - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, + // height: SizeConfig.heightMultiplier * + // (SizeConfig.isHeightVeryShort ? 8 : 6), + // padding: 10, disabled: model.state == ViewState.BusyLocal, onPressed: () async { await model.nextOnObjectivePage(model); @@ -235,9 +232,6 @@ class _UpdateSoapIndexState extends State title: TranslationBase.of(context).previous, color: Colors.grey[300], fontColor: Colors.black, - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, fontWeight: FontWeight.w600, disabled: model.state == ViewState.BusyLocal, onPressed: () async { @@ -253,9 +247,7 @@ class _UpdateSoapIndexState extends State title: TranslationBase.of(context).next, fontWeight: FontWeight.w600, color: Colors.red[700], - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, + disabled: model.state == ViewState.BusyLocal, onPressed: () async { model.nextOnAssessmentPage(model); @@ -274,9 +266,6 @@ class _UpdateSoapIndexState extends State children: [ Expanded( child: AppButton( - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, title: TranslationBase.of(context).previous, color: Colors.grey[300], fontColor: Colors.black, @@ -292,9 +281,7 @@ class _UpdateSoapIndexState extends State ), Expanded( child: AppButton( - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, + title: model.isAddProgress ? TranslationBase.of(context).next : TranslationBase.of(context).finish, diff --git a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart index 7a2866b5..f3ca4ea7 100644 --- a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart @@ -316,7 +316,7 @@ class _RegisterSearchPatientPageState extends State { child: AppButton( title: TranslationBase.of(context).cancel, hasBorder: true, - vPadding: 12, + // vPadding: 12, hPadding: 8, borderColor: Color(0xFFeaeaea), color: Color(0xFFeaeaea), @@ -335,8 +335,6 @@ class _RegisterSearchPatientPageState extends State { child: AppButton( title: TranslationBase.of(context).next, hasBorder: true, - vPadding: 12, - hPadding: 8, borderColor: Color(0xFFB8382B), color: AppGlobal.appRedColor, fontColor: Colors.white, diff --git a/lib/widgets/shared/buttons/app_buttons_widget.dart b/lib/widgets/shared/buttons/app_buttons_widget.dart index 46b6fb6d..5f2d3faf 100644 --- a/lib/widgets/shared/buttons/app_buttons_widget.dart +++ b/lib/widgets/shared/buttons/app_buttons_widget.dart @@ -33,7 +33,7 @@ class AppButton extends StatefulWidget { this.icon, this.color, this.fontSize, - this.padding = 13, + this.padding = 8, this.loading = false, this.disabled = false, this.fontColor = Colors.white, @@ -53,11 +53,13 @@ class _AppButtonState extends State { @override Widget build(BuildContext context) { if (widget.fontSize == null) { - widget.fontSize = SizeConfig.getHeightMultiplier() * 1.9; + widget.fontSize = SizeConfig.getHeightMultiplier() * + (SizeConfig.isHeightVeryShort ? 1.3 : 1.7); } return Container( // height: MediaQuery.of(context).size.height * 0.075, - height: widget.height, + height: widget.height?? SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 6 : 5), child: IgnorePointer( ignoring: widget.loading || widget.disabled, child: RawMaterialButton( diff --git a/lib/widgets/shared/buttons/secondary_button.dart b/lib/widgets/shared/buttons/secondary_button.dart deleted file mode 100644 index 2ef22a80..00000000 --- a/lib/widgets/shared/buttons/secondary_button.dart +++ /dev/null @@ -1,259 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -/// SecondaryButton widget -/// [label] button label -/// [icon] button icon its optional -/// [iconOnly] just show the icon -/// [color] the background color -/// [textColor] the text color -/// [onTap] button function -/// [loading] show the progress indicator -/// [disabled] disabled the button -/// [borderColor] the button border color -/// [noBorderRadius] remove border radius -class SecondaryButton extends StatefulWidget { - SecondaryButton( - {Key key, - this.label = "", - this.icon, - this.iconOnly = false, - this.color, - this.textColor = Colors.white, - this.onTap, - this.loading: false, - this.small = false, - this.disabled = false, - this.borderColor, - this.noBorderRadius = false}) - : super(key: key); - - final String label; - final Widget icon; - final VoidCallback onTap; - final bool loading; - final Color color; - final Color textColor; - final Color borderColor; - final bool small; - final bool iconOnly; - final bool disabled; - final bool noBorderRadius; - - @override - _SecondaryButtonState createState() => _SecondaryButtonState(); -} - -class _SecondaryButtonState extends State - with TickerProviderStateMixin { - double _buttonSize = 1.0; - AnimationController _animationController; - Animation _animation; - - double _rippleSize = 0.0; - AnimationController _rippleController; - Animation _rippleAnimation; - - @override - void initState() { - if (widget.disabled != null && !widget.disabled) { - setState(() { - _rippleSize = 1.0; - }); - } - _animationController = AnimationController( - vsync: this, - lowerBound: 0.7, - upperBound: 1.0, - duration: Duration(milliseconds: 120)); - _animation = CurvedAnimation( - parent: _animationController, - curve: Curves.easeOutQuad, - reverseCurve: Curves.easeOutQuad); - _animation.addListener(() { - setState(() { - _buttonSize = _animation.value; - }); - }); - - _rippleController = AnimationController( - vsync: this, - lowerBound: 0.0, - upperBound: 1.0, - duration: Duration(seconds: 1)); - _rippleAnimation = CurvedAnimation( - parent: _rippleController, curve: Curves.easeInOutQuint); - _rippleAnimation.addListener(() { - setState(() { - _rippleSize = _rippleAnimation.value; - }); - }); - super.initState(); - } - - @override - void dispose() { - _animationController.dispose(); - _rippleController.dispose(); - super.dispose(); - } - - Widget _buildIcon() { - if (widget.icon != null && (widget.label != null && widget.label != "")) { - return Container(height: 25.0, child: widget.icon); - } else if (widget.icon != null && - (widget.label == null || widget.label == "")) { - return Container(height: 25.0, width: 25, child: widget.icon); - } else { - return Container(); - } - } - - @override - void didUpdateWidget(SecondaryButton oldWidget) { - super.didUpdateWidget(oldWidget); - if (oldWidget.disabled != widget.disabled) { - bool d = widget.disabled ?? false; - if (!d) { - _rippleController.forward(); - } else { - if (_rippleSize == 1.0) - _rippleController.reverse(from: 1.0); - else - _rippleController.reverse(); - } - } - } - - @override - Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return IgnorePointer( - ignoring: widget.loading, - child: GestureDetector( - onTapDown: (TapDownDetails tap) { - _animationController.reverse(from: 1.0); - }, - onTapUp: (TapUpDetails tap) { - _animationController.forward(); - }, - onTapCancel: () { - _animationController.forward(); - }, - onTap: () => { - widget.disabled ? null : widget.onTap(), - }, - // onTap: widget.disabled?null:Feedback.wrapForTap(widget.onTap, context), - behavior: HitTestBehavior.opaque, - child: Transform.scale( - scale: _buttonSize, - child: Container( - decoration: BoxDecoration( - border: widget.borderColor != null - ? Border.all( - color: widget.borderColor.withOpacity(0.1), width: 2.0) - : null, - borderRadius: BorderRadius.all(Radius.circular(100.0)), - boxShadow: [ - BoxShadow( - color: Color.fromRGBO(0, 0, 0, 0.04), - spreadRadius: -0.0, - offset: Offset(0, 4.0), - blurRadius: 18.0) - ], - ), - child: ClipRRect( - borderRadius: widget.noBorderRadius - ? BorderRadius.all(Radius.circular(0.0)) - : BorderRadius.all(Radius.circular(10.0)), - child: Stack( - children: [ - Positioned( - left: 0, - bottom: 0, - child: Container( - width: MediaQuery.of(context).size.width, - height: 100, - decoration: BoxDecoration( - color: widget.disabled - ? Colors.grey - : widget.color ?? Theme.of(context).buttonColor), - ), - ), - Positioned( - left: -MediaQuery.of(context).size.width * 2.2 / 1.8, - bottom: -MediaQuery.of(context).size.width * 2.2 / 1.8, - child: Transform.scale( - scale: widget.disabled != null ? _rippleSize : 1.0, - child: Container( - width: MediaQuery.of(context).size.width * 2.2, - height: MediaQuery.of(context).size.width * 2.2, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: widget.disabled - ? Colors.grey - : widget.color ?? Theme.of(context).buttonColor, - ), - ), - ), - ), - Container( - padding: widget.iconOnly - ? EdgeInsets.symmetric(vertical: 4.0, horizontal: 5.0) - : EdgeInsets.only( - top: widget.small ? 8.0 : 14.0, - bottom: widget.small ? 6.0 : 14.0, - left: 18.0, - right: 18.0), - child: Stack( - children: [ - Positioned( - child: _buildIcon(), - ), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - widget.loading - ? Padding( - padding: EdgeInsets.all(2.6), - child: SizedBox( - height: 19.0, - width: 19.0, - child: CircularProgressIndicator( - backgroundColor: Colors.white, - valueColor: - AlwaysStoppedAnimation( - Colors.grey[300], - ), - ), - ), - ) - : Padding( - padding: EdgeInsets.only( - bottom: widget.small ? 4.0 : 3.0), - child: Text( - widget.label, - style: TextStyle( - color: widget.textColor, - fontSize: 16, - fontWeight: FontWeight.w700, - fontFamily: 'Poppins'), - ), - ) - ], - ) - ], - ), - ), - ], - ), - ), - ), - ), - ), - ); - } -}