BASE: Implement Navigation In Services List Screen.

This commit is contained in:
2025-11-28 12:24:40 +05:00
parent e55892f36e
commit 5c98705bde

View File

@@ -1,6 +1,7 @@
import 'dart:developer';
import 'package:customer/constant/constant.dart';
import 'package:customer/models/section_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@@ -19,17 +20,23 @@ class ServiceListScreen extends StatelessWidget {
init: ServiceListController(),
builder: (controller) {
return Scaffold(
backgroundColor: AppThemeData.cardColor,
appBar: AppBar(
elevation: 0,
automaticallyImplyLeading: false,
titleSpacing: 20,
centerTitle: false,
backgroundColor: AppThemeData.cardColor,
title: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset("assets/images/fondex_logo.png",
height: 32.r, width: 124.r, fit: BoxFit.contain),
Image.asset(
"assets/images/fondex_logo.png",
height: 32.r,
width: 124.r,
fit: BoxFit.contain,
),
],
),
),
@@ -40,16 +47,21 @@ class ServiceListScreen extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
controller.serviceListBanner.isEmpty
? SizedBox()
: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.r),
child: BannerView(
bannerList: controller.serviceListBanner,
),
),
// controller.serviceListBanner.isEmpty
// ? SizedBox()
// : Padding(
// padding: EdgeInsets.symmetric(horizontal: 16.r),
// child: BannerView(
// bannerList: controller.serviceListBanner,
// ),
// ),
SizedBox(height: 10.h),
// Main Cards Section
_mainCardsSection(),
_mainCardsSection(
context: context,
controller: controller,
sectionModel: controller.sectionList,
),
SizedBox(height: 15.h),
@@ -69,9 +81,10 @@ class ServiceListScreen extends StatelessWidget {
SizedBox(height: 10.h),
// Other Services Section
_otherServicesCardMaker(
image: "assets/images/delivery_img.png",
title: "Курьерская доставка",
image: "assets/images/garderob_img.png",
title: "Обновить гардероб",
subtitle: "Доставляем безопасно",
),
_otherServicesCardMaker(
@@ -91,98 +104,6 @@ class ServiceListScreen extends StatelessWidget {
),
SizedBox(height: 45.h),
const SizedBox(height: 12),
controller.serviceListBanner.isEmpty
? SizedBox()
: BannerView(
bannerList: controller.serviceListBanner,
),
const SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Explore Our Services".tr,
style: AppThemeData.semiBoldTextStyle(
fontSize: 20,
color:
themeController.isDark.value
? AppThemeData.grey50
: AppThemeData.grey900,
),
),
const SizedBox(height: 12),
GridView.builder(
itemCount: controller.sectionList.length,
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
mainAxisSpacing: 12,
crossAxisSpacing: 12,
mainAxisExtent: 130,
),
itemBuilder: (context, index) {
final section = controller.sectionList[index];
return GestureDetector(
onTap:
() => controller.onServiceTap(
context,
section,
),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors:
Constant.sectionColor[index %
Constant.sectionColor.length],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
borderRadius: BorderRadius.circular(12),
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(
top: 10,
left: 5,
right: 5,
),
child: Text(
section.name ?? '',
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style:
AppThemeData.semiBoldTextStyle(
fontSize: 14,
color: AppThemeData.grey900,
),
),
),
const Spacer(),
NetworkImageWidget(
imageUrl:
section.sectionImage ?? '',
width: 80,
height: 60,
fit: BoxFit.contain,
),
],
),
),
);
},
),
],
),
),
],
),
),
@@ -272,7 +193,11 @@ class ServiceListScreen extends StatelessWidget {
);
}
Widget _mainCardsSection() {
Widget _mainCardsSection({
required BuildContext context,
required ServiceListController controller,
required RxList<SectionModel> sectionModel,
}) {
return Container(
padding: EdgeInsets.symmetric(vertical: 16.r, horizontal: 16.r),
decoration: BoxDecoration(
@@ -291,14 +216,33 @@ class ServiceListScreen extends StatelessWidget {
image: "assets/images/food_img.png",
// onTap: () {
// log("Main Card Tapped");
onTap: () async {},
onTap: () async {
SectionModel? innerSectionModel = sectionModel
.firstWhereOrNull(
(element) =>
element.serviceTypeFlag == "delivery-service",
);
if (innerSectionModel != null) {
controller.onServiceTap(context, innerSectionModel);
}
},
// },
),
_mainCardsMaker(
title: "Обновить гардероб",
image: "assets/images/garderob_img.png",
title: "Курьерская доставка",
image: "assets/images/delivery_img.png",
onTap: () {
log("Main Card Tapped");
SectionModel? innerSectionModel = sectionModel
.firstWhereOrNull(
(element) =>
element.serviceTypeFlag == "parcel_delivery",
);
if (innerSectionModel != null) {
controller.onServiceTap(context, innerSectionModel);
}
},
),
],
@@ -308,6 +252,13 @@ class ServiceListScreen extends StatelessWidget {
onTap: () {
log("Taxi Card Tapped");
// push(context, DashBoardCabService(user: null));
SectionModel? innerSectionModel = sectionModel.firstWhereOrNull(
(element) => element.serviceTypeFlag == "cab-service",
);
if (innerSectionModel != null) {
controller.onServiceTap(context, innerSectionModel);
}
},
child: Container(
height: 192.h,