Untitled
Widget buildNotesUI() { final String _name = customerController.selectedCustomer?.personalInfo!.firstName != null && (customerController.selectedCustomer?.personalInfo?.firstName!.isNotEmpty ?? false) ? "${customerController.selectedCustomer?.personalInfo?.firstName} ${customerController.selectedCustomer?.personalInfo!.lastName}" : tr(Keys.unNamedClient); return customerController.selectedCustomerNotes!.isEmpty ? Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ SvgPicture.asset(AppImages.searchlgIcon), Padding( padding: const EdgeInsets.only(top: 18), child: Text( tr(Keys.nothingyet), style: NewAppTheme.textTheme.bodySmall?.copyWith( fontSize: SizeConstants.fontExtraSmall, fontWeight: FontWeight.w400, color: Theme.of(context).extension<CustomColors>()!.defultTextColor2, ), ), ) ], ) : SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(top: AppConstant.padding_24), child: SizedBox( width: 380, child: CustomSlidingSegmentedControl<NotesSegmentType>( initialValue: NotesSegmentType.all, isStretch: true, children: { NotesSegmentType.all: Text( tr(Keys.all).capitalizeFirst(), textAlign: TextAlign.center, style: NewAppTheme.textTheme.bodyMedium?.copyWith( fontSize: SizeConstants.fontExtraSmall, fontWeight: FontWeight.w400, color: NewAppTheme.xF4000000, ), ), NotesSegmentType.fromsalon: Text( tr(Keys.fromsalon).capitalizeFirst(), textAlign: TextAlign.center, style: NewAppTheme.textTheme.bodyMedium?.copyWith( fontSize: SizeConstants.fontExtraSmall, fontWeight: FontWeight.w400, color: NewAppTheme.xF4000000, ), ), NotesSegmentType.fromclients: Text( tr(Keys.fromclient).capitalizeFirst(), textAlign: TextAlign.center, style: NewAppTheme.textTheme.bodyMedium?.copyWith( fontSize: SizeConstants.fontExtraSmall, fontWeight: FontWeight.w400, color: NewAppTheme.xF4000000, ), ), }, innerPadding: const EdgeInsets.all(4), decoration: BoxDecoration( color: NewAppTheme.white5, border: Border.all(color: NewAppTheme.xFFEAECF0), borderRadius: BorderRadius.circular(AppConstant.borderRadius_8), ), thumbDecoration: BoxDecoration( color: NewAppTheme.xFFFFFFFF, borderRadius: BorderRadius.circular(06), ), onValueChanged: (v) { // if (v == NotesSegmentType.all) { // customerController.setCustomerNotes(val: '-1'); // } else if (v == NotesSegmentType.fromsalon) { // customerController.setCustomerNotes(val: '1'); // } else if (v == NotesSegmentType.fromclients) { // customerController.setCustomerNotes(val: '2'); // } }, ), ), ), Padding( padding: const EdgeInsets.only(top: AppConstant.padding_24), child: LayoutBuilder(builder: (context, constraints) { double widgetWidth = constraints.maxWidth; return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Text( '${customerController.selectedCustomerNotes!.length} ${tr(Keys.notes).capitalizeFirst()}', style: NewAppTheme.textTheme.labelSmall?.copyWith( fontSize: SizeConstants.fontSmall, fontWeight: FontWeight.w600, color: Theme.of(context).extension<CustomColors>()!.defultTextColor, ), ), SizedBox( width: 243, ), GestureDetector( onTap: () { showCupertinoModalPopup( context: context, builder: (context) => AddPopAlertWidget( onDeleted: () {}, controller: customerController.noteController, isUploadImage: false, buttonName1: '${tr(Keys.capcancel)}', buttonName2: '${tr(Keys.save)}'.capitalizeFirst(), button1onTap: () { Navigator.pop(context); }, button2onTap: customerController.noteController.text.isNotEmpty && customerController.selectedCustomer != null ? () async { await customerController.saveNote(customerController.selectedCustomer!); setState(() {}); } : null, )); }, child: Container( height: AppConstant.height_40, width: 90, alignment: Alignment.center, decoration: BoxDecoration( color: NewAppTheme.xFFF5F5F5, borderRadius: BorderRadius.circular(AppConstant.borderRadius_8), ), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Icon( Icons.add, color: NewAppTheme.x921E2527, ), Padding( padding: const EdgeInsets.only(left: 8), child: Text( tr(Keys.add.capitalizeFirst()), style: NewAppTheme.textTheme.labelSmall?.copyWith( fontSize: SizeConstants.fontSmall, fontWeight: FontWeight.w600, color: NewAppTheme.xF4000000, ), ), ), ], ), ), ), ], ), SizedBox( height: 24.h, ), ListView.builder( itemCount: customerController.selectedCustomerNotes?.length, shrinkWrap: true, physics: const ScrollPhysics(), itemBuilder: (context, index) { return Padding( padding: const EdgeInsets.only(bottom: 32), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: 380, decoration: BoxDecoration( borderRadius: BorderRadius.circular(AppConstant.borderRadius_8), color: // customerController.selectedCustomerNotes?[index]. ?? NewAppTheme.xFFF8F8F8, ), child: Padding( padding: const EdgeInsets.all(12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ SvgPicture.asset( AppImages.fileicon, colorFilter: ColorFilter.mode( // notesModl[index].imageColor ?? Color(0x661E2527), BlendMode.srcIn), ), Padding( padding: const EdgeInsets.only(left: AppConstant.padding_12), child: Text( "by " + "${customerController.isNoteCreatedBySalon(customerController.selectedCustomerNotes![index]) ? "Salon" : _name}", style: NewAppTheme.textTheme.labelSmall?.copyWith( fontSize: SizeConstants.fontSmall4, fontWeight: FontWeight.w600, color: NewAppTheme.xF4000000, ), ), ), const Spacer(), PopupMenuButton<int>( icon: SvgPicture.asset(AppImages.moreIcon), itemBuilder: (context) => [ PopupMenuItem( onTap: () { // setState(() { // editMode[index] != null ? // : editMode[index] = true ; // }); }, value: 1, child: GestureDetector( onTap: () { // setState(() { // editMode[index] = false; // }); }, child: Row( children: [ Icon( Icons.edit, color: Theme.of(context).extension<CustomColors>()!.defultTextColor, ), const SizedBox( width: AppConstant.width_10, ), Text( tr(Keys.edit.capitalizeFirst()), style: NewAppTheme.textTheme.titleMedium?.copyWith( fontSize: SizeConstants.fontSmall2, fontWeight: FontWeight.w400, color: Theme.of(context).extension<CustomColors>()!.defultTextColor, ), ), ], ), ), ), PopupMenuItem( onTap: () { showCupertinoModalPopup( context: context, builder: (context) => PopAlertWidget( title: '${tr(Keys.deleteNoteTitle)}?', subTitle: '${tr(Keys.deleteNoteHint)}', buttonName1: '${tr(Keys.capcancel)}', buttonName2: '${tr(Keys.capDelete)}', button1onTap: () { Navigator.pop(context); }, ), ); }, value: 2, child: Row( children: [ SvgPicture.asset( height: 20, width: 20, AppImages.deleteicon, colorFilter: ColorFilter.mode(Theme.of(context).extension<CustomColors>()!.defultTextColor, BlendMode.srcIn), ), const SizedBox( width: AppConstant.width_10, ), Text( tr(Keys.delete.capitalizeFirst()), style: NewAppTheme.textTheme.titleMedium?.copyWith( fontSize: SizeConstants.fontSmall2, fontWeight: FontWeight.w400, color: Theme.of(context).extension<CustomColors>()!.defultTextColor, ), ) ], ), ), ], offset: const Offset(0, 40), color: Theme.of(context).colorScheme.onSecondary, elevation: 0, ), ], ), buildTextFieldRow( 380 - 25, '', TextEditingController(text: 'I’m planning on changing color dramatically. Added my current hair and what I want'), index, notesModel[index].isEditMode, ), (notesModel[index].hairImage ?? '').isEmpty ? Container() : Wrap( // runSpacing: 8, // spacing: 8, children: notesModel .map((item) => Chip( side: BorderSide( color: NewAppTheme.xFFF8F8F8, ), elevation: 0, padding: EdgeInsets.all(8), backgroundColor: NewAppTheme.xFFF8F8F8, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(0), ), deleteIcon: notesModel[index].isEditMode == true ? Container() : Icon( Icons.close, color: NewAppTheme.x661E2527, ), onDeleted: () {}, deleteIconColor: NewAppTheme.x661E2527, label: Text( notesModel[index].imageName ?? '', style: NewAppTheme.textTheme.bodySmall?.copyWith( fontSize: SizeConstants.fontSmall2, fontWeight: FontWeight.w400, color: Theme.of(context).extension<CustomColors>()!.defultTextColor2, ), ), avatar: CachedNetworkImage( height: 18.h, width: 18.h, imageUrl: notesModel[index].hairImage ?? '', placeholder: (context, url) => CircularProgressIndicator(), errorWidget: (context, url, error) => Icon(Icons.error), ), )) .toList(), ), notesModel[index].isEditMode == true ? Container() : Row( children: [ const Spacer(), GestureDetector( onTap: () { setState(() { notesModel[index].isEditMode = true; }); }, child: Container( height: 32, width: 86, alignment: Alignment.center, decoration: BoxDecoration( color: NewAppTheme.xFFFFFFFF, border: Border.all(color: NewAppTheme.xFFD0D5DD), borderRadius: BorderRadius.circular(6), ), child: Text( tr(Keys.cancel.capitalizeFirst()), style: NewAppTheme.textTheme.labelSmall?.copyWith( fontSize: SizeConstants.fontSmall, fontWeight: FontWeight.w600, color: NewAppTheme.xF4000000, ), ), ), ), const SizedBox( width: AppConstant.width_16, ), Container( height: 32, width: 65, alignment: Alignment.center, decoration: BoxDecoration( color: NewAppTheme.xFFFF6400, borderRadius: BorderRadius.circular(6), ), child: Text( Keys.save, style: NewAppTheme.textTheme.labelSmall?.copyWith( fontSize: SizeConstants.fontSmall2, fontWeight: FontWeight.w600, color: NewAppTheme.xFFFFFFFF, ), ), ), ], ), ], ), ), ), Padding( padding: const EdgeInsets.only(top: 6), child: Row( children: [ Container( height: 40, width: 3.w, decoration: BoxDecoration(color: notesModel[index].lineColor, borderRadius: const BorderRadius.only(topLeft: Radius.circular(4), bottomLeft: Radius.circular(4))), ), Container( width: 377, decoration: BoxDecoration( borderRadius: BorderRadius.only(bottomRight: Radius.circular(4), topRight: Radius.circular(4)), color: notesModel[index].bg2Color, ), child: Padding( padding: const EdgeInsets.all(12), child: Column( children: [ Row( children: [ Text( notesModel[index].name ?? '', style: NewAppTheme.textTheme.bodySmall?.copyWith( fontSize: SizeConstants.fontSmall2, fontWeight: FontWeight.w400, color: Theme.of(context).extension<CustomColors>()!.defultTextColor2, ), ), const Spacer(), Text( notesModel[index].dateTime ?? '', style: NewAppTheme.textTheme.bodySmall?.copyWith( fontSize: SizeConstants.fontSmall2, fontWeight: FontWeight.w400, color: Theme.of(context).extension<CustomColors>()!.defultTextColor2, ), ) ], ) ], ), ), ), ], ), ), ], ), ); }, ), ], ); }), ), ], ), ); }
Leave a Comment