Feedback page implementation contd.

pull/101/head
haroon amjad 2 months ago
parent 73b05276f6
commit 9f845f1de8

@ -6,8 +6,6 @@ class DateUtil {
/// convert String To Date function /// convert String To Date function
/// [date] String we want to convert /// [date] String we want to convert
static DateTime convertStringToDate(String? date) { static DateTime convertStringToDate(String? date) {
print("the date is $date");
if (date == null) return DateTime.now(); if (date == null) return DateTime.now();
if (date.isEmpty) return DateTime.now(); if (date.isEmpty) return DateTime.now();

@ -22,6 +22,8 @@ class ContactUsViewModel extends ChangeNotifier {
int selectedLiveChatProjectIndex = -1; int selectedLiveChatProjectIndex = -1;
List<String> feedbackAttachmentList = [];
ContactUsViewModel({required this.contactUsRepo, required this.errorHandlerService, required this.appState}); ContactUsViewModel({required this.contactUsRepo, required this.errorHandlerService, required this.appState});
initContactUsViewModel() { initContactUsViewModel() {
@ -31,6 +33,7 @@ class ContactUsViewModel extends ChangeNotifier {
hmgHospitalsLocationsList.clear(); hmgHospitalsLocationsList.clear();
hmgPharmacyLocationsList.clear(); hmgPharmacyLocationsList.clear();
liveChatProjectsList.clear(); liveChatProjectsList.clear();
feedbackAttachmentList.clear();
getHMGLocations(); getHMGLocations();
notifyListeners(); notifyListeners();
} }

@ -12,6 +12,7 @@ import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart';
import 'package:hmg_patient_app_new/widgets/image_picker.dart';
import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -25,55 +26,61 @@ class FeedbackPage extends StatelessWidget {
contactUsViewModel = Provider.of<ContactUsViewModel>(context); contactUsViewModel = Provider.of<ContactUsViewModel>(context);
return Scaffold( return Scaffold(
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
body: Column( body: Consumer<ContactUsViewModel>(builder: (context, contactUsVM, child) {
children: [ return Column(
Expanded( children: [
child: CollapsingListView( Expanded(
title: LocaleKeys.feedback.tr(), child: CollapsingListView(
child: Column( isLeading: Navigator.canPop(context),
crossAxisAlignment: CrossAxisAlignment.start, title: LocaleKeys.feedback.tr(),
children: [ child: Column(
SizedBox(height: 16.h), crossAxisAlignment: CrossAxisAlignment.start,
CustomTabBar( children: [
activeTextColor: AppColors.primaryRedColor, SizedBox(height: 16.h),
activeBackgroundColor: AppColors.primaryRedColor.withValues(alpha: .1), CustomTabBar(
tabs: [ activeTextColor: AppColors.primaryRedColor,
CustomTabBarModel(null, "Send".needTranslation), activeBackgroundColor: AppColors.primaryRedColor.withValues(alpha: .1),
CustomTabBarModel(null, "Status".needTranslation), tabs: [
], CustomTabBarModel(null, "Send".needTranslation),
onTabChange: (index) { CustomTabBarModel(null, "Status".needTranslation),
contactUsViewModel.setIsSendFeedbackTabSelected(index == 0); ],
}, onTabChange: (index) {
).paddingSymmetrical(24.h, 0.h), contactUsViewModel.setIsSendFeedbackTabSelected(index == 0);
getSelectedTabWidget(context).paddingSymmetrical(24.h, 16.w), },
], ).paddingSymmetrical(24.h, 0.h),
getSelectedTabWidget(context).paddingSymmetrical(24.h, 16.w),
],
),
), ),
), ),
), Container(
Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor,
color: AppColors.whiteColor, customBorder: BorderRadius.only(
borderRadius: 24.h, topLeft: Radius.circular(24.h),
hasShadow: true, topRight: Radius.circular(24.h),
),
hasShadow: true,
),
child: CustomButton(
text: LocaleKeys.submit.tr(context: context),
onPressed: () async {},
backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedColor,
textColor: AppColors.whiteColor,
fontSize: 16,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 50.h,
icon: AppAssets.feedback,
iconColor: AppColors.whiteColor,
iconSize: 20.h,
).paddingSymmetrical(24.h, 24.h),
), ),
child: CustomButton( ],
text: LocaleKeys.submit.tr(context: context), );
onPressed: () async {}, }),
backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedColor,
textColor: AppColors.whiteColor,
fontSize: 16,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 50.h,
icon: AppAssets.feedback,
iconColor: AppColors.whiteColor,
iconSize: 20.h,
).paddingSymmetrical(24.h, 24.h),
),
],
),
); );
} }
@ -87,7 +94,7 @@ class FeedbackPage extends StatelessWidget {
Container( Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor, color: AppColors.whiteColor,
borderRadius: 24.h, borderRadius: 16.r,
hasShadow: false, hasShadow: false,
), ),
child: Padding( child: Padding(
@ -124,12 +131,28 @@ class FeedbackPage extends StatelessWidget {
SizedBox(height: 16.h), SizedBox(height: 16.h),
TextInputWidget( TextInputWidget(
labelText: "Subject".needTranslation, labelText: "Subject".needTranslation,
hintText: "Type subject here".needTranslation, hintText: "Enter subject here".needTranslation,
// controller: searchEditingController,
isEnable: true,
prefix: null,
autoFocus: false,
isBorderAllowed: false,
keyboardType: TextInputType.text,
padding: EdgeInsets.symmetric(
vertical: ResponsiveExtension(10).h,
horizontal: ResponsiveExtension(15).h,
),
),
SizedBox(height: 16.h),
TextInputWidget(
labelText: "Message".needTranslation,
hintText: "Enter message here".needTranslation,
// controller: searchEditingController, // controller: searchEditingController,
isEnable: true, isEnable: true,
prefix: null, prefix: null,
autoFocus: false, autoFocus: false,
isBorderAllowed: false, isBorderAllowed: false,
isMultiline: true,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: ResponsiveExtension(10).h, vertical: ResponsiveExtension(10).h,
@ -137,6 +160,35 @@ class FeedbackPage extends StatelessWidget {
), ),
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
CustomButton(
text: LocaleKeys.selectAttachment.tr(context: context),
onPressed: () async {
ImageOptions.showImageOptionsNew(
context,
true,
(String image, file) {
print(image);
print(file);
Navigator.pop(context);
// setState(() {
// EReferralAttachment eReferralAttachment = new EReferralAttachment(fileName: 'image ${medicalReportImages.length + 1}.png', base64String: image);
// medicalReportImages.add(eReferralAttachment);
// });
},
);
},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
fontSize: 14.f,
fontWeight: FontWeight.w500,
borderRadius: 10.r,
padding: EdgeInsets.symmetric(horizontal: 10.w),
height: isTablet || isFoldable ? 46.h : 40.h,
icon: AppAssets.file_icon,
iconColor: AppColors.primaryRedColor,
iconSize: 16.h,
)
], ],
); );
} else { } else {

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart';
import 'package:hmg_patient_app_new/presentation/contact_us/feedback_page.dart';
import 'package:hmg_patient_app_new/presentation/hmg_services/services_page.dart'; import 'package:hmg_patient_app_new/presentation/hmg_services/services_page.dart';
import 'package:hmg_patient_app_new/presentation/home/landing_page.dart'; import 'package:hmg_patient_app_new/presentation/home/landing_page.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart';
@ -29,7 +30,7 @@ class _LandingNavigationState extends State<LandingNavigation> {
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
children: [ children: [
const LandingPage(), const LandingPage(),
appState.isAuthenticated ? MedicalFilePage() : /* need add feedback page */ const LandingPage(), appState.isAuthenticated ? MedicalFilePage() : /* need add feedback page */ FeedbackPage(),
BookAppointmentPage(), BookAppointmentPage(),
const ToDoPage(), const ToDoPage(),
appState.isAuthenticated ? /* need add news page */ ServicesPage() : const LandingPage(), appState.isAuthenticated ? /* need add news page */ ServicesPage() : const LandingPage(),

@ -43,6 +43,11 @@ class TextInputWidget extends StatelessWidget {
final Color? labelColor; final Color? labelColor;
final Function(String)? onSubmitted; final Function(String)? onSubmitted;
// new multiline options
final bool isMultiline;
final int minLines;
final int maxLines;
// final List<Country> countryList; // final List<Country> countryList;
// final Function(Country)? onCountryChange; // final Function(Country)? onCountryChange;
@ -73,10 +78,14 @@ class TextInputWidget extends StatelessWidget {
this.isWalletAmountInput = false, this.isWalletAmountInput = false,
this.suffix, this.suffix,
this.labelColor, this.labelColor,
this.onSubmitted this.onSubmitted,
// this.countryList = const [], // multiline defaults
// this.onCountryChange, this.isMultiline = false,
}); this.minLines = 3,
this.maxLines = 6,
// this.countryList = const [],
// this.onCountryChange,
});
final FocusNode _focusNode = FocusNode(); final FocusNode _focusNode = FocusNode();
@ -113,7 +122,7 @@ class TextInputWidget extends StatelessWidget {
children: [ children: [
Container( Container(
padding: padding, padding: padding,
height: 64.h, height: isMultiline ? null : 64.h,
alignment: Alignment.center, alignment: Alignment.center,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: Colors.white, color: Colors.white,
@ -238,7 +247,7 @@ class TextInputWidget extends StatelessWidget {
return TextField( return TextField(
enabled: isEnable, enabled: isEnable,
scrollPadding: EdgeInsets.zero, scrollPadding: EdgeInsets.zero,
keyboardType: keyboardType, keyboardType: isMultiline ? TextInputType.multiline : keyboardType,
controller: controller, controller: controller,
readOnly: isReadOnly, readOnly: isReadOnly,
textAlignVertical: TextAlignVertical.top, textAlignVertical: TextAlignVertical.top,
@ -253,7 +262,15 @@ class TextInputWidget extends StatelessWidget {
FocusManager.instance.primaryFocus?.unfocus(); FocusManager.instance.primaryFocus?.unfocus();
}, },
onSubmitted: onSubmitted, onSubmitted: onSubmitted,
style: TextStyle(fontSize: fontS, height: isWalletAmountInput! ? 1 / 4 : 0, fontWeight: FontWeight.w500, color: AppColors.textColor, letterSpacing: -1), minLines: isMultiline ? minLines : 1,
maxLines: isMultiline ? maxLines : 1,
style: TextStyle(
fontSize: fontS,
height: isMultiline ? 1.2 : (isWalletAmountInput! ? 1 / 4 : 0),
fontWeight: FontWeight.w500,
color: AppColors.textColor,
letterSpacing: -1,
),
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
hintText: hintText, hintText: hintText,

Loading…
Cancel
Save