微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在抽屉颤动上显示用户角色

如何解决如何在抽屉颤动上显示用户角色

我目前在用户登录后在我的抽屉上同时显示电子邮件和姓名。角色存储在 Firestore 中。

我想显示用户角色,例如“免费或 VIP” 但我找不到适合 UserAccountsDrawerHeader Widget 的属性有什么想法吗?

UserAccountsDrawerHeader(
                      accountName: Text(
                        _name,style: TextStyle(
                            fontFamily: FontFamily.elgantfamily,fontWeight: FontWeight.bold),),accountEmail: Text(
                        _email,style:
                            TextStyle(fontFamily: FontFamily.elgantfamily),accountRole: Text(
                      _role,style: TextStyle(
                        fontFamily: FontFamily.elgantfamily,_getUserNameandEmail() async {
String uid = await GetStorage().read(sharedPrefrenceKey.uuid);
if (uid != null) {
  _name = GetStorage().read(sharedPrefrenceKey.name);
  _email = GetStorage().read(sharedPrefrenceKey.email);
  _role = GetStorage().read(sharedPrefrenceKey.role);
  setState(() {});
}
}

解决方法

如果你真的想使用 UserAccountsDrawerHeader 你可以这样做

UserAccountsDrawerHeader(
                accountName: Text('User Name'),accountEmail: Text('Email'),otherAccountsPictures: [
                Text(
                  'Role',style: TextStyle(
                  color: Colors.red
                ),)
              ],)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。