Kod sayfam bu firebase profil fotografı photoURL diye kayıot ediliyor ama bir türlü profil fotografını değiştiremedim yardımcı olurmusunuz
`import ‘dart:io’;
import ‘package:cloud_firestore/cloud_firestore.dart’;
import ‘package:firebase_auth/firebase_auth.dart’;
import ‘package:firebase_storage/firebase_storage.dart’;
import “package:flutter/material.dart”;
import ‘package:flutter_svg/flutter_svg.dart’;
import ‘package:image_picker/image_picker.dart’;
import ‘package:uuid/uuid.dart’;
import ‘../service/userModel.dart’;
FirebaseAuth _auth = FirebaseAuth.instance;
final Reference storageRef = FirebaseStorage.instance.ref();
final usersRef = FirebaseFirestore.instance.collection(‘users’);
class ProfilDuzenle extends StatefulWidget {
final String currentUserId;
ProfilDuzenle({this.currentUserId});
@override
_ProfilDuzenleState createState() => _ProfilDuzenleState();
}
class _ProfilDuzenleState extends State<ProfilDuzenle> {
final _scaffoldKey = GlobalKey<ScaffoldState>();
TextEditingController fullNameController = TextEditingController();
TextEditingController locationController = TextEditingController();
TextEditingController userNameController = TextEditingController();
File _image;
UserModel user;
bool _fullNameValid = true;
bool _userNameValid = true;
bool _locationValid = true;
final picker = ImagePicker();
String uid = Uuid().v4();
@override
void initState() {
super.initState();
getUser();
}
getUser() async {
setState(() {});
DocumentSnapshot doc = await usersRef.doc(_auth.currentUser.uid).get();
user = UserModel.fromDoc(doc);
fullNameController.text = user.fullName;
userNameController.text = user.userName;
locationController.text = user.location;
}
Column buildfullNameField() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 12.0),
child: Text(
“Adınız”,
style: TextStyle(color: Colors.grey),
)),
TextField(
controller: fullNameController,
decoration: InputDecoration(
hintText: “Adınızı giriniz”,
errorText: _fullNameValid ? null : “Adınız çok kısa”,
),
)
],
);
}
Column buildusernameField() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 12.0),
child: Text(
“Kullanıcı Adınız”,
style: TextStyle(color: Colors.grey),
),
),
TextField(
controller: userNameController,
decoration: InputDecoration(
hintText: “Kullanıcı adınızı giriniz”,
errorText: _userNameValid ? null : “Kullanıcı adınız çok uzun”,
),
)
],
);
}
Column buildlocationField() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 12.0),
child: Text(
“Konumunuz”,
style: TextStyle(color: Colors.grey),
),
),
TextField(
controller: locationController,
decoration: InputDecoration(
hintText: “Konumunuzu giriniz”,
errorText: _locationValid ? null : “Konumunuz çok uzun”,
),
)
],
);
}
Future updateProfileData() async {
setState(() {
fullNameController.text.trim().length < 3 ||
fullNameController.text.isEmpty
? _fullNameValid = false
: _fullNameValid = true;
userNameController.text.trim().length > 100
? _userNameValid = false
: _userNameValid = true;
locationController.text.trim().length > 100
? _locationValid = false
: _locationValid = true;
});
if (_fullNameValid && _locationValid && _userNameValid) {
usersRef.doc(_auth.currentUser.uid).update({
"fullName": fullNameController.text,
"userName": userNameController.text,
"location": locationController.text,
});
SnackBar snackbar = SnackBar(
content: Text("Profil Ayarları Güncellendi Çıkabilirsiniz!"));
_scaffoldKey.currentState.showSnackBar(snackbar);
}
}
handleTakePhoto() async {
Navigator.pop(context);
final imageFile = await picker.getImage(
source: ImageSource.camera,
maxHeight: 675,
maxWidth: 960,
);
setState(() {
if (imageFile ≠ null) {
this._image = File(imageFile.path);
} else {
print(‘Resim Seçilmedi!’);
}
});
}
handleChooseFromGallery() async {
Navigator.pop(context);
final imageFile = await picker.getImage(
source: ImageSource.gallery,
);
setState(() {
if (imageFile ≠ null) {
this._image = File(imageFile.path);
} else {
print(‘Resim Seçilmedi!’);
}
});
}
selectImage(parentContext) {
return showDialog(
context: parentContext,
builder: (context) {
return SimpleDialog(
children: <Widget>[
SimpleDialogOption(
child: Text(“Kamerayı kullan”), onPressed: handleTakePhoto),
SimpleDialogOption(
child: Text(“Galeriden seç”),
onPressed: handleChooseFromGallery),
SimpleDialogOption(
child: Text(“Vazgeç”),
onPressed: () => Navigator.pop(context),
)
],
);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
key: scaffoldKey,
appBar: AppBar(
elevation: 0.0,
backgroundColor: Colors.transparent,
title: new Text(
“Profil Düzenle”,
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
fontFamily: ‘Satisfy’,
color: Colors.black,
),
),
iconTheme: new IconThemeData(color: Colors.black),
centerTitle: true,
actions: <Widget>[
IconButton(
icon:
Icon(Icons.notifications_active_outlined, color: Colors.black),
tooltip: ‘Bildirimler’,
onPressed: () {},
),
IconButton(
icon: Icon(Icons.done, color: Colors.green),
tooltip: ‘Onayla’,
onPressed: () {}),
],
),
body: ListView(
children: <Widget>[
Container(
child: Column(
children: <Widget>[
Form(
child: Container(
height: 120,
width: 120,
child: Stack(
fit: StackFit.expand,
children: [
CircleAvatar(
radius: 100,
backgroundColor: Colors.transparent,
child: ClipOval(
child: (image ≠ null)
? Image.file(_image, fit: BoxFit.cover)
: _auth.currentUser.photoURL == null ||
auth.currentUser.photoURL.isEmpty
? Image.asset(“assets/images/user.png”)
: Image.network(auth.currentUser.photoURL),
),
),
Positioned(
right: 0,
bottom: 2,
child: SizedBox(
height: 46,
width: 46,
child: FlatButton(
padding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
side: BorderSide(
color: Colors.white,
),
),
color: Color(0xFFF5F6F9),
onPressed: () {
selectImage(context);
},
child:
SvgPicture.asset(“assets/icons/camera.svg”),
),
),
),
],
),
),
),
Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
buildfullNameField(),
buildusernameField(),
buildlocationField(),
],
),
),
SizedBox(
width: 300,
height: 35,
child: new RaisedButton(
onPressed: updateProfileData,
color: Colors.green,
padding: EdgeInsets.symmetric(horizontal: 50),
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)),
child: Text(
“Kaydet”,
style: TextStyle(
fontSize: 14,
letterSpacing: 2.2,
color: Colors.white),
),
),
),
SizedBox(
height: 15,
),
SizedBox(
width: 200,
height: 40,
child: new OutlineButton(
padding: EdgeInsets.symmetric(horizontal: 50),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)),
onPressed: () => Navigator.pop(context),
child: Text(“Vazgeç”,
style: TextStyle(
fontSize: 14,
letterSpacing: 2.2,
color: Colors.black)),
),
),
],
),
),
],
),
);
}
}
`
Kod sayfam bu firebase profil fotografı photoURL diye kayıot ediliyor ama bir türlü profil fotografını değiştiremedim yardımcı olurmusunuz