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

Loading…
Cancel
Save