gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 04:43:42 25 4
gpt4 key购买 nike

我希望你一切安好。我还有另一个关于 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com