Skip to content

Commit 089f2d6

Browse files
committed
Added chat screen
1 parent f994da2 commit 089f2d6

File tree

13 files changed

+423
-37
lines changed

13 files changed

+423
-37
lines changed

.vscode/settings.json

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
11
{
2-
"cmake.configureOnOpen": false
3-
}
2+
"cmake.configureOnOpen": false,
3+
4+
"[javascript]": {
5+
"editor.defaultFormatter": "esbenp.prettier-vscode"
6+
},
7+
"[jsonc]": {
8+
"editor.defaultFormatter": "esbenp.prettier-vscode"
9+
},
10+
"[json]": {
11+
"editor.defaultFormatter": "esbenp.prettier-vscode"
12+
},
13+
14+
"editor.formatOnSave": true,
15+
"[dart]": {
16+
"editor.formatOnSave": true
17+
},
18+
"editor.defaultFormatter": "esbenp.prettier-vscode",
19+
"editor.codeActionsOnSave": {
20+
"source.organizeImports": true
21+
},
22+
"prettier.singleQuote": true,
23+
"prettier.trailingComma": "all",
24+
"prettier.printWidth": 80,
25+
"prettier.useTabs": false,
26+
"prettier.tabWidth": 2
27+
}

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ android {
4747
applicationId "com.example.femunity"
4848
// You can update the following values to match your application needs.
4949
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
50-
minSdkVersion 19
50+
minSdkVersion 21
5151
targetSdkVersion flutter.targetSdkVersion
5252
versionCode flutterVersionCode.toInteger()
5353
versionName flutterVersionName

android/app/src/main/AndroidManifest.xml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.example.femunity">
3+
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
4+
<uses-permission android:name="android.permission.INTERNET"/>
5+
<uses-permission android:name="android.permission.BLUETOOTH"/>
6+
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
7+
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
8+
<queries>
9+
<intent>
10+
<action android:name="android.speech.RecognitionService" />
11+
</intent>
12+
</queries>
313
<application
414
android:label="femunity"
515
android:name="${applicationName}"
@@ -12,6 +22,7 @@
1222
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1323
android:hardwareAccelerated="true"
1424
android:windowSoftInputMode="adjustResize">
25+
1526
<!-- Specifies an Android theme to apply to this Activity as soon as
1627
the Android process has started. This theme is visible to the user
1728
while the Flutter UI initializes. After that, this theme continues
@@ -31,4 +42,5 @@
3142
android:name="flutterEmbedding"
3243
android:value="2" />
3344
</application>
34-
</manifest>
45+
46+
</manifest>

assets/images/sakhi.png

185 KB
Loading

lib/features/communities/screens/health_screen.dart

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:femunity/features/communities/screens/mindfulness.dart';
2+
import 'package:femunity/features/posts/screens/chat_screen.dart';
23
import 'package:femunity/features/posts/screens/journal_screen.dart';
34
import 'package:femunity/features/posts/screens/tracking_screen.dart';
45
import 'package:flutter/material.dart';
@@ -50,7 +51,8 @@ class WellnessScreen extends StatelessWidget {
5051
children: [
5152
SizedBox(
5253
height: 48,
53-
child: const Icon(Icons.track_changes, size: 48, color: Colors.white),
54+
child: const Icon(Icons.track_changes,
55+
size: 48, color: Colors.white),
5456
),
5557
SizedBox(height: 16),
5658
Text(
@@ -83,7 +85,8 @@ class WellnessScreen extends StatelessWidget {
8385
children: [
8486
SizedBox(
8587
height: 48,
86-
child: const Icon(Icons.spa, size: 48, color: Colors.white),
88+
child: const Icon(Icons.spa,
89+
size: 48, color: Colors.white),
8790
),
8891
SizedBox(height: 16),
8992
Text(
@@ -116,7 +119,8 @@ class WellnessScreen extends StatelessWidget {
116119
children: [
117120
SizedBox(
118121
height: 48,
119-
child: const Icon(Icons.book, size: 48, color: Colors.white),
122+
child: const Icon(Icons.book,
123+
size: 48, color: Colors.white),
120124
),
121125
SizedBox(height: 16),
122126
Text(
@@ -131,28 +135,37 @@ class WellnessScreen extends StatelessWidget {
131135
),
132136
),
133137
),
134-
Container(
135-
decoration: BoxDecoration(
136-
color: Colors.orange,
137-
borderRadius: BorderRadius.circular(16.0),
138-
),
139-
child: Column(
140-
mainAxisAlignment: MainAxisAlignment.center,
141-
children: [
142-
SizedBox(
143-
height: 48,
144-
child: const Icon(Icons.music_note, size: 48, color: Colors.white),
145-
),
146-
SizedBox(height: 16),
147-
Text(
148-
'Music',
149-
style: TextStyle(
150-
fontSize: 18,
151-
fontWeight: FontWeight.bold,
152-
color: Colors.white,
138+
GestureDetector(
139+
onTap: () {
140+
Navigator.push(
141+
context,
142+
MaterialPageRoute(builder: (context) => ChatScreen()),
143+
);
144+
},
145+
child: Container(
146+
decoration: BoxDecoration(
147+
color: Colors.orange,
148+
borderRadius: BorderRadius.circular(16.0),
149+
),
150+
child: Column(
151+
mainAxisAlignment: MainAxisAlignment.center,
152+
children: [
153+
SizedBox(
154+
height: 48,
155+
child: const Icon(Icons.chat_bubble,
156+
size: 48, color: Colors.white),
153157
),
154-
),
155-
],
158+
SizedBox(height: 16),
159+
Text(
160+
'Sakhi',
161+
style: TextStyle(
162+
fontSize: 18,
163+
fontWeight: FontWeight.bold,
164+
color: Colors.white,
165+
),
166+
),
167+
],
168+
),
156169
),
157170
),
158171
],
@@ -163,4 +176,4 @@ class WellnessScreen extends StatelessWidget {
163176
),
164177
);
165178
}
166-
}
179+
}

lib/features/home/drawer/profile_drawer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class ProfileDrawer extends ConsumerWidget {
128128
Padding(
129129
padding: const EdgeInsets.all(16),
130130
child: Text(
131-
'Version 1.20.00',
131+
'Version 1.20.10',
132132
style: Theme.of(context).textTheme.caption,
133133
),
134134
),
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
import 'package:femunity/features/posts/screens/feature_box.dart';
2+
import 'package:femunity/theme/pallate.dart';
3+
import 'package:flutter/material.dart';
4+
import 'package:speech_to_text/speech_recognition_result.dart';
5+
import 'package:speech_to_text/speech_to_text.dart';
6+
7+
class ChatScreen extends StatefulWidget {
8+
const ChatScreen({Key? key}) : super(key: key);
9+
10+
@override
11+
State<ChatScreen> createState() => _ChatScreenState();
12+
}
13+
14+
class _ChatScreenState extends State<ChatScreen> {
15+
final speechToText = SpeechToText();
16+
String lastWords = '';
17+
18+
@override
19+
void initState() {
20+
super.initState();
21+
initSpeechToText();
22+
}
23+
24+
Future<void> initSpeechToText() async {
25+
await speechToText.initialize();
26+
setState(() {});
27+
}
28+
29+
Future<void> startListening() async {
30+
await speechToText.listen(onResult: onSpeechResult);
31+
setState(() {});
32+
}
33+
34+
/// Manually stop the active speech recognition session
35+
/// Note that there are also timeouts that each platform enforces
36+
/// and the SpeechToText plugin supports setting timeouts on the
37+
/// listen method.
38+
Future<void> stopListening() async {
39+
await speechToText.stop();
40+
setState(() {});
41+
}
42+
43+
/// This is the callback that the SpeechToText plugin calls when
44+
/// the platform returns recognized words.
45+
void onSpeechResult(SpeechRecognitionResult result) {
46+
setState(() {
47+
lastWords = result.recognizedWords;
48+
});
49+
}
50+
51+
@override
52+
void dispose() {
53+
super.dispose();
54+
speechToText.stop();
55+
}
56+
57+
@override
58+
Widget build(BuildContext context) {
59+
return Scaffold(
60+
appBar: AppBar(
61+
title: const Text('Sakhi'),
62+
),
63+
body: SingleChildScrollView(
64+
child: Column(
65+
children: [
66+
Stack(
67+
children: [
68+
Center(
69+
child: Container(
70+
height: 120,
71+
width: 120,
72+
margin: const EdgeInsets.only(top: 4),
73+
decoration: BoxDecoration(
74+
color: Colors.black,
75+
shape: BoxShape.circle,
76+
),
77+
),
78+
),
79+
Container(
80+
height: 140,
81+
decoration: BoxDecoration(
82+
shape: BoxShape.circle,
83+
image: DecorationImage(
84+
image: AssetImage(
85+
"assets/images/sakhi.png",
86+
),
87+
),
88+
),
89+
),
90+
],
91+
),
92+
Container(
93+
padding: const EdgeInsets.symmetric(
94+
horizontal: 20,
95+
vertical: 10,
96+
),
97+
margin:
98+
const EdgeInsets.symmetric(horizontal: 40).copyWith(top: 30),
99+
decoration: BoxDecoration(
100+
border: Border.all(color: Colors.white),
101+
borderRadius: BorderRadius.circular(20)
102+
.copyWith(topLeft: const Radius.circular(0)),
103+
),
104+
child: const Padding(
105+
padding: const EdgeInsets.symmetric(vertical: 10.0),
106+
child: Text(
107+
"Hey! What's on your mind?",
108+
style: TextStyle(
109+
fontSize: 20,
110+
fontFamily: 'Times New Roman',
111+
),
112+
),
113+
),
114+
),
115+
Container(
116+
padding: const EdgeInsets.all(10),
117+
alignment: Alignment.centerLeft,
118+
margin: const EdgeInsets.only(
119+
top: 8,
120+
left: 10,
121+
),
122+
child: const Text(
123+
"Here are a few features",
124+
style: TextStyle(
125+
fontFamily: "Times New Roman",
126+
fontSize: 18,
127+
fontWeight: FontWeight.bold,
128+
),
129+
),
130+
),
131+
Column(
132+
children: [
133+
FeatureBox(
134+
color: Pallete.firstSuggestionBoxColor,
135+
headerText: 'Share your feelings',
136+
descriptionText:
137+
"Talk and interact with non-judgmental ears.",
138+
),
139+
FeatureBox(
140+
color: Pallete.secondSuggestionBoxColor,
141+
headerText: "headerText",
142+
descriptionText: "descriptionText",
143+
),
144+
FeatureBox(
145+
color: Pallete.thirdSuggestionBoxColor,
146+
headerText: "headerText",
147+
descriptionText: "descriptionText",
148+
),
149+
],
150+
),
151+
],
152+
),
153+
),
154+
floatingActionButton: FloatingActionButton(
155+
backgroundColor: Colors.yellow,
156+
onPressed: () async {
157+
if (await speechToText.hasPermission && speechToText.isNotListening) {
158+
await startListening();
159+
} else if (speechToText.isListening) {
160+
await stopListening();
161+
} else {
162+
initSpeechToText();
163+
}
164+
},
165+
child: const Icon(Icons.mic),
166+
),
167+
);
168+
}
169+
}

0 commit comments

Comments
 (0)