From 634f3fa046693f2a93da9d4579f1b4b8a2f4bae4 Mon Sep 17 00:00:00 2001 From: HuiChan Seo <78739194+seochan99@users.noreply.github.com> Date: Tue, 20 Feb 2024 14:26:52 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8Feat:=20=EB=AC=B8=EC=9E=A5=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Podfile | 12 +--- ios/Podfile.lock | 8 ++- ios/Runner.xcodeproj/project.pbxproj | 3 + lib/utilities/base/supported_locale.dart | 6 ++ .../word/widget/word_sentence_widget.dart | 55 +++++++++++++++++++ 5 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 lib/utilities/base/supported_locale.dart create mode 100644 lib/views/word/widget/word_sentence_widget.dart diff --git a/ios/Podfile b/ios/Podfile index 231da75..d580bf7 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -41,14 +41,6 @@ post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| - - # You can enable the permissions needed here. For example to enable camera - # permission, just remove the `#` character in front so it looks like this: - # - # ## dart: PermissionGroup.camera - # 'PERMISSION_CAMERA=1' - # - # Preprocessor definitions can be found at: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler_apple/ios/Classes/PermissionHandlerEnums.h config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ '$(inherited)', @@ -67,8 +59,8 @@ post_install do |installer| ## dart: PermissionGroup.camera # 'PERMISSION_CAMERA=1', - ## dart: PermissionGroup.microphone - # 'PERMISSION_MICROPHONE=1', + # dart: PermissionGroup.microphone + 'PERMISSION_MICROPHONE=1', ## dart: PermissionGroup.speech # 'PERMISSION_SPEECH_RECOGNIZER=1', diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 8c7380d..592c3a6 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -634,6 +634,8 @@ PODS: - AppAuth/Core (1.6.2) - AppAuth/ExternalUserAgent (1.6.2): - AppAuth/Core + - audioplayers_darwin (0.0.1): + - Flutter - BoringSSL-GRPC (0.0.24): - BoringSSL-GRPC/Implementation (= 0.0.24) - BoringSSL-GRPC/Interface (= 0.0.24) @@ -840,6 +842,7 @@ PODS: - FlutterMacOS DEPENDENCIES: + - audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`) - cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) - firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`) @@ -887,6 +890,8 @@ SPEC REPOS: - Try EXTERNAL SOURCES: + audioplayers_darwin: + :path: ".symlinks/plugins/audioplayers_darwin/ios" cloud_firestore: :path: ".symlinks/plugins/cloud_firestore/ios" firebase_auth: @@ -923,6 +928,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: abseil: 926fb7a82dc6d2b8e1f2ed7f3a718bce691d1e46 AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570 + audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 BoringSSL-GRPC: 3175b25143e648463a56daeaaa499c6cb86dad33 cloud_firestore: ba576bee785a05ff952e4da7fa4e23c196917436 Firebase: 10c8cb12fb7ad2ae0c09ffc86cd9c1ab392a0031 @@ -964,6 +970,6 @@ SPEC CHECKSUMS: Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96 video_player_avfoundation: 02011213dab73ae3687df27ce441fbbcc82b5579 -PODFILE CHECKSUM: 0b2c97823421f8b156b8e4753a469ac167670df8 +PODFILE CHECKSUM: 163f6f9d5628ee98843cfda3ba4b8cb24bfcad1a COCOAPODS: 1.15.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 7052ce9..9ba0168 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -476,6 +476,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -605,6 +606,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = ""; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -653,6 +655,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/lib/utilities/base/supported_locale.dart b/lib/utilities/base/supported_locale.dart new file mode 100644 index 0000000..3852096 --- /dev/null +++ b/lib/utilities/base/supported_locale.dart @@ -0,0 +1,6 @@ +import 'package:flutter/material.dart'; + +const supportedLocale = [ + Locale.fromSubtags(languageCode: 'ko'), // English + Locale.fromSubtags(languageCode: 'us'), // German +]; diff --git a/lib/views/word/widget/word_sentence_widget.dart b/lib/views/word/widget/word_sentence_widget.dart new file mode 100644 index 0000000..91c7709 --- /dev/null +++ b/lib/views/word/widget/word_sentence_widget.dart @@ -0,0 +1,55 @@ +// word_sentence_widget.dart +import 'dart:io'; + +import 'package:earlips/models/word_data_model.dart'; +import 'package:earlips/viewModels/record/record_viewmodel.dart'; +import 'package:earlips/viewModels/word/word_viewmodel.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_sound/flutter_sound.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:get/get.dart'; + +class WordSentenceWidget extends StatelessWidget { + final List wordDataList; + const WordSentenceWidget({super.key, required this.wordDataList}); + + @override + Widget build(BuildContext context) { + final wordViewModel = Get.find(); // Access your ViewModel! + return GetBuilder( + init: RecordViewModel(), + builder: (viewModel) => Center( + child: Column( + children: [ + const Text('WordSentenceWidget'), + StreamBuilder( + stream: viewModel.recorder.onProgress, + builder: (context, snapshot) { + final disposition = snapshot.hasData + ? snapshot.data!.duration + : Duration.zero; + + return Text('Recorder: ${disposition.inSeconds}s'); + }), + ElevatedButton( + onPressed: () async { + if (viewModel.recorder.isRecording) { + await viewModel.stopRecording( + wordDataList[wordViewModel.currentIndex.value] + .wordCard + .word); + } else { + await viewModel.startRecording(); + } + }, + child: Icon( + viewModel.recorder.isRecording ? Icons.stop : Icons.mic, + size: 40, + ), + ), + ], + ), + ), + ); + } +}