BASE: Implement Navigation In Services List Screen.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:customer/constant/constant.dart';
|
import 'package:customer/constant/constant.dart';
|
||||||
|
import 'package:customer/models/section_model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -19,17 +20,23 @@ class ServiceListScreen extends StatelessWidget {
|
|||||||
init: ServiceListController(),
|
init: ServiceListController(),
|
||||||
builder: (controller) {
|
builder: (controller) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: AppThemeData.cardColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
titleSpacing: 20,
|
titleSpacing: 20,
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
|
backgroundColor: AppThemeData.cardColor,
|
||||||
title: Column(
|
title: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Image.asset("assets/images/fondex_logo.png",
|
Image.asset(
|
||||||
height: 32.r, width: 124.r, fit: BoxFit.contain),
|
"assets/images/fondex_logo.png",
|
||||||
|
height: 32.r,
|
||||||
|
width: 124.r,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -40,16 +47,21 @@ class ServiceListScreen extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
controller.serviceListBanner.isEmpty
|
// controller.serviceListBanner.isEmpty
|
||||||
? SizedBox()
|
// ? SizedBox()
|
||||||
: Padding(
|
// : Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16.r),
|
// padding: EdgeInsets.symmetric(horizontal: 16.r),
|
||||||
child: BannerView(
|
// child: BannerView(
|
||||||
bannerList: controller.serviceListBanner,
|
// bannerList: controller.serviceListBanner,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
// Main Cards Section
|
// Main Cards Section
|
||||||
_mainCardsSection(),
|
_mainCardsSection(
|
||||||
|
context: context,
|
||||||
|
controller: controller,
|
||||||
|
sectionModel: controller.sectionList,
|
||||||
|
),
|
||||||
|
|
||||||
SizedBox(height: 15.h),
|
SizedBox(height: 15.h),
|
||||||
|
|
||||||
@@ -69,9 +81,10 @@ class ServiceListScreen extends StatelessWidget {
|
|||||||
|
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
|
|
||||||
|
// Other Services Section
|
||||||
_otherServicesCardMaker(
|
_otherServicesCardMaker(
|
||||||
image: "assets/images/delivery_img.png",
|
image: "assets/images/garderob_img.png",
|
||||||
title: "Курьерская доставка",
|
title: "Обновить гардероб",
|
||||||
subtitle: "Доставляем безопасно",
|
subtitle: "Доставляем безопасно",
|
||||||
),
|
),
|
||||||
_otherServicesCardMaker(
|
_otherServicesCardMaker(
|
||||||
@@ -91,98 +104,6 @@ class ServiceListScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(height: 45.h),
|
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(
|
return Container(
|
||||||
padding: EdgeInsets.symmetric(vertical: 16.r, horizontal: 16.r),
|
padding: EdgeInsets.symmetric(vertical: 16.r, horizontal: 16.r),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -291,14 +216,33 @@ class ServiceListScreen extends StatelessWidget {
|
|||||||
image: "assets/images/food_img.png",
|
image: "assets/images/food_img.png",
|
||||||
// onTap: () {
|
// onTap: () {
|
||||||
// log("Main Card Tapped");
|
// 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(
|
_mainCardsMaker(
|
||||||
title: "Обновить гардероб",
|
title: "Курьерская доставка",
|
||||||
image: "assets/images/garderob_img.png",
|
image: "assets/images/delivery_img.png",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
log("Main Card Tapped");
|
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: () {
|
onTap: () {
|
||||||
log("Taxi Card Tapped");
|
log("Taxi Card Tapped");
|
||||||
// push(context, DashBoardCabService(user: null));
|
// push(context, DashBoardCabService(user: null));
|
||||||
|
SectionModel? innerSectionModel = sectionModel.firstWhereOrNull(
|
||||||
|
(element) => element.serviceTypeFlag == "cab-service",
|
||||||
|
);
|
||||||
|
|
||||||
|
if (innerSectionModel != null) {
|
||||||
|
controller.onServiceTap(context, innerSectionModel);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 192.h,
|
height: 192.h,
|
||||||
|
|||||||
Reference in New Issue
Block a user