forked from eatvio/eatvio_app
feat(chat): add sound
This commit is contained in:
BIN
assets/audio/recive_message.wav
Normal file
BIN
assets/audio/recive_message.wav
Normal file
Binary file not shown.
BIN
assets/audio/send_message.wav
Normal file
BIN
assets/audio/send_message.wav
Normal file
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:dart_pusher_channels/dart_pusher_channels.dart';
|
||||
import 'package:easy_debounce/easy_debounce.dart';
|
||||
import 'package:eatvio_app/core/constants/constants.dart';
|
||||
@@ -98,7 +99,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
|
||||
privateChatChannel.subscribe();
|
||||
|
||||
privateChatChannel.bind('App\\Events\\ChatMessageUpdated').listen((event) {
|
||||
print(jsonDecode(event.data));
|
||||
AudioPlayer().play((AssetSource('audio/recive_message.wav')));
|
||||
List<ChatMessageModel> messagesList = [
|
||||
ChatMessageModel.fromJson(jsonDecode(event.data)['message']),
|
||||
...(state as ChatRoomStateLoaded).chatMessages,
|
||||
@@ -147,6 +148,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
|
||||
data: data,
|
||||
files: files,
|
||||
);
|
||||
AudioPlayer().play((AssetSource('audio/send_message.wav')));
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.dart';
|
||||
|
||||
@@ -18,7 +18,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
// import 'package:syncfusion_flutter_charts/charts.dart';
|
||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||
|
||||
class DiaryScreen extends StatelessWidget {
|
||||
final String? diaryID;
|
||||
@@ -136,30 +136,30 @@ class DiaryScreen extends StatelessWidget {
|
||||
Text(
|
||||
"от дневной суточной нормы",
|
||||
),
|
||||
// Transform.rotate(
|
||||
// angle: -1.5708,
|
||||
// child: ClipRect(
|
||||
// child: Align(
|
||||
// alignment: Alignment.centerRight,
|
||||
// widthFactor: 0.5,
|
||||
// child: SfCircularChart(
|
||||
// series: <CircularSeries>[
|
||||
// RadialBarSeries<NutritionData, String>(
|
||||
// dataSource: state.chartDataCounted,
|
||||
// xValueMapper: (NutritionData data, _) => data.category,
|
||||
// yValueMapper: (NutritionData data, _) => data.nutrition,
|
||||
// pointColorMapper: (NutritionData data, _) => data.color,
|
||||
// trackColor: Color.fromRGBO(59, 130, 246, 1),
|
||||
// trackOpacity: 0.1,
|
||||
// gap: "8%",
|
||||
// radius: "110%",
|
||||
// innerRadius: '20%', // Измените значение по вашему усмотрению
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Transform.rotate(
|
||||
angle: -1.5708,
|
||||
child: ClipRect(
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
widthFactor: 0.5,
|
||||
child: SfCircularChart(
|
||||
series: <CircularSeries>[
|
||||
RadialBarSeries<NutritionData, String>(
|
||||
dataSource: state.chartDataCounted,
|
||||
xValueMapper: (NutritionData data, _) => data.category,
|
||||
yValueMapper: (NutritionData data, _) => data.nutrition,
|
||||
pointColorMapper: (NutritionData data, _) => data.color,
|
||||
trackColor: Color.fromRGBO(59, 130, 246, 1),
|
||||
trackOpacity: 0.1,
|
||||
gap: "8%",
|
||||
radius: "110%",
|
||||
innerRadius: '20%', // Измените значение по вашему усмотрению
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -901,7 +901,7 @@ class DiaryScreen extends StatelessWidget {
|
||||
};
|
||||
}
|
||||
|
||||
/* _buildComment(BuildContext context, DiaryStateLoaded state) {
|
||||
_buildComment(BuildContext context, DiaryStateLoaded state) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 24.h,
|
||||
@@ -934,7 +934,7 @@ class DiaryScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
);
|
||||
} */
|
||||
}
|
||||
|
||||
_buildWakupRetire(BuildContext context, DiaryStateLoaded state) {
|
||||
return Container(
|
||||
|
||||
@@ -50,6 +50,7 @@ dependencies:
|
||||
share_plus: ^10.0.0
|
||||
flutter_html: 3.0.0-beta.2
|
||||
file_picker: ^8.1.1
|
||||
audioplayers: ^5.2.1
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.4.11
|
||||
@@ -65,3 +66,4 @@ flutter:
|
||||
assets:
|
||||
- assets/
|
||||
- assets/images/
|
||||
- assets/audio/
|
||||
|
||||
Reference in New Issue
Block a user