feat(ui): Show a toast when the record button is tapped

This commit is contained in:
PapaTutuWawa 2022-12-03 13:01:54 +01:00
parent cc13078ec5
commit 9affa0e89a
5 changed files with 24 additions and 1 deletions

View File

@ -69,6 +69,9 @@
"warnings": { "warnings": {
"message": { "message": {
"integrityCheckFailed": "Could not verify file integrity" "integrityCheckFailed": "Could not verify file integrity"
},
"conversation": {
"holdForLonger": "Hold button to record a voice message"
} }
}, },
"pages": { "pages": {

View File

@ -69,6 +69,9 @@
"warnings": { "warnings": {
"message": { "message": {
"integrityCheckFailed": "Konnte Integrität der Datei nicht überprüfen" "integrityCheckFailed": "Konnte Integrität der Datei nicht überprüfen"
},
"conversation": {
"holdForLonger": "Button länger gedrückt halten, um eine Sprachnachricht aufzunehmen"
} }
}, },
"pages": { "pages": {

View File

@ -3,6 +3,8 @@ import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart'; import 'package:flutter_vibrate/flutter_vibrate.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:moxxyv2/i18n/strings.g.dart';
import 'package:moxxyv2/shared/helpers.dart'; import 'package:moxxyv2/shared/helpers.dart';
import 'package:moxxyv2/ui/bloc/conversation_bloc.dart'; import 'package:moxxyv2/ui/bloc/conversation_bloc.dart';
import 'package:moxxyv2/ui/constants.dart'; import 'package:moxxyv2/ui/constants.dart';
@ -313,7 +315,14 @@ class ConversationBottomRowState extends State<ConversationBottomRow> {
heroTag: 'fabRest', heroTag: 'fabRest',
onPressed: () { onPressed: () {
switch (state.sendButtonState) { switch (state.sendButtonState) {
case SendButtonState.audio: return; case SendButtonState.audio:
Vibrate.feedback(FeedbackType.heavy);
Fluttertoast.showToast(
msg: t.warnings.conversation.holdForLonger,
gravity: ToastGravity.SNACKBAR,
toastLength: Toast.LENGTH_SHORT,
);
return;
case SendButtonState.cancelCorrection: case SendButtonState.cancelCorrection:
context.read<ConversationBloc>().add( context.read<ConversationBloc>().add(
MessageEditCancelledEvent(), MessageEditCancelledEvent(),

View File

@ -483,6 +483,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
fluttertoast:
dependency: "direct main"
description:
name: fluttertoast
url: "https://pub.dartlang.org"
source: hosted
version: "8.1.1"
freezed: freezed:
dependency: "direct dev" dependency: "direct dev"
description: description:

View File

@ -38,6 +38,7 @@ dependencies:
flutter_secure_storage: 5.0.2 flutter_secure_storage: 5.0.2
flutter_speed_dial: 6.0.0 flutter_speed_dial: 6.0.0
flutter_vibrate: 1.3.0 flutter_vibrate: 1.3.0
fluttertoast: 8.1.1
freezed_annotation: 2.1.0 freezed_annotation: 2.1.0
get_it: 7.2.0 get_it: 7.2.0
hex: 0.2.0 hex: 0.2.0