check null safety
This commit is contained in:
@@ -3,23 +3,12 @@ import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/user_search/user_serach.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UserListRow extends StatefulWidget {
|
||||
final OnUserRowSelect onUserRowSelect;
|
||||
class UserListRow extends StatelessWidget {
|
||||
final OnUserRowSelect? onUserRowSelect;
|
||||
final User user;
|
||||
const UserListRow({this.user, this.onUserRowSelect});
|
||||
const UserListRow({required this.user, this.onUserRowSelect});
|
||||
|
||||
@override
|
||||
_UserListRowState createState() => _UserListRowState();
|
||||
}
|
||||
|
||||
class _UserListRowState extends State<UserListRow> {
|
||||
final double dotSize = 15.0;
|
||||
User user;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
this.user = widget.user;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -30,8 +19,7 @@ class _UserListRowState extends State<UserListRow> {
|
||||
color: Colors.white,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (widget.onUserRowSelect != null)
|
||||
widget.onUserRowSelect(widget.user);
|
||||
if (onUserRowSelect != null) onUserRowSelect!(user);
|
||||
},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
@@ -53,17 +41,17 @@ class _UserListRowState extends State<UserListRow> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
user.name == null ? '' : user.name,
|
||||
user.name ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
new Text(
|
||||
user.fcsID == null ? "" : user.fcsID,
|
||||
user.fcsID ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 13.0, color: Colors.grey),
|
||||
),
|
||||
new Text(
|
||||
user.phoneNumber == null ? "" : user.phoneNumber,
|
||||
user.phoneNumber ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 13.0, color: Colors.grey),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user