如何更新用户信息

时间:2020-06-23 01:02:11

标签: flutter dart

我想构建一个附加信息,该信息将显示在用户的个人资料中。因此,如果用户信息尚未更新,将要求他们更新其个人资料,该信息只会显示给个人资料所有者。那么它将向查看该个人资料的其他用户显示“此用户尚未更新要显示的个人资料信息”。如果配置文件已更新,则信息将显示在其配置文件中,并显示给查看该配置文件的任何用户。我该如何开发呢?

这是我到目前为止在个人资料上尝试过的内容

buildUserInfo() {
     bool isProfileOwner = currentUserId == widget.profileId;
     if(isProfileOwner) {
                      return Column(
                 mainAxisAlignment: MainAxisAlignment.start,
                 children: <Widget>[
                   Container(
                     alignment: Alignment.topLeft,
                     child: ListTile(
                       trailing: IconButton(
                         icon: Icon(Icons.edit),
                         onPressed: () => Navigator.push(context, 
                         MaterialPageRoute(builder: (context) => Information())
                       )),
                       title: Text(
                         'Update profile info'
                       ),
                     ),
                   ),
                   Divider(),
                   ListTile(
                     contentPadding: EdgeInsets.all(0.0),
                     leading: Icon( Icons.my_location,),
                     title:Text(
                       currentUser.address,
            style: TextStyle(
              color: Colors.grey,
            ),
          ),
        ),
        ListTile(
          contentPadding: EdgeInsets.all(0.0),
          leading: Icon( Icons.location_on,),
          title: Text(
            currentUser.location,
            style: TextStyle(
              color: Colors.grey,
            ),
          ),
        ),
        ListTile(
          contentPadding: EdgeInsets.all(0.0),
          leading: Icon( Icons.school,),
          title: Text(
            currentUser.school,
            style: TextStyle(
              color: Colors.grey,
            ),
          ),
        ),
        ListTile(
          contentPadding: EdgeInsets.all(0.0),
          leading: Icon( Icons.work,),
          title: Text(
            currentUser.work,
            style: TextStyle(
              color: Colors.grey,
            ),
          ),
        ),
        ListTile(
          contentPadding: EdgeInsets.all(0.0),
          leading: Icon( Icons.contact_mail,),
          title: Text(
            currentUser.contactAddress,
            style: TextStyle(
              color: Colors.grey,
            ),
          ),
        ),
       
        Row(
          children: <Widget>[
            Padding(
              padding: const EdgeInsets.all(8.0),
              child: Icon(
                Icons.timelapse,
                size: 20.0,
              ),
            ),
            Padding(
              padding: const EdgeInsets.all(6.0),
              child: Text(timeago.format(timestamp)),
            ),
          ],
        ),
      ],
    );
   } else {
     return Text('');
   }
  }

0 个答案:

没有答案
相关问题