check null safety
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import 'package:fcs/domain/entities/setting.dart';
|
||||
|
||||
class Contact {
|
||||
String usaAddress;
|
||||
String mmAddress;
|
||||
String usaContactNumber;
|
||||
String mmContactNumber;
|
||||
String emailAddress;
|
||||
String facebookLink;
|
||||
String? usaAddress;
|
||||
String? mmAddress;
|
||||
String? usaContactNumber;
|
||||
String? mmContactNumber;
|
||||
String? emailAddress;
|
||||
String? facebookLink;
|
||||
|
||||
Contact({
|
||||
this.usaAddress,
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
class DeliveryAddress {
|
||||
String id;
|
||||
String fullName;
|
||||
String addressLine1;
|
||||
String addressLine2;
|
||||
String city;
|
||||
String state;
|
||||
String phoneNumber;
|
||||
String? id;
|
||||
String? fullName;
|
||||
String? addressLine1;
|
||||
String? addressLine2;
|
||||
String? city;
|
||||
String? state;
|
||||
String? phoneNumber;
|
||||
bool isDefault;
|
||||
String userID;
|
||||
String? userID;
|
||||
|
||||
DeliveryAddress(
|
||||
{this.id,
|
||||
this.fullName,
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
|
||||
class Message {
|
||||
String id;
|
||||
String message;
|
||||
DateTime date;
|
||||
String receiverID;
|
||||
String receiverName;
|
||||
String senderID;
|
||||
String senderName;
|
||||
String messageType;
|
||||
String messageID;
|
||||
String? id;
|
||||
String? message;
|
||||
DateTime? date;
|
||||
String? receiverID;
|
||||
String? receiverName;
|
||||
String? senderID;
|
||||
String? senderName;
|
||||
String? messageType;
|
||||
String? messageID;
|
||||
|
||||
Message(
|
||||
{this.id,
|
||||
@@ -21,11 +21,13 @@ class Message {
|
||||
this.senderName,
|
||||
this.messageType,
|
||||
this.messageID});
|
||||
|
||||
bool fromToday() {
|
||||
if (date == null) return false;
|
||||
var now = DateTime.now();
|
||||
return date.day == now.day &&
|
||||
date.month == now.month &&
|
||||
date.year == now.year;
|
||||
return date!.day == now.day &&
|
||||
date!.month == now.month &&
|
||||
date!.year == now.year;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
@@ -36,9 +38,10 @@ class Message {
|
||||
}
|
||||
|
||||
bool sameDay(Message another) {
|
||||
return date.year == another.date.year &&
|
||||
date.month == another.date.month &&
|
||||
date.day == another.date.day;
|
||||
if (date == null) return false;
|
||||
return date!.year == another.date!.year &&
|
||||
date!.month == another.date!.month &&
|
||||
date!.day == another.date!.day;
|
||||
}
|
||||
|
||||
factory Message.fromMap(Map<String, dynamic> map, String id) {
|
||||
@@ -52,7 +55,7 @@ class Message {
|
||||
receiverName: map['receiver_name'],
|
||||
messageType: map['msg_type'],
|
||||
messageID: map['msg_id'],
|
||||
date: date != null ? date.toDate() : null,
|
||||
date: date.toDate(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
import 'package:fcs/domain/constants.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:flutter_icons_null_safety/flutter_icons_null_safety.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class Privilege {
|
||||
String id;
|
||||
String name;
|
||||
String desc;
|
||||
bool sysAdminOnly = true;
|
||||
bool isChecked = false;
|
||||
String? name;
|
||||
String? desc;
|
||||
bool? sysAdminOnly = true;
|
||||
bool? isChecked = false;
|
||||
|
||||
IconData iconData;
|
||||
IconData? iconData;
|
||||
|
||||
Privilege(
|
||||
{this.id, this.name, this.desc, this.isChecked, this.sysAdminOnly}) {
|
||||
{required this.id,
|
||||
this.name,
|
||||
this.desc,
|
||||
this.isChecked,
|
||||
this.sysAdminOnly}) {
|
||||
if (this.id == privilege_admin) {
|
||||
iconData = MaterialCommunityIcons.account_tie;
|
||||
} else if (this.id == privilege_support) {
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
class RadioGroup {
|
||||
String text;
|
||||
int index;
|
||||
RadioGroup({this.text, this.index});
|
||||
}
|
||||
@@ -3,17 +3,21 @@ import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
class ShipmentStatus {
|
||||
String status;
|
||||
DateTime date;
|
||||
bool done;
|
||||
String staffId;
|
||||
String staffName;
|
||||
bool? done;
|
||||
String? staffId;
|
||||
String? staffName;
|
||||
ShipmentStatus(
|
||||
{this.status, this.date, this.done, this.staffId, this.staffName});
|
||||
{required this.status,
|
||||
required this.date,
|
||||
this.done,
|
||||
this.staffId,
|
||||
this.staffName});
|
||||
|
||||
factory ShipmentStatus.fromMap(Map<String, dynamic> map) {
|
||||
var _date = (map['date'] as Timestamp);
|
||||
return ShipmentStatus(
|
||||
status: map['status'],
|
||||
date: _date == null ? null : _date.toDate(),
|
||||
date: _date.toDate(),
|
||||
done: map['done'],
|
||||
staffId: map['staff_id'],
|
||||
staffName: map['staff_name']);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
class Status {
|
||||
String status;
|
||||
String message;
|
||||
String errorCode;
|
||||
String? status;
|
||||
String? message;
|
||||
String? errorCode;
|
||||
Status(this.status, this.message);
|
||||
|
||||
Status.fromJson(Map<String, dynamic> json) {
|
||||
@@ -10,4 +9,4 @@ class Status {
|
||||
message = json['message'];
|
||||
errorCode = json['error_code'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:fcs/domain/entities/setting.dart';
|
||||
|
||||
class Term {
|
||||
String termEng;
|
||||
String termMm;
|
||||
String? termEng;
|
||||
String? termMm;
|
||||
|
||||
Term({this.termEng, this.termMm});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user