generated from blueberry-team/blueberry_template_deprecated
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3d40eb
commit cc290d8
Showing
8 changed files
with
179 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
lib/feature/voiceOutput/provider/CategoryIondexProvider.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
||
class CategoryIndexNotifier extends StateNotifier<int> { | ||
CategoryIndexNotifier() : super(0); | ||
|
||
void setIndex(int index) { | ||
state = index; | ||
} | ||
} | ||
|
||
final categoryIndexProvider = | ||
StateNotifierProvider<CategoryIndexNotifier, int>((ref) { | ||
return CategoryIndexNotifier(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'package:blueberry_flutter_template/feature/voiceOutput/provider/CategoryIondexProvider.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
||
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, | ||
radius: 50, | ||
child: IconButton( | ||
onPressed: () { | ||
print('음성 출력: ${categoryIndex}'); | ||
}, | ||
icon: const Icon(Icons.volume_up), | ||
// 마이크 아이콘 | ||
iconSize: 50, | ||
// 아이콘 크기 | ||
color: Colors.white, | ||
// 아이콘 색상 | ||
splashRadius: 30, // 클릭 반경 | ||
), | ||
); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
lib/feature/voiceOutput/widget/VoiceOutputCategoryListView.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import 'package:blueberry_flutter_template/feature/voiceOutput/provider/CategoryIondexProvider.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:carousel_slider/carousel_slider.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
||
class VoiceOutputCategoryListView extends ConsumerWidget { | ||
const VoiceOutputCategoryListView({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
// 카테고리 데이터를 리스트로 정의 | ||
final categories = ['화내는 남편', '놀러온 남자', '데이트 준비중', '조직폭력배 남자']; | ||
|
||
return CarouselSlider( | ||
options: CarouselOptions( | ||
height: 250.0, // 슬라이더 높이 | ||
enableInfiniteScroll: false, // 무한 스크롤 비활성화 | ||
enlargeCenterPage: true, // 중앙의 아이템 확대 | ||
viewportFraction: 0.4, // 각 아이템의 크기 비율 | ||
onPageChanged: (index, reason) { | ||
ref.read(categoryIndexProvider.notifier).setIndex(index); | ||
}, | ||
), | ||
items: categories.map((category) { | ||
return Builder( | ||
builder: (BuildContext context) { | ||
return Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Expanded( | ||
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, // 텍스트 두께 | ||
), | ||
), | ||
), | ||
), | ||
const SizedBox(height: 10), // 텍스트와 원 사이의 간격 | ||
Expanded( | ||
flex: 1, // 여유 공간의 1/3 사용 | ||
child: Text( | ||
category, // 카테고리 이름 표시 | ||
textAlign: TextAlign.center, // 텍스트 가운데 정렬 | ||
softWrap: true, // 텍스트 자동 줄바꿈 | ||
overflow: TextOverflow.ellipsis, // 텍스트가 길면 생략 표시 | ||
maxLines: 2, // 최대 줄 수 설정 | ||
style: const TextStyle(fontSize: 14), // 텍스트 스타일 설정 | ||
), | ||
), | ||
], | ||
); | ||
}, | ||
); | ||
}).toList(), | ||
); | ||
} | ||
} | ||
|
49 changes: 49 additions & 0 deletions
49
lib/feature/voiceOutput/widget/VoiceOutputDescriptionTextBox.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import 'package:blueberry_flutter_template/feature/voiceOutput/provider/CategoryIondexProvider.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
||
class VoiceOutputDescriptionTextBox extends ConsumerWidget { | ||
const VoiceOutputDescriptionTextBox({ | ||
super.key, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final categoryIndex = ref.watch(categoryIndexProvider); | ||
|
||
final descriptionList = [ | ||
'너는 항상 왜 그러는 거야?', | ||
'늦었네..?', | ||
'오늘도 수고 많았어~', | ||
'뭐? 어떤 놈인데?', | ||
]; | ||
|
||
return Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 60), | ||
child: Container( | ||
width: double.infinity, | ||
decoration: BoxDecoration( | ||
color: Colors.grey.shade300, | ||
borderRadius: BorderRadius.circular(14), | ||
), | ||
child: Center( | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
const CircleAvatar( | ||
backgroundColor: Colors.white, | ||
child: Icon(Icons.person, color: Colors.black)), | ||
Text( | ||
descriptionList[categoryIndex], | ||
style: const TextStyle( | ||
fontSize: 16, | ||
color: Colors.black, | ||
), | ||
), | ||
const SizedBox(width: 16), | ||
], | ||
), | ||
)), | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters