83 lines
2.5 KiB
Dart
83 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:taxglide/consts/app_colors.dart';
|
|
import 'package:taxglide/model/serivce_list_model.dart';
|
|
import 'package:taxglide/view/Main_controller/main_controller.dart';
|
|
import 'package:taxglide/view/screens/serivce_request_screen.dart';
|
|
|
|
class CommonServiceItem extends StatelessWidget {
|
|
final ServiceListModel service;
|
|
final int sourceTabIndex; // ✅ New param to know from where user clicked
|
|
|
|
const CommonServiceItem({
|
|
super.key,
|
|
required this.service,
|
|
required this.sourceTabIndex,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
Get.offAll(
|
|
() => MainController(
|
|
child: ServiceRequestScreen(
|
|
id: service.id,
|
|
service: service.service,
|
|
icon: service.icon,
|
|
),
|
|
initialIndex: sourceTabIndex, // 0 for Home, 1 for Services
|
|
sourceTabIndex:
|
|
sourceTabIndex, // to remember where it came from
|
|
),
|
|
);
|
|
},
|
|
child: Container(
|
|
width: 110,
|
|
height: 84,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(10),
|
|
border: Border.all(color: const Color(0xFFE1E1E1), width: 1),
|
|
boxShadow: const [
|
|
BoxShadow(
|
|
color: Color(0x66757575),
|
|
offset: Offset(0, 1),
|
|
blurRadius: 7.3,
|
|
),
|
|
],
|
|
),
|
|
padding: const EdgeInsets.all(8),
|
|
child: Center(
|
|
child: Image.network(
|
|
service.icon,
|
|
width: 42,
|
|
height: 42,
|
|
fit: BoxFit.contain,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
service.service,
|
|
textAlign: TextAlign.center,
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(
|
|
fontFamily: 'Gilroy-SemiBold',
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 13,
|
|
height: 1.3,
|
|
letterSpacing: 0.02,
|
|
color: AppColors.homepageserivcetext,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|