inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

Flutter 입문 - 안드로이드, iOS 개발을 한 번에 (with Firebase)

user.photoUrl, user.email에 빨간줄

337

Mike Kim

작성한 질문수 1

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)),
],
),
),
),
)
],
),
),
),
),
);
}

ios android Flutter

답변 2

1

오준석

_buildBody() 메서드가 HomePage 클래스 밖에 선언되어 있네요. 클래스 안으로 넣어 보세요.

0

Mike Kim

정말 감사합니다. 구글 돌아다녀보고 했는데 클래스 안에 없어서라는 기본을 안하고 하다니 감사합니다. 다시 공부 시작할 수 있게 되었습니다.

과거 ai없을때 듣고 다시 듣는 중인데

1

55

1

40번 수업이 완료가 되지 않아요.

0

62

1

최신버전 firebase_ui_auth 할때 EmailAuthProvider 오류 잡는 방법

0

158

1

애뮬레이터로 main.dart를 실행하면 컴퓨터가 멈춥니다.

0

330

2

혹시 재촬영 계획이 있으신가요?

0

249

1

애뮬레이터 Intel HAXM 다운로드가 안돼요

0

559

2

에뮬레이터 홈화면

0

259

1

종속성 충돌 질문

0

341

1

plugin 중에서 에러 발생시 발생한 코드 위치에 바로 에러 표시해주는 기능 있을까요?

0

426

1

firebase option 오류

0

374

2

alt+enter 가 맥북에서는 option enter로 알고 있는데 단축키가 먹히지 않습니다 ㅜㅜ

0

1463

11

파이어베이스 연결시 갑자기 다른 오류가 발생했어요 ㅠㅠ

0

409

1

Failed assertion: line 246 pos 15: 'items.length >= 2': is not true.

0

1321

1

Firebase로 이메일 로그인 기능 구현

0

355

1

GridView에 데이터가 표시가 안됩니다.

0

298

1

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher. 해결법을 모르겠습니다

0

6896

4

안드로이드 에뮬레이터 실행오류

1

1010

1

firebase 연동 중 오류 질문

0

468

1

05. AccountPage UI 작성강의 설명문의

0

371

1

firestore에서 List<String>을 받아오고 싶을 때

0

543

1

firebase 이메일 로그인 설정 관련 오류 문의의 건

0

1091

1

기본위젯

0

2731

1

firebase에 upload 에러가 발생했습니다

0

1284

3

디버그 서명 인증서 SHA-1가 구해지지 않습니다.

1

319

1