|
|
|
@ -1,13 +1,12 @@
|
|
|
|
import 'package:car_customer_app/views/provider/sheet/items_list_sheet.dart';
|
|
|
|
import 'package:car_customer_app/views/provider/sheet/items_list_sheet.dart';
|
|
|
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:mc_common_app/classes/consts.dart';
|
|
|
|
import 'package:mc_common_app/classes/consts.dart';
|
|
|
|
import 'package:mc_common_app/config/routes.dart';
|
|
|
|
import 'package:mc_common_app/config/routes.dart';
|
|
|
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
|
|
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
|
|
|
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
|
|
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
|
|
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
|
|
|
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
|
|
|
import 'package:mc_common_app/models/services/branch_model.dart';
|
|
|
|
import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart';
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
|
|
|
import 'package:mc_common_app/models/services/service_model.dart';
|
|
|
|
|
|
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
|
|
import 'package:mc_common_app/utils/navigator.dart';
|
|
|
|
import 'package:mc_common_app/utils/navigator.dart';
|
|
|
|
import 'package:mc_common_app/widgets/bottom_sheet.dart';
|
|
|
|
import 'package:mc_common_app/widgets/bottom_sheet.dart';
|
|
|
|
@ -16,9 +15,9 @@ import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
|
|
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class BranchDetailPage extends StatefulWidget {
|
|
|
|
class BranchDetailPage extends StatefulWidget {
|
|
|
|
BranchModel branchModel;
|
|
|
|
final BranchDetailModel branchDetailModel;
|
|
|
|
|
|
|
|
|
|
|
|
BranchDetailPage({required this.branchModel});
|
|
|
|
BranchDetailPage({required this.branchDetailModel});
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
State<BranchDetailPage> createState() => _BranchDetailPageState();
|
|
|
|
State<BranchDetailPage> createState() => _BranchDetailPageState();
|
|
|
|
@ -29,7 +28,7 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
// TODO: implement initState
|
|
|
|
// TODO: implement initState
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
if (widget.branchModel.branchServices!.length > 0) widget.branchModel.branchServices?.first.isExpanded = true;
|
|
|
|
if (widget.branchDetailModel.branchServices!.length > 0) widget.branchDetailModel.branchServices?.first.isExpanded = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
@ -52,7 +51,7 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Image.asset(MyAssets.bnCar),
|
|
|
|
Image.asset(MyAssets.bnCar),
|
|
|
|
12.height,
|
|
|
|
12.height,
|
|
|
|
"${widget.branchModel.branchName} | ${widget.branchModel.serviceProviderName}".toString().toText(
|
|
|
|
"${widget.branchDetailModel.branchName} | ${widget.branchDetailModel.serviceProviderName}".toString().toText(
|
|
|
|
fontSize: 16,
|
|
|
|
fontSize: 16,
|
|
|
|
isBold: true,
|
|
|
|
isBold: true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -60,14 +59,14 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
(LocaleKeys.location.tr() + ":").toText(color: MyColors.lightTextColor, fontSize: 12),
|
|
|
|
(LocaleKeys.location.tr() + ":").toText(color: MyColors.lightTextColor, fontSize: 12),
|
|
|
|
4.width,
|
|
|
|
4.width,
|
|
|
|
(widget.branchModel.distanceKm.toString() + " km").toText(fontSize: 12, isBold: true),
|
|
|
|
(widget.branchDetailModel.distanceKm.toString() + " km").toText(fontSize: 12, isBold: true),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
("Time" + ":").toText(color: MyColors.lightTextColor, fontSize: 12),
|
|
|
|
("Time" + ":").toText(color: MyColors.lightTextColor, fontSize: 12),
|
|
|
|
4.width,
|
|
|
|
4.width,
|
|
|
|
"${widget.branchModel.openTime} - ${widget.branchModel.closeTime}".toText(fontSize: 12, isBold: true),
|
|
|
|
"${widget.branchDetailModel.openTime} - ${widget.branchDetailModel.closeTime}".toText(fontSize: 12, isBold: true),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
2.height,
|
|
|
|
2.height,
|
|
|
|
@ -123,7 +122,7 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.onPress(
|
|
|
|
.onPress(
|
|
|
|
() {
|
|
|
|
() {
|
|
|
|
navigateWithName(context, AppRoutes.providerProfilePage, arguments: widget.branchModel.serviceProviderId);
|
|
|
|
navigateWithName(context, AppRoutes.providerProfilePage, arguments: widget.branchDetailModel.serviceProviderId);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
@ -134,7 +133,7 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
|
|
|
|
color: MyColors.lightTextColor,
|
|
|
|
color: MyColors.lightTextColor,
|
|
|
|
isBold: true,
|
|
|
|
isBold: true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (widget.branchModel.branchServices!.length == 0) "No Services Available".toText(fontSize: 12, isBold: true),
|
|
|
|
if (widget.branchDetailModel.branchServices!.length == 0) "No Services Available".toText(fontSize: 12, isBold: true),
|
|
|
|
showServicesList(),
|
|
|
|
showServicesList(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).toWhiteContainer(
|
|
|
|
).toWhiteContainer(
|
|
|
|
@ -150,7 +149,9 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
|
|
|
|
title: "Book Appointment",
|
|
|
|
title: "Book Appointment",
|
|
|
|
maxWidth: double.infinity,
|
|
|
|
maxWidth: double.infinity,
|
|
|
|
margin: EdgeInsets.all(21),
|
|
|
|
margin: EdgeInsets.all(21),
|
|
|
|
onPressed: () {},
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
navigateWithName(context, AppRoutes.bookAppointmenServicesView);
|
|
|
|
|
|
|
|
},
|
|
|
|
).toContainer(
|
|
|
|
).toContainer(
|
|
|
|
paddingAll: 0,
|
|
|
|
paddingAll: 0,
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
@ -165,7 +166,7 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return ExpansionTile(
|
|
|
|
return ExpansionTile(
|
|
|
|
tilePadding: EdgeInsets.zero,
|
|
|
|
tilePadding: EdgeInsets.zero,
|
|
|
|
title: (widget.branchModel.branchServices![index].serviceDescription ?? "").toText(
|
|
|
|
title: (widget.branchDetailModel.branchServices![index].serviceDescription ?? "").toText(
|
|
|
|
fontSize: 16,
|
|
|
|
fontSize: 16,
|
|
|
|
isBold: true,
|
|
|
|
isBold: true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -173,11 +174,11 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
|
|
|
|
Column(
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
showItem("Allowing home service:", (widget.branchModel.branchServices![index].isAllowAppointment ?? false) ? "Yes" : "No", valueColor: Colors.green),
|
|
|
|
showItem("Allowing home service:", (widget.branchDetailModel.branchServices![index].isAllowAppointment ?? false) ? "Yes" : "No", valueColor: Colors.green),
|
|
|
|
showItem("Home service range", widget.branchModel.branchServices![index].customerLocationRange.toString() + "KM"),
|
|
|
|
showItem("Home service range", widget.branchDetailModel.branchServices![index].customerLocationRange.toString() + "KM"),
|
|
|
|
showItem("Charges per KM", widget.branchModel.branchServices![index].customerLocationRange.toString() + "SAR"),
|
|
|
|
showItem("Charges per KM", widget.branchDetailModel.branchServices![index].customerLocationRange.toString() + "SAR"),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
(widget.branchModel.branchServices![index].itemsCount.toString() + "+ items").toText(
|
|
|
|
(widget.branchDetailModel.branchServices![index].itemsCount.toString() + "+ items").toText(
|
|
|
|
fontSize: 12,
|
|
|
|
fontSize: 12,
|
|
|
|
isBold: true,
|
|
|
|
isBold: true,
|
|
|
|
color: MyColors.primaryColor,
|
|
|
|
color: MyColors.primaryColor,
|
|
|
|
@ -186,18 +187,18 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
|
|
|
|
20.height,
|
|
|
|
20.height,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).onPress(() {
|
|
|
|
).onPress(() {
|
|
|
|
showMyBottomSheet(context, child: ItemsListSheet(widget.branchModel.branchServices![index].serviceProviderServiceId ?? 0));
|
|
|
|
showMyBottomSheet(context, child: ItemsListSheet(widget.branchDetailModel.branchServices![index].serviceProviderServiceId ?? 0));
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
onExpansionChanged: (value) {
|
|
|
|
onExpansionChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
widget.branchModel.branchServices![index].isExpanded = value;
|
|
|
|
widget.branchDetailModel.branchServices![index].isExpanded = value;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
collapsedBackgroundColor: Colors.transparent,
|
|
|
|
collapsedBackgroundColor: Colors.transparent,
|
|
|
|
initiallyExpanded: widget.branchModel.branchServices![index].isExpanded,
|
|
|
|
initiallyExpanded: widget.branchDetailModel.branchServices![index].isExpanded,
|
|
|
|
trailing: widget.branchModel.branchServices![index].isExpanded ? Icon(Icons.keyboard_arrow_up) : Icon(Icons.keyboard_arrow_down),
|
|
|
|
trailing: widget.branchDetailModel.branchServices![index].isExpanded ? Icon(Icons.keyboard_arrow_up) : Icon(Icons.keyboard_arrow_down),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
separatorBuilder: (context, index) {
|
|
|
|
separatorBuilder: (context, index) {
|
|
|
|
@ -205,7 +206,7 @@ class _BranchDetailPageState extends State<BranchDetailPage> {
|
|
|
|
height: 1,
|
|
|
|
height: 1,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
itemCount: widget.branchModel.branchServices!.length,
|
|
|
|
itemCount: widget.branchDetailModel.branchServices!.length,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
shrinkWrap: true,
|
|
|
|
shrinkWrap: true,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|