You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HMG_Patient_App_New/lib/presentation/hmg_services/services_view.dart

62 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
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/hmg_services/models/ui_models/hmg_services_component_model.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
class ServiceGridViewItem extends StatelessWidget {
final HmgServicesComponentModel hmgServiceComponentModel;
final int index;
final bool isHomePage;
final bool isLocked;
final bool isHealthToolIcon;
final Function? onTap;
const ServiceGridViewItem(this.hmgServiceComponentModel, this.index, this.isHomePage, {super.key, this.isLocked = false, this.onTap, this.isHealthToolIcon = false});
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
hmgServiceComponentModel.route != null
? getIt.get<NavigationService>().pushPageRoute(hmgServiceComponentModel.route!)
: hmgServiceComponentModel.onTap != null
? hmgServiceComponentModel.onTap!()
: null;
},
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 48.h,
width: 48.w,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: hmgServiceComponentModel.bgColor,
borderRadius: 12.r,
hasShadow: false,
),
child: Padding(
padding: EdgeInsets.all(12.h),
child: Utils.buildSvgWithAssets(
icon: hmgServiceComponentModel.icon,
iconColor: isHealthToolIcon ? null : AppColors.whiteColor,
fit: BoxFit.contain,
),
),
),
SizedBox(height: 5.h),
hmgServiceComponentModel.title.toText12(
fontWeight: FontWeight.w500,
color: AppColors.textColor,
maxLine: 2,
),
],
));
}
}