Comments (30)
please help me this!
from flutterchatapptutorial.
please help me this!
Please click on get dependencies on the above popup
Make sure to add the latest version of dependencies and multidex in the pubspec.yaml and gradlebuild file from pub.dev .
for any help just comment.
The first error about user. ===>
rename the class and constructor name in user.dart file to AppUser and use AppUser instead of User because User is a firebase method.
and then
return user != null ? AppUser(userId: user.uid) : null;
The second error ===>
In new version of firebase FirebaseUser is replaced only with User. So change the complete function to::::
AppUser _userFromFirebaseUser(User user){
return user != null ? AppUser(userId: user.uid) : null;
}
The third error will be resolved when you do up above.
Error no 4 ====>
In new firebase AuthResults is replaced with UserCredentials. Please do that too.
from flutterchatapptutorial.
Your image is not visible.
from flutterchatapptutorial.
from flutterchatapptutorial.
The problem is in the main.dart file
Add the code above stateful widget in void main
from flutterchatapptutorial.
Performing hot restart...
Syncing files to device Android SDK built for x86 64...
lib/main.dart:9:9: Error: Getter not found: 'Firebase'.
await Firebase.initializeApp();
^^^^^^^^
Restarted application in 1,261ms.
from flutterchatapptutorial.
from flutterchatapptutorial.
from flutterchatapptutorial.
please help me
from flutterchatapptutorial.
Please show line number 45 and line number 10
from flutterchatapptutorial.
Change the getLoggedInState function as following. It may help
getLoggedInState () async{
await HelperFunctions.getUserLoggedInSharedPreference().then((value){
setState(() {
if(value != null){
setState(() {
userIsLoggedIn = value;
});
}
});
});
}
from flutterchatapptutorial.
from flutterchatapptutorial.
this is also happening since I have updated android
studio
from flutterchatapptutorial.
Try to update flutter or reinstall the sdk at C:\src\flutter. This might help.
from flutterchatapptutorial.
If the issue is solved please close the topic. Thank you.
from flutterchatapptutorial.
from flutterchatapptutorial.
how do I fix this
from flutterchatapptutorial.
Please show me the recent changes which you did before when the error occurred.
from flutterchatapptutorial.
from flutterchatapptutorial.
moved DatabaseMethods from inistate to getuserinfo
and
change snapshot to snapshots
from flutterchatapptutorial.
from flutterchatapptutorial.
What's your purpose of doing this? My code is working fine when database method is in initState method. And please show the database method to getChatRoom
from flutterchatapptutorial.
it is not showing data once it is loaded , in the chatroomTile
from flutterchatapptutorial.
What's your purpose of doing this? My code is working fine when database method is in initState method. And please show the database method to getChatRoom
from flutterchatapptutorial.
Write a mail to me. I'll share the code. Check for mail in my github ID. Else I'll share the solution code tomorrow.
from flutterchatapptutorial.
plz share here only.
from flutterchatapptutorial.
this is the complete.
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:ourchat/helper/helperfunctions.dart';
import 'package:ourchat/services/database.dart';
class ConversationScreen extends StatefulWidget {
final String chatRoomId;
final String thisUserName;
ConversationScreen(this.chatRoomId, this.thisUserName);
@OverRide
_ConversationScreenState createState() => _ConversationScreenState();
}
class _ConversationScreenState extends State {
String _x;
DatabaseMethods databaseMethods = new DatabaseMethods();
TextEditingController messageController = new TextEditingController();
Stream chatMessageStream;
Widget chatMessageList(){
return StreamBuilder(
stream: chatMessageStream,
builder: (context, snapshot) {
return snapshot.hasData ?Container(
margin: EdgeInsets.only(bottom: 80),
child: ListView.builder(
reverse: true,
itemCount: snapshot.data.docs.length,
itemBuilder: (context, index){
return MessageTile(snapshot.data.docs[index].data()["message"],
snapshot.data.docs[index].data()["sendBy"] == _x,
snapshot.data.docs[index].data()["time2"]);
}),
) : Container(
child: Center(child: CircularProgressIndicator()),
);
},
);
}
sendMessage(){
if(messageController.text.isNotEmpty){
Map<String, dynamic>messageMap = {
"message" : messageController.text,
"sendBy" : _x,
"time" : DateTime.now().microsecondsSinceEpoch,
"time2" : DateTime.now().toLocal().toString().substring(5, 16)
};
databaseMethods.addConversationMessages(widget.chatRoomId, messageMap);
messageController.text = "";
}
}
void initState(){
getUserName();
databaseMethods.getConversationMessages(widget.chatRoomId).then((value){
setState(() {
chatMessageStream = value;
});
});
super.initState();
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: Row(
children: [Container(
margin: EdgeInsets.only(left: 20, top: 5, bottom: 5),
padding: EdgeInsets.all(10),
width: 36,
height: 36,
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(30),
),
),
],
),
title: Text(widget.thisUserName, style: TextStyle(
fontFamily: 'Dancing',
fontSize: 25,
fontWeight: FontWeight.bold,
),),
),
body :Container(
child: Stack(
children: [
chatMessageList(),
Container(
alignment: Alignment.bottomCenter,
child: Container(
color: Color(0x54FFFFFF),
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 16),
child: Row(
children: [
Expanded(
child: TextField(
controller: messageController,
style: TextStyle(
color: Colors.white,
),
decoration: InputDecoration(
hintText: "Message...",
hintStyle: TextStyle(
color: Colors.white54,
),
border: InputBorder.none,
),
),
),
GestureDetector(
onTap: (){
sendMessage();
},
child: Container(
height: 40,
width: 40,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
const Color(0x36FFFFFF),
const Color(0x0FFFFFFF),
],
),
borderRadius: BorderRadius.circular(40)
),
padding: EdgeInsets.all(12),
child: Image.asset("assets/images/send.png")),
)
],
),
),
),
],
),
)
);
}
getUserName() async{
_x = await HelperFunctions.getUsernameSharedPreference();
}
}
class MessageTile extends StatelessWidget {
final String message;
final bool isSendByMe;
final String tim;
MessageTile(this.message , this.isSendByMe, this.tim);
@OverRide
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(left: isSendByMe ? 60: 12,right: isSendByMe ? 24 : 100),
margin: EdgeInsets.symmetric(vertical: 4),
width: MediaQuery.of(context).size.width,
alignment: isSendByMe ? Alignment.centerRight : Alignment.centerLeft,
child: Column(
children: [
Container(
margin: EdgeInsets.symmetric(vertical: 4),
padding: EdgeInsets.symmetric(horizontal: 24,vertical: 12),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: isSendByMe ? [
const Color(0xff007EF4),
const Color(0xff2A75BC)
]
: [
const Color(0x1AFFFFFF),
const Color(0x1AFFFFFF)
]
),
borderRadius: isSendByMe ?
BorderRadius.only(
topLeft: Radius.circular(23),
topRight: Radius.circular(23),
bottomLeft: Radius.circular(23)
)
:
BorderRadius.only(
topLeft: Radius.circular(23),
topRight: Radius.circular(23),
bottomRight: Radius.circular(23)
)
),
child: Text(message, style: TextStyle(
color: Colors.white,
fontSize: 16,
),
),
),
Container(
child: Text(tim,textAlign: TextAlign.right, style: TextStyle(
color: Colors.white,
fontSize: 10
),),
),
],
),
);
}
}
from flutterchatapptutorial.
from flutterchatapptutorial.
I am not able to get this what is on that emulator screen
from flutterchatapptutorial.
This is the home screen, since I have shared the complete conversation screen code, please complete the video tutorial, you will get what it is.
from flutterchatapptutorial.
Related Issues (15)
- 'dart:ui/text.dart': Failed assertion: line 1372: '<optimized out>': is not true HOT 1
- Message writing area overlapping chats HOT 10
- Can you give this awesome work a migration ☹️❤️ HOT 1
- The method 'substring' was called on null. E/flutter ( 2654): Receiver: null E/flutter ( 2654): Tried calling: substring(0, 1) HOT 2
- app bar
- null safty
- Firebase V9
- bug: web app crashes when sending a messages that contains a lot of bytes
- Facing issue when using firebase
- Having error in Firebase HOT 1
- I just finished the first video and I get an error relating to firebase HOT 4
- Firebase collections creation HOT 1
- Sign In Auth Unable to get user from Firebase Auth HOT 1
- ChatRoom streamBuilder
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutterchatapptutorial.