Compare commits
11 Commits
master
...
fatima_dev
| Author | SHA1 | Date |
|---|---|---|
|
|
f76b204c2d | 1 month ago |
|
|
3ceb98c045 | 2 months ago |
|
|
1bbb706d8c | 2 months ago |
|
|
3146a9433b | 2 months ago |
|
|
87ec0f2966 | 2 months ago |
|
|
ff10b66b14 | 2 months ago |
|
|
388e5b4aed | 2 months ago |
|
|
13966f60a9 | 2 months ago |
|
|
38bda8e8ed | 2 months ago |
|
|
b88aee4632 | 2 months ago |
|
|
c893cd73ec | 3 months ago |
@ -1,63 +0,0 @@
|
|||||||
# View-Only Mode: CustomerID Parameter Exclusion
|
|
||||||
|
|
||||||
## Summary
|
|
||||||
Updated all API calls to exclude `customerID` parameter when `AppState().getIsViewOnly` is `true`.
|
|
||||||
|
|
||||||
## Files Modified
|
|
||||||
|
|
||||||
### 1. **request_repo.dart**
|
|
||||||
- ✅ `createRequest()` - Excludes customerID in view-only mode
|
|
||||||
- ✅ `getRequests()` - Excludes customerID for customer app type in view-only mode
|
|
||||||
- ✅ `getRequestBasedOnFilters()` - Excludes customerID for customer app type in view-only mode
|
|
||||||
- ✅ `getOffersFromProvidersByRequest()` - Excludes customerID in view-only mode
|
|
||||||
|
|
||||||
### 2. **ads_repo.dart**
|
|
||||||
- ✅ `cancelMyAdReservation()` - Excludes customerID in view-only mode
|
|
||||||
- ✅ `createReserveAd()` - Excludes customerID in view-only mode
|
|
||||||
- ✅ `uploadBankReceiptsOnReserveDealDone()` - Excludes customerID in view-only mode
|
|
||||||
|
|
||||||
### 3. **appointment_repo.dart**
|
|
||||||
- ✅ `createAppointmentsMulti()` - Excludes customerID in view-only mode
|
|
||||||
- ✅ `getMyAppointmentsForCustomersByFilters()` - Excludes customerID in view-only mode
|
|
||||||
|
|
||||||
### 4. **branch_repo.dart**
|
|
||||||
- ✅ `submitBranchRatings()` - Excludes customerID in view-only mode
|
|
||||||
- ✅ `addProviderToFavourite()` - Excludes customerID in view-only mode
|
|
||||||
- ✅ `getMyFavoriteProviders()` - Excludes customerID in view-only mode
|
|
||||||
|
|
||||||
### 5. **setting_options_repo.dart**
|
|
||||||
- ✅ `appInvitationCreate()` - Excludes customerID for customer app type in view-only mode
|
|
||||||
|
|
||||||
## How It Works
|
|
||||||
|
|
||||||
When `AppState().getIsViewOnly` is `true`, the application is in demonstration/view-only mode. In this mode:
|
|
||||||
|
|
||||||
1. **API parameters are conditionally added**: Instead of always including `customerID`, we check the view-only flag first
|
|
||||||
2. **Pattern used**:
|
|
||||||
```dart
|
|
||||||
var params = {
|
|
||||||
"otherParam": value,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!appState.getIsViewOnly) {
|
|
||||||
params["customerID"] = customerId;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **App types considered**: The changes properly handle both customer and provider app types
|
|
||||||
|
|
||||||
## Testing Recommendations
|
|
||||||
|
|
||||||
1. Test in normal mode (getIsViewOnly = false):
|
|
||||||
- All APIs should include customerID as before
|
|
||||||
- All existing functionality should work
|
|
||||||
|
|
||||||
2. Test in view-only mode (getIsViewOnly = true):
|
|
||||||
- APIs should NOT include customerID parameter
|
|
||||||
- Read-only operations should work
|
|
||||||
- Write operations should be blocked by view-only mode
|
|
||||||
|
|
||||||
## Note
|
|
||||||
|
|
||||||
The `createComplainFromProvider()` method in `common_repo.dart` was NOT modified because the `customerID` in that API represents the target customer being complained about, not the authenticated user making the request.
|
|
||||||
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.2 MiB |
@ -0,0 +1,3 @@
|
|||||||
|
description: This file stores settings for Dart & Flutter DevTools.
|
||||||
|
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||||
|
extensions:
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,104 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
||||||
|
import 'package:mc_common_app/models/advertisment_models/ad_details_model.dart';
|
||||||
|
import 'package:mc_common_app/view_models/ad_view_model.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
||||||
|
import 'package:mc_common_app/utils/enums.dart';
|
||||||
|
import 'package:mc_common_app/views/advertisement/components/ads_list_widget.dart';
|
||||||
|
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
|
||||||
|
import 'package:mc_common_app/widgets/common_widgets/filters_list.dart';
|
||||||
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
|
||||||
|
class FavouriteAdsView extends StatefulWidget {
|
||||||
|
const FavouriteAdsView({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<FavouriteAdsView> createState() => _FavouriteAdsViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FavouriteAdsViewState extends State<FavouriteAdsView> {
|
||||||
|
int selectedBrandId = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
scheduleMicrotask(() async {
|
||||||
|
final adVM = context.read<AdVM>();
|
||||||
|
await adVM.getFavouriteAds();
|
||||||
|
// Load filter options if not already loaded
|
||||||
|
if (adVM.exploreAdsFilterOptions.isEmpty) {
|
||||||
|
await adVM.populateAdsFilterList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<AdDetailsModel> getFilteredAds(AdVM adVM) {
|
||||||
|
if (selectedBrandId == 0) {
|
||||||
|
return adVM.favouriteAds;
|
||||||
|
}
|
||||||
|
return adVM.favouriteAds.where((ad) => ad.vehicle?.model?.vehicleBrandID == selectedBrandId).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Consumer(builder: (BuildContext context, AdVM adVM, Widget? child) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: CustomAppBar(title: LocaleKeys.myFavouriteAds.tr()),
|
||||||
|
body: SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: double.infinity,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
if (adVM.exploreAdsFilterOptions.isNotEmpty) ...[
|
||||||
|
16.height,
|
||||||
|
FiltersList(
|
||||||
|
showImages: true,
|
||||||
|
filterList: adVM.exploreAdsFilterOptions,
|
||||||
|
onFilterTapped: (index, selectedFilterId) {
|
||||||
|
setState(() {
|
||||||
|
selectedBrandId = selectedFilterId;
|
||||||
|
});
|
||||||
|
// Update filter selection in the list
|
||||||
|
for (var filter in adVM.exploreAdsFilterOptions) {
|
||||||
|
filter.isSelected = false;
|
||||||
|
}
|
||||||
|
adVM.exploreAdsFilterOptions[index].isSelected = true;
|
||||||
|
},
|
||||||
|
needLeftPadding: false,
|
||||||
|
).paddingOnly(left: 21),
|
||||||
|
],
|
||||||
|
16.height,
|
||||||
|
Expanded(
|
||||||
|
child: RefreshIndicator(
|
||||||
|
onRefresh: () async {
|
||||||
|
await adVM.getFavouriteAds();
|
||||||
|
},
|
||||||
|
child: adVM.state == ViewState.busy
|
||||||
|
? const Center(child: CircularProgressIndicator())
|
||||||
|
: getFilteredAds(adVM).isEmpty
|
||||||
|
? Center(
|
||||||
|
child: Text(
|
||||||
|
LocaleKeys.noFavouriteAds.tr(),
|
||||||
|
style: const TextStyle(fontSize: 16),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: AdsListWidget(
|
||||||
|
isAdsFragment: false,
|
||||||
|
isDraftAds: false,
|
||||||
|
shouldShowAdStatus: false,
|
||||||
|
adsList: getFilteredAds(adVM),
|
||||||
|
hasMoreData: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,228 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:shimmer/shimmer.dart';
|
||||||
|
|
||||||
|
/// Shimmer for horizontal appointment slider
|
||||||
|
class AppointmentSliderShimmer extends StatelessWidget {
|
||||||
|
const AppointmentSliderShimmer({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SizedBox(
|
||||||
|
height: 180,
|
||||||
|
child: ListView.builder(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
itemCount: 3,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 21),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Shimmer.fromColors(
|
||||||
|
baseColor: Colors.grey[300]!,
|
||||||
|
highlightColor: Colors.grey[100]!,
|
||||||
|
child: Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(right: index < 2 ? 12 : 0),
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Shimmer for appointments list (vertical list of appointment cards)
|
||||||
|
class AppointmentsListShimmer extends StatelessWidget {
|
||||||
|
final int itemCount;
|
||||||
|
|
||||||
|
const AppointmentsListShimmer({super.key, this.itemCount = 5});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Shimmer.fromColors(
|
||||||
|
baseColor: Colors.grey[300]!,
|
||||||
|
highlightColor: Colors.grey[100]!,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 21),
|
||||||
|
child: ListView.separated(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
itemCount: itemCount,
|
||||||
|
separatorBuilder: (context, index) => const SizedBox(height: 12),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Container(
|
||||||
|
height: 140,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Shimmer for branches list (vertical list of branch cards)
|
||||||
|
class BranchesListShimmer extends StatelessWidget {
|
||||||
|
final int itemCount;
|
||||||
|
|
||||||
|
const BranchesListShimmer({Key? key, this.itemCount = 5}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Shimmer.fromColors(
|
||||||
|
baseColor: Colors.grey[300]!,
|
||||||
|
highlightColor: Colors.grey[100]!,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: ListView.separated(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
itemCount: itemCount,
|
||||||
|
separatorBuilder: (context, index) => const SizedBox(height: 12),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Container(
|
||||||
|
height: 160,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Shimmer for requests list (vertical list of request cards)
|
||||||
|
class RequestsListShimmer extends StatelessWidget {
|
||||||
|
final int itemCount;
|
||||||
|
|
||||||
|
const RequestsListShimmer({Key? key, this.itemCount = 5}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Shimmer.fromColors(
|
||||||
|
baseColor: Colors.grey[300]!,
|
||||||
|
highlightColor: Colors.grey[100]!,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 21),
|
||||||
|
child: ListView.separated(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
itemCount: itemCount,
|
||||||
|
separatorBuilder: (context, index) => const SizedBox(height: 12),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Container(
|
||||||
|
height: 120,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Shimmer for services grid (3 columns)
|
||||||
|
class ServicesGridShimmer extends StatelessWidget {
|
||||||
|
const ServicesGridShimmer({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Shimmer.fromColors(
|
||||||
|
baseColor: Colors.grey[300]!,
|
||||||
|
highlightColor: Colors.grey[100]!,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 21),
|
||||||
|
child: GridView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 3,
|
||||||
|
mainAxisSpacing: 12,
|
||||||
|
crossAxisSpacing: 12,
|
||||||
|
childAspectRatio: 0.9,
|
||||||
|
),
|
||||||
|
itemCount: 6,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Shimmer for ads list
|
||||||
|
class AdsListShimmer extends StatelessWidget {
|
||||||
|
final int itemCount;
|
||||||
|
|
||||||
|
const AdsListShimmer({Key? key, this.itemCount = 3}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Shimmer.fromColors(
|
||||||
|
baseColor: Colors.grey[300]!,
|
||||||
|
highlightColor: Colors.grey[100]!,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 21),
|
||||||
|
child: ListView.separated(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
itemCount: itemCount,
|
||||||
|
separatorBuilder: (context, index) => const SizedBox(height: 12),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Container(
|
||||||
|
height: 140,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Shimmer for provider branches grid
|
||||||
|
class BranchesGridShimmer extends StatelessWidget {
|
||||||
|
const BranchesGridShimmer({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Shimmer.fromColors(
|
||||||
|
baseColor: Colors.grey[300]!,
|
||||||
|
highlightColor: Colors.grey[100]!,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 21),
|
||||||
|
child: GridView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 2,
|
||||||
|
mainAxisSpacing: 12,
|
||||||
|
crossAxisSpacing: 12,
|
||||||
|
childAspectRatio: 0.75,
|
||||||
|
),
|
||||||
|
itemCount: 4,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue