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

@@ -21,7 +21,8 @@ class ContactPage extends StatefulWidget {
class _ContactPageState extends State<ContactPage> {
@override
Widget build(BuildContext context) {
Setting setting = Provider.of<MainModel>(context).setting;
Setting? setting = Provider.of<MainModel>(context).setting;
if (setting == null) return Container();
bool isEditable = context.select((MainModel m) => m.contactEditable());
return Scaffold(
@@ -61,14 +62,14 @@ class _ContactPageState extends State<ContactPage> {
children: [
itemTitle(context, "contact.callus"),
contactItem(context, setting.usaContactNumber, CupertinoIcons.phone,
onTap: () => _call(setting.usaContactNumber),
onTap: () => _call(setting.usaContactNumber ?? ""),
labelKey: "contact.usa.phone"),
contactItem(
context,
setting.mmContactNumber,
CupertinoIcons.phone,
onTap: () => _call(
setting.mmContactNumber,
setting.mmContactNumber ?? "",
),
labelKey: "contact.mm.phone",
),
@@ -90,7 +91,7 @@ class _ContactPageState extends State<ContactPage> {
context,
setting.emailAddress,
CupertinoIcons.mail,
onTap: () => _email(setting.emailAddress),
onTap: () => _email(setting.emailAddress ?? ""),
labelKey: "contact.fcs.email",
),
itemTitle(context, "contact.visitus"),
@@ -98,7 +99,7 @@ class _ContactPageState extends State<ContactPage> {
context,
setting.facebookLink,
FontAwesomeIcons.facebook,
onTap: () => _opencontactItem(setting.facebookLink),
onTap: () => _opencontactItem(setting.facebookLink ?? ""),
labelKey: "contact.facebook",
),
],