diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..0e40fe8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ + +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/Flutter-Chat-App.iml b/.idea/Flutter-Chat-App.iml new file mode 100644 index 0000000..343f2c6 --- /dev/null +++ b/.idea/Flutter-Chat-App.iml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..681f41a --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml new file mode 100644 index 0000000..4bff185 --- /dev/null +++ b/.idea/libraries/Dart_Packages.xml @@ -0,0 +1,324 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml new file mode 100644 index 0000000..e766a65 --- /dev/null +++ b/.idea/libraries/Dart_SDK.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..35d05c3 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/chat_app/lib/screens/chat_screen.dart b/chat_app/lib/screens/chat_screen.dart index be72264..1f47b78 100644 --- a/chat_app/lib/screens/chat_screen.dart +++ b/chat_app/lib/screens/chat_screen.dart @@ -2,7 +2,8 @@ import 'package:flutter/material.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import '../widgets/messages.dart'; -import'package:chat_app/widgets/new_message.dart'; +import 'package:chat_app/widgets/new_message.dart'; + class ChatScreen extends StatelessWidget { @override Widget build(BuildContext context) { @@ -13,15 +14,20 @@ class ChatScreen extends StatelessWidget { DropdownButton( icon: Icon( Icons.more_vert, - color: Theme.of(context).primaryIconTheme.color, + color: Theme + .of(context) + .primaryIconTheme + .color, ), items: [ DropdownMenuItem( child: Container( child: Row( children: [ - Icon(Icons.exit_to_app), - SizedBox(width: 8), + Icon( + Icons.exit_to_app, + ), + SizedBox(width: 10), Text('Logout'), ], ), @@ -39,9 +45,10 @@ class ChatScreen extends StatelessWidget { ), body: Container( child: Column( - children:[ + children: [ Expanded( - child: Messages(),), + child: Messages(), + ), NewMessage(), ], ), diff --git a/chat_app/lib/widgets/auth_form.dart b/chat_app/lib/widgets/auth_form.dart index b7c41d5..bd259fe 100644 --- a/chat_app/lib/widgets/auth_form.dart +++ b/chat_app/lib/widgets/auth_form.dart @@ -56,6 +56,8 @@ class _AuthFormState extends State { return Center( child: Card( margin: EdgeInsets.all(20), + elevation: 10, + shadowColor: Colors.purple, child: SingleChildScrollView( child: Padding( padding: EdgeInsets.all(16), @@ -104,7 +106,9 @@ class _AuthFormState extends State { } return null; }, - decoration: InputDecoration(labelText: 'Password'), + decoration: InputDecoration( + labelText: 'Password', + ), obscureText: true, onSaved: (value) { _userPassword = value; @@ -114,15 +118,20 @@ class _AuthFormState extends State { if (widget.isLoading) CircularProgressIndicator(), if (!widget.isLoading) RaisedButton( - child: Text(_isLogin ? 'Login' : 'Signup'), + elevation: 3, + child: Text( + _isLogin ? 'Login' : 'Signup', + ), onPressed: _trySubmit, ), if (!widget.isLoading) FlatButton( textColor: Theme.of(context).primaryColor, - child: Text(_isLogin - ? 'Create new account' - : 'I already have an account'), + child: Text( + _isLogin + ? 'Create new account' + : 'I already have an account', + ), onPressed: () { setState(() { _isLogin = !_isLogin; diff --git a/chat_app/lib/widgets/md.dart b/chat_app/lib/widgets/md.dart index e21edae..e3eea9b 100644 --- a/chat_app/lib/widgets/md.dart +++ b/chat_app/lib/widgets/md.dart @@ -13,18 +13,16 @@ class MD extends StatelessWidget { @override Widget build(BuildContext context) { return Row( - mainAxisAlignment: - isMe ? MainAxisAlignment.end : MainAxisAlignment.start, - children: [ - Container( - decoration: BoxDecoration( - color: isMe ? Colors.blue : Theme.of(context).accentColor, - borderRadius: BorderRadius.only( - topRight: Radius.circular(8), - bottomRight: isMe ? Radius.circular(0) : Radius.circular(12), - topLeft: Radius.circular(8), - bottomLeft: !isMe ? Radius.circular(0) : Radius.circular(8), - ), + mainAxisAlignment: isMe ? MainAxisAlignment.end : MainAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + color: isMe ? Colors.blue : Theme.of(context).accentColor, + borderRadius: BorderRadius.only( + topRight: Radius.circular(8), + bottomRight: isMe ? Radius.circular(0) : Radius.circular(12), + topLeft: Radius.circular(8), + bottomLeft: !isMe ? Radius.circular(0) : Radius.circular(8), ), width: 180, padding: EdgeInsets.all(12), @@ -52,6 +50,8 @@ class MD extends StatelessWidget { ), ]), ), - ]); + ), + ], + ); } } diff --git a/chat_app/lib/widgets/new_message.dart b/chat_app/lib/widgets/new_message.dart index a50f621..bd966d6 100644 --- a/chat_app/lib/widgets/new_message.dart +++ b/chat_app/lib/widgets/new_message.dart @@ -15,7 +15,7 @@ class _NewMessageState extends State { FocusScope.of(context).unfocus(); final user = await FirebaseAuth.instance.currentUser(); final userData = - await Firestore.instance.collection('users').document(user.uid).get(); + await Firestore.instance.collection('users').document(user.uid).get(); Firestore.instance.collection('chat').add({ 'text': enteredMessage, 'ts': Timestamp.now(), @@ -37,7 +37,8 @@ class _NewMessageState extends State { controller: _controller, decoration: InputDecoration(labelText: 'Write a message!'), onChanged: (value) { - enteredMessage = value; + enteredMessage=value; + print('message added'); }, ), ), @@ -45,7 +46,7 @@ class _NewMessageState extends State { icon: Icon(Icons.send), onPressed: enteredMessage.trim().isEmpty ? null : _sendMessage, color: Theme.of(context).accentColor, - ) + ), ], ), );