작성
·
250
0
선생님 질문이 있습니다.
final FirebaseUser user;
HomePage(this.user);
firebase user 선언 했는데
user 밑줄로 빨간 줄 생기네요
child: CircleAvatar(
backgroundImage: NetworkImage(user.photoUrl),
),
마우스로 빨간줄 위에 체크해보니
Undefined name 이라고 뜨네요
밑에는 혹시나 몰라서 코딩적은 것 남깁니다.
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
class HomePage extends StatelessWidget {
final FirebaseUser user;
HomePage(this.user);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
title: Text(
'Instagram Clon',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 20,
),
),
),
body: _buildBody(),
);
}
}
Widget _buildBody() {
return Padding(
padding: const EdgeInsets.all(8.0),
child: SafeArea(
child: SingleChildScrollView(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Instagram에 오신걸 환영합니다.',
style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.w500),
),
Padding(padding: EdgeInsets.all(8.0)),
Text('사진과 동영상을 보려면 팔로우 하세요'),
Padding(padding: EdgeInsets.all(16.0)),
SizedBox(
width: 380,
child: Card(
elevation: 4.0,
margin: EdgeInsets.all(20.0),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Padding(padding: EdgeInsets.all(4.0)),
SizedBox(
width: 80.0,
height: 80.0,
child: CircleAvatar(
backgroundImage: NetworkImage(user.photoUrl),
),
),
Padding(padding: EdgeInsets.all(8.0)),
Text(
user.email,
style: TextStyle(fontWeight: FontWeight.bold),
),
Text('Maik'),
Padding(padding: EdgeInsets.all(8.0)),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
width: 70.0,
height: 70.0,
child: Image.network(
'https://images.unsplash.com/photo-1587831663705-fe11c6db99b4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
fit: BoxFit.cover),
),
Padding(padding: EdgeInsets.all(1.0)),
SizedBox(
width: 70.0,
height: 70.0,
child: Image.network(
'https://images.unsplash.com/photo-1587747305800-adc0ebe7cf86?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
fit: BoxFit.cover),
),
Padding(padding: EdgeInsets.all(1.0)),
SizedBox(
width: 70.0,
height: 70.0,
child: Image.network(
'https://images.unsplash.com/photo-1587751034030-0dd59564377f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
fit: BoxFit.cover),
),
],
),
Padding(padding: EdgeInsets.all(4.0)),
Text('Facebook 친구'),
Padding(padding: EdgeInsets.all(4.0)),
RaisedButton(
color: Colors.blueAccent,
onPressed: () {},
child: Text(
'팔로우',
style: TextStyle(color: Colors.white),
),
),
Padding(padding: EdgeInsets.all(8.0)),
],
),
),
),
)
],
),
),
),
),
);
}