resolved fSize issue

faiz_dev
faizatflutter 1 week ago
parent c1971ef287
commit 28f8aec60f

@ -7,7 +7,6 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
@ -21,37 +20,39 @@ import 'package:provider/provider.dart';
class TrackingScreen extends StatelessWidget {
final OrderTrackingState state = OrderTrackingState.ended;
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: Visibility(
visible: state == OrderTrackingState.ended,
visible: state == OrderTrackingState.ended,
child: SafeArea(
child: CustomButton(
height: 56.h,
backgroundColor: AppColors.bgGreenColor,
borderColor: Colors.transparent,
text: "Close".needTranslation,
textColor: AppColors.whiteColor,
onPressed: () {},
).paddingOnly(left:16.h,right:16.h),
height: 56.h,
backgroundColor: AppColors.bgGreenColor,
borderColor: Colors.transparent,
text: "Close".needTranslation,
textColor: AppColors.whiteColor,
onPressed: () {},
).paddingOnly(left: 16.h, right: 16.h),
),
),
body: CollapsingListView(
title: "Tracking Details".needTranslation,
child: SingleChildScrollView(
child: Column(
children: [
animationSection(),
Column(
spacing: 16.h,
children: [OrderStatus(context), OrderTrackingId(), ContactSection()],
).paddingAll(16.h),
],
))),
children: [
animationSection(),
Column(
spacing: 16.h,
children: [OrderStatus(context), OrderTrackingId(), ContactSection()],
).paddingAll(16.h),
],
))),
);
}
animationSection(){
animationSection() {
switch (state) {
case OrderTrackingState.waitingForCall:
case OrderTrackingState.dispactched:
@ -59,7 +60,7 @@ class TrackingScreen extends StatelessWidget {
return Lottie.asset(AppAnimations.ambulance, repeat: true, reverse: false, width: 260.h, height: 200.h);
case OrderTrackingState.ended:
default:
return Lottie.asset(AppAnimations.checkmark, repeat: true, width: 260.h, height: 200.h);
return Lottie.asset(AppAnimations.checkmark, repeat: true, width: 260.h, height: 200.h);
}
}
@ -95,7 +96,9 @@ class TrackingScreen extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 16,),
SizedBox(
height: 16,
),
CustomButton(
text: "Cancel Request".needTranslation,
onPressed: () async {},
@ -119,7 +122,7 @@ class TrackingScreen extends StatelessWidget {
backgroundColor: AppColors.lightRedButtonColor,
borderColor: Colors.transparent,
text: "Share Your Live Locatin on Whatsapp".needTranslation,
fontSize: 12.fSize,
fontSize: 12.f,
textColor: AppColors.primaryRedColor,
iconColor: AppColors.primaryRedColor,
onPressed: () {},
@ -131,11 +134,7 @@ class TrackingScreen extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 12.h,
children: [
dividerSection,
doctorSection(),
mapSection(context)
],
children: [dividerSection, doctorSection(), mapSection(context)],
);
case OrderTrackingState.ended:
default:
@ -170,17 +169,14 @@ class TrackingScreen extends StatelessWidget {
return Row(
spacing: 16.h,
children: [
Utils.buildImgWithNetwork(url: "", iconColor: Colors.transparent)
.circle(52.h),
Utils.buildImgWithNetwork(url: "", iconColor: Colors.transparent).circle(52.h),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Dr. John Doe".toText16(
color: AppColors.textColor, weight: FontWeight.w600),
"Dr. John Doe".toText16(color: AppColors.textColor, weight: FontWeight.w600),
SizedBox(height: 4.h),
"MBBS, MD - General Medicine".toText12(
color: AppColors.greyTextColor, fontWeight: FontWeight.w500),
"MBBS, MD - General Medicine".toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500),
],
),
),
@ -204,23 +200,16 @@ class TrackingScreen extends StatelessWidget {
Widget mapForRequestedCoordinate(BuildContext context) {
// return SizedBox.shrink();
if (context.read<EmergencyServicesViewModel>().isGMSAvailable ||
Platform.isIOS)
return GMSMap(
myLocationEnabled: false,
currentLocation:
context.read<EmergencyServicesViewModel>().getGMSLocation(),
onCameraMoved: (value) => context
.read<EmergencyServicesViewModel>()
.handleGMSMapCameraMoved(value));
if (context.read<EmergencyServicesViewModel>().isGMSAvailable || Platform.isIOS)
return GMSMap(
myLocationEnabled: false,
currentLocation: context.read<EmergencyServicesViewModel>().getGMSLocation(),
onCameraMoved: (value) => context.read<EmergencyServicesViewModel>().handleGMSMapCameraMoved(value));
else
return HMSMap(
myLocationEnabled: false,
currentLocation:
context.read<EmergencyServicesViewModel>().getHMSLocation(),
onCameraMoved: (value) => context
.read<EmergencyServicesViewModel>()
.handleHMSMapCameraMoved(value));
currentLocation: context.read<EmergencyServicesViewModel>().getHMSLocation(),
onCameraMoved: (value) => context.read<EmergencyServicesViewModel>().handleHMSMapCameraMoved(value));
}
informationRegardingTrackingSection() {
@ -229,71 +218,68 @@ class TrackingScreen extends StatelessWidget {
children: [
currentStatus(),
SizedBox(height: 4.h),
"You will receive a call from HMG for confirmation ".toText12(
color: AppColors.greyTextColor, fontWeight: FontWeight.w500)
"You will receive a call from HMG for confirmation ".toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500)
],
);
}
currentStatus() {
switch (state) {
case OrderTrackingState.waitingForCall:
case OrderTrackingState.dispactched:
return RichText(
text: TextSpan(children: <TextSpan>[
TextSpan(
text: "Please wait for the call".needTranslation,
style: TextStyle(
fontSize: 21.fSize,
fontWeight: FontWeight.w600,
color: AppColors.textColor,
),
),
TextSpan(
text: "...".needTranslation,
style: TextStyle(
fontSize: 21.fSize,
fontWeight: FontWeight.w600,
color: AppColors.errorColor,
),
),
]),
);
case OrderTrackingState.returning:
return RichText(
text: TextSpan(children: <TextSpan>[
TextSpan(
text: "15:30".needTranslation,
style: TextStyle(
fontSize: 21.fSize,
fontWeight: FontWeight.w600,
color: AppColors.textColor,
),
),
TextSpan(
text: " mins ".needTranslation,
style: TextStyle(
fontSize: 21.fSize,
fontWeight: FontWeight.w600,
color: AppColors.errorColor,
),
),
TextSpan(
text: "to hospital".needTranslation,
style: TextStyle(
fontSize: 21.fSize,
fontWeight: FontWeight.w600,
color: AppColors.textColor,
),
),
]),
);
case OrderTrackingState.ended:
default:
return "Arrived"
.needTranslation
.toText21(color: AppColors.textColor, weight: FontWeight.w600);
}
switch (state) {
case OrderTrackingState.waitingForCall:
case OrderTrackingState.dispactched:
return RichText(
text: TextSpan(children: <TextSpan>[
TextSpan(
text: "Please wait for the call".needTranslation,
style: TextStyle(
fontSize: 21.f,
fontWeight: FontWeight.w600,
color: AppColors.textColor,
),
),
TextSpan(
text: "...".needTranslation,
style: TextStyle(
fontSize: 21.f,
fontWeight: FontWeight.w600,
color: AppColors.errorColor,
),
),
]),
);
case OrderTrackingState.returning:
return RichText(
text: TextSpan(children: <TextSpan>[
TextSpan(
text: "15:30".needTranslation,
style: TextStyle(
fontSize: 21.f,
fontWeight: FontWeight.w600,
color: AppColors.textColor,
),
),
TextSpan(
text: " mins ".needTranslation,
style: TextStyle(
fontSize: 21.f,
fontWeight: FontWeight.w600,
color: AppColors.errorColor,
),
),
TextSpan(
text: "to hospital".needTranslation,
style: TextStyle(
fontSize: 21.f,
fontWeight: FontWeight.w600,
color: AppColors.textColor,
),
),
]),
);
case OrderTrackingState.ended:
default:
return "Arrived".needTranslation.toText21(color: AppColors.textColor, weight: FontWeight.w600);
}
}
OrderTrackingId() {
@ -308,19 +294,15 @@ class TrackingScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8.h,
children: [
"Req ID:1234567890"
.toText16(color: AppColors.textColor, weight: FontWeight.w600),
"Req ID:1234567890".toText16(color: AppColors.textColor, weight: FontWeight.w600),
Row(
spacing: 8.h,
children: [
Chip("location name".needTranslation, AppAssets.location_pickup,
AppColors.blackBgColor),
Chip("hotel name ".needTranslation, AppAssets.hospital,
AppColors.blackBgColor),
Chip("location name".needTranslation, AppAssets.location_pickup, AppColors.blackBgColor),
Chip("hotel name ".needTranslation, AppAssets.hospital, AppColors.blackBgColor),
],
),
Chip("hotel name ".needTranslation, AppAssets.hospital,
AppColors.blackBgColor),
Chip("hotel name ".needTranslation, AppAssets.hospital, AppColors.blackBgColor),
],
),
);
@ -350,11 +332,8 @@ class TrackingScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 4.h,
children: [
"Contact Rapid Response Team (RRT)".needTranslation.toText14(
color: AppColors.textColor, weight: FontWeight.w600),
"1223456789".needTranslation.toText12(
color: AppColors.primaryRedColor,
fontWeight: FontWeight.w500),
"Contact Rapid Response Team (RRT)".needTranslation.toText14(color: AppColors.textColor, weight: FontWeight.w600),
"1223456789".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500),
SizedBox(height: 8.h),
],
),
@ -390,27 +369,22 @@ class TrackingScreen extends StatelessWidget {
getTitle(OrderTrackingState state) {
switch (state) {
case OrderTrackingState.waitingForCall:
return "Confirmation Call".needTranslation
.toText16(color: AppColors.textColor, weight: FontWeight.w600);
return "Confirmation Call".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600);
case OrderTrackingState.dispactched:
return "Pickup Up from Home".needTranslation
.toText16(color: AppColors.textColor, weight: FontWeight.w600);
return "Pickup Up from Home".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600);
case OrderTrackingState.returning:
return " On The Way To Hospital".needTranslation
.toText16(color: AppColors.textColor, weight: FontWeight.w600);
return " On The Way To Hospital".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600);
case OrderTrackingState.ended:
default:
return "Arrived at Hospital".needTranslation
.toText16(color: AppColors.textColor, weight: FontWeight.w600);
return "Arrived at Hospital".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600);
}
}
mapSection(BuildContext context) {
return SizedBox(
return SizedBox(
height: 170.h,
width: double.infinity,
child: ClipRRect(
borderRadius: BorderRadius.circular(20.h),child: mapForRequestedCoordinate(context)),
child: ClipRRect(borderRadius: BorderRadius.circular(20.h), child: mapForRequestedCoordinate(context)),
);
}
}

Loading…
Cancel
Save