Skip to content

Commit

Permalink
krille-chan#84 FluffyChat: read receipt icon added to chat input row …
Browse files Browse the repository at this point in the history
…on mobile
  • Loading branch information
carowebtec authored and Caroline committed Mar 29, 2023
1 parent af12ca4 commit de95407
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 23 deletions.
33 changes: 10 additions & 23 deletions lib/pages/chat/chat_input_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:fluffychat/widgets/matrix.dart';
import '../../config/themes.dart';
import 'chat.dart';
import 'input_bar.dart';
import 'read_receipt/chat_input_row_read_receipt_button.dart';

class ChatInputRow extends StatelessWidget {
final ChatController controller;
Expand Down Expand Up @@ -253,36 +254,22 @@ class ChatInputRow extends StatelessWidget {
Container(
height: 56,
alignment: Alignment.center,
child: IconButton(
tooltip: L10n.of(context)!.voiceMessage,
icon: const Icon(Icons.mic_none_outlined),
onPressed: controller.voiceMessageAction,
),
child: Row(children: [
ChatInputRowReadReceiptButton(controller),
IconButton(
tooltip: L10n.of(context)!.voiceMessage,
icon: const Icon(Icons.mic_none_outlined),
onPressed: controller.voiceMessageAction,
)
]),
),
if (!PlatformInfos.isMobile || controller.inputText.isNotEmpty)
Container(
height: 56,
alignment: Alignment.center,
child: Row(
children: [
if (controller.showReadReceiptButton())
controller.requireReadReceipt
? IconButton(
tooltip: L10n.of(context)!.readReceiptOff,
icon: const Icon(
Icons.mark_chat_read,
color: AppConfig.primaryColor,
),
onPressed: controller.toggleReadReceiptAction,
)
: IconButton(
tooltip: L10n.of(context)!.readReceiptOn,
icon: const Icon(
Icons.mark_chat_read_outlined,
color: Colors.grey,
),
onPressed: controller.toggleReadReceiptAction,
),
ChatInputRowReadReceiptButton(controller),
IconButton(
icon: const Icon(Icons.send_outlined),
onPressed: controller.send,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import 'package:flutter/material.dart';

import 'package:flutter_gen/gen_l10n/l10n.dart';

import 'package:fluffychat/config/app_config.dart';
import '../chat.dart';

class ChatInputRowReadReceiptButton extends StatelessWidget {
final ChatController controller;

const ChatInputRowReadReceiptButton(this.controller, {Key? key})
: super(key: key);

@override
Widget build(BuildContext context) {
if (controller.showReadReceiptButton()) {
if (controller.requireReadReceipt) {
return IconButton(
tooltip: L10n.of(context)!.readReceiptOff,
icon: const Icon(
Icons.mark_chat_read,
color: AppConfig.primaryColor,
),
onPressed: controller.toggleReadReceiptAction,
);
} else {
return IconButton(
tooltip: L10n.of(context)!.readReceiptOn,
icon: const Icon(
Icons.mark_chat_read_outlined,
color: Colors.grey,
),
onPressed: controller.toggleReadReceiptAction,
);
}
} else {
return Container();
}
}
}

0 comments on commit de95407

Please sign in to comment.