From 9ac7357e49c7b740c1b24ab69fda35f9125181ff Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Fri, 19 Apr 2024 19:48:31 +0800 Subject: [PATCH] :sparkles: New chat menu --- lib/i18n/app_en.arb | 2 ++ lib/i18n/app_zh.arb | 2 ++ lib/widgets/chat/chat_new.dart | 15 +++++++++++++++ lib/widgets/chat/message.dart | 29 +++++++++++++++-------------- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/lib/i18n/app_en.arb b/lib/i18n/app_en.arb index 80735ee..7d512f4 100644 --- a/lib/i18n/app_en.arb +++ b/lib/i18n/app_en.arb @@ -38,6 +38,8 @@ "reactionAdded": "Your reaction has been added.", "reactionRemoved": "Your reaction has been removed.", "chatNew": "New Chat", + "chatNewCreate": "Create a channel", + "chatNewJoin": "Join a exists channel", "chatMessagePlaceholder": "Write a message...", "chatMessageEditNotify": "You are about editing a message.", "chatMessageReplyNotify": "You are about replying a message.", diff --git a/lib/i18n/app_zh.arb b/lib/i18n/app_zh.arb index 95c1dc9..b86e70f 100644 --- a/lib/i18n/app_zh.arb +++ b/lib/i18n/app_zh.arb @@ -38,6 +38,8 @@ "reactionAdded": "你的反应已被添加。", "reactionRemoved": "你的反应已被移除。", "chatNew": "新聊天", + "chatNewCreate": "新建频道", + "chatNewJoin": "加入已有频道", "chatMessagePlaceholder": "发条消息……", "chatMessageEditNotify": "你正在编辑信息中……", "chatMessageReplyNotify": "你正在回复消息中……", diff --git a/lib/widgets/chat/chat_new.dart b/lib/widgets/chat/chat_new.dart index c6c9b51..2f16509 100644 --- a/lib/widgets/chat/chat_new.dart +++ b/lib/widgets/chat/chat_new.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -19,6 +20,20 @@ class ChatNewAction extends StatelessWidget { style: Theme.of(context).textTheme.headlineSmall, ), ), + Expanded( + child: ListView( + children: [ + ListTile( + leading: const Icon(Icons.add), + title: Text(AppLocalizations.of(context)!.chatNewCreate), + ), + ListTile( + leading: const Icon(Icons.travel_explore), + title: Text(AppLocalizations.of(context)!.chatNewJoin), + ), + ], + ), + ), ], ), ); diff --git a/lib/widgets/chat/message.dart b/lib/widgets/chat/message.dart index 374c84f..5cf0670 100644 --- a/lib/widgets/chat/message.dart +++ b/lib/widgets/chat/message.dart @@ -29,20 +29,21 @@ class ChatMessage extends StatelessWidget { Container( padding: const EdgeInsets.only(left: 8, right: 8), child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Transform( - alignment: Alignment.center, - transform: Matrix4.rotationY(math.pi), - child: const Icon(Icons.reply, size: 16), - ), - const SizedBox(width: 8), - CircleAvatar( - radius: 10, - backgroundImage: NetworkImage(item.replyTo!.sender.account.avatar), - ), - ]), + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Transform( + alignment: Alignment.center, + transform: Matrix4.rotationY(math.pi), + child: const Icon(Icons.reply, size: 16), + ), + const SizedBox(width: 8), + CircleAvatar( + radius: 10, + backgroundImage: NetworkImage(item.replyTo!.sender.account.avatar), + ), + ], + ), ), Expanded( child: Column(