check null safety

This commit is contained in:
tzw
2021-09-10 16:33:52 +06:30
parent 3eacbef117
commit d8c86a512b
46 changed files with 275 additions and 304 deletions

View File

@@ -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),
),