diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..3287bb6
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,13 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Flutter",
+ "request": "launch",
+ "type": "dart"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/fonts/Pacifico-Regular.ttf b/fonts/Pacifico-Regular.ttf
new file mode 100644
index 0000000..a2994c9
Binary files /dev/null and b/fonts/Pacifico-Regular.ttf differ
diff --git a/fonts/SourceSansPro-Regular.ttf b/fonts/SourceSansPro-Regular.ttf
new file mode 100644
index 0000000..278ad8a
Binary files /dev/null and b/fonts/SourceSansPro-Regular.ttf differ
diff --git a/gifs/805.gif b/gifs/805.gif
new file mode 100644
index 0000000..266398b
Binary files /dev/null and b/gifs/805.gif differ
diff --git a/gifs/bestScenery.gif b/gifs/bestScenery.gif
new file mode 100644
index 0000000..dc0cf12
Binary files /dev/null and b/gifs/bestScenery.gif differ
diff --git a/gifs/download.gif b/gifs/download.gif
new file mode 100644
index 0000000..9b2a669
Binary files /dev/null and b/gifs/download.gif differ
diff --git a/gifs/go-top.gif b/gifs/go-top.gif
new file mode 100644
index 0000000..9500186
Binary files /dev/null and b/gifs/go-top.gif differ
diff --git a/gifs/imgld1.gif b/gifs/imgld1.gif
new file mode 100644
index 0000000..7def0be
Binary files /dev/null and b/gifs/imgld1.gif differ
diff --git a/gifs/imgld2.gif b/gifs/imgld2.gif
new file mode 100644
index 0000000..019e5ea
Binary files /dev/null and b/gifs/imgld2.gif differ
diff --git a/gifs/ld1.gif b/gifs/ld1.gif
new file mode 100644
index 0000000..4b937d5
Binary files /dev/null and b/gifs/ld1.gif differ
diff --git a/gifs/ld2.svg b/gifs/ld2.svg
new file mode 100644
index 0000000..768c176
--- /dev/null
+++ b/gifs/ld2.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/gifs/ld3.gif b/gifs/ld3.gif
new file mode 100644
index 0000000..f72a1cd
Binary files /dev/null and b/gifs/ld3.gif differ
diff --git a/gifs/ld4.gif b/gifs/ld4.gif
new file mode 100644
index 0000000..b4f8453
Binary files /dev/null and b/gifs/ld4.gif differ
diff --git a/gifs/ld5.gif b/gifs/ld5.gif
new file mode 100644
index 0000000..279ef3c
Binary files /dev/null and b/gifs/ld5.gif differ
diff --git a/gifs/ld6.gif b/gifs/ld6.gif
new file mode 100644
index 0000000..e852e97
Binary files /dev/null and b/gifs/ld6.gif differ
diff --git a/gifs/ld7.gif b/gifs/ld7.gif
new file mode 100644
index 0000000..0a540c4
Binary files /dev/null and b/gifs/ld7.gif differ
diff --git a/gifs/ld8.gif b/gifs/ld8.gif
new file mode 100644
index 0000000..51ee60a
Binary files /dev/null and b/gifs/ld8.gif differ
diff --git a/gifs/ld9.gif b/gifs/ld9.gif
new file mode 100644
index 0000000..7bb4cd0
Binary files /dev/null and b/gifs/ld9.gif differ
diff --git a/images/scenery1.jpg b/images/scenery1.jpg
new file mode 100644
index 0000000..8715613
Binary files /dev/null and b/images/scenery1.jpg differ
diff --git a/lib/Drawer screens/about.dart b/lib/Drawer screens/about.dart
new file mode 100644
index 0000000..e69de29
diff --git a/lib/Drawer screens/privacypolicy.dart b/lib/Drawer screens/privacypolicy.dart
new file mode 100644
index 0000000..e69de29
diff --git a/lib/Drawer screens/profile_edit.dart b/lib/Drawer screens/profile_edit.dart
new file mode 100644
index 0000000..55c5d14
--- /dev/null
+++ b/lib/Drawer screens/profile_edit.dart
@@ -0,0 +1,408 @@
+import 'package:flash_chat/progress.dart';
+import 'package:flutter/material.dart';
+import 'package:firebase_storage/firebase_storage.dart';
+import 'package:flutter_image_compress/flutter_image_compress.dart';
+import 'package:image_cropper/image_cropper.dart';
+import 'package:image_picker/image_picker.dart';
+import 'dart:io';
+import 'package:shared_preferences/shared_preferences.dart';
+import 'package:cloud_firestore/cloud_firestore.dart';
+
+
+
+class ProfileEdit extends StatefulWidget {
+
+ final String profileImageUrl;
+ final String userName;
+ final String about;
+ final String phoneNumber;
+
+
+ ProfileEdit({this.profileImageUrl,this.userName,this.about, this.phoneNumber});
+ @override
+ _ProfileEditState createState() => _ProfileEditState();
+}
+
+
+
+class _ProfileEditState extends State {
+
+final usersRef = Firestore.instance.collection('users');
+final DateTime timestamp = DateTime.now();
+QuerySnapshot qs;
+String newDownloadUrl=" ";
+String newBio="";
+bool isTextFieldEmpty=true;
+bool newBioUpdated = false;
+
+searchForUidViaPhoneNumberAndUpdateProfilePic(String downloadUrl) async{
+ qs = await usersRef.getDocuments();
+ var listOfDocuments = qs.documents;
+ for(var dc in listOfDocuments){
+ if(dc["displayName"] == widget.userName || dc["phoneNumber"]==widget.phoneNumber)
+ {
+ String uid = dc["id"];
+ usersRef.document(uid).setData({
+ "id": uid,
+ "displayName": widget.userName,
+ "bio": (newBio == "") ? widget.about : newBio ,
+ "phoneNumber": widget.phoneNumber,
+ "timestamp": timestamp,
+ "imageDownloadUrl" : downloadUrl
+ });
+ }
+ }
+}
+
+TextEditingController tcontroller;
+
+handleBioChangerButton() async{
+ qs = await usersRef.getDocuments();
+ var listOfDocuments = qs.documents;
+ for(var dc in listOfDocuments){
+ if(dc["displayName"] == widget.userName || dc["phoneNumber"]==widget.phoneNumber)
+ {
+ String uid = dc["id"];
+ usersRef.document(uid).setData({
+ "id": uid,
+ "displayName": widget.userName,
+ "bio": newBio,
+ "phoneNumber": widget.phoneNumber,
+ "timestamp": timestamp,
+ "imageDownloadUrl" : (newDownloadUrl==" ") ? widget.profileImageUrl : newDownloadUrl,
+ });
+ }
+ }
+ setState(() {
+ newBioUpdated = true;
+ });
+ print(newBio);
+ final prefs2 = await SharedPreferences.getInstance();
+ prefs2.setString("loggedInUserBio",newBio);
+}
+
+handleEditBio(BuildContext ctx){
+ showModalBottomSheet(isScrollControlled: true,context: ctx, builder: (context){
+ return Padding(
+ padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ mainAxisSize: MainAxisSize.max,
+ children: [
+ Expanded(
+ flex: 6,
+ child: Padding(
+ padding: EdgeInsets.only(
+ bottom: MediaQuery.of(context).viewInsets.bottom),
+ child: TextField(
+ autofocus: true,
+ onChanged: (val){
+ setState(() {
+ newBio = val;
+ if(val.length==0){
+ isTextFieldEmpty = true;
+ }
+
+ if(val.length>0){
+ isTextFieldEmpty = false;
+ }
+ });
+
+ },
+ controller: tcontroller,
+ decoration: InputDecoration(
+ contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
+ hintText: 'Type your message',
+ border: OutlineInputBorder(borderRadius: BorderRadius.all(Radius.circular(32),),
+ borderSide: BorderSide(color: Colors.grey[400]),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.all(Radius.circular(32),),
+ borderSide: BorderSide(color: Colors.grey[400]),
+ ),
+ focusedBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.all(Radius.circular(32),),
+ borderSide: BorderSide(color: Colors.grey[400]),
+ ),
+ ),
+ ),
+ ),
+ ),
+ SizedBox(
+ width: MediaQuery.of(context).size.width*0.06,
+ ),
+ Expanded(
+ flex: 2,
+ child: Padding(
+ padding: EdgeInsets.only(
+ bottom: MediaQuery.of(context).viewInsets.bottom),
+ child: RawMaterialButton(
+ onPressed: (){
+ if(isTextFieldEmpty == false && newBio.length>0){
+ handleBioChangerButton();
+ Navigator.pop(context);
+ }
+
+ },
+ child: Icon(Icons.send, color:Colors.green),
+ constraints: BoxConstraints.tightFor(width: 40, height: 40),
+ shape: CircleBorder(),
+ fillColor: Colors.black,
+ elevation: 0.0,
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ });
+}
+
+ bool isImageDownloading;
+ String downloadUrl;
+ File image;
+
+ uploadImageAndGetDownloadUrl() async{
+ StorageReference ref = FirebaseStorage.instance.ref().child(widget.phoneNumber);
+ StorageUploadTask uploadTask = ref.putFile(this.image);
+ StorageTaskSnapshot taskSnapshot = await uploadTask.onComplete;
+ downloadUrl = await taskSnapshot.ref.getDownloadURL();
+ newDownloadUrl = downloadUrl;
+ final prefs = await SharedPreferences.getInstance();
+ prefs.setString("loggedInUserImage",downloadUrl);
+ setState(() {
+ isImageDownloading = true;
+ });
+ searchForUidViaPhoneNumberAndUpdateProfilePic(downloadUrl);
+}
+
+
+ handleSelectImage(BuildContext parentContext){
+ return showDialog(context: parentContext, builder: (context){
+ return SimpleDialog(
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(Radius.circular(14.0),),
+ ),
+ title: Text('Select Profile Picture'),
+ children: [
+ SimpleDialogOption(
+ child: Text('Photo from Camera'),
+ onPressed: handleImageFromCamera,
+ ),
+ Divider(),
+ SimpleDialogOption(
+ child: Text('Choose from Gallery'),
+ onPressed: handleImageFromGallery,
+ ),
+ Divider(),
+ SimpleDialogOption(
+ child: Text('Cancel'),
+ onPressed: () => Navigator.of(context).pop(),
+ ),
+ ],
+ );
+ });
+ }
+
+ handleImageFromCamera() async{
+ Navigator.pop(context);
+ File image = await ImagePicker.pickImage(source: ImageSource.camera, maxHeight: 675, maxWidth: 960);
+ File croppedFile = await ImageCropper.cropImage(
+ sourcePath: image.path,
+ maxHeight: 512,
+ maxWidth: 512,
+ aspectRatioPresets: [
+ CropAspectRatioPreset.square,
+ ],
+ );
+
+ var result = await FlutterImageCompress.compressAndGetFile(
+ croppedFile.path, croppedFile.path,
+ quality: 68,
+ );
+
+ this.image = result;
+ await uploadImageAndGetDownloadUrl();
+ }
+
+ handleImageFromGallery() async{
+ Navigator.pop(context);
+ File image = await ImagePicker.pickImage(source: ImageSource.gallery);
+
+ File croppedFile = await ImageCropper.cropImage(
+ sourcePath: image.path,
+ maxHeight: 512,
+ maxWidth: 512,
+ aspectRatioPresets: [
+ CropAspectRatioPreset.square,
+ ],
+ );
+
+ var result = await FlutterImageCompress.compressAndGetFile(
+ croppedFile.path, croppedFile.path,
+ quality: 68,
+ );
+
+ this.image = result;
+
+ await uploadImageAndGetDownloadUrl();
+ // setState(() {
+ // this.image = image;
+ // });
+ }
+
+
+
+
+
+ @override
+ Widget build(BuildContext context) {
+ return SafeArea(
+ child: Scaffold(
+ resizeToAvoidBottomPadding: false,
+ body: Stack(
+ children: [
+ Column(
+ children: [
+ Container(
+ width: double.infinity,
+ height: MediaQuery.of(context).size.height*0.415,
+ decoration: BoxDecoration(
+ image: DecorationImage(
+ image: AssetImage('images/scenery1.jpg'),
+ fit: BoxFit.fill,
+ ),
+ ),
+ ),
+ Expanded(
+ child: Container(
+ width: double.infinity,
+ color: Color(0xffe6fff5),
+ ),
+ ),
+ ],
+ ),
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ SizedBox(
+ height: MediaQuery.of(context).size.height*0.29,
+ ),
+ Container(
+ alignment: Alignment.topCenter,
+ child: (isImageDownloading==true) ?
+ CircleAvatar( backgroundColor: Colors.transparent ,radius: MediaQuery.of(context).size.width*0.18, child: ClipOval(
+ child: FadeInImage.assetNetwork(
+ fadeInDuration: Duration(milliseconds: 200),
+ fadeOutDuration: Duration(milliseconds: 200),
+ placeholder: 'gifs/496.gif',
+ image: newDownloadUrl,
+ fit: BoxFit.fill,
+ ),
+),
+)
+ : (widget.profileImageUrl == 'NoImage') ? CircleAvatar(child: Image.asset('images/blah.png')) : CircleAvatar( backgroundColor: Colors.transparent ,radius: MediaQuery.of(context).size.width*0.18, child: ClipOval(
+ child: FadeInImage.assetNetwork(
+ fadeInDuration: Duration(milliseconds: 200),
+ fadeOutDuration: Duration(milliseconds: 200),
+ placeholder: 'gifs/ld9.gif',
+ image: this.widget.profileImageUrl,
+ fit: BoxFit.fill,
+ ),
+),
+),
+ ),
+ SizedBox(
+ height: MediaQuery.of(context).size.height*0.014,
+ ),
+ Text(widget.userName, style: TextStyle(
+ fontFamily: 'Pacifico',
+ fontSize: 34,
+ fontWeight: FontWeight.w500,
+ color: Color(0xff008080),
+ ),
+ ),
+ SizedBox(
+ height: MediaQuery.of(context).size.height*0.04,
+ ),
+ Card(
+ margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 25.0),
+ child: ListTile(
+ leading: Icon(
+ Icons.phone,
+ color: Colors.teal[400],
+ ),
+ title: Padding(
+ padding: EdgeInsets.symmetric(vertical: 10.0),
+ child: Text(
+ widget.phoneNumber,
+ style: TextStyle(
+ fontFamily: 'Source Sans Pro',
+ fontSize: 20.0,
+ color: Color(0xff595959),
+ ),
+ ),
+ ),
+ )),
+ SizedBox(
+ height: MediaQuery.of(context).size.height*0.002,
+ ),
+ Card(
+ margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 25.0),
+ child: ListTile(
+ leading: Icon(
+ Icons.info,
+ color:Colors.teal[400],
+ ),
+ title: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 6.0),
+ child: (newBioUpdated == true)
+ ? Text(newBio, style: TextStyle(
+ fontFamily: 'Source Sans Pro',
+ fontSize: 20.0,
+ color: Color(0xff595959),
+ ),)
+ : Text(
+ widget.about,
+ style: TextStyle(
+ fontFamily: 'Source Sans Pro',
+ fontSize: 20.0,
+ color: Color(0xff595959),
+ ),
+ ),
+ ),
+ trailing: Padding(
+ padding: const EdgeInsets.only(top: 30, left: 5, bottom: 5),
+ child: GestureDetector(onTap: ()=> handleEditBio(context) , child: Icon(Icons.edit, color: Colors.cyan[400],)),
+ ),
+ )),
+ ],
+ ),
+ Column(
+ children: [
+ SizedBox(
+ height: MediaQuery.of(context).size.height*0.45,
+ ),
+ Container(
+ padding: EdgeInsets.only(left: MediaQuery.of(context).size.width*0.53),
+ child: RawMaterialButton(
+ onPressed: ()=>handleSelectImage(context),
+ child: Icon(Icons.edit, color: Colors.white,),
+ constraints: BoxConstraints.tightFor(width: 36, height: 36),
+ shape: CircleBorder(),
+ fillColor: Color(0xff008080),
+ elevation: 0.0,
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
+
+
+
diff --git a/lib/Drawer screens/reach_us.dart b/lib/Drawer screens/reach_us.dart
new file mode 100644
index 0000000..e69de29
diff --git a/lib/main.dart b/lib/main.dart
index 4b566a9..3289e13 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -14,9 +14,9 @@ import 'models/contacts_list.dart';
import 'screens/otp_screen.dart';
import 'screens/tempScreen.dart';
import 'package:flash_chat/screens/chat_screen.dart';
+import 'Drawer screens/profile_edit.dart';
+
-//VERY IMPORTANTTTTTTTTTTTTTTTTTTT: MULTIPLE VERTICALLY STACKED CIRCLES ERROR ON CONTACT SCREEN
-//handle landscape orientation, because it's literally in shambles rn
// handle invalid verification code error
//handle image upload to Firestore along with other items as a document after compression and conversion to string
//handle back phone's button press on screens
@@ -24,7 +24,7 @@ import 'package:flash_chat/screens/chat_screen.dart';
//can't resolve GradleException error in app level build.gradle
//divide login stuff and adding user stuff. add login stuff back to create account or something
-//CONTACT'SCREEN NOT UPDATING AFTER ONE INITIAL REFRESH
+
//on CONTACT's SCREEN, PHONE NUMBERS W/O +91 SHOULD ALSO BE DISPLAYED
//CHECK IF USER IS ONLINE AND DISPLAY 'online' BELOW THEIR NAME
@@ -150,53 +150,24 @@ class FlashChat extends StatelessWidget {
//);
-
// auth.isAuth
-// ? ChatScreen()
-// : FutureBuilder(
-// future: auth.tryAutoLogin(),
-// builder: (ctx, authResultSnapshot) =>
-// authResultSnapshot.connectionState ==
-// ConnectionState.waiting
-// ? SplashScreen()
-// : CreateAccount(),
-// ),
-
-
-
-//auth.isAuth
-//? ChatScreen()
-// : FutureBuilder(
-//future: auth.tryAutoLogin(),
-//builder: (ctx, authResultSnapshot) =>
-//authResultSnapshot.connectionState ==
-//ConnectionState.waiting
-//? SplashScreen()
-// : CreateAccount(),
-//),
-
-
-
+// ? ChatListScreen()
+// : FutureBuilder(
+// future: auth.tryAutoLogin(),
+// builder: (ctx, authResultSnapshot) =>
+// authResultSnapshot.connectionState ==
+// ConnectionState.waiting
+// ? SplashScreen()
+// : CreateAccount(),
+// ),
-//auth.isAuth
-//? ChatScreen()
-// : FutureBuilder(
-//future: auth.tryAutoLogin(),
-//builder: (ctx, authResultSnapshot) =>
-//authResultSnapshot.connectionState ==
-//ConnectionState.waiting
-//? SplashScreen()
-// : CreateAccount(),
-//),
-
-
-//auth.isAuth
-//? ChatScreen()
-// : FutureBuilder(
-//future: auth.tryAutoLogin(),
-//builder: (ctx, authResultSnapshot) =>
-//authResultSnapshot.connectionState ==
-//ConnectionState.waiting
-//? SplashScreen()
-// : CreateAccount(),
-//),
\ No newline at end of file
+// auth.isAuth
+// ? ChatListScreen()
+// : FutureBuilder(
+// future: auth.tryAutoLogin(),
+// builder: (ctx, authResultSnapshot) =>
+// authResultSnapshot.connectionState ==
+// ConnectionState.waiting
+// ? SplashScreen()
+// : CreateAccount(),
+// ),
\ No newline at end of file
diff --git a/lib/provider/auth.dart b/lib/provider/auth.dart
index cbf3a46..0b633a0 100644
--- a/lib/provider/auth.dart
+++ b/lib/provider/auth.dart
@@ -10,7 +10,8 @@ import 'dart:io';
final usersRef = Firestore.instance.collection('users');
final DateTime timestamp = DateTime.now();
-
+QuerySnapshot qs;
+bool userExistsInFirebase = false;
class Auth with ChangeNotifier {
User presentUser;
@@ -18,11 +19,12 @@ class Auth with ChangeNotifier {
FirebaseUser user;
String loggedInUserIDSharedPref;
String loggedInUserContactNumber;
+ String loggedInUserName;
bool get isAuth{
return uidSharedPref!=null;
}
-
+
Future logIn(String smsCode, String verificationId, String phoneNumber) async {
try {
@@ -57,6 +59,14 @@ class Auth with ChangeNotifier {
final prefs3 = await SharedPreferences.getInstance();
prefs3.setString("loggedInUserImage", downloadUrl);
+
+ final prefs4 = await SharedPreferences.getInstance();
+ prefs4.setString("loggedInUserName", displayName);
+
+ final prefs6 = await SharedPreferences.getInstance();
+ prefs6.setString("loggedInUserBio", "Hello there, I'm available for chat");
+
+
// 2) if the user doesn't exist, then we want to take them to the create account page
// final username = await Navigator.push(
// context, MaterialPageRoute(builder: (context) => CreateAccount()));
@@ -65,7 +75,7 @@ class Auth with ChangeNotifier {
usersRef.document(user.uid).setData({
"id": user.uid,
"displayName": displayName,
- "bio": "",
+ "bio": "Hello there, I'm available for chat",
"phoneNumber": phoneNumber,
"timestamp": timestamp,
"imageDownloadUrl" : downloadUrl
@@ -74,14 +84,27 @@ class Auth with ChangeNotifier {
doc = await usersRef.document(user.uid).get();
-
+
+ qs = await usersRef.getDocuments();
+ var listOfDocuments = qs.documents;
+ for(var dc in listOfDocuments){
+ if(dc["displayName"] == displayName || dc["phoneNumber"]==phoneNumber)
+ {
+ userExistsInFirebase = true;
+ break;
+ }
+ }
+ final prefs5 = await SharedPreferences.getInstance();
+ if(userExistsInFirebase == true){
+ prefs5.setString("recentlyLoggedInUser","exists");
+ }
presentUser = User.fromDocument(doc);
}
Future tryAutoLogin() async {
final prefs = await SharedPreferences.getInstance();
- if (!prefs.containsKey('uid')) {
+ if (!prefs.containsKey('recentlyLoggedInUser')) {
return false;
}
uidSharedPref = prefs.getString("uid");
diff --git a/lib/screens/chatList_screen.dart b/lib/screens/chatList_screen.dart
index 398ee98..998bfe7 100644
--- a/lib/screens/chatList_screen.dart
+++ b/lib/screens/chatList_screen.dart
@@ -1,6 +1,7 @@
import 'dart:core';
import 'package:flash_chat/progress.dart';
import 'package:flash_chat/screens/chat_screen.dart';
+import 'package:flash_chat/screens/chat_screen.dart' as prefix0;
import 'package:flutter/material.dart';
import 'contacts_screen.dart';
import 'package:permission_handler/permission_handler.dart';
@@ -11,6 +12,10 @@ import 'dart:async';
import 'package:flash_chat/models/user.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:contacts_service/contacts_service.dart';
+import 'package:flash_chat/Drawer screens/profile_edit.dart';
+import 'package:flash_chat/Drawer screens/privacypolicy.dart';
+import 'package:flash_chat/Drawer screens/about.dart';
+import 'package:flash_chat/Drawer screens/reach_us.dart';
String loggedInUserID;
User loggedInUser;
@@ -46,6 +51,21 @@ class _ChatListScreenState extends State {
+String loggedInUserPhoneNumber;
+String loggedInUserImgUrl;
+bool getLoggedInUserIDBool= false;
+String loggedInUserName;
+String loggedInUserBio;
+setLoggedInUserInfo() async{
+ final prefs = await SharedPreferences.getInstance();
+ loggedInUserPhoneNumber = prefs.getString("loggedInUserPhoneNumber");
+ loggedInUserImgUrl = prefs.getString("loggedInUserImage");
+ loggedInUserName = prefs.getString("loggedInUserName");
+ loggedInUserBio = prefs.getString("loggedInUserBio");
+
+}
+
+
handleContactsButton(BuildContext context) async {
PermissionStatus permissionStatus = await PermissionHandler().checkPermissionStatus(PermissionGroup.contacts);
@@ -89,6 +109,7 @@ PermissionStatus permissionStatus = await PermissionHandler().checkPermissionSta
@override
void initState() {
super.initState();
+ setLoggedInUserInfo();
getContacts();
setLoggedInUserID();
}
@@ -101,28 +122,29 @@ PermissionStatus permissionStatus = await PermissionHandler().checkPermissionSta
padding: EdgeInsets.zero,
children: [
UserAccountsDrawerHeader(
- accountName: Text("Ashish Rawat"),
+ accountName: loggedInUserName==null ? Text(" ") :Text(loggedInUserName),
decoration: BoxDecoration(
color: Colors.blueAccent,
),
- accountEmail: Text("ashishrawat2911@gmail.com"),
- currentAccountPicture: CircleAvatar(
- backgroundColor:
- Theme.of(context).platform == TargetPlatform.iOS
- ? Colors.lightBlue
- : Colors.white,
- child: Text(
- "A",
- style: TextStyle(fontSize: 40.0),
- ),
- ),
+ accountEmail: loggedInUserPhoneNumber==null ? Text(" ") : Text(loggedInUserPhoneNumber),
+ currentAccountPicture: (loggedInUserImgUrl == 'NoImage' || loggedInUserImgUrl == null) ? CircleAvatar(child: Image.asset('images/blah.png')) : CircleAvatar( backgroundColor: Colors.transparent ,radius: 23, child: ClipOval(
+ child: FadeInImage.assetNetwork(
+ fadeInDuration: Duration(milliseconds: 200),
+ fadeOutDuration: Duration(milliseconds: 200),
+ placeholder: 'gifs/ld9.gif',
+ image: this.loggedInUserImgUrl,
+ fit: BoxFit.fill,
+ ),
+),
+),
),
ListTile(
leading: Icon(Icons.person),
title: Text('Edit Profile',),
onTap: () {
- // Update the state of the app.
- // ...
+ Navigator.of(context).pop();
+ Navigator.push(context, MaterialPageRoute(builder: (context)=>ProfileEdit(profileImageUrl: loggedInUserImgUrl, userName: loggedInUserName, about: loggedInUserBio, phoneNumber: loggedInUserPhoneNumber,)));
+
},
),
ListTile(
diff --git a/pubspec.yaml b/pubspec.yaml
index dcb5820..8999646 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -41,14 +41,24 @@ dev_dependencies:
flutter:
fonts:
+ - family: Pacifico
+ fonts:
+ - asset: fonts/Pacifico-Regular.ttf
+
+ - family: Source Sans Pro
+ fonts:
+ - asset: fonts/SourceSansPro-Regular.ttf
+
+
- family: Montserrat
fonts:
- - asset: fonts/Montserrat-Regular.ttf
- weight: 700
+ - asset: fonts/Montserrat-Regular.ttf
+ weight: 700
+
- family: Manjari
fonts:
- - asset: fonts/Manjari-Regular.ttf
- weight: 700
+ - asset: fonts/Manjari-Regular.ttf
+ weight: 700
uses-material-design: true
assets: