null safety
This commit is contained in:
@@ -56,7 +56,7 @@ class _StaffEditorState extends State<StaffEditor> {
|
||||
title: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
p.isChecked = p.isChecked == null ? true : !p.isChecked;
|
||||
p.isChecked = p.isChecked == null ? true : !p.isChecked!;
|
||||
});
|
||||
},
|
||||
child: new Row(
|
||||
@@ -79,10 +79,10 @@ class _StaffEditorState extends State<StaffEditor> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
p.name,
|
||||
p.name ??"",
|
||||
style: TextStyle(fontSize: 15.0, color: primaryColor),
|
||||
),
|
||||
Text(p.desc,
|
||||
Text(p.desc ?? "",
|
||||
style: TextStyle(fontSize: 13, color: Colors.grey[600]))
|
||||
],
|
||||
),
|
||||
@@ -151,7 +151,7 @@ class _StaffEditorState extends State<StaffEditor> {
|
||||
? Container()
|
||||
: IconButton(
|
||||
icon: Icon(Icons.open_in_new, color: primaryColor),
|
||||
onPressed: () => call(context, user.phoneNumber)),
|
||||
onPressed: () => call(context, user.phoneNumber!)),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -227,7 +227,7 @@ class _StaffEditorState extends State<StaffEditor> {
|
||||
});
|
||||
StaffModel staffModel = Provider.of<StaffModel>(context, listen: false);
|
||||
try {
|
||||
await staffModel.updatePrivileges(this.selectedUser!.id, privilegesIDs());
|
||||
await staffModel.updatePrivileges(this.selectedUser!.id!, privilegesIDs());
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
@@ -239,7 +239,7 @@ class _StaffEditorState extends State<StaffEditor> {
|
||||
}
|
||||
|
||||
List<String> privilegesIDs() {
|
||||
return this.privileges.where((p) => p.isChecked).map((p) => p.id).toList();
|
||||
return this.privileges.where((p) => p.isChecked!).map((p) => p.id).toList();
|
||||
}
|
||||
|
||||
_save() async {
|
||||
@@ -249,7 +249,7 @@ class _StaffEditorState extends State<StaffEditor> {
|
||||
if (widget.staff == null) return;
|
||||
StaffModel staffModel = Provider.of<StaffModel>(context, listen: false);
|
||||
try {
|
||||
await staffModel.updatePrivileges(widget.staff!.id, privilegesIDs());
|
||||
await staffModel.updatePrivileges(widget.staff!.id!, privilegesIDs());
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
|
||||
Reference in New Issue
Block a user