From 9886137e63ec5fc0f10787e834af21d028f0a4da Mon Sep 17 00:00:00 2001 From: AhsanAli13503 Date: Fri, 31 May 2024 12:57:10 +0500 Subject: [PATCH] fix: code cleaning --- .../assets/images/text_field_bottom_left.png | Bin 0 -> 407 bytes .../assets/images/text_field_top_right.png | Bin 0 -> 411 bytes evently/lib/evently_provider.dart | 3 +- .../custom_widgets/bottom_buttons.dart | 6 +- evently/lib/screens/detail_screen.dart | 52 ++-- .../lib/screens/host_view_ticket_preview.dart | 277 ++++++++---------- evently/lib/screens/overview_screen.dart | 12 +- evently/lib/screens/perks_screen.dart | 2 +- evently/lib/screens/price_screen.dart | 2 - evently/lib/utils/constants.dart | 6 +- evently/lib/widgets/evently_text_field.dart | 13 +- 11 files changed, 179 insertions(+), 194 deletions(-) create mode 100644 evently/assets/images/text_field_bottom_left.png create mode 100644 evently/assets/images/text_field_top_right.png diff --git a/evently/assets/images/text_field_bottom_left.png b/evently/assets/images/text_field_bottom_left.png new file mode 100644 index 0000000000000000000000000000000000000000..5151a60f913479ccae527e6d0078f1f1bde9e548 GIT binary patch literal 407 zcmeAS@N?(olHy`uVBq!ia0vp^i-1^@gAGV-YyAWy88{0(B8wRqxP?KOkzv*x37{Zj zage(c!@6@aFM%AEbVpxD28NCO+VVL5JkQ)(sovoBIAg`q}uya2h}Jr>uLw`Pp-H3L6-l zT3D!oT8^BllijdU<@BcY0+0Kd&89r5{CBrh)-Wl!Y^O$7()?vFD<#_YGAnKVZywz9 zUh!Bnv(l#5?25+j7qz=}nAeOAYU&P6X| zj( zy<_{{f3KYP-@n$mEgbQaHtBpn&&MfvuOxQ+ zR^~H?zL&55=n;50RW`vaQNpgKMp$W2v0>kKgO(20p75rYj-z*yOSB!Gjx37l$y4>{ kh?o=2DWs$#KqVBzxK$!^rQ_89k)YuAboFyt=akR{05HaitpET3 literal 0 HcmV?d00001 diff --git a/evently/lib/evently_provider.dart b/evently/lib/evently_provider.dart index d4065cbb26..0e13b3f409 100644 --- a/evently/lib/evently_provider.dart +++ b/evently/lib/evently_provider.dart @@ -136,6 +136,7 @@ class EventlyProvider extends ChangeNotifier { set setPerks(PerksModel perksModel) { _perks.add(perksModel); + setSelectedPerks = _perks.length - 1; notifyListeners(); } @@ -146,6 +147,7 @@ class EventlyProvider extends ChangeNotifier { removePerks(int index) { _perks.removeAt(index); + setSelectedPerks = _perks.length - 1; notifyListeners(); } @@ -292,7 +294,6 @@ class EventlyProvider extends ChangeNotifier { final String prices = isFreeDrop == FreeDrop.yes ? "0" : _selectedDenom.formatAmount(price: price.toString()); - final recipe = event.createRecipe( cookbookId: _cookbookId!, recipeId: _recipeId, diff --git a/evently/lib/screens/custom_widgets/bottom_buttons.dart b/evently/lib/screens/custom_widgets/bottom_buttons.dart index 6c8809be16..52e95671f0 100644 --- a/evently/lib/screens/custom_widgets/bottom_buttons.dart +++ b/evently/lib/screens/custom_widgets/bottom_buttons.dart @@ -41,7 +41,11 @@ class BottomButtons extends StatelessWidget { const VerticalSpace(10), Center( child: InkWell( - onTap: onPressSaveDraft, + onTap: () { + if (isContinueEnable) { + onPressSaveDraft(); + } + }, child: Text( LocaleKeys.save_draft.tr(), style: TextStyle(color: EventlyAppTheme.kTextGrey02, fontSize: 14.sp, fontWeight: FontWeight.w700), diff --git a/evently/lib/screens/detail_screen.dart b/evently/lib/screens/detail_screen.dart index 2a199fe9b4..ec4d57a16a 100644 --- a/evently/lib/screens/detail_screen.dart +++ b/evently/lib/screens/detail_screen.dart @@ -5,7 +5,9 @@ import 'package:evently/screens/custom_widgets/bottom_buttons.dart'; import 'package:evently/screens/custom_widgets/page_app_bar.dart'; import 'package:evently/screens/custom_widgets/step_labels.dart'; import 'package:evently/screens/custom_widgets/steps_indicator.dart'; +import 'package:evently/utils/constants.dart'; import 'package:evently/utils/enums.dart'; +import 'package:evently/utils/evently_app_theme.dart'; import 'package:evently/utils/route_util.dart'; import 'package:evently/utils/space_utils.dart'; import 'package:evently/viewmodels/create_event_viewmodel.dart'; @@ -60,11 +62,12 @@ class _DetailsScreenState extends State { }); }, child: EventlyTextField( - enable: false, - label: LocaleKeys.start_date.tr(), - controller: TextEditingController(text: provider.startDate), - textCapitalization: TextCapitalization.sentences, - ), + enable: false, + label: LocaleKeys.start_date.tr(), + controller: TextEditingController(text: provider.startDate), + textCapitalization: TextCapitalization.sentences, + imageBackground: PngUtils.textFieldBottomLeft, + inputTextColor: EventlyAppTheme.kTextDarkBlue), ), ), HorizontalSpace(20.w), @@ -77,14 +80,15 @@ class _DetailsScreenState extends State { }); }, child: EventlyTextField( - enable: false, - label: LocaleKeys.end_date.tr(), - controller: TextEditingController(text: provider.endDate), - textCapitalization: TextCapitalization.sentences, - validator: (value) { - return null; - }, - ), + enable: false, + label: LocaleKeys.end_date.tr(), + controller: TextEditingController(text: provider.endDate), + textCapitalization: TextCapitalization.sentences, + validator: (value) { + return null; + }, + imageBackground: PngUtils.textFieldTopRight, + inputTextColor: EventlyAppTheme.kTextDarkBlue), ), ), ], @@ -103,14 +107,15 @@ class _DetailsScreenState extends State { }); }, child: EventlyTextField( - enable: false, - label: LocaleKeys.start_time.tr(), - controller: TextEditingController(text: provider.startTime), - textCapitalization: TextCapitalization.sentences, - validator: (value) { - return null; - }, - ), + enable: false, + label: LocaleKeys.start_time.tr(), + controller: TextEditingController(text: provider.startTime), + textCapitalization: TextCapitalization.sentences, + validator: (value) { + return null; + }, + imageBackground: PngUtils.textFieldBottomLeft, + inputTextColor: EventlyAppTheme.kTextDarkBlue), ), ), HorizontalSpace(20.w), @@ -132,6 +137,8 @@ class _DetailsScreenState extends State { validator: (value) { return null; }, + imageBackground: PngUtils.textFieldTopRight, + inputTextColor: EventlyAppTheme.kTextDarkBlue, ), ), ), @@ -163,10 +170,9 @@ class _DetailsScreenState extends State { textCapitalization: TextCapitalization.sentences, noOfLines: 4, ), - const VerticalSpace(80), + const VerticalSpace(40), BottomButtons( onPressContinue: () { - createEventViewModel.nextPage(); }, onPressSaveDraft: () { diff --git a/evently/lib/screens/host_view_ticket_preview.dart b/evently/lib/screens/host_view_ticket_preview.dart index f4317feda7..dbb76c4349 100644 --- a/evently/lib/screens/host_view_ticket_preview.dart +++ b/evently/lib/screens/host_view_ticket_preview.dart @@ -34,6 +34,13 @@ class _HostTicketPreviewState extends State { child: Scaffold( bottomNavigationBar: Container( padding: EdgeInsets.symmetric(horizontal: 30.w), + decoration: BoxDecoration(color: EventlyAppTheme.kWhite, boxShadow: [ + BoxShadow( + color: EventlyAppTheme.kGrey01.withOpacity(0.1), + // offset: Offset(0, 0), + // blurRadius: 20, + spreadRadius: 1) + ]), height: 110.h, child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -62,185 +69,145 @@ class _HostTicketPreviewState extends State { borderRadius: BorderRadius.circular(10.r), child: Container( margin: EdgeInsets.symmetric(vertical: 20.w, horizontal: 20.w), - decoration: BoxDecoration( - image: const DecorationImage(image: AssetImage(PngUtils.kHostPreview), fit: BoxFit.fitHeight), - borderRadius: BorderRadius.circular(10.r), - ), - child: Column( + child: Stack( children: [ - Padding( - padding: const EdgeInsets.only(), - child: ClipRRect( - borderRadius: const BorderRadius.only( - topRight: Radius.circular(14), - topLeft: Radius.circular(14), - ), - child: Stack( - alignment: Alignment.bottomLeft, - children: [ - Image.asset( - PngUtils.kPhantom, - fit: BoxFit.cover, + Image.asset(PngUtils.kHostPreview), + Column( + children: [ + Padding( + padding: const EdgeInsets.only(), + child: ClipRRect( + borderRadius: const BorderRadius.only( + topRight: Radius.circular(14), + topLeft: Radius.circular(14), + ), + child: Stack( + alignment: Alignment.bottomLeft, + children: [ + Image.asset( + PngUtils.kPhantom, + fit: BoxFit.cover, + ), + Padding( + padding: EdgeInsets.only(bottom: 10.h, left: 10.w), + child: Text( + provider.eventName, + style: TextStyle(fontSize: 20.sp, color: EventlyAppTheme.kWhite, fontWeight: FontWeight.w700), + ), + ) + ], ), - Padding( - padding: EdgeInsets.only(bottom: 10.h, left: 10.w), - child: Text( - provider.eventName, - style: TextStyle(fontSize: 20.sp, color: EventlyAppTheme.kWhite, fontWeight: FontWeight.w700), - ), - ) - ], - ), - ), - ), - VerticalSpace(10.h), - Padding( - padding: EdgeInsets.only(left: 10.w, right: 30.h), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - 'DATE', - style: TextStyle(fontSize: 11.sp, fontWeight: FontWeight.w400, color: EventlyAppTheme.kWhite), - ), - SizedBox(height: 1.h), - Text( - provider.startDate, - style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.bold, color: EventlyAppTheme.kWhite), - ), - ], ), - Column( + ), + VerticalSpace(10.h), + Padding( + padding: EdgeInsets.only(left: 10.w, right: 30.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, children: [ - Text( - 'Time', - style: TextStyle(fontSize: 11.sp, fontWeight: FontWeight.w400, color: EventlyAppTheme.kWhite), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + 'DATE', + style: TextStyle(fontSize: 11.sp, fontWeight: FontWeight.w400, color: EventlyAppTheme.kWhite), + ), + SizedBox(height: 1.h), + Text( + provider.startDate, + style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.bold, color: EventlyAppTheme.kWhite), + ), + ], ), - SizedBox(height: 1.h), - Text( - provider.startTime, - style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.bold, color: EventlyAppTheme.kWhite), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + 'Time', + style: TextStyle(fontSize: 11.sp, fontWeight: FontWeight.w400, color: EventlyAppTheme.kWhite), + ), + SizedBox(height: 1.h), + Text( + provider.startTime, + style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.bold, color: EventlyAppTheme.kWhite), + ), + ], ), ], ), - ], - ), - ), - VerticalSpace(20.h), - Padding( - padding: EdgeInsets.only(left: 10.w, right: 30.h), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( + ), + VerticalSpace(20.h), + Padding( + padding: EdgeInsets.only(left: 10.w, right: 30.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, children: [ - Text( - 'LOCATION', - style: TextStyle(fontSize: 11.sp, fontWeight: FontWeight.w400, color: EventlyAppTheme.kWhite), - ), - SizedBox(height: 1.h), - ConstrainedBox( - constraints: BoxConstraints(maxWidth: 1.sw / 2.4), - child: Text( - provider.location, - style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.bold, color: EventlyAppTheme.kWhite), - maxLines: 2, - ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + 'LOCATION', + style: TextStyle(fontSize: 11.sp, fontWeight: FontWeight.w400, color: EventlyAppTheme.kWhite), + ), + SizedBox(height: 1.h), + ConstrainedBox( + constraints: BoxConstraints(maxWidth: 1.sw / 2.4), + child: Text( + provider.location, + style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.bold, color: EventlyAppTheme.kWhite), + maxLines: 2, + ), + ), + ], ), ], ), - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Text( - // 'SEAT', - // style: TextStyle(fontSize: 11.sp, fontWeight: FontWeight.w400, color: EventlyAppTheme.kWhite), - // ), - // SizedBox(height: 1.h), - // Column( - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Text( - // '6A', - // style: TextStyle(fontSize: 30.sp, fontWeight: FontWeight.bold, color: EventlyAppTheme.kWhite), - // ), - // Text( - // 'Room 3', - // style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.bold, color: EventlyAppTheme.kWhite), - // ) - // ], - // ), - // ], - // ), - ], - ), - ), - VerticalSpace(20.h), - Padding( - padding: EdgeInsets.only(left: 10.w, right: 30.h), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( + ), + VerticalSpace(20.h), + Padding( + padding: EdgeInsets.only(left: 10.w, right: 30.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, children: [ - Text( - 'PERKS', - style: TextStyle(fontSize: 11.sp, fontWeight: FontWeight.w400, color: EventlyAppTheme.kWhite), - ), - SizedBox(height: 1.h), - Row( + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - SvgPicture.asset(SVGUtils.kDiamond), - SizedBox(width: 5.w), Text( - 'x ${provider.perks.length}', - style: TextStyle(fontSize: 15.sp, color: EventlyAppTheme.kWhite, fontWeight: FontWeight.bold), + 'PERKS', + style: TextStyle(fontSize: 11.sp, fontWeight: FontWeight.w400, color: EventlyAppTheme.kWhite), ), - SizedBox(width: 5.w), - Text( - 'Redeem', - style: TextStyle(fontSize: 15.sp, color: EventlyAppTheme.kGreenText, fontWeight: FontWeight.bold), + SizedBox(height: 1.h), + Row( + children: [ + SvgPicture.asset(SVGUtils.kDiamond), + SizedBox(width: 5.w), + Text( + 'x ${provider.perks.length}', + style: TextStyle(fontSize: 15.sp, color: EventlyAppTheme.kWhite, fontWeight: FontWeight.bold), + ), + SizedBox(width: 5.w), + Text( + 'Redeem', + style: TextStyle(fontSize: 15.sp, color: EventlyAppTheme.kGreenText, fontWeight: FontWeight.bold), + ) + ], ) ], - ) + ), ], ), - ], - ), - ), - VerticalSpace(16.h), - Image.asset(PngUtils.kDottedLine), - VerticalSpace(40.h), - Text( - 'Scan QR to enter', - style: TextStyle( - color: EventlyAppTheme.kWhite, - fontWeight: FontWeight.bold, - fontSize: 15.sp, - ), - ), - VerticalSpace(10.h), - Container( - decoration: const BoxDecoration(color: EventlyAppTheme.kBlack), - width: 338, - height: 338, + ), + VerticalSpace(30.h), + Image.asset(PngUtils.kDottedLine), + ], ), - SizedBox(height: 20.h), ], ), ), diff --git a/evently/lib/screens/overview_screen.dart b/evently/lib/screens/overview_screen.dart index 0ad9e1ce37..8c5bd9ee0b 100644 --- a/evently/lib/screens/overview_screen.dart +++ b/evently/lib/screens/overview_screen.dart @@ -148,11 +148,13 @@ class _OverViewScreenState extends State { createEventViewModel.nextPage(); }, onPressSaveDraft: () { - final navigator = Navigator.of(context); - provider.saveAsDraft( - onCompleted: () => navigator.popUntil((route) => route.settings.name == RouteUtil.kRouteEventHub), - uploadStep: UploadStep.overView, - ); + if (provider.isOverviewEnable) { + final navigator = Navigator.of(context); + provider.saveAsDraft( + onCompleted: () => navigator.popUntil((route) => route.settings.name == RouteUtil.kRouteEventHub), + uploadStep: UploadStep.overView, + ); + } }, isContinueEnable: provider.isOverviewEnable, ) diff --git a/evently/lib/screens/perks_screen.dart b/evently/lib/screens/perks_screen.dart index 06d3bc60bf..2584f0678b 100644 --- a/evently/lib/screens/perks_screen.dart +++ b/evently/lib/screens/perks_screen.dart @@ -121,7 +121,7 @@ class _PerksScreenState extends State { final navigator = Navigator.of(context); provider.saveAsDraft( onCompleted: () => navigator.popUntil((route) => route.settings.name == RouteUtil.kRouteEventHub), - uploadStep: UploadStep.perks, + uploadStep:provider.perks.isEmpty ? UploadStep.detail : UploadStep.perks, ); }, isContinueEnable: true, diff --git a/evently/lib/screens/price_screen.dart b/evently/lib/screens/price_screen.dart index b77db24b91..267ad84545 100644 --- a/evently/lib/screens/price_screen.dart +++ b/evently/lib/screens/price_screen.dart @@ -17,7 +17,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:provider/provider.dart'; - import '../generated/locale_keys.g.dart'; class PriceScreen extends StatefulWidget { @@ -206,7 +205,6 @@ class _PriceScreenState extends State { padding: EdgeInsets.symmetric(horizontal: 20.w), child: BottomButtons( onPressContinue: () { - homeViewModel.nextPage(); }, onPressSaveDraft: () { diff --git a/evently/lib/utils/constants.dart b/evently/lib/utils/constants.dart index f5715190db..06a65a7540 100644 --- a/evently/lib/utils/constants.dart +++ b/evently/lib/utils/constants.dart @@ -28,7 +28,6 @@ const int kEthIntBase = 1000000000000000000; final List imageAllowedExts = ["png", "jpg", "jpeg", "heif"]; const kPylons = "Pylons"; - const kErrProfileNotExist = 'profileDoesNotExist'; const cookbookName = "Evently Cookbook"; @@ -93,6 +92,10 @@ class PngUtils { /// i need this variable to be used static const kPhantom = "assets/images/phantom.png"; static const kDottedLine = "assets/images/dotted_line.png"; + + ///text field background + static const textFieldBottomLeft = "assets/images/text_field_bottom_left.png"; + static const textFieldTopRight = "assets/images/text_field_top_right.png"; } /// Currency ABRR @@ -104,4 +107,3 @@ const String kAgoricAbr = "RUN"; const String kAtomAbr = "ATOM"; const String kLunaAbr = "Luna"; const String kEthereumAbr = "ETH"; - diff --git a/evently/lib/widgets/evently_text_field.dart b/evently/lib/widgets/evently_text_field.dart index 62ed55450f..6f3d989080 100644 --- a/evently/lib/widgets/evently_text_field.dart +++ b/evently/lib/widgets/evently_text_field.dart @@ -18,6 +18,8 @@ class EventlyTextField extends StatelessWidget { this.textCapitalization = TextCapitalization.none, this.onChanged, this.enable, + this.imageBackground, + this.inputTextColor, }); final String label; @@ -32,6 +34,9 @@ class EventlyTextField extends StatelessWidget { final ValueChanged? onChanged; final bool? enable; + final String? imageBackground; + final Color? inputTextColor; + @override Widget build(BuildContext context) { return Column( @@ -47,13 +52,13 @@ class EventlyTextField extends StatelessWidget { children: [ ScreenResponsive( mobileScreen: (context) => Image.asset( - noOfLines == 1 ? PngUtils.kTextFieldSingleLine : PngUtils.kTextFieldMultiLine, + imageBackground ?? (noOfLines == 1 ? PngUtils.kTextFieldSingleLine : PngUtils.kTextFieldMultiLine), height: noOfLines == 1 ? 40.h : 120.h, width: 1.sw, fit: BoxFit.fill, ), tabletScreen: (context) => Image.asset( - noOfLines == 1 ? PngUtils.kTextFieldSingleLine : PngUtils.kTextFieldMultiLine, + imageBackground ?? (noOfLines == 1 ? PngUtils.kTextFieldSingleLine : PngUtils.kTextFieldMultiLine), height: noOfLines == 1 ? 32.h : 110.h, width: 1.sw, fit: BoxFit.fill, @@ -73,7 +78,7 @@ class EventlyTextField extends StatelessWidget { child: TextFormField( enabled: enable, onChanged: onChanged, - style: TextStyle(fontSize: noOfLines == 1 ? 18.sp : 15, fontWeight: FontWeight.w400, color: EventlyAppTheme.kTextGrey), + style: TextStyle(fontSize: noOfLines == 1 ? 18.sp : 15, fontWeight: FontWeight.w400, color: inputTextColor ?? EventlyAppTheme.kTextGrey02), controller: controller, validator: validator, minLines: noOfLines, @@ -83,7 +88,7 @@ class EventlyTextField extends StatelessWidget { inputFormatters: inputFormatters, decoration: InputDecoration( hintText: hint, - hintStyle: const TextStyle(fontSize: 15, fontWeight: FontWeight.w400, color: EventlyAppTheme.kTextGrey), + hintStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.w400, color: inputTextColor ?? EventlyAppTheme.kTextGrey02), border: const OutlineInputBorder(borderSide: BorderSide.none), floatingLabelBehavior: FloatingLabelBehavior.always, contentPadding: EdgeInsets.fromLTRB(10.w, 0.h, 10.w, 0.h),