diff --git a/assets/icon_dark/carhorn_dark.png b/assets/icon_dark/carhorn_dark.png index 9458970..7a85101 100644 Binary files a/assets/icon_dark/carhorn_dark.png and b/assets/icon_dark/carhorn_dark.png differ diff --git a/assets/icon_dark/crack_dark.png b/assets/icon_dark/crack_dark.png index e5d15f0..9235661 100644 Binary files a/assets/icon_dark/crack_dark.png and b/assets/icon_dark/crack_dark.png differ diff --git a/assets/icon_dark/firealarm_dark.png b/assets/icon_dark/firealarm_dark.png index 60f40e3..786e16c 100644 Binary files a/assets/icon_dark/firealarm_dark.png and b/assets/icon_dark/firealarm_dark.png differ diff --git a/assets/icon_dark/gun_dark.png b/assets/icon_dark/gun_dark.png index fd9d857..8bd7aba 100644 Binary files a/assets/icon_dark/gun_dark.png and b/assets/icon_dark/gun_dark.png differ diff --git a/assets/icon_dark/infantcrying_dark.png b/assets/icon_dark/infantcrying_dark.png index 7d41cac..09db89f 100644 Binary files a/assets/icon_dark/infantcrying_dark.png and b/assets/icon_dark/infantcrying_dark.png differ diff --git a/assets/icon_dark/mamapapa_dark.png b/assets/icon_dark/mamapapa_dark.png index ccab41a..4955144 100644 Binary files a/assets/icon_dark/mamapapa_dark.png and b/assets/icon_dark/mamapapa_dark.png differ diff --git a/assets/icon_dark/name_dark.png b/assets/icon_dark/name_dark.png index fc16e61..f87ce46 100644 Binary files a/assets/icon_dark/name_dark.png and b/assets/icon_dark/name_dark.png differ diff --git a/lib/main.dart b/lib/main.dart index c8d0922..9500b8b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:see_our_sounds/src/screens/category/category_card.dart'; +import 'package:see_our_sounds/src/screens/category/category_screen.dart'; import 'package:see_our_sounds/src/screens/home/home_screen.dart'; +import 'package:see_our_sounds/src/screens/onboarding_screen.dart'; void main() { runApp(ProviderScope(child: const MyApp())); @@ -14,8 +17,11 @@ class MyApp extends StatelessWidget { return MaterialApp( title: 'HearSitter', debugShowCheckedModeBanner: false, - theme: ThemeData(primarySwatch: Colors.blue, fontFamily: 'NotoSansKR'), - home: HomseScreen(), + theme: ThemeData( + primarySwatch: Colors.blue, + fontFamily: 'NotoSansKR', + scaffoldBackgroundColor: Colors.white), + home: OnboardingScreen(), ); } } diff --git a/lib/src/core/app_constants.dart b/lib/src/core/app_constants.dart index e119f0e..dd7caa2 100644 --- a/lib/src/core/app_constants.dart +++ b/lib/src/core/app_constants.dart @@ -1,5 +1,7 @@ import 'dart:ui'; +import 'package:see_our_sounds/src/core/app_assets.dart'; + class AppUri { AppUri._(); @@ -26,33 +28,96 @@ class AppDatabase { } enum SoundCategory { - INFANT_CRYING, - CRACK_SOUND, - FIRE_ALARM, - GUN_SHOT, - CAR_HORN, - ANNOUNCEMNET, - NAME, - MAMAM_PAPA, - BICYCLE_BELL, -} - -enum PuzzleType { MATH_PUZZLE, MEMORY_PUZZLE, BRAIN_PUZZLE } - -class KeyUtil { - static const IS_DARK_MODE = "isDarkMode"; - - static const String splash = 'Splash'; - static const String dashboard = 'Dashboard'; - static const String home = 'Home'; - - static const String calculator = 'Calculator'; - static const String guessSign = 'GuessSign'; - static const String correctAnswer = 'CorrectAnswer'; - static const String quickCalculation = 'QuickCalculation'; - static const String mentalArithmetic = 'MentalArithmetic'; - static const String squareRoot = 'SquareRoot'; - static const String mathPairs = 'MathPairs'; - static const String magicTriangle = 'MagicTriangle'; - static const String picturePuzzle = 'PicturePuzzle'; + BABY_CRYING, // 아기 울음 소리 + CRACK_SOUND, // 유리 깨지는 소리 + FIRE_ALARM, // 화재 알람 + GUN_SHOT, // 총소리 + CAR_HORN, // 자동차 경적 소리 + NAME, // 이름 + MAMA, // 엄마 + PAPA, // 아빠 +} + +String soundCategoryIconLight(SoundCategory soundCategory) { + switch (soundCategory) { + case SoundCategory.BABY_CRYING: + return AppAssets.infantCryingIconLight; + case SoundCategory.CRACK_SOUND: + return AppAssets.crackIconLight; + case SoundCategory.FIRE_ALARM: + return AppAssets.fireAlarmIconLight; + case SoundCategory.GUN_SHOT: + return AppAssets.gunIconLight; + case SoundCategory.CAR_HORN: + return AppAssets.carHornIconLight; + case SoundCategory.NAME: + return AppAssets.nameIconLight; + case SoundCategory.MAMA: + return AppAssets.mamaPapaIconLight; + case SoundCategory.PAPA: + return AppAssets.mamaPapaIconLight; + } +} + +String soundCategoryIconDark(SoundCategory soundCategory) { + switch (soundCategory) { + case SoundCategory.BABY_CRYING: + return AppAssets.infantCryingIconDark; + case SoundCategory.CRACK_SOUND: + return AppAssets.crackIconDark; + case SoundCategory.FIRE_ALARM: + return AppAssets.fireAlarmIconDark; + case SoundCategory.GUN_SHOT: + return AppAssets.gunIconDark; + case SoundCategory.CAR_HORN: + return AppAssets.carHornIconDark; + case SoundCategory.NAME: + return AppAssets.nameIconDark; + case SoundCategory.MAMA: + return AppAssets.mamaPapaIconDark; + case SoundCategory.PAPA: + return AppAssets.mamaPapaIconDark; + } +} + +String soundCategoryToLabel(SoundCategory soundCategory) { + switch (soundCategory) { + case SoundCategory.BABY_CRYING: + return 'Baby Crying'; + case SoundCategory.CRACK_SOUND: + return 'Glass'; + case SoundCategory.FIRE_ALARM: + return 'Fire alarm'; + case SoundCategory.GUN_SHOT: + return 'Gunshot'; + case SoundCategory.CAR_HORN: + return 'Car horn'; + case SoundCategory.NAME: + return 'Name'; + case SoundCategory.MAMA: + return 'Mama'; + case SoundCategory.PAPA: + return 'Papa'; + } +} + +Color soundCategoryColor(SoundCategory soundCategory) { + switch (soundCategory) { + case SoundCategory.BABY_CRYING: + return const Color(0xffffd400); + case SoundCategory.CRACK_SOUND: + return const Color(0xff0072db); + case SoundCategory.FIRE_ALARM: + return const Color(0xffe94025); + case SoundCategory.GUN_SHOT: + return Color(0xff473b3d); + case SoundCategory.CAR_HORN: + return Color(0xff7c1bbb); + case SoundCategory.NAME: + return Color(0xffffa7cb); + case SoundCategory.MAMA: + return Color(0xffff6e11); + case SoundCategory.PAPA: + return Color(0xff008d62); + } } diff --git a/lib/src/screens/category/category_card.dart b/lib/src/screens/category/category_card.dart new file mode 100644 index 0000000..33f4785 --- /dev/null +++ b/lib/src/screens/category/category_card.dart @@ -0,0 +1,62 @@ +import 'package:flutter/material.dart'; +import 'package:see_our_sounds/src/core/app_constants.dart'; + +class CategoryCard extends StatelessWidget { + final String imgUrl; + final Color color; + final double width; + final String audioLabel; + final VoidCallback onTap; + final Color labelColor; + final bool isSelected; + + const CategoryCard( + {Key? key, + required this.audioLabel, + required this.imgUrl, + required this.onTap, + required this.isSelected, + this.color = Colors.white, + this.labelColor = Colors.black, + this.width = 85}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: onTap, + child: Container( + width: width, + height: 80, + decoration: BoxDecoration( + borderRadius: const BorderRadius.all(Radius.circular(15)), + color: color, + boxShadow: [ + BoxShadow( + color: Colors.grey.shade100, blurRadius: 3, spreadRadius: 1) + ]), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 25, + width: 25, + child: Image.asset( + imgUrl, + ), + ), + const SizedBox( + height: 4, + ), + Text( + audioLabel, + style: TextStyle( + fontSize: 13, fontWeight: FontWeight.w500, color: labelColor), + ) + ], + ), + ), + ); + } +} diff --git a/lib/src/screens/category/category_screen.dart b/lib/src/screens/category/category_screen.dart new file mode 100644 index 0000000..d195eea --- /dev/null +++ b/lib/src/screens/category/category_screen.dart @@ -0,0 +1,130 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:see_our_sounds/src/core/app_constants.dart'; +import 'package:see_our_sounds/src/screens/category/category_card.dart'; + +class CategoryScreen extends StatefulWidget { + const CategoryScreen({Key? key}) : super(key: key); + + @override + State createState() => _CategoryScreenState(); +} + +class _CategoryScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: Padding( + padding: const EdgeInsets.only(left: 20), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + 'Tell me\nwhat you wanna hear', + style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold), + ), + const Padding( + padding: EdgeInsets.only(top: 5, bottom: 35), + child: Text( + 'So I can show you what you want to hear.', + style: TextStyle(fontSize: 13, color: AppColor.grayColor), + ), + ), + Padding( + padding: const EdgeInsets.only(right: 20), + child: Align( + alignment: Alignment.center, + child: Wrap( + alignment: WrapAlignment.center, + spacing: 19, + runSpacing: 13, + children: [ + CategoryCard( + color: AppColor.primaryColor, + labelColor: Colors.white, + audioLabel: + soundCategoryToLabel(SoundCategory.BABY_CRYING), + imgUrl: + soundCategoryIconLight(SoundCategory.BABY_CRYING), + width: 120, + onTap: () {}, + isSelected: false), + CategoryCard( + audioLabel: 'Crack Sound', + width: 130, + imgUrl: + soundCategoryIconDark(SoundCategory.CRACK_SOUND), + onTap: () {}, + isSelected: false), + CategoryCard( + audioLabel: + soundCategoryToLabel(SoundCategory.FIRE_ALARM), + imgUrl: + soundCategoryIconDark(SoundCategory.FIRE_ALARM), + width: 110, + onTap: () {}, + isSelected: false), + CategoryCard( + audioLabel: + soundCategoryToLabel(SoundCategory.GUN_SHOT), + imgUrl: soundCategoryIconDark(SoundCategory.GUN_SHOT), + onTap: () {}, + width: 95, + isSelected: false), + CategoryCard( + audioLabel: + soundCategoryToLabel(SoundCategory.CAR_HORN), + imgUrl: soundCategoryIconDark(SoundCategory.CAR_HORN), + width: 100, + onTap: () {}, + isSelected: false), + CategoryCard( + audioLabel: soundCategoryToLabel(SoundCategory.NAME), + imgUrl: soundCategoryIconDark(SoundCategory.NAME), + onTap: () {}, + isSelected: false), + CategoryCard( + audioLabel: soundCategoryToLabel(SoundCategory.MAMA), + imgUrl: soundCategoryIconDark(SoundCategory.MAMA), + onTap: () {}, + isSelected: false), + CategoryCard( + audioLabel: soundCategoryToLabel(SoundCategory.PAPA), + imgUrl: soundCategoryIconDark(SoundCategory.PAPA), + onTap: () {}, + isSelected: false), + ], + ), + ), + ) + ], + ), + ), + ), + bottomNavigationBar: Container( + width: double.infinity, + height: 55, + margin: const EdgeInsets.fromLTRB(20, 0, 20, 20), + decoration: BoxDecoration( + color: AppColor.primaryColor, + borderRadius: const BorderRadius.all(Radius.circular(15)), + boxShadow: [ + BoxShadow( + color: Colors.grey.shade100, blurRadius: 2, spreadRadius: 1) + ]), + child: const Center( + child: Text( + 'Done', + style: TextStyle( + color: Colors.white, + fontSize: 16, + ), + textAlign: TextAlign.center, + ), + ), + ), + ); + } +} diff --git a/lib/src/screens/home/home_screen.dart b/lib/src/screens/home/home_screen.dart index 9881306..af3b7c9 100644 --- a/lib/src/screens/home/home_screen.dart +++ b/lib/src/screens/home/home_screen.dart @@ -1,22 +1,14 @@ -import 'dart:async'; -import 'dart:typed_data'; - import 'package:flutter/material.dart'; -import 'package:flutter/scheduler.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:permission_handler/permission_handler.dart'; import 'package:see_our_sounds/src/core/app_constants.dart'; -import 'package:see_our_sounds/src/core/utils/audio_util.dart'; import 'package:see_our_sounds/src/models/audio_tagging_model.dart'; import 'package:see_our_sounds/src/providers/audio_tagging_api_provider.dart'; import 'package:see_our_sounds/src/providers/audio_tagging_db_provider.dart'; import 'package:see_our_sounds/src/providers/decibel_provider.dart'; import 'package:see_our_sounds/src/providers/stt_provider.dart'; -import 'package:see_our_sounds/src/screens/history_screen.dart'; import 'package:see_our_sounds/src/screens/home/decibel_history_chart.dart'; import 'package:see_our_sounds/src/screens/home/widgets/toggle_button.dart'; -import 'package:see_our_sounds/src/services/audio_tagging_service.dart'; -import 'package:sound_stream/sound_stream.dart'; + import 'package:syncfusion_flutter_gauges/gauges.dart'; final isRecordingProvider = StateProvider((ref) => false); @@ -31,7 +23,6 @@ class HomseScreen extends ConsumerStatefulWidget { class _HomseScreenState extends ConsumerState { @override Widget build(BuildContext context) { - List audioChunks = []; bool isRecording = ref.watch(isRecordingProvider); final stt = ref.watch(sttProvider); final audioTaggingApi = @@ -92,26 +83,8 @@ class _HomseScreenState extends ConsumerState { return const SizedBox.shrink(); }, ), - Spacer(), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Text( - 'Recent History', - style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500), - textAlign: TextAlign.start, - ), - TextButton( - onPressed: () {}, - child: const Text( - 'See All', - style: TextStyle( - color: AppColor.primaryColor, - fontSize: 15, - fontWeight: FontWeight.w400), - )) - ], - ), + const Spacer(), + historyTitle(), Container( width: double.infinity, height: 80, @@ -119,12 +92,12 @@ class _HomseScreenState extends ConsumerState { padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15), decoration: BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(20)), + borderRadius: const BorderRadius.all(Radius.circular(15)), boxShadow: [ BoxShadow( color: Colors.grey.shade100, blurRadius: 2, - spreadRadius: 5) + spreadRadius: 1) ]), child: history.isEmpty ? Row( @@ -176,7 +149,7 @@ class _HomseScreenState extends ConsumerState { decibelGauge(0), ], )), - Spacer(), + const Spacer(), bottomNavigationBar(isRecording) ], ), @@ -184,18 +157,40 @@ class _HomseScreenState extends ConsumerState { )); } + Row historyTitle() { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Text( + 'Recent History', + style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500), + textAlign: TextAlign.start, + ), + TextButton( + onPressed: () {}, + child: const Text( + 'See All', + style: TextStyle( + color: AppColor.primaryColor, + fontSize: 15, + fontWeight: FontWeight.w400), + )) + ], + ); + } + Widget bottomNavigationBar(bool isRecording) { return Container( width: double.infinity, - height: 65, + height: 60, margin: const EdgeInsets.only(bottom: 20), padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 5), decoration: BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(20)), + borderRadius: const BorderRadius.all(Radius.circular(15)), boxShadow: [ BoxShadow( - color: Colors.grey.shade100, blurRadius: 2, spreadRadius: 5) + color: Colors.grey.shade100, blurRadius: 2, spreadRadius: 1) ]), child: Row( children: [ diff --git a/lib/src/screens/onboarding_screen.dart b/lib/src/screens/onboarding_screen.dart new file mode 100644 index 0000000..ab37838 --- /dev/null +++ b/lib/src/screens/onboarding_screen.dart @@ -0,0 +1,82 @@ +import 'package:flutter/material.dart'; +import 'package:see_our_sounds/src/core/app_constants.dart'; + +class OnboardingScreen extends StatefulWidget { + const OnboardingScreen({Key? key}) : super(key: key); + + @override + State createState() => _OnboardingScreenState(); +} + +class _OnboardingScreenState extends State { + TextEditingController textEditingController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: Padding( + padding: const EdgeInsets.only(left: 20), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + "Hi, I'm a HearSitter,\n" + "your deaf assistant.", + style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold)), + Container( + padding: const EdgeInsets.only(top: 5, bottom: 35), + margin: const EdgeInsets.only(right: 40), + child: const Text( + "To help you better, I would like to get to know your name.", + style: TextStyle(fontSize: 13, color: AppColor.grayColor)), + ), + const Text("What's your name?", + style: TextStyle(fontSize: 25, fontWeight: FontWeight.w500)), + const SizedBox( + height: 10, + ), + TextField( + style: const TextStyle( + fontSize: 20, + decoration: TextDecoration.none, + decorationThickness: 0), + cursorColor: Colors.black, + controller: textEditingController, + keyboardType: TextInputType.text, + decoration: const InputDecoration.collapsed( + hintText: 'Your name', + hintStyle: TextStyle(color: AppColor.grayColor, fontSize: 20), + border: InputBorder.none, + ), + ) + ], + ), + ), + ), + bottomNavigationBar: Container( + width: double.infinity, + height: 55, + margin: const EdgeInsets.fromLTRB(20, 0, 20, 20), + decoration: BoxDecoration( + color: AppColor.primaryColor, + borderRadius: const BorderRadius.all(Radius.circular(15)), + boxShadow: [ + BoxShadow( + color: Colors.grey.shade100, blurRadius: 2, spreadRadius: 1) + ]), + child: const Center( + child: Text( + 'Next', + style: TextStyle( + color: Colors.white, + fontSize: 16, + ), + textAlign: TextAlign.center, + ), + ), + ), + ); + } +} diff --git a/lib/src/screens/setting/audio_setting_screen.dart b/lib/src/screens/setting/audio_setting_screen.dart deleted file mode 100644 index eead01b..0000000 --- a/lib/src/screens/setting/audio_setting_screen.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:flutter/material.dart'; - -class AudioSettingScreen extends StatefulWidget { - const AudioSettingScreen({Key? key}) : super(key: key); - - @override - State createState() => _AudioSettingScreenState(); -} - -class _AudioSettingScreenState extends State { - @override - Widget build(BuildContext context) { - var size = MediaQuery.of(context).size; - return Scaffold( - body: SafeArea( - child: Column( - children: [ - - ], - ), - ), - ); - } -} diff --git a/lib/src/screens/setting/setting_gridview_card.dart b/lib/src/screens/setting/setting_gridview_card.dart deleted file mode 100644 index 5c00d2d..0000000 --- a/lib/src/screens/setting/setting_gridview_card.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:flutter/material.dart'; - -class SettingGridViewCard extends StatelessWidget { - final String? imgUrl; - final String? audioLabel; - final VoidCallback? onTap; - final bool? isSelected; - - const SettingGridViewCard( - {Key? key, - required this.audioLabel, - required this.imgUrl, - required this.onTap, - required this.isSelected}) - : super(key: key); - - @override - Widget build(BuildContext context) { - return InkWell( - onTap: onTap, - child: Card( - child: Center( - child: Container( - - ), - ), - ), - ); - } -}