merge fix's

mirza_development
Mirza.Shafique@cloudsolutions.com.sa 2 years ago
parent 20125d81ae
commit 689460a78d

@ -10,6 +10,7 @@ class BranchDetailModel {
final String? branchName; final String? branchName;
final String? branchDescription; final String? branchDescription;
final int? cityId; final int? cityId;
final String? cityName;
final String? address; final String? address;
final String? latitude; final String? latitude;
final String? longitude; final String? longitude;
@ -32,6 +33,7 @@ class BranchDetailModel {
this.branchName, this.branchName,
this.branchDescription, this.branchDescription,
this.cityId, this.cityId,
this.cityName,
this.address, this.address,
this.latitude, this.latitude,
this.longitude, this.longitude,
@ -48,13 +50,15 @@ class BranchDetailModel {
required this.isExpanded, required this.isExpanded,
}); });
factory BranchDetailModel.fromJson(Map<String, dynamic> json) => BranchDetailModel( factory BranchDetailModel.fromJson(Map<String, dynamic> json) =>
BranchDetailModel(
id: json["id"], id: json["id"],
serviceProviderId: json["serviceProviderID"], serviceProviderId: json["serviceProviderID"],
serviceProviderName: json["serviceProviderName"], serviceProviderName: json["serviceProviderName"],
branchName: json["branchName"], branchName: json["branchName"],
branchDescription: json["branchDescription"], branchDescription: json["branchDescription"],
cityId: json["cityID"], cityId: json["cityID"],
cityName: json["cityName"],
address: json["address"], address: json["address"],
latitude: json["latitude"], latitude: json["latitude"],
longitude: json["longitude"], longitude: json["longitude"],
@ -64,12 +68,15 @@ class BranchDetailModel {
branchStatus: (json['branchStatus'] as int).toBranchStatusEnum(), branchStatus: (json['branchStatus'] as int).toBranchStatusEnum(),
statusId: json["branchStatus"], statusId: json["branchStatus"],
statusText: json["statusText"], statusText: json["statusText"],
branchServices: json["serviceProviderServices"] == null ? [] : List<ServiceModel>.from(json["serviceProviderServices"]!.map((x) => ServiceModel.fromJson(x))), branchServices: json["serviceProviderServices"] == null ? [] : List<
ServiceModel>.from(json["serviceProviderServices"]!.map((x) =>
ServiceModel.fromJson(x))),
categories: [], categories: [],
isExpanded: false, isExpanded: false,
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() =>
{
"id": id, "id": id,
"serviceProviderID": serviceProviderId, "serviceProviderID": serviceProviderId,
"serviceProviderName": serviceProviderName, "serviceProviderName": serviceProviderName,
@ -84,6 +91,7 @@ class BranchDetailModel {
"closeTime": closeTime, "closeTime": closeTime,
"status": statusId, "status": statusId,
"statusText": statusText, "statusText": statusText,
"serviceProviderServices": branchServices == null ? [] : List<dynamic>.from(branchServices!.map((x) => x.toJson())), "serviceProviderServices": branchServices == null ? [] : List<
dynamic>.from(branchServices!.map((x) => x.toJson())),
}; };
} }

@ -1,12 +1,9 @@
import 'dart:developer';
import 'dart:io'; import 'dart:io';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:mc_common_app/utils/app_permission_handler.dart'; import 'package:mc_common_app/utils/app_permission_handler.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:permission_handler/permission_handler.dart';
abstract class CommonAppServices { abstract class CommonAppServices {
Future<List<File>> pickMultipleImages(); Future<List<File>> pickMultipleImages();
@ -14,6 +11,9 @@ abstract class CommonAppServices {
Future<File?> pickImageFromPhone(int sourceFlag); Future<File?> pickImageFromPhone(int sourceFlag);
Future<List<File>?> pickMultipleFiles(BuildContext context); Future<List<File>?> pickMultipleFiles(BuildContext context);
Future<File?> pickFile(BuildContext context,
{required FileType fileType, List<String>? allowedExtensions});
} }
class CommonServicesImp implements CommonAppServices { class CommonServicesImp implements CommonAppServices {
@ -64,4 +64,28 @@ class CommonServicesImp implements CommonAppServices {
} }
return pickedImages; return pickedImages;
} }
@override
Future<File?> pickFile(BuildContext context,
{required FileType fileType, List<String>? allowedExtensions}) async {
FilePickerResult? result;
final status = await AppPermissions.checkStoragePermissions(context);
if (status) {
result = await FilePicker.platform.pickFiles(
allowMultiple: true,
type: fileType,
allowedExtensions: allowedExtensions);
}
List<File> pickedFiles = [];
if (result != null) {
for (var element in result.files) {
if (element.path != null) {
pickedFiles.add(File(element.path!));
}
}
}
return pickedFiles.length > 0 ? pickedFiles.first : null;
}
} }

@ -28,8 +28,11 @@ class DropdownField extends StatefulWidget {
final Function(DropValue) onSelect; final Function(DropValue) onSelect;
final bool showAppointmentPickerVariant; final bool showAppointmentPickerVariant;
final TextStyle? textStyle; final TextStyle? textStyle;
final bool isSelectAble;
const DropdownField(this.onSelect, {Key? key, this.hint, this.list, this.dropdownValue, this.errorValue = "", this.showAppointmentPickerVariant = false, this.textStyle}) : super(key: key); const DropdownField(this.onSelect,
{Key? key, this.hint, this.list, this.dropdownValue, this.errorValue = "", this.showAppointmentPickerVariant = false, this.textStyle, this.isSelectAble = true})
: super(key: key);
@override @override
State<DropdownField> createState() => _DropdownFieldState(); State<DropdownField> createState() => _DropdownFieldState();
@ -53,7 +56,9 @@ class _DropdownFieldState extends State<DropdownField> {
return Column( return Column(
children: [ children: [
Container( Container(
decoration: widget.showAppointmentPickerVariant ? null : Utils.containerColorRadiusBorderWidth(MyColors.white, 0, MyColors.darkPrimaryColor, 2), decoration: widget.showAppointmentPickerVariant ? null : Utils
.containerColorRadiusBorderWidth(
MyColors.white, 0, MyColors.darkPrimaryColor, 2),
margin: const EdgeInsets.all(0), margin: const EdgeInsets.all(0),
padding: const EdgeInsets.only(left: 8, right: 8), padding: const EdgeInsets.only(left: 8, right: 8),
width: widget.showAppointmentPickerVariant ? 170 : null, width: widget.showAppointmentPickerVariant ? 170 : null,
@ -65,8 +70,15 @@ class _DropdownFieldState extends State<DropdownField> {
iconEnabledColor: borderColor, iconEnabledColor: borderColor,
iconDisabledColor: borderColor, iconDisabledColor: borderColor,
isExpanded: true, isExpanded: true,
style: widget.showAppointmentPickerVariant ? widget.textStyle : const TextStyle(color: Colors.black, fontWeight: FontWeight.w600, fontSize: 15), style: widget.showAppointmentPickerVariant
hint: (widget.hint ?? "").toText(color: widget.showAppointmentPickerVariant ? Colors.black : borderColor, fontSize: widget.showAppointmentPickerVariant ? 18 : 15), ? widget.textStyle
: const TextStyle(
color: Colors.black, fontWeight: FontWeight.w600, fontSize: 15),
hint: (widget.hint ?? "").toText(
color: widget.showAppointmentPickerVariant
? Colors.black
: borderColor,
fontSize: widget.showAppointmentPickerVariant ? 18 : 15),
underline: Container(height: 0), underline: Container(height: 0),
onChanged: (DropValue? newValue) { onChanged: (DropValue? newValue) {
setState(() { setState(() {
@ -75,11 +87,12 @@ class _DropdownFieldState extends State<DropdownField> {
}); });
}, },
items: (widget.list ?? defaultV).map<DropdownMenuItem<DropValue>>( items: (widget.list ?? defaultV).map<DropdownMenuItem<DropValue>>(
(DropValue value) { (DropValue value) {
return DropdownMenuItem<DropValue>( return DropdownMenuItem<DropValue>(
value: value, value: value,
enabled: value.isEnabled ?? true, enabled: value.isEnabled ?? true,
child: value.value.toText(fontSize: 15, color: value.isEnabled == false ? Colors.black38 : null), child: value.value.toText(fontSize: 15,
color: value.isEnabled == false ? Colors.black38 : null),
); );
}, },
).toList(), ).toList(),

@ -137,6 +137,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.6" version: "1.0.6"
device_info_plus:
dependency: "direct main"
description:
name: device_info_plus
sha256: "77f757b789ff68e4eaf9c56d1752309bd9f7ad557cb105b938a7f8eb89e59110"
url: "https://pub.dev"
source: hosted
version: "9.1.2"
device_info_plus_platform_interface:
dependency: transitive
description:
name: device_info_plus_platform_interface
sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64
url: "https://pub.dev"
source: hosted
version: "7.0.0"
dropdown_button2: dropdown_button2:
dependency: "direct main" dependency: "direct main"
description: description:
@ -181,10 +197,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: ffi name: ffi
sha256: "13a6ccf6a459a125b3fcdb6ec73bd5ff90822e071207c663bfd1f70062d51d18" sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.1" version: "2.1.0"
file: file:
dependency: transitive dependency: transitive
description: description:
@ -197,10 +213,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: file_picker name: file_picker
sha256: "704259669b5e9cb24e15c11cfcf02caf5f20d30901b3916d60b6d1c2d647035f" sha256: "4e42aacde3b993c5947467ab640882c56947d9d27342a5b6f2895b23956954a6"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.6.1" version: "6.1.1"
file_selector_linux: file_selector_linux:
dependency: transitive dependency: transitive
description: description:
@ -745,10 +761,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: path_provider_windows name: path_provider_windows
sha256: a34ecd7fb548f8e57321fd8e50d865d266941b54e6c3b7758cf8f37c24116905 sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.7" version: "2.2.1"
percent_indicator: percent_indicator:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1158,10 +1174,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: win32 name: win32
sha256: c0e3a4f7be7dae51d8f152230b86627e3397c1ba8c3fa58e63d44a9f3edc9cef sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.6.1" version: "5.2.0"
win32_registry:
dependency: transitive
description:
name: win32_registry
sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a"
url: "https://pub.dev"
source: hosted
version: "1.1.2"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
@ -1179,5 +1203,5 @@ packages:
source: hosted source: hosted
version: "6.3.0" version: "6.3.0"
sdks: sdks:
dart: ">=3.2.0-194.0.dev <4.0.0" dart: ">=3.2.0 <4.0.0"
flutter: ">=3.10.0" flutter: ">=3.10.0"

Loading…
Cancel
Save