ios - Flutter-无法从Firebase加载此个人资料图像

标签 ios firebase flutter dart google-cloud-firestore

我希望你一切安好。我还有另一个关于 flutter 的问题。我正在尝试从评论对象(下面的代码)加载此个人资料图片。我尝试重命名并重新加载Firebase存储和所有内容。我尝试添加异步,但无济于事。如果您想查看我正在关注的教程,请在下面提供一个链接。我非常感谢您的帮助!
教程链接:https://www.udemy.com/course/ios-android-masterclass-build-3-apps-with-google-flutter/
集数:113
我的屏幕图片:
replace image of momo is here with picture.
list_widgets-> _ReviewListTileState-> initState()

@override
 void initState() {
   this._review = widget.review;
   this._review.contact.getContactInfoFromFirestore().whenComplete(() {
    setState(()  {
      print("Dot Dots");
    });
   });
   super.initState();
 } 
list_widgets-> _ReviewListTileState-> build()
InkResponse(
              onTap: (){
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => view_profile_page(contact: _review.contact),
                  ),
                );
                },
              child: Container(
                child: (_review.contact.displayImage == null) ? Container(
                  width: MediaQuery.of(context).size.width / 7.5,
                  child: Text("${_review.contact.firstName} was here"),
                ) : CircleAvatar(
                  backgroundImage: _review.contact.displayImage,
                  radius: MediaQuery.of(context).size.width / 15,
                ),
              ),
            ),

review_objects->评论{}
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutterrentalapp/Models/user_objects.dart';

class Review{

  Contact contact;
  String text;
  double rating;
  DateTime dateTime;

  Review();

  void createReview(Contact contact, String text, double rating, DateTime dateTime){
    this.contact = contact;
    this.text = text;
    this.rating = rating;
    this.dateTime = dateTime;
  }

  void getReviewInfoFromFirestore(DocumentSnapshot snapshot){
    this.rating = snapshot['rating'].toDouble() ?? 2.5;
    this.text = snapshot['text'] ?? "";

    Timestamp timestamp = snapshot['dateTime'] ?? Timestamp.now();
    this.dateTime = timestamp.toDate();

    String fullName = snapshot['name'] ?? "";
    String contactID = snapshot['userID'] ?? "";
    _loadContactInfo(contactID,fullName);
  }

  void _loadContactInfo(String id, String fullName){
    String firstName = "";
    String lastName = "";
    firstName = fullName.split(" ")[0];
    lastName = fullName.split(" ")[1];
    this.contact = Contact(id: id, firstName: firstName, lastName:lastName);

  }

}

最佳答案

这些问题中的另一个问题是经典程序员输入错误的内容。我必须返回其中一个类中的代码,并进行一些更改。尽管我找不到它了。
谢谢大家的有用建议。

关于ios - Flutter-无法从Firebase加载此个人资料图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62660968/

相关文章:

ios - 如何获得更新的 Apple 开发证书和 Provisioning Center

ios - 具有自定义图像且无边框的 UIBarButtonItem

ios - SKNode runAction 滞后 :completion: in recursive method

ios - 有没有办法在 UITableView 中的条件后不返回单元格?

dart - Flutter - 容器子渲染时的高度动画变化

firebase - 当通过移动设备中的内置浏览器使用时,Firebase signInWithPopup会阻止身份验证/弹出窗口

Android Firebase - .setPersistenceEnabled(true) 时启动时间缓慢

firebase - 如何在 Flutter 中手动分配 Listview.builder 的第一个元素?

firebase - 如果保留为空,如何不将字段保存到Firebase

dart - 如何仅将填充应用于 Flutter 中 TextField 中的文本?