Merge branch 'feature/new-ui' into refactor-messg-widget
This commit is contained in:
+113
-110
@@ -185,128 +185,131 @@ class _HomePageState extends State<HomePage> {
|
|||||||
|
|
||||||
Drawer _buildDrawer(BuildContext context, User user) {
|
Drawer _buildDrawer(BuildContext context, User user) {
|
||||||
return Drawer(
|
return Drawer(
|
||||||
child: SafeArea(
|
child: Container(
|
||||||
child: Padding(
|
color: StreamChatTheme.of(context).colorTheme.white,
|
||||||
padding: EdgeInsets.only(
|
child: SafeArea(
|
||||||
top: MediaQuery.of(context).viewPadding.top + 8,
|
child: Padding(
|
||||||
),
|
padding: EdgeInsets.only(
|
||||||
child: Column(
|
top: MediaQuery.of(context).viewPadding.top + 8,
|
||||||
children: [
|
),
|
||||||
Padding(
|
child: Column(
|
||||||
padding: const EdgeInsets.only(
|
children: [
|
||||||
bottom: 20.0,
|
Padding(
|
||||||
left: 8,
|
padding: const EdgeInsets.only(
|
||||||
),
|
bottom: 20.0,
|
||||||
child: Row(
|
left: 8,
|
||||||
children: [
|
),
|
||||||
UserAvatar(
|
child: Row(
|
||||||
user: user,
|
children: [
|
||||||
showOnlineStatus: false,
|
UserAvatar(
|
||||||
constraints: BoxConstraints.tight(Size.fromRadius(20)),
|
user: user,
|
||||||
),
|
showOnlineStatus: false,
|
||||||
Padding(
|
constraints: BoxConstraints.tight(Size.fromRadius(20)),
|
||||||
padding: const EdgeInsets.only(left: 16.0),
|
),
|
||||||
child: Text(
|
Padding(
|
||||||
user.name,
|
padding: const EdgeInsets.only(left: 16.0),
|
||||||
style: TextStyle(
|
child: Text(
|
||||||
fontSize: 16,
|
user.name,
|
||||||
fontWeight: FontWeight.bold,
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: StreamSvgIcon.penWrite(
|
|
||||||
color: StreamChatTheme.of(context)
|
|
||||||
.colorTheme
|
|
||||||
.black
|
|
||||||
.withOpacity(.5),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.popAndPushNamed(
|
|
||||||
context,
|
|
||||||
Routes.NEW_CHAT,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
title: Text(
|
|
||||||
'New direct message',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.5,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
ListTile(
|
||||||
ListTile(
|
leading: StreamSvgIcon.penWrite(
|
||||||
leading: StreamSvgIcon.contacts(
|
color: StreamChatTheme.of(context)
|
||||||
color: StreamChatTheme.of(context)
|
.colorTheme
|
||||||
.colorTheme
|
.black
|
||||||
.black
|
.withOpacity(.5),
|
||||||
.withOpacity(.5),
|
),
|
||||||
),
|
onTap: () {
|
||||||
onTap: () {
|
Navigator.popAndPushNamed(
|
||||||
Navigator.popAndPushNamed(
|
context,
|
||||||
context,
|
Routes.NEW_CHAT,
|
||||||
Routes.NEW_GROUP_CHAT,
|
);
|
||||||
);
|
},
|
||||||
},
|
title: Text(
|
||||||
title: Text(
|
'New direct message',
|
||||||
'New group',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 14.5,
|
||||||
fontSize: 14.5,
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
ListTile(
|
||||||
Expanded(
|
leading: StreamSvgIcon.contacts(
|
||||||
child: Container(
|
color: StreamChatTheme.of(context)
|
||||||
alignment: Alignment.bottomCenter,
|
.colorTheme
|
||||||
child: ListTile(
|
.black
|
||||||
onTap: () async {
|
.withOpacity(.5),
|
||||||
Navigator.pop(context);
|
),
|
||||||
|
onTap: () {
|
||||||
final secureStorage = FlutterSecureStorage();
|
Navigator.popAndPushNamed(
|
||||||
await secureStorage.deleteAll();
|
context,
|
||||||
|
Routes.NEW_GROUP_CHAT,
|
||||||
StreamChat.of(context).client.disconnect(
|
);
|
||||||
clearUser: true,
|
},
|
||||||
);
|
title: Text(
|
||||||
|
'New group',
|
||||||
await Navigator.pushReplacementNamed(
|
style: TextStyle(
|
||||||
context,
|
fontSize: 14.5,
|
||||||
Routes.CHOOSE_USER,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
leading: StreamSvgIcon.user(
|
|
||||||
color: StreamChatTheme.of(context)
|
|
||||||
.colorTheme
|
|
||||||
.black
|
|
||||||
.withOpacity(.5),
|
|
||||||
),
|
),
|
||||||
title: Text(
|
),
|
||||||
'Sign out',
|
),
|
||||||
style: TextStyle(
|
Expanded(
|
||||||
fontSize: 14.5,
|
child: Container(
|
||||||
),
|
alignment: Alignment.bottomCenter,
|
||||||
),
|
child: ListTile(
|
||||||
trailing: IconButton(
|
onTap: () async {
|
||||||
icon: StreamSvgIcon.Icon_moon(
|
Navigator.pop(context);
|
||||||
size: 24,
|
|
||||||
),
|
final secureStorage = FlutterSecureStorage();
|
||||||
color: StreamChatTheme.of(context).colorTheme.grey,
|
await secureStorage.deleteAll();
|
||||||
onPressed: () async {
|
|
||||||
final sp = await StreamingSharedPreferences.instance;
|
StreamChat.of(context).client.disconnect(
|
||||||
sp.setInt(
|
clearUser: true,
|
||||||
'theme',
|
);
|
||||||
Theme.of(context).brightness == Brightness.dark
|
|
||||||
? 1
|
await Navigator.pushReplacementNamed(
|
||||||
: -1,
|
context,
|
||||||
|
Routes.CHOOSE_USER,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
leading: StreamSvgIcon.user(
|
||||||
|
color: StreamChatTheme.of(context)
|
||||||
|
.colorTheme
|
||||||
|
.black
|
||||||
|
.withOpacity(.5),
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
'Sign out',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
trailing: IconButton(
|
||||||
|
icon: StreamSvgIcon.Icon_moon(
|
||||||
|
size: 24,
|
||||||
|
),
|
||||||
|
color: StreamChatTheme.of(context).colorTheme.grey,
|
||||||
|
onPressed: () async {
|
||||||
|
final sp = await StreamingSharedPreferences.instance;
|
||||||
|
sp.setInt(
|
||||||
|
'theme',
|
||||||
|
Theme.of(context).brightness == Brightness.dark
|
||||||
|
? 1
|
||||||
|
: -1,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -63,10 +63,7 @@ class DeletedMessage extends StatelessWidget {
|
|||||||
'Message deleted',
|
'Message deleted',
|
||||||
style: messageTheme.messageText.copyWith(
|
style: messageTheme.messageText.copyWith(
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
color: (Theme.of(context).brightness == Brightness.dark
|
color: messageTheme.createdAt.color,
|
||||||
? StreamChatTheme.of(context).colorTheme.white
|
|
||||||
: StreamChatTheme.of(context).colorTheme.black)
|
|
||||||
.withOpacity(.5),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -279,9 +279,6 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
var leftPadding =
|
var leftPadding =
|
||||||
widget.showUserAvatar != DisplayWidget.gone ? avatarWidth + 8.5 : 0.5;
|
widget.showUserAvatar != DisplayWidget.gone ? avatarWidth + 8.5 : 0.5;
|
||||||
|
|
||||||
final isOnlyEmoji =
|
|
||||||
widget.message.text.characters.every((c) => Emoji.byChar(c) != null);
|
|
||||||
|
|
||||||
final hasFiles =
|
final hasFiles =
|
||||||
widget.message.attachments?.any((element) => element.type == 'file') ==
|
widget.message.attachments?.any((element) => element.type == 'file') ==
|
||||||
true;
|
true;
|
||||||
@@ -934,9 +931,16 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final _emojis = Emoji.all();
|
||||||
bool get isOnlyEmoji =>
|
bool get isOnlyEmoji =>
|
||||||
widget.message.text.characters.isNotEmpty &&
|
widget.message.text.characters.isNotEmpty &&
|
||||||
widget.message.text.characters.every((c) => Emoji.byChar(c) != null);
|
widget.message.text.trim().characters.every((c) =>
|
||||||
|
_emojis.firstWhere(
|
||||||
|
(Emoji emoji) => emoji.char.contains(c),
|
||||||
|
orElse: () => null,
|
||||||
|
) !=
|
||||||
|
null) &&
|
||||||
|
widget.message.text.characters.length < 4;
|
||||||
|
|
||||||
Color _getBackgroundColor() {
|
Color _getBackgroundColor() {
|
||||||
if (hasQuotedMessage) {
|
if (hasQuotedMessage) {
|
||||||
|
|||||||
Reference in New Issue
Block a user