classes added from provider
parent
dba5492995
commit
ff9b906211
@ -0,0 +1,100 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final itemModel = itemModelFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
ItemModel itemModelFromJson(String str) => ItemModel.fromJson(json.decode(str));
|
||||
|
||||
String itemModelToJson(ItemModel data) => json.encode(data.toJson());
|
||||
|
||||
class ItemModel {
|
||||
final int? messageStatus;
|
||||
final int? totalItemsCount;
|
||||
final List<ItemData>? data;
|
||||
final String? message;
|
||||
|
||||
ItemModel({
|
||||
this.messageStatus,
|
||||
this.totalItemsCount,
|
||||
this.data,
|
||||
this.message,
|
||||
});
|
||||
|
||||
factory ItemModel.fromJson(Map<String, dynamic> json) => ItemModel(
|
||||
messageStatus: json["messageStatus"],
|
||||
totalItemsCount: json["totalItemsCount"],
|
||||
data: json["data"] == null ? [] : List<ItemData>.from(json["data"]!.map((x) => ItemData.fromJson(x))),
|
||||
message: json["message"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"messageStatus": messageStatus,
|
||||
"totalItemsCount": totalItemsCount,
|
||||
"data": data == null ? [] : List<dynamic>.from(data!.map((x) => x.toJson())),
|
||||
"message": message,
|
||||
};
|
||||
}
|
||||
|
||||
class ItemData {
|
||||
final int? id;
|
||||
final String? name;
|
||||
final String? price;
|
||||
final String? manufactureDate;
|
||||
final String? description;
|
||||
final dynamic pictureUrl;
|
||||
final int? companyId;
|
||||
final int? serviceProviderServiceId;
|
||||
final bool? isActive;
|
||||
final bool? isAllowAppointment;
|
||||
final bool? isAppointmentCompanyLoc;
|
||||
final bool? isAppointmentCustomerLoc;
|
||||
bool? isUpdate;
|
||||
|
||||
ItemData({
|
||||
this.id,
|
||||
this.name,
|
||||
this.price,
|
||||
this.manufactureDate,
|
||||
this.description,
|
||||
this.pictureUrl,
|
||||
this.companyId,
|
||||
this.serviceProviderServiceId,
|
||||
this.isActive,
|
||||
this.isAllowAppointment,
|
||||
this.isAppointmentCompanyLoc,
|
||||
this.isAppointmentCustomerLoc,
|
||||
this.isUpdate,
|
||||
});
|
||||
|
||||
factory ItemData.fromJson(Map<String, dynamic> json) => ItemData(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
price: json["price"].toString(),
|
||||
manufactureDate: json["manufactureDate"],
|
||||
description: json["description"],
|
||||
pictureUrl: json["pictureUrl"],
|
||||
companyId: json["companyID"],
|
||||
serviceProviderServiceId: json["serviceProviderServiceID"],
|
||||
isActive: json["isActive"],
|
||||
isAllowAppointment: json["isAllowAppointment"],
|
||||
isAppointmentCompanyLoc: json["isAppointmentCompanyLoc"],
|
||||
isAppointmentCustomerLoc: json["isAppointmentCustomerLoc"],
|
||||
isUpdate: false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"price": price,
|
||||
"manufactureDate": manufactureDate,
|
||||
"description": description,
|
||||
"pictureUrl": pictureUrl,
|
||||
"companyID": companyId,
|
||||
"serviceProviderServiceID": serviceProviderServiceId,
|
||||
"isActive": isActive,
|
||||
"isAllowAppointment": isAllowAppointment,
|
||||
"isAppointmentCompanyLoc": isAppointmentCompanyLoc,
|
||||
"isAppointmentCustomerLoc": isAppointmentCustomerLoc,
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,125 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final subscription = subscriptionFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
Subscription subscriptionFromJson(String str) => Subscription.fromJson(json.decode(str));
|
||||
|
||||
String subscriptionToJson(Subscription data) => json.encode(data.toJson());
|
||||
|
||||
class SubscriptionModel {
|
||||
SubscriptionModel({
|
||||
this.messageStatus,
|
||||
this.totalItemsCount,
|
||||
this.data,
|
||||
this.message,
|
||||
});
|
||||
|
||||
int? messageStatus;
|
||||
int? totalItemsCount;
|
||||
List<Subscription>? data;
|
||||
String? message;
|
||||
|
||||
factory SubscriptionModel.fromJson(Map<String, dynamic> json) => SubscriptionModel(
|
||||
messageStatus: json["messageStatus"],
|
||||
totalItemsCount: json["totalItemsCount"],
|
||||
data: json["data"] == null ? [] : List<Subscription>.from(json["data"]!.map((x) => Subscription.fromJson(x))),
|
||||
message: json["message"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"messageStatus": messageStatus,
|
||||
"totalItemsCount": totalItemsCount,
|
||||
"data": data == null ? [] : List<dynamic>.from(data!.map((x) => x.toJson())),
|
||||
"message": message,
|
||||
};
|
||||
}
|
||||
|
||||
class Subscription {
|
||||
Subscription({
|
||||
this.id,
|
||||
this.name,
|
||||
this.description,
|
||||
this.durationName,
|
||||
this.durationDays,
|
||||
this.price,
|
||||
this.currency,
|
||||
this.numberOfBranches,
|
||||
this.numberOfSubUsers,
|
||||
this.numberOfAds,
|
||||
this.countryId,
|
||||
this.countryName,
|
||||
this.isSubscribed,
|
||||
this.subscriptionAppliedId,
|
||||
this.serviceProviderId,
|
||||
this.dateStart,
|
||||
this.dateEnd,
|
||||
this.isExpired,
|
||||
this.isActive,
|
||||
});
|
||||
|
||||
int? id;
|
||||
String? name;
|
||||
String? description;
|
||||
String? durationName;
|
||||
int? durationDays;
|
||||
double? price;
|
||||
String? currency;
|
||||
int? numberOfBranches;
|
||||
int? numberOfSubUsers;
|
||||
int? numberOfAds;
|
||||
int? countryId;
|
||||
String? countryName;
|
||||
bool? isSubscribed;
|
||||
int? subscriptionAppliedId;
|
||||
int? serviceProviderId;
|
||||
DateTime? dateStart;
|
||||
DateTime? dateEnd;
|
||||
bool? isExpired;
|
||||
bool? isActive;
|
||||
|
||||
factory Subscription.fromJson(Map<String, dynamic> json) => Subscription(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
description: json["description"],
|
||||
durationName: json["durationName"],
|
||||
durationDays: json["durationDays"],
|
||||
price: json["price"]?.toDouble(),
|
||||
currency: json["currency"],
|
||||
numberOfBranches: json["numberOfBranches"],
|
||||
numberOfSubUsers: json["numberOfSubUsers"],
|
||||
numberOfAds: json["numberOfAds"],
|
||||
countryId: json["countryID"],
|
||||
countryName: json["countryName"]!,
|
||||
isSubscribed: json["isSubscribed"],
|
||||
subscriptionAppliedId: json["subscriptionAppliedID"],
|
||||
serviceProviderId: json["serviceProviderID"],
|
||||
dateStart: json["dateStart"] == null ? null : DateTime.parse(json["dateStart"]),
|
||||
dateEnd: json["dateEnd"] == null ? null : DateTime.parse(json["dateEnd"]),
|
||||
isExpired: json["isExpired"],
|
||||
isActive: json["isActive"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"description": description,
|
||||
"durationName": durationName,
|
||||
"durationDays": durationDays,
|
||||
"price": price,
|
||||
"currency": currency,
|
||||
"numberOfBranches": numberOfBranches,
|
||||
"numberOfSubUsers": numberOfSubUsers,
|
||||
"numberOfAds": numberOfAds,
|
||||
"countryID": countryId,
|
||||
"countryName": countryName,
|
||||
"isSubscribed": isSubscribed,
|
||||
"subscriptionAppliedID": subscriptionAppliedId,
|
||||
"serviceProviderID": serviceProviderId,
|
||||
"dateStart": dateStart?.toIso8601String(),
|
||||
"dateEnd": dateEnd?.toIso8601String(),
|
||||
"isExpired": isExpired,
|
||||
"isActive": isActive,
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mc_common_app/extensions/string_extensions.dart';
|
||||
import 'package:mc_common_app/theme/colors.dart';
|
||||
|
||||
class CheckBoxWithTitleDescription extends StatelessWidget {
|
||||
bool isSelected;
|
||||
String title, description;
|
||||
Function(bool) onSelection;
|
||||
|
||||
CheckBoxWithTitleDescription({required this.isSelected, required this.title, required this.description, required this.onSelection, Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Checkbox(
|
||||
value: isSelected,
|
||||
onChanged: (bool? v) {
|
||||
onSelection(v ?? false);
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
title.toText(fontSize: 14, isBold: true),
|
||||
description.toText(fontSize: 12, color: MyColors.lightTextColor),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mc_common_app/extensions/string_extensions.dart';
|
||||
|
||||
class EmptyWidget extends StatelessWidget {
|
||||
const EmptyWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(child: "No Data Found".toText());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue