diff --git a/packages/simplex_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/simplex_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
index 895868225..a2e720776 100644
Binary files a/packages/simplex_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/packages/simplex_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/packages/simplex_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/simplex_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 498392fec..a58dfbc82 100644
Binary files a/packages/simplex_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/packages/simplex_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/packages/simplex_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/simplex_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index 8c9e0e7b0..167c706b1 100644
Binary files a/packages/simplex_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/packages/simplex_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/packages/simplex_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/simplex_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index 603a6dfcd..c48eaeece 100644
Binary files a/packages/simplex_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/packages/simplex_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/packages/simplex_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/simplex_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 67a0a9b80..7ad7636ba 100644
Binary files a/packages/simplex_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/packages/simplex_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/packages/simplex_app/assets/simpleX.png b/packages/simplex_app/assets/simpleX.png
new file mode 100644
index 000000000..227b0d06f
Binary files /dev/null and b/packages/simplex_app/assets/simpleX.png differ
diff --git a/packages/simplex_app/assets/simpleX.svg b/packages/simplex_app/assets/simpleX.svg
new file mode 100644
index 000000000..cbc5699f9
--- /dev/null
+++ b/packages/simplex_app/assets/simpleX.svg
@@ -0,0 +1,17 @@
+
diff --git a/packages/simplex_app/ios/Runner.xcodeproj/project.pbxproj b/packages/simplex_app/ios/Runner.xcodeproj/project.pbxproj
index 4708178eb..6e36b93db 100644
--- a/packages/simplex_app/ios/Runner.xcodeproj/project.pbxproj
+++ b/packages/simplex_app/ios/Runner.xcodeproj/project.pbxproj
@@ -536,4 +536,4 @@
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
-}
+}
\ No newline at end of file
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
index dc9ada472..a20bcf634 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
index 28c6bf030..11bd973c5 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
index 2ccbfd967..41e8efa18 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
index f091b6b0b..9d8ce847a 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
index 4cde12118..7f8a530da 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
index d0ef06e7e..665e6cf35 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
index dcdc2306c..2c4bb73ee 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
index 2ccbfd967..41e8efa18 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
index c8f9ed8f5..975ca4b87 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
index a6d6b8609..24280d00a 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
index a6d6b8609..24280d00a 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
index 75b2d164a..9797adaf2 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
index c4df70d39..7552c6b67 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
index 6a84f41e1..2857870c3 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ
diff --git a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
index d0e1f5853..9780b65f6 100644
Binary files a/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/packages/simplex_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ
diff --git a/packages/simplex_app/lib/main.dart b/packages/simplex_app/lib/main.dart
index 28c131ebd..36e47fdd7 100644
--- a/packages/simplex_app/lib/main.dart
+++ b/packages/simplex_app/lib/main.dart
@@ -7,7 +7,7 @@ import 'package:simplex_chat/providers/drawer_providers.dart';
import 'package:simplex_chat/views/contacts/add_contact_view.dart';
import 'package:simplex_chat/views/group/add_group_view.dart';
import 'package:simplex_chat/views/onboarding/intro_view.dart';
-import 'package:simplex_chat/views/scanInvitation/scan_invitation_view.dart';
+import 'package:simplex_chat/views/scan_invitation/scan_invitation_view.dart';
import 'package:simplex_chat/views/setup_profile_view.dart';
import 'package:simplex_chat/views/splash_screen.dart';
diff --git a/packages/simplex_app/lib/model/contact.dart b/packages/simplex_app/lib/model/contact.dart
index 273719316..ee20a9f6a 100644
--- a/packages/simplex_app/lib/model/contact.dart
+++ b/packages/simplex_app/lib/model/contact.dart
@@ -2,21 +2,32 @@ import 'dart:convert';
class Contact {
final String name;
- final String msg;
- final String msgTime;
+ final String subtitle;
+ final String photo;
+ final bool isGroup;
- Contact({this.name, this.msg, this.msgTime});
+ Contact({
+ this.name,
+ this.subtitle,
+ this.photo = '',
+ this.isGroup = false,
+ });
factory Contact.fromJson(Map json) {
return Contact(
- name: json['name'], msg: json['msg'], msgTime: json['msgTime']);
+ name: json['name'],
+ subtitle: json['subtitle'],
+ photo: json['photo'],
+ isGroup: json['isGroup'],
+ );
}
static Map toJson(Contact contact) {
return {
'name': contact.name,
- 'msg': contact.msg,
- 'msgTime': contact.msgTime,
+ 'subtitle': contact.subtitle,
+ 'photo': contact.photo,
+ 'isGroup': false,
};
}
diff --git a/packages/simplex_app/lib/model/group.dart b/packages/simplex_app/lib/model/group.dart
index 56a19e83d..d8187ac5b 100644
--- a/packages/simplex_app/lib/model/group.dart
+++ b/packages/simplex_app/lib/model/group.dart
@@ -1,32 +1,37 @@
import 'dart:convert';
class Group {
- final String photoPath;
- final String groupName;
- final String groupDescription;
+ final String name;
+ final String subtitle;
+ final String photo;
final List members;
+ final bool isGroup;
- Group(
- {this.groupName,
- this.photoPath,
- this.groupDescription,
- this.members = const []});
+ Group({
+ this.name,
+ this.subtitle,
+ this.photo = '',
+ this.isGroup = true,
+ this.members = const [],
+ });
factory Group.fromJson(Map json) {
return Group(
- photoPath: json['gPhoto'],
- groupName: json['gName'],
- groupDescription: json['desc'],
- members: json['contacts'],
+ name: json['name'],
+ subtitle: json['subtitle'],
+ photo: json['photo'],
+ isGroup: json['isGroup'],
+ members: json['members'],
);
}
static Map toJson(Group group) {
return {
- 'gPhoto': group.photoPath,
- 'gName': group.groupName,
- 'desc': group.groupDescription,
- 'contacts': group.members,
+ 'name': group.name,
+ 'subtitle': group.subtitle,
+ 'photo': group.photo,
+ 'isGroup': true,
+ 'members': group.members,
};
}
diff --git a/packages/simplex_app/lib/views/contacts/contacts_view.dart b/packages/simplex_app/lib/views/contacts/conversations.dart
similarity index 62%
rename from packages/simplex_app/lib/views/contacts/contacts_view.dart
rename to packages/simplex_app/lib/views/contacts/conversations.dart
index a7aca4b3f..10815db5f 100644
--- a/packages/simplex_app/lib/views/contacts/contacts_view.dart
+++ b/packages/simplex_app/lib/views/contacts/conversations.dart
@@ -1,46 +1,40 @@
import 'dart:io';
import 'package:flutter/material.dart';
+import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:simplex_chat/animations/bottom_animation.dart';
import 'package:simplex_chat/app_routes.dart';
import 'package:simplex_chat/constants.dart';
import 'package:simplex_chat/model/contact.dart';
+import 'package:simplex_chat/model/group.dart';
+import 'package:simplex_chat/providers/drawer_providers.dart';
import 'package:simplex_chat/views/conversation/conversation_view.dart';
-class ContactsView extends StatefulWidget {
- const ContactsView({Key key}) : super(key: key);
+class Conversations extends StatefulWidget {
+ const Conversations({Key key}) : super(key: key);
@override
- _ContactsViewState createState() => _ContactsViewState();
+ _ConversationsState createState() => _ConversationsState();
}
-class _ContactsViewState extends State {
+class _ConversationsState extends State {
bool _eraseMedia = false;
+ String _photo = '';
+ String _displayName = '';
+
+ List _conversations = [];
+
List _contactsList = []; // for storing contacts
+ List _groupList = []; // for storing groups
final List _options = [
'Add contact',
'Scan invitation',
+ 'Add group',
];
- // delete a contact
- void _deleteContact(Contact contact) async {
- SharedPreferences prefs = await SharedPreferences.getInstance();
- setState(() {
- _contactsList.remove(contact);
- });
- await prefs.setString('contacts', Contact.encode(_contactsList));
- var snackBar = SnackBar(
- backgroundColor: Colors.red,
- content: Text('${contact.name} deleted!'),
- );
- ScaffoldMessenger.of(context)
- ..hideCurrentSnackBar()
- ..showSnackBar(snackBar);
- }
-
// getting data from local storage FOR NOW!!
void _getContacts() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
@@ -52,8 +46,18 @@ class _ContactsViewState extends State {
}
}
- String _photo = '';
- String _displayName = '';
+ // getting data from local storage FOR NOW!!
+ void _getGroups() async {
+ SharedPreferences prefs = await SharedPreferences.getInstance();
+ final String _groups = prefs.getString('groups');
+ if (_groups != null) {
+ setState(() {
+ _groupList = List.from(Group.decode(_groups));
+ });
+ }
+
+ _gettingGroupContactsChats();
+ }
void _getUserData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
@@ -63,15 +67,24 @@ class _ContactsViewState extends State {
});
}
+ void _gettingGroupContactsChats() {
+ setState(() {
+ _conversations = List.from(_contactsList);
+ _conversations = _conversations + _groupList;
+ });
+ }
+
@override
void initState() {
_getUserData();
_getContacts();
+ _getGroups();
super.initState();
}
@override
Widget build(BuildContext context) {
+ final _drawerProviders = Provider.of(context);
return Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
@@ -83,16 +96,21 @@ class _ContactsViewState extends State {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
- Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Text('Hi! $_displayName', style: kSmallHeadingStyle),
- const Text('Good day!'),
- ],
+ GestureDetector(
+ onTap: _addNewContacts,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ Text('Hi! $_displayName', style: kSmallHeadingStyle),
+ const Text('Good day!'),
+ ],
+ ),
),
const SizedBox(width: 10.0),
GestureDetector(
- onTap: _addNewContacts,
+ onTap: () {
+ _drawerProviders.currentIndex = 0;
+ },
child: CircleAvatar(
backgroundImage: _photo.isEmpty
? const AssetImage('assets/dp.png') as ImageProvider
@@ -107,7 +125,7 @@ class _ContactsViewState extends State {
Icon(Icons.chat, color: kPrimaryColor),
SizedBox(width: 8.0),
Text(
- 'Chats',
+ 'Conversations',
style: kHeadingStyle,
)
],
@@ -137,29 +155,49 @@ class _ContactsViewState extends State {
: ListView(
shrinkWrap: true,
children: List.generate(
- _contactsList.length,
+ _conversations.length,
(index) => WidgetAnimator(
child: ListTile(
- leading: const CircleAvatar(
- backgroundImage: AssetImage('assets/dp.png'),
+ leading: CircleAvatar(
+ backgroundImage:
+ // ignore: avoid_dynamic_calls
+ _conversations[index].photo == ''
+ ? const AssetImage('assets/dp.png')
+ as ImageProvider
+ : FileImage(
+ // ignore: avoid_dynamic_calls
+ File(_conversations[index].photo)),
),
- title: Text(_contactsList[index].name),
- subtitle: Text(_contactsList[index].msg),
- trailing: Text(
- _contactsList[index].msgTime,
- style: const TextStyle(
- fontSize: 11, color: Colors.grey),
+ // ignore: avoid_dynamic_calls
+ title: Text(_conversations[index].name),
+ // ignore: avoid_dynamic_calls
+ subtitle: Text(_conversations[index].subtitle),
+ // ignore: avoid_dynamic_calls
+ trailing: Icon(
+ // ignore: avoid_dynamic_calls
+ _conversations[index].isGroup
+ ? Icons.group
+ : Icons.person,
+ size: 18,
+ color: Colors.grey[400],
),
- onTap: () => Navigator.push(
- context,
- MaterialPageRoute(
- builder: (_) => ConversationView(
- contact: _contactsList[index],
+ onTap: () async {
+ var value = await Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (_) => ConversationView(
+ data: _conversations[index],
+ ),
),
- ),
- ),
+ );
+ value ??= false;
+ if (value) {
+ _getContacts();
+ _getGroups();
+ }
+ },
onLongPress: () =>
- _conversationOptions(_contactsList[index]),
+ _conversationOptions(_conversations[index]),
),
),
),
@@ -173,12 +211,17 @@ class _ContactsViewState extends State {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0),
),
- offset: const Offset(-10, -120),
- onSelected: (value) {
+ offset: const Offset(-10, -155),
+ onSelected: (value) async {
if (value == _options[0]) {
- Navigator.pushNamed(context, AppRoutes.scanInvitation);
+ await Navigator.pushNamed(context, AppRoutes.scanInvitation);
+ } else if (value == _options[1]) {
+ await Navigator.pushNamed(context, AppRoutes.addContact);
} else {
- Navigator.pushNamed(context, AppRoutes.addContact);
+ var value = await Navigator.pushNamed(context, AppRoutes.addGroup);
+ if (value) {
+ _getGroups();
+ }
}
},
itemBuilder: (context) => _options
@@ -200,7 +243,39 @@ class _ContactsViewState extends State {
);
}
- void _conversationOptions(Contact contact) {
+ // delete a contact
+ void _deleteContact(Contact contact) async {
+ SharedPreferences prefs = await SharedPreferences.getInstance();
+ setState(() {
+ _contactsList.remove(contact);
+ });
+ await prefs.setString('contacts', Contact.encode(_contactsList));
+ var snackBar = SnackBar(
+ backgroundColor: Colors.red,
+ content: Text('${contact.name} deleted!'),
+ );
+ ScaffoldMessenger.of(context)
+ ..hideCurrentSnackBar()
+ ..showSnackBar(snackBar);
+ }
+
+ // delete a group
+ void _deleteGroup(Group group) async {
+ SharedPreferences prefs = await SharedPreferences.getInstance();
+ setState(() {
+ _groupList.remove(group);
+ });
+ await prefs.setString('groups', Group.encode(_groupList));
+ var snackBar = SnackBar(
+ backgroundColor: Colors.red,
+ content: Text('${group.name} deleted!'),
+ );
+ ScaffoldMessenger.of(context)
+ ..hideCurrentSnackBar()
+ ..showSnackBar(snackBar);
+ }
+
+ void _conversationOptions(var chat) {
showDialog(
context: context,
builder: (context) => AlertDialog(
@@ -210,7 +285,7 @@ class _ContactsViewState extends State {
TextButton(
onPressed: () {
Navigator.pop(context);
- _deleteConversation(contact);
+ _deleteConversation(chat);
},
child: const Text(
'Delete Conversation',
@@ -228,7 +303,7 @@ class _ContactsViewState extends State {
);
}
- void _deleteConversation(Contact contact) {
+ void _deleteConversation(var chat) {
showDialog(
context: context,
builder: (context) => StatefulBuilder(
@@ -256,10 +331,18 @@ class _ContactsViewState extends State {
),
actions: [
InkWell(
- onTap: () {
- _deleteContact(contact);
- Navigator.pop(context);
- },
+ // ignore: avoid_dynamic_calls
+ onTap: chat.isGroup
+ ? () {
+ _deleteGroup(chat);
+ _conversations.remove(chat);
+ Navigator.pop(context);
+ }
+ : () {
+ _deleteContact(chat);
+ _conversations.remove(chat);
+ Navigator.pop(context);
+ },
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Icon(Icons.check, color: Colors.green),
@@ -329,6 +412,7 @@ class _ContactsViewState extends State {
void _addNewContacts() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
+ // adding dummy contact
List _localList = [];
final String _local = prefs.getString('contacts');
if (_local != null) {
@@ -338,18 +422,7 @@ class _ContactsViewState extends State {
List _newList = [
Contact(
name: 'Harry',
- msg: 'Hello!',
- msgTime: 'Just now',
- ),
- Contact(
- name: 'Ayesha',
- msg: 'OK!',
- msgTime: 'Just now',
- ),
- Contact(
- name: 'Larry',
- msg: 'Yep, Already done!',
- msgTime: 'Just now',
+ subtitle: 'Hello!',
),
];
_newList = _localList + _newList;
@@ -358,7 +431,29 @@ class _ContactsViewState extends State {
final String _newContacts = Contact.encode(_newList);
await prefs.setString('contacts', _newContacts);
+
+ // adding dummy contact
+ List _localListGroup = [];
+ final String _localGroups = prefs.getString('groups');
+ if (_local != null) {
+ _localListGroup = List.from(Group.decode(_localGroups));
+ }
+
+ List _newGroups = [
+ Group(
+ name: 'College Friends',
+ subtitle: 'Lovely people',
+ members: ['Alice', 'James', 'Rio']),
+ ];
+ _newGroups = _localListGroup + _newGroups;
+
+ // dummy ftn for filling the list
+ final String _newGroup = Group.encode(_newGroups);
+
+ await prefs.setString('groups', _newGroup);
+
_getContacts();
+ _getGroups();
const snackBar = SnackBar(
backgroundColor: Colors.green,
content: Text('New contacts loaded!'),
diff --git a/packages/simplex_app/lib/views/conversation/contact_detail_conversation.dart b/packages/simplex_app/lib/views/conversation/contact_detail_conversation.dart
index 03b09e660..bc5de39e1 100644
--- a/packages/simplex_app/lib/views/conversation/contact_detail_conversation.dart
+++ b/packages/simplex_app/lib/views/conversation/contact_detail_conversation.dart
@@ -10,21 +10,24 @@ class ContactDetailsConversation extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
+ centerTitle: true,
title: Text(contact.name),
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 12.0),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- const CircleAvatar(
- radius: 65,
- backgroundImage: AssetImage('assets/dp.png'),
- ),
- const SizedBox(height: 15.0),
- const Text('Display Name', style: kMediumHeadingStyle),
- Text(contact.name),
- ],
+ child: Center(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ const CircleAvatar(
+ radius: 65,
+ backgroundImage: AssetImage('assets/dp.png'),
+ ),
+ const SizedBox(height: 15.0),
+ const Text('Display Name', style: kMediumHeadingStyle),
+ Text(contact.name),
+ ],
+ ),
),
),
);
diff --git a/packages/simplex_app/lib/views/conversation/conversation_view.dart b/packages/simplex_app/lib/views/conversation/conversation_view.dart
index 2ef273361..e9ba11661 100644
--- a/packages/simplex_app/lib/views/conversation/conversation_view.dart
+++ b/packages/simplex_app/lib/views/conversation/conversation_view.dart
@@ -1,16 +1,13 @@
import 'dart:io';
import 'package:flutter/material.dart';
-import 'package:simplex_chat/model/contact.dart';
-import 'package:simplex_chat/model/group.dart';
import 'package:simplex_chat/views/conversation/contact_detail_conversation.dart';
import 'package:simplex_chat/views/conversation/group_detail_conversation.dart';
import 'package:simplex_chat/widgets/message_bubble.dart';
class ConversationView extends StatefulWidget {
- final Contact contact;
- final Group group;
- const ConversationView({Key key, this.contact, this.group}) : super(key: key);
+ final data;
+ const ConversationView({Key key, this.data}) : super(key: key);
@override
_ConversationViewState createState() => _ConversationViewState();
@@ -49,45 +46,72 @@ class _ConversationViewState extends State {
onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold(
appBar: AppBar(
- leading: InkWell(
- onTap: () => Navigator.of(context).pop(true),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- const Icon(Icons.arrow_back),
- const SizedBox(width: 8.0),
- CircleAvatar(
- backgroundImage: widget.contact == null
- ? widget.group.photoPath == ''
- ? const AssetImage('assets/dp.png')
- : FileImage(
- File(widget.group.photoPath),
- )
- : const AssetImage('assets/dp.png')),
- ],
+ leading: BackButton(
+ onPressed: () => Navigator.of(context).pop(true),
+ ),
+ leadingWidth: MediaQuery.of(context).size.width * 0.085,
+ title: InkWell(
+ // ignore: avoid_dynamic_calls
+ onTap: widget.data.isGroup
+ ? () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (_) => GroupDetailsConversation(
+ group: widget.data,
+ ),
+ ),
+ );
+ }
+ : () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (_) => ContactDetailsConversation(
+ contact: widget.data,
+ ),
+ ),
+ );
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 8.0),
+ child: Row(
+ children: [
+ CircleAvatar(
+ radius: 15,
+ // ignore: avoid_dynamic_calls
+ backgroundImage: widget.data.photo == ''
+ ? const AssetImage('assets/dp.png')
+ : FileImage(
+ // ignore: avoid_dynamic_calls
+ File(widget.data.photo),
+ ),
+ ),
+ const SizedBox(width: 10.0),
+ Text(
+ // ignore: avoid_dynamic_calls
+ widget.data.name,
+ ),
+ ],
+ ),
),
),
- leadingWidth: MediaQuery.of(context).size.width * 0.2,
- title: Text(widget.contact != null
- ? widget.contact.name
- : widget.group.groupName),
actions: [
IconButton(
- onPressed: widget.contact != null
- ? () => Navigator.push(
- context,
- MaterialPageRoute(
- builder: (_) => ContactDetailsConversation(
- contact: widget.contact,
- )))
- : () => Navigator.push(
- context,
- MaterialPageRoute(
- builder: (_) => GroupDetailsConversation(
- group: widget.group,
- ))),
- icon: const Icon(Icons.info),
- ),
+ onPressed: () {
+ setState(() {
+ _chatMessages.add(MessageBubble(
+ isUser: false,
+ // ignore: avoid_dynamic_calls
+ sender: widget.data.name,
+ text: 'Hey there! How is it going?',
+ ));
+ });
+ },
+ icon: const Icon(
+ Icons.message,
+ ),
+ )
],
),
body: Column(
@@ -139,10 +163,10 @@ class _ConversationViewState extends State {
),
),
)),
- const SizedBox(width: 15.0),
- InkWell(
- onTap: () async {
- if (_messageFieldController.text == '') {
+ const SizedBox(width: 4.0),
+ IconButton(
+ onPressed: () {
+ if (_messageFieldController.text.isNotEmpty) {
setState(() {
_chatMessages.add(MessageBubble(
isUser: true,
@@ -154,7 +178,7 @@ class _ConversationViewState extends State {
_focus.unfocus();
}
},
- child: const Icon(Icons.send_rounded,
+ icon: const Icon(Icons.send_rounded,
size: 25.0, color: Colors.teal),
),
],
diff --git a/packages/simplex_app/lib/views/conversation/group_detail_conversation.dart b/packages/simplex_app/lib/views/conversation/group_detail_conversation.dart
index 98b73381c..aef2424e5 100644
--- a/packages/simplex_app/lib/views/conversation/group_detail_conversation.dart
+++ b/packages/simplex_app/lib/views/conversation/group_detail_conversation.dart
@@ -62,7 +62,8 @@ class _GroupDetailsConversationState extends State {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
- title: Text(widget.group.groupName),
+ centerTitle: true,
+ title: Text(widget.group.name),
),
body: SingleChildScrollView(
child: Padding(
@@ -73,14 +74,14 @@ class _GroupDetailsConversationState extends State {
Center(
child: CircleAvatar(
radius: 70,
- backgroundImage: widget.group.photoPath == ''
+ backgroundImage: widget.group.photo == ''
? const AssetImage('assets/dp.png')
- : FileImage(File(widget.group.photoPath)),
+ : FileImage(File(widget.group.photo)),
),
),
const SizedBox(height: 25.0),
const Text('Group Name', style: kMediumHeadingStyle),
- Text(widget.group.groupName),
+ Text(widget.group.name),
const Divider(),
ListTile(
leading: const Icon(Icons.person_add),
@@ -197,14 +198,14 @@ class _GroupDetailsConversationState extends State {
int index = 0;
index = _groupList
- .indexWhere((group) => group.groupName == widget.group.groupName);
+ .indexWhere((group) => group.name == widget.group.name);
// add the full _members list to the group
Group _updatedGroup = Group(
- groupName: widget.group.groupName,
- groupDescription: widget.group.groupDescription,
+ name: widget.group.name,
+ subtitle: widget.group.subtitle,
members: _members,
- photoPath: widget.group.photoPath,
+ photo: widget.group.photo,
);
// put it in updated group local list
@@ -235,13 +236,13 @@ class _GroupDetailsConversationState extends State {
int index = 0;
index = _groupList
- .indexWhere((group) => group.groupName == widget.group.groupName);
+ .indexWhere((group) => group.name == widget.group.name);
// new instance of group (updated)
Group _updatedGroup = Group(
- groupName: widget.group.groupName,
- groupDescription: widget.group.groupDescription,
- photoPath: widget.group.photoPath,
+ name: widget.group.name,
+ subtitle: widget.group.subtitle,
+ photo: widget.group.photo,
members: _members,
);
diff --git a/packages/simplex_app/lib/views/group/add_group_view.dart b/packages/simplex_app/lib/views/group/add_group_view.dart
index cf4929535..f4aa8f8ee 100644
--- a/packages/simplex_app/lib/views/group/add_group_view.dart
+++ b/packages/simplex_app/lib/views/group/add_group_view.dart
@@ -252,7 +252,6 @@ class _AddGroupViewState extends State {
if (_formKey.currentState.validate()) {
FocusScope.of(context).unfocus();
_addNewGroup(
- _groupPhotoPath,
_displayNameController.text.trim(),
_descController.text.trim());
_descController.clear();
@@ -398,7 +397,7 @@ class _AddGroupViewState extends State {
}
}
- void _addNewGroup(String photo, String name, String desc) async {
+ void _addNewGroup(String name, String desc) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
List _localList = [];
final String _local = prefs.getString('groups');
@@ -407,12 +406,13 @@ class _AddGroupViewState extends State {
}
List _groups = [
Group(
- photoPath: _groupPhotoPath,
- groupName: name,
- groupDescription: desc,
+ name: name,
+ photo: _groupPhotoPath,
+ subtitle: desc,
members: _members,
),
];
+ debugPrint(_groups[0].isGroup.toString());
_groups = _localList + _groups;
final String _newGroups = Group.encode(_groups);
diff --git a/packages/simplex_app/lib/views/group/group_view.dart b/packages/simplex_app/lib/views/group/group_view.dart
deleted file mode 100644
index 7e4d329e7..000000000
--- a/packages/simplex_app/lib/views/group/group_view.dart
+++ /dev/null
@@ -1,380 +0,0 @@
-import 'dart:io';
-
-import 'package:flutter/material.dart';
-import 'package:shared_preferences/shared_preferences.dart';
-import 'package:simplex_chat/animations/bottom_animation.dart';
-import 'package:simplex_chat/app_routes.dart';
-import 'package:simplex_chat/constants.dart';
-import 'package:simplex_chat/model/group.dart';
-import 'package:simplex_chat/views/conversation/conversation_view.dart';
-
-class GroupView extends StatefulWidget {
- const GroupView({Key key}) : super(key: key);
-
- @override
- State createState() => _GroupViewState();
-}
-
-class _GroupViewState extends State {
- bool _eraseMedia = false;
- final List _options = [
- 'Add group',
- 'Scan a Group',
- 'Invitation',
- ];
-
- List _groupList = [];
-
- // delete a group
- void _deleteContact(Group group) async {
- SharedPreferences prefs = await SharedPreferences.getInstance();
- setState(() {
- _groupList.remove(group);
- });
- await prefs.setString('groups', Group.encode(_groupList));
- var snackBar = SnackBar(
- backgroundColor: Colors.red,
- content: Text('${group.groupName} deleted!'),
- );
- ScaffoldMessenger.of(context)
- ..hideCurrentSnackBar()
- ..showSnackBar(snackBar);
- }
-
- // getting data from local storage FOR NOW!!
- void _getGroups() async {
- SharedPreferences prefs = await SharedPreferences.getInstance();
- final String _groups = prefs.getString('groups');
- if (_groups != null) {
- setState(() {
- _groupList = List.from(Group.decode(_groups));
- });
- }
- }
-
- String _photo = '';
- String _displayName = '';
-
- void _getUserData() async {
- SharedPreferences prefs = await SharedPreferences.getInstance();
- setState(() {
- _displayName = prefs.getString('displayName');
- _photo = prefs.getString('photo$_displayName');
- });
- }
-
- @override
- void initState() {
- _getUserData();
- _getGroups();
- super.initState();
- }
-
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.white,
- body: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 20.0),
- child: Column(
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Text('Hi! $_displayName', style: kSmallHeadingStyle),
- const Text('Good day!'),
- ],
- ),
- const SizedBox(width: 10.0),
- CircleAvatar(
- backgroundImage: _photo.isEmpty
- ? const AssetImage('assets/dp.png') as ImageProvider
- : FileImage(File(_photo)),
- ),
- ],
- ),
- const SizedBox(height: 15.0),
- Row(
- children: const [
- Icon(Icons.group, color: kPrimaryColor),
- SizedBox(width: 8.0),
- Text(
- 'Groups',
- style: kHeadingStyle,
- )
- ],
- ),
- const SizedBox(height: 5.0),
- _groupList.isEmpty
- ? SizedBox(
- height: MediaQuery.of(context).size.height * 0.7,
- child: Center(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: const [
- Text(
- "You don't have any groups yet!",
- style: kMediumHeadingStyle,
- textAlign: TextAlign.center,
- ),
- SizedBox(height: 8.0),
- Text(
- 'Click the icon below to add a contact',
- textAlign: TextAlign.center,
- ),
- ],
- ),
- ),
- )
- : ListView(
- shrinkWrap: true,
- children: List.generate(
- _groupList.length,
- (index) => WidgetAnimator(
- child: ListTile(
- leading: CircleAvatar(
- backgroundImage: _groupList[index].photoPath == ''
- ? const AssetImage('assets/dp.png')
- as ImageProvider
- : FileImage(File(_groupList[index].photoPath)),
- ),
- title: Text(_groupList[index].groupName),
- subtitle: Text(_groupList[index].groupDescription),
- trailing: Text(
- 'Members: ${_groupList[index].members.length}',
- style: const TextStyle(
- fontSize: 11, color: Colors.grey),
- ),
- onTap: () async {
- var value = await Navigator.push(
- context,
- MaterialPageRoute(
- builder: (_) =>
- ConversationView(group: _groupList[index]),
- ),
- );
- if (value) {
- _getGroups();
- }
- },
- onLongPress: () =>
- _conversationOptions(_groupList[index]),
- ),
- ),
- ),
- ),
- ],
- ),
- ),
- floatingActionButton: PopupMenuButton(
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(5.0),
- ),
- offset: const Offset(-10, -150),
- onSelected: (value) async {
- if (value == _options[0]) {
- var value = await Navigator.pushNamed(context, AppRoutes.addGroup);
- if (value == true) {
- _getGroups();
- }
- } else if (value == _options[1]) {
- await Navigator.pushNamed(context, AppRoutes.addContact);
- } else {
- await Navigator.pushNamed(context, AppRoutes.scanInvitation);
- }
- },
- itemBuilder: (context) => _options
- .map(
- (opt) => PopupMenuItem(
- value: opt,
- child: Text(opt),
- ),
- )
- .toList(),
- child: const FloatingActionButton(
- heroTag: 'group',
- onPressed: null,
- child: Icon(
- Icons.group_add,
- ),
- ),
- ),
- );
- }
-
- void _conversationOptions(Group group) {
- showDialog(
- context: context,
- builder: (context) => AlertDialog(
- content: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- TextButton(
- onPressed: () {
- Navigator.pop(context);
- _deleteConversation(group);
- },
- child: const Text(
- 'Delete Group',
- style: TextStyle(color: Colors.red),
- )),
- TextButton(
- onPressed: () {
- Navigator.pop(context);
- _disconnect();
- },
- child: const Text('Leave Group')),
- ],
- ),
- ),
- );
- }
-
- void _deleteConversation(Group group) {
- showDialog(
- context: context,
- builder: (context) => StatefulBuilder(
- builder: (context, setState) => AlertDialog(
- title: const Text('Are you Sure?'),
- content: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- const Text('All group history will be deleted from your device!'),
- const SizedBox(height: 15.0),
- Row(
- children: [
- Checkbox(
- value: _eraseMedia,
- onChanged: (value) {
- setState(() {
- _eraseMedia = value;
- });
- }),
- const Text('Erase files & Media')
- ],
- ),
- ],
- ),
- actions: [
- InkWell(
- onTap: () {
- _deleteContact(group);
- Navigator.pop(context);
- },
- child: const Padding(
- padding: EdgeInsets.all(8.0),
- child: Icon(Icons.check, color: Colors.green),
- ),
- ),
- InkWell(
- onTap: () => Navigator.pop(context),
- child: const Padding(
- padding: EdgeInsets.all(8.0),
- child: Icon(Icons.cancel_outlined, color: Colors.red),
- ),
- )
- ],
- ),
- ),
- );
- }
-
- void _disconnect() {
- showDialog(
- context: context,
- builder: (context) => StatefulBuilder(
- builder: (context, setState) => AlertDialog(
- title: const Text('Are you Sure?'),
- content: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- const Text(
- 'Leaving a group will erase all the data from your device and you will no longer be able to contact again!'),
- const SizedBox(height: 15.0),
- Row(
- children: [
- Checkbox(
- value: _eraseMedia,
- onChanged: (value) {
- setState(() {
- _eraseMedia = value;
- });
- }),
- const Text('Erase files & Media')
- ],
- ),
- ],
- ),
- actions: [
- InkWell(
- onTap: () => Navigator.pop(context),
- child: const Padding(
- padding: EdgeInsets.all(8.0),
- child: Icon(Icons.check, color: Colors.green),
- ),
- ),
- InkWell(
- onTap: () => Navigator.pop(context),
- child: const Padding(
- padding: EdgeInsets.all(8.0),
- child: Icon(Icons.cancel_outlined, color: Colors.red),
- ),
- )
- ],
- ),
- ),
- );
- }
-
- // dummy ftn for loading new contacts
- // ignore: unused_element
- void _addNewGroups() async {
- SharedPreferences prefs = await SharedPreferences.getInstance();
- List _localList = [];
- final String _local = prefs.getString('groups');
- if (_local != null) {
- _localList = List.from(Group.decode(_local));
- }
-
- List _groups = [
- Group(
- groupName: 'Family group',
- groupDescription: 'Some description here',
- members: [
- 'Hamza',
- 'Alice',
- 'John',
- 'Bob',
- ],
- ),
- Group(
- groupName: 'Friends',
- groupDescription: 'Miss you all',
- members: [
- 'Alice',
- 'John',
- 'Bob',
- ],
- ),
- ];
- _groups = _localList + _groups;
-
- // dummy ftn for filling the list
- final String _newGroups = Group.encode(_groups);
-
- await prefs.setString('groups', _newGroups);
-
- _getGroups();
-
- const snackBar = SnackBar(
- backgroundColor: Colors.green,
- content: Text('New Groups loaded!'),
- );
- ScaffoldMessenger.of(context)
- ..hideCurrentSnackBar()
- ..showSnackBar(snackBar);
- }
-}
diff --git a/packages/simplex_app/lib/views/home/drawer.dart b/packages/simplex_app/lib/views/home/drawer.dart
index 008177ffa..700834743 100644
--- a/packages/simplex_app/lib/views/home/drawer.dart
+++ b/packages/simplex_app/lib/views/home/drawer.dart
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
-import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:simplex_chat/app_routes.dart';
@@ -20,46 +19,23 @@ class MyDrawer extends StatelessWidget {
return Column(
children: [
const SizedBox(height: 30.0),
- SvgPicture.asset(
- 'assets/logo.svg',
- height: 50.0,
+ Image.asset(
+ 'assets/simpleX.png',
+ height: 85.0,
),
const Divider(height: 50.0),
- ListTile(
- tileColor: _drawerProviders.currentIndex == 0
- ? kPrimaryColor
- : Colors.transparent,
- leading: Icon(
- Icons.person,
- color: _drawerProviders.currentIndex == 0
- ? Colors.white
- : Colors.grey,
- ),
- title: Text(
- 'Your Profile',
- style: TextStyle(
- color: _drawerProviders.currentIndex == 0
- ? Colors.white
- : Colors.black,
- ),
- ),
- onTap: () {
- _drawerProviders.currentIndex = 0;
- Navigator.pop(context);
- },
- ),
ListTile(
tileColor: _drawerProviders.currentIndex == 1
? kPrimaryColor
: Colors.transparent,
leading: Icon(
- Icons.contact_phone,
+ Icons.chat,
color: _drawerProviders.currentIndex == 1
? Colors.white
: Colors.grey,
),
title: Text(
- 'Your contacts',
+ 'Conversations',
style: TextStyle(
color: _drawerProviders.currentIndex == 1
? Colors.white
@@ -95,33 +71,21 @@ class MyDrawer extends StatelessWidget {
},
),
ListTile(
- tileColor: _drawerProviders.currentIndex == 3
- ? kPrimaryColor
- : Colors.transparent,
- leading: Icon(
- Icons.group,
- color: _drawerProviders.currentIndex == 3
- ? Colors.white
- : Colors.grey,
+ leading: const Icon(
+ Icons.settings,
+ color: Colors.grey,
),
- title: Text(
- 'Your groups',
- style: TextStyle(
- color: _drawerProviders.currentIndex == 3
- ? Colors.white
- : Colors.black,
- ),
- ),
- onTap: () {
- _drawerProviders.currentIndex = 3;
- Navigator.pop(context);
- },
+ title: const Text('Settings'),
+ onTap: () {},
),
const Spacer(),
ListTile(
leading: const Icon(Icons.refresh),
title: const Text('Switch Profile'),
- subtitle: const Text('*Not supported yet!*'),
+ subtitle: const Text(
+ 'Not supported yet!',
+ style: TextStyle(fontStyle: FontStyle.italic),
+ ),
onTap: () => _switchProfile(context),
),
],
@@ -134,11 +98,8 @@ class MyDrawer extends StatelessWidget {
void _switchProfile(BuildContext context) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
- await Navigator.pushNamedAndRemoveUntil(
- context,
- AppRoutes.setupProfile,
- (route) => route.settings.name == AppRoutes.setupProfile ? true : false,
- );
+ int _count = 0;
+ Navigator.of(context).popUntil((route) => _count++ >= 2);
String _name = prefs.getString('displayName');
await prefs.remove('displayName');
await prefs.remove('fullName');
diff --git a/packages/simplex_app/lib/views/home/home_view.dart b/packages/simplex_app/lib/views/home/home_view.dart
index 177a06114..496d483bf 100644
--- a/packages/simplex_app/lib/views/home/home_view.dart
+++ b/packages/simplex_app/lib/views/home/home_view.dart
@@ -4,8 +4,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:simplex_chat/constants.dart';
import 'package:simplex_chat/providers/drawer_providers.dart';
-import 'package:simplex_chat/views/contacts/contacts_view.dart';
-import 'package:simplex_chat/views/group/group_view.dart';
+import 'package:simplex_chat/views/contacts/conversations.dart';
import 'package:simplex_chat/views/home/drawer.dart';
import 'package:simplex_chat/views/invitations/invitation_view.dart';
import 'package:simplex_chat/views/profile/profile_view.dart';
@@ -22,9 +21,8 @@ class _HomeViewState extends State {
// views
final List _views = [
const ProfileView(),
- const ContactsView(),
+ const Conversations(),
const Invitations(),
- const GroupView(),
];
@override
@@ -44,15 +42,25 @@ class _HomeViewState extends State {
Positioned(
top: MediaQuery.of(context).size.height * 0.03,
left: MediaQuery.of(context).size.width * 0.03,
- child: InkWell(
- onTap: () {
- Scaffold.of(context).openDrawer();
- },
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: SvgPicture.asset('assets/menu.svg'),
- ),
- ),
+ child: _drawerProviders.currentIndex == 0
+ ? InkWell(
+ onTap: () {
+ _drawerProviders.currentIndex = 1;
+ },
+ child: const Padding(
+ padding: EdgeInsets.all(8.0),
+ child: Icon(Icons.arrow_back),
+ ),
+ )
+ : InkWell(
+ onTap: () {
+ Scaffold.of(context).openDrawer();
+ },
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: SvgPicture.asset('assets/menu.svg'),
+ ),
+ ),
),
],
);
diff --git a/packages/simplex_app/lib/views/invitations/invitation_view.dart b/packages/simplex_app/lib/views/invitations/invitation_view.dart
index 28cfdbb63..1ef7083e7 100644
--- a/packages/simplex_app/lib/views/invitations/invitation_view.dart
+++ b/packages/simplex_app/lib/views/invitations/invitation_view.dart
@@ -72,7 +72,7 @@ class _InvitationsState extends State {
child: const Center(
child: Text(
"You don't have any invitations yet!",
- style: kMediumHeadingStyle,
+ style: kSmallHeadingStyle,
textAlign: TextAlign.center,
),
),
diff --git a/packages/simplex_app/lib/views/onBoarding/intro_view.dart b/packages/simplex_app/lib/views/on_boarding/intro_view.dart
similarity index 100%
rename from packages/simplex_app/lib/views/onBoarding/intro_view.dart
rename to packages/simplex_app/lib/views/on_boarding/intro_view.dart
diff --git a/packages/simplex_app/lib/views/scanInvitation/scan_invitation_view.dart b/packages/simplex_app/lib/views/scan_invitation/scan_invitation_view.dart
similarity index 100%
rename from packages/simplex_app/lib/views/scanInvitation/scan_invitation_view.dart
rename to packages/simplex_app/lib/views/scan_invitation/scan_invitation_view.dart
diff --git a/packages/simplex_app/lib/views/splash_screen.dart b/packages/simplex_app/lib/views/splash_screen.dart
index fb07e5f10..68fcd5ad7 100644
--- a/packages/simplex_app/lib/views/splash_screen.dart
+++ b/packages/simplex_app/lib/views/splash_screen.dart
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
-import 'package:flutter_svg/flutter_svg.dart';
import 'package:progress_indicators/progress_indicators.dart';
import 'package:simplex_chat/animations/entrance_fader.dart';
import 'package:simplex_chat/app_routes.dart';
@@ -13,8 +12,8 @@ class SplashScreen extends StatefulWidget {
}
class _SplashScreenState extends State {
- // logincheck
- void _loginCheck() {
+ // delay on splash screen
+ void _splashDelay() {
Future.delayed(const Duration(seconds: 4), () {
Navigator.pushNamed(
context,
@@ -25,7 +24,7 @@ class _SplashScreenState extends State {
@override
void initState() {
- _loginCheck();
+ _splashDelay();
super.initState();
}
@@ -38,14 +37,14 @@ class _SplashScreenState extends State {
children: [
EntranceFader(
duration: const Duration(seconds: 1),
- offset: const Offset(0, 20),
- child: SvgPicture.asset(
- 'assets/logo.svg',
- height: 70,
+ offset: const Offset(0, 15),
+ child: Image.asset(
+ 'assets/simpleX.png',
+ height: 150,
),
),
EntranceFader(
- offset: const Offset(0, 00),
+ offset: const Offset(0, 0),
duration: const Duration(seconds: 1),
delay: const Duration(seconds: 1),
child: JumpingDotsProgressIndicator(
diff --git a/packages/simplex_app/lib/widgets/custom_text_field.dart b/packages/simplex_app/lib/widgets/custom_text_field.dart
index 4b5f0db34..1202ae340 100644
--- a/packages/simplex_app/lib/widgets/custom_text_field.dart
+++ b/packages/simplex_app/lib/widgets/custom_text_field.dart
@@ -60,6 +60,7 @@ class _CustomTextFieldState extends State {
width: width * 0.89,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8.0)),
child: TextFormField(
+ textCapitalization: TextCapitalization.sentences,
controller: widget.textEditingController,
textInputAction: TextInputAction.done,
keyboardType: widget.textInputType,
diff --git a/packages/simplex_app/pubspec.lock b/packages/simplex_app/pubspec.lock
index 3ccf03b10..178881eaa 100644
--- a/packages/simplex_app/pubspec.lock
+++ b/packages/simplex_app/pubspec.lock
@@ -1,6 +1,20 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
+ archive:
+ dependency: transitive
+ description:
+ name: archive
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.1.6"
+ args:
+ dependency: transitive
+ description:
+ name: args
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.3.0"
async:
dependency: transitive
description:
@@ -50,6 +64,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.1+5"
+ crypto:
+ dependency: transitive
+ description:
+ name: crypto
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.0.1"
cupertino_icons:
dependency: "direct main"
description:
@@ -90,6 +111,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ flutter_launcher_icons:
+ dependency: "direct dev"
+ description:
+ name: flutter_launcher_icons
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.9.2"
flutter_lints:
dependency: "direct dev"
description:
@@ -135,6 +163,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
+ image:
+ dependency: transitive
+ description:
+ name: image
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.0.8"
image_picker:
dependency: "direct main"
description:
@@ -427,6 +462,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.2"
+ yaml:
+ dependency: transitive
+ description:
+ name: yaml
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.1.0"
sdks:
dart: ">=2.14.0 <3.0.0"
flutter: ">=2.5.0"
diff --git a/packages/simplex_app/pubspec.yaml b/packages/simplex_app/pubspec.yaml
index 6b4c6ff57..801c2aa9e 100644
--- a/packages/simplex_app/pubspec.yaml
+++ b/packages/simplex_app/pubspec.yaml
@@ -63,6 +63,12 @@ dev_dependencies:
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.0.0
+ flutter_launcher_icons: ^0.9.2
+
+flutter_icons:
+ image_path: "assets/simpleX.png"
+ android: true
+ ios: true
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec