Skip to content

Commit

Permalink
음성추가 카테고리추가 (#16)
Browse files Browse the repository at this point in the history
* change color and theme

* add
  • Loading branch information
jwson-automation authored Aug 28, 2024
1 parent 94277dc commit e2db427
Show file tree
Hide file tree
Showing 30 changed files with 220 additions and 205 deletions.
4 changes: 4 additions & 0 deletions assets/images/1_smile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/images/2_angry.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/images/3_funny.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions assets/images/smile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/voice/voice_1.mp3
Binary file not shown.
Binary file added assets/voice/voice_1.wav
Binary file not shown.
Binary file removed assets/voice/voice_2.mp3
Binary file not shown.
Binary file added assets/voice/voice_2.wav
Binary file not shown.
Binary file removed assets/voice/voice_3.mp3
Binary file not shown.
Binary file added assets/voice/voice_3.wav
Binary file not shown.
Binary file removed assets/voice/voice_4.mp3
Binary file not shown.
4 changes: 2 additions & 2 deletions lib/core/SplashScreen.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:blueberry_flutter_template/core/TopScreen.dart';
import 'package:blueberry_flutter_template/feature/onboarding/OnboardingScreen.dart';
import 'package:blueberry_flutter_template/gen/assets.gen.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -37,7 +38,7 @@ class _SplashScreenState extends State<SplashScreen> {
// 초기화 완료 후 메인 화면으로 전환
if (mounted) {
hasSeenOnboarding
? context.goNamed(OnboardingScreen.name) // 온보딩 화면을 본 경우
? context.goNamed(TopScreen.name) // 온보딩 화면을 본 경우
: context.goNamed(OnboardingScreen.name) // 온보딩 화면을 보지 않은 경우
;
}
Expand All @@ -61,7 +62,6 @@ class _SplashScreenState extends State<SplashScreen> {
Widget build(BuildContext context) {
// 모바일인 경우 스플래쉬 스크린 표시
return Scaffold(
backgroundColor: Colors.white, // 배경색 설정
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
Expand Down
89 changes: 46 additions & 43 deletions lib/core/TopScreen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:blueberry_flutter_template/feature/send/SendMessageScreen.dart';
import 'package:blueberry_flutter_template/feature/setting/SettingScreen.dart';
import 'package:blueberry_flutter_template/feature/voiceOutput/VoiceOutputScreen.dart';
import 'package:blueberry_flutter_template/utils/AppColors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

Expand Down Expand Up @@ -53,52 +54,54 @@ class CustomBottomNavigationBar extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(bottom: 60.0),
padding: EdgeInsets.symmetric(horizontal: 20.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: List.generate(3, (index) {
return Material(
color: Colors.transparent,
child: InkWell(
onTap: () => onPageChanged(index),
customBorder: const CircleBorder(),
child: Container(
width: 100,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 30,
height: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color:
index == currentIndex ? Colors.blue : Colors.grey,
),
),
const SizedBox(
height: 3,
),
if (index == currentIndex)
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 40.0),
child: Container(
margin: const EdgeInsets.only(bottom: 60.0),
decoration: BoxDecoration(
color: accentColor,
borderRadius: BorderRadius.circular(28.0),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: List.generate(3, (index) {
return Material(
color: Colors.transparent,
child: InkWell(
onTap: () => onPageChanged(index),
customBorder: const CircleBorder(),
child: SizedBox(
width: 100,
height: 80,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 20,
height: 6,
width: 30,
height: 30,
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(10)),
shape: BoxShape.circle,
color:
index == currentIndex ? Colors.white : accentColor2,
),
),
const SizedBox(
height: 3,
),
],
),
)),
);
}),
if (index == currentIndex)
Container(
width: 20,
height: 6,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10)),
),
],
),
)),
);
}),
),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/feature/onboarding/OnboardingData.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class OnboardingData {
{
title: AppStrings.onboardingTitle3,
description: AppStrings.onboardingDescription3,
image: Assets.images.sample
image: Assets.images.smile
},
];
}
7 changes: 4 additions & 3 deletions lib/feature/onboarding/OnboardingScreen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:blueberry_flutter_template/core/TopScreen.dart';
import 'package:blueberry_flutter_template/feature/onboarding/widgets/OnboardingPageViewBuilder.dart';
import 'package:blueberry_flutter_template/utils/AppColors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_custom_page_steps_indication/CustomPageStepsIndication.dart';
import 'package:go_router/go_router.dart';
Expand Down Expand Up @@ -70,9 +71,9 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
StepProgress(
totalSteps: OnboardingData.pageDataList.length,
currentStep: _currentPage,
continueButtonColor: Colors.black,
backButtonColor: Colors.blue,
finishButtonColor: Colors.red,
continueButtonColor: accentColor,
backButtonColor: textColor,
finishButtonColor: accentColor,
enableFinishButtonGlow: false,
onNext: (int) {
_onNextPressed();
Expand Down
2 changes: 1 addition & 1 deletion lib/feature/send/SendMessageScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SendMessageTitleText extends StatelessWidget {
Widget build(BuildContext context) {
return const Text(
'경찰서에 문자하기',
style: black24TextStyle,
style: black28boldTextStyle,
);
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/feature/send/widget/SendMessageButton.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:blueberry_flutter_template/feature/send/provider/messageIndexProvider.dart';
import 'package:blueberry_flutter_template/utils/AppColors.dart';
import 'package:blueberry_flutter_template/utils/AppStrings.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
Expand All @@ -11,7 +12,7 @@ class SendMessageButton extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final index = ref.watch(messageIndexProvider);
return CircleAvatar(
backgroundColor: Colors.black,
backgroundColor: accentColor,
radius: 50,
child: IconButton(
onPressed: () async {
Expand Down
6 changes: 2 additions & 4 deletions lib/feature/send/widget/SendMessagePreview.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:blueberry_flutter_template/feature/send/provider/messageIndexProvider.dart';
import 'package:blueberry_flutter_template/utils/AppTextStyle.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

Expand All @@ -19,10 +20,7 @@ class SendMessagePreview extends ConsumerWidget {
Text(
messages[index],
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 32.0,
fontWeight: FontWeight.bold,
),
style: black28boldTextStyle,
),
SizedBox(height: 60),

Expand Down
3 changes: 2 additions & 1 deletion lib/feature/send/widget/SendMessagePreviewChangeButton.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:blueberry_flutter_template/feature/send/provider/messageIndexProvider.dart';
import 'package:blueberry_flutter_template/utils/AppTextStyle.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

Expand All @@ -18,7 +19,7 @@ class SendMessagePreviewChangeButton extends ConsumerWidget {
// 텍스트 변경
},
),
Text('메시지 텍스트 변경하기', style: TextStyle(fontSize: 24.0)),
Text('메시지 텍스트 변경하기', style: black16TextStyle),
],
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/feature/voiceOutput/VoiceOutputScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class VoiceOutputTitleText extends StatelessWidget {
Widget build(BuildContext context) {
return const Text(
'남자 음성 출력 하기',
style: black24TextStyle,
style: black28boldTextStyle,
);
}
}
12 changes: 7 additions & 5 deletions lib/feature/voiceOutput/widget/VoiceOutputButton.dart
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
import 'package:audioplayers/audioplayers.dart';
import 'package:blueberry_flutter_template/feature/voiceOutput/provider/CategoryIondexProvider.dart';
import 'package:blueberry_flutter_template/utils/AppColors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final player = AudioPlayer();

class VoiceOutputButton extends ConsumerWidget {
const VoiceOutputButton({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
final categoryIndex = ref.watch(categoryIndexProvider);

return CircleAvatar(
backgroundColor: Colors.black,
backgroundColor: accentColor,
radius: 50,
child: IconButton(
onPressed: () {
print('음성 출력: ${categoryIndex}');
player.play(AssetSource('voice/voice_${categoryIndex + 1}.wav'));
},
icon: const Icon(Icons.volume_up),
color: Colors.white,
// 마이크 아이콘
iconSize: 50,
// 아이콘 크기
color: Colors.white,
// 아이콘 색상
splashRadius: 30, // 클릭 반경
),
);
Expand Down
19 changes: 10 additions & 9 deletions lib/feature/voiceOutput/widget/VoiceOutputCategoryListView.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import 'package:blueberry_flutter_template/feature/voiceOutput/provider/CategoryIondexProvider.dart';
import 'package:blueberry_flutter_template/gen/assets.gen.dart';
import 'package:blueberry_flutter_template/utils/AppColors.dart';
import 'package:flutter/material.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';

class VoiceOutputCategoryListView extends ConsumerWidget {
const VoiceOutputCategoryListView({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
// 카테고리 데이터를 리스트로 정의
final categories = ['화내는 남편', '놀러온 남자', '데이트 준비중', '조직폭력배 남자'];
final categories = ['마중 나온 남자', '약간 다투는 남자', '혼자 이야기 하는 남자'];
final svgImages = [Assets.images.a1Smile, Assets.images.a2Angry, Assets.images.a3Funny];

return CarouselSlider(
options: CarouselOptions(
Expand All @@ -31,14 +35,11 @@ class VoiceOutputCategoryListView extends ConsumerWidget {
flex: 2, // 여유 공간의 2/3 사용
child: CircleAvatar(
radius: 80, // 원의 크기 조정
backgroundColor: Colors.blue, // 원의 배경색
child: Text(
category[0], // 카테고리 이름의 첫 글자
style: const TextStyle(
color: Colors.white, // 텍스트 색상
fontSize: 40, // 텍스트 크기
fontWeight: FontWeight.bold, // 텍스트 두께
),
backgroundColor: primaryColor, // 원의 배경색
child: SvgPicture.asset(
svgImages[categories.indexOf(category)], // SVG 이미지 표시
width: 100, // SVG 이미지 너비
height: 100, // SVG 이미지 높이
),
),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:blueberry_flutter_template/feature/voiceOutput/provider/CategoryIondexProvider.dart';
import 'package:blueberry_flutter_template/utils/AppColors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

Expand All @@ -11,19 +12,14 @@ class VoiceOutputDescriptionTextBox extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final categoryIndex = ref.watch(categoryIndexProvider);

final descriptionList = [
'너는 항상 왜 그러는 거야?',
'늦었네..?',
'오늘도 수고 많았어~',
'뭐? 어떤 놈인데?',
];
final descriptionList = ['잘 갔다 왔어? 오늘 좀 늦었네?', '왔어? 우리 이야기 좀 하자', '아~ 진짜 드디어 왔네..'];

return Padding(
padding: const EdgeInsets.symmetric(horizontal: 60),
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: Colors.grey.shade300,
color: accentColor,
borderRadius: BorderRadius.circular(14),
),
child: Center(
Expand All @@ -37,7 +33,7 @@ class VoiceOutputDescriptionTextBox extends ConsumerWidget {
descriptionList[categoryIndex],
style: const TextStyle(
fontSize: 16,
color: Colors.black,
color: textColor,
),
),
const SizedBox(width: 16),
Expand Down
Loading

0 comments on commit e2db427

Please sign in to comment.