我正在关注以下视频:
https://www.youtube.com/watch?v=LlzC0X4oCrc&list=PLxefhmF0pcPkC__GnBhBmGl4013eBYLWh&index=14
编译器消息:
lib/pages/HomePage.dart:129:38: Error: The argument type 'User' can't be assigned to the parameter type 'String'.
- 'User' is from 'package:buddiesgram/models/user.dart' ('lib/models/user.dart').
ProfilePage(userProfileId: currentUser),
HomePage.dart
Scaffold buildHomeScreen() {
return Scaffold(
body: PageView(
children: <Widget>[
//TimeLinePage(),
RaisedButton.icon(onPressed: logoutUser, icon: Icon(Icons.close), label: Text("Sign Out")),
SearchPage(),
UploadPage(gCurrentUser: currentUser,),
NotificationsPage(),
ProfilePage(userProfileId: currentUser), /// --- esto me da error......
],
controller: pageController,
onPageChanged: whenPageChanges,
physics: NeverScrollableScrollPhysics(),
),
ProfilePage.dart
class ProfilePage extends StatefulWidget{
final String userProfileId;
ProfilePage({this.userProfileId});
@override
_ProfilePageState createState() => _ProfilePageState();
}
class _ProfilePageState extends State<ProfilePage>{
final String currentOnlineUserId = currentUser?.id;
createProfileTopView(){
return FutureBuilder(
future: usersReference.document(widget.userProfileId).get(),
user.dart
class User {
final String id;
final String profileName;
final String username;
final String url;
final String email;
final String bio;
User({
this.id,
this.profileName,
this.username,
this.url,
this.email,
this.bio,
});
factory User.fromDocument(DocumentSnapshot doc) {
return User(
id: doc.documentID,
email: doc['email'],
username: doc['username'],
url: doc['url'],
profileName: doc['profileName'],
bio: doc['bio'],
);
}
}