Skip to content

Commit 6581e8f

Browse files
committed
part 06
1 parent 19e8330 commit 6581e8f

File tree

5 files changed

+336
-11
lines changed

5 files changed

+336
-11
lines changed

README.md

Lines changed: 85 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,91 @@
1-
# firebase_app_web
1+
<a href="https://www.buymeacoffee.com/DevStack06" target="_blank" align="center">
2+
<p align="center">
3+
<img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174">
4+
</p>
5+
</a>
26

3-
A new Flutter project.
7+
### Chat App Development Front-End and Back-End using Flutter, SocketIo, and NodeJS.
48

5-
## Getting Started
9+
<br>
610

7-
This project is a starting point for a Flutter application.
11+
<img src= "https://github.com/DevStack06/images/blob/master/ChatImages/chatapp.png" >
12+
<br>
813

9-
A few resources to get you started if this is your first Flutter project:
14+
### Playlist for Chat App Development series -:
1015

11-
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12-
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
16+
| Playlist Name | | YouTube Playlist Link |
17+
| ----------------------------------------------------------- | --- | ---------------------------------------------------------------------------- |
18+
| Chat App Development (Main Playlist) | | [Link](https://youtube.com/playlist?list=PLtIU0BH0pkKovuEaNsrGE_Xd5Tz3m1zeC) |
19+
| Chat App Development (Only Front-End using Flutter) | | [Link](https://youtube.com/playlist?list=PLtIU0BH0pkKrgqaT-9JSrRRyetkVEkDn6) |
20+
| Chat Server Development (Only Back-End using Node/SocketIo) | | [Link](https://youtube.com/playlist?list=PLtIU0BH0pkKqKm88PUSRWiKsZ50ztsITv) |
1321

14-
For help getting started with Flutter, view our
15-
[online documentation](https://flutter.dev/docs), which offers tutorials,
16-
samples, guidance on mobile development, and a full API reference.
22+
<br>
23+
24+
### Some Screenshots of this series
25+
26+
<h3 align="center" style="color:green" >1. Home page</h3>
27+
<p align="center">
28+
<img src="https://github.com/DevStack06/images/blob/master/ChatImages/homepage.png" width="350"></img>
29+
</p>
30+
<br>
31+
<h3 align="center" style="color:green" >2. Chat page</h3>
32+
<p align="center">
33+
<img src="https://github.com/DevStack06/images/blob/master/ChatImages/IndividualCHatPage.png" width="350"></img>
34+
</p>
35+
<br>
36+
<h3 align="center" style="color:green" >3. Camera Page</h3>
37+
<p align="center">
38+
<img src="https://github.com/DevStack06/images/blob/master/ChatImages/Camerapage.png" width="350"></img>
39+
</p>
40+
<br>
41+
<h3 align="center" style="color:green" >4. PopUp Menu Item</h3>
42+
<p align="center">
43+
<img src="https://github.com/DevStack06/images/blob/master/ChatImages/PopupMenuItem.png" width="350"></img>
44+
</p>
45+
<br>
46+
<h3 align="center" style="color:green" >5. Emoji Picker</h3>
47+
<p align="center">
48+
<img src="https://github.com/DevStack06/images/blob/master/ChatImages/EmojiPicker.png" width="350"></img>
49+
</p>
50+
<br>
51+
<h3 align="center" style="color:green" >6. Create Group Page</h3>
52+
<p align="center">
53+
<img src="https://github.com/DevStack06/images/blob/master/ChatImages/SelectCOntactPage.png" width="350"></img>
54+
</p>
55+
<br>
56+
<h3 align="center" style="color:green" >7. Select Contact Page</h3>
57+
<p align="center">
58+
<img src="https://github.com/DevStack06/images/blob/master/ChatImages/newgroup.png" width="350"></img>
59+
</p>
60+
<br>
61+
<h3 align="center" style="color:green" >8.View Image/Video Page </h3>
62+
<p align="center">
63+
<img src="https://github.com/DevStack06/images/blob/master/ChatImages/Viewphoto.png" width="350"></img>
64+
</p>
65+
<br>
66+
67+
### Some Other playlist
68+
69+
| Playlist Name | | YouTube Playlist Link |
70+
| -------------------------------------------------------------------- | --- | ------------------------------------------------------------------------------------------- |
71+
| Flutter model class series, for Rest API connection and JSON parsing | | [Link](https://www.youtube.com/playlist?list=PLtIU0BH0pkKpXE-1vC7NswofFPby1OYh-) |
72+
| Flutter Basic series | | [link](https://www.youtube.com/playlist?list=PLtIU0BH0pkKrk8C7KToFeRSVTi2CLpFTG) |
73+
| Blog App Development (Main Playlist) | | [Link](https://youtube.com/playlist?list=PLtIU0BH0pkKoE2PBvgbHEBPAP-sd670VI) |
74+
| Blog App Development (Only Front-End using Flutter) | | [Link](https://www.youtube.com/watch?v=6VCLeHRnixg&list=PLtIU0BH0pkKpitsp5jzt-yDAoXAFBkcPb) |
75+
| Blog App Development (Only Back-End using Node/ExpressJs) | | [Link](https://www.youtube.com/watch?v=T35T8nzyRDI&list=PLtIU0BH0pkKqypuOtDhcXZ4oATJfji49r) |
76+
77+
### **_If this tutorial helped you please give a star and also fork the repo, Thank you happy coding :)_**
78+
79+
### To use this app follow below instructions-:
80+
81+
1. Clone this app using below syntax -:
82+
83+
> git clone https://github.com/DevStack06/Whatsapp-Clone-Flutter.git
84+
85+
2. After cloning install packages using below syntax -:
86+
> flutter pub get
87+
88+
Above command will install all the neccery packges.
89+
90+
3. Run the app on your mobile using below command -:
91+
> flutter run

lib/pages/PhoneAuth.dart

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
import 'dart:async';
2+
3+
import 'package:flutter/material.dart';
4+
import 'package:otp_text_field/otp_field.dart';
5+
import 'package:otp_text_field/otp_field_style.dart';
6+
import 'package:otp_text_field/style.dart';
7+
8+
class PhoneAuth extends StatefulWidget {
9+
PhoneAuth({Key key}) : super(key: key);
10+
11+
@override
12+
_PhoneAuthState createState() => _PhoneAuthState();
13+
}
14+
15+
class _PhoneAuthState extends State<PhoneAuth> {
16+
TextEditingController _phneController = TextEditingController();
17+
// Timer _timer;
18+
int _start = 30;
19+
String buttonName = "Send";
20+
bool wait = false;
21+
22+
@override
23+
Widget build(BuildContext context) {
24+
return Scaffold(
25+
backgroundColor: Colors.black87,
26+
appBar: AppBar(
27+
backgroundColor: Colors.black87,
28+
centerTitle: true,
29+
title: Text(
30+
"SignUp",
31+
style: TextStyle(color: Colors.white, fontSize: 24),
32+
),
33+
),
34+
body: SingleChildScrollView(
35+
child: Container(
36+
height: MediaQuery.of(context).size.height,
37+
width: MediaQuery.of(context).size.width,
38+
child: Column(
39+
children: [
40+
SizedBox(
41+
height: 150,
42+
),
43+
textItem("Enter your phone Number", _phneController, false),
44+
SizedBox(
45+
height: 25,
46+
),
47+
subdivider(
48+
"Enter your 6 digit otp ",
49+
),
50+
SizedBox(
51+
height: 30,
52+
),
53+
otp(),
54+
SizedBox(
55+
height: 40,
56+
),
57+
RichText(
58+
text: TextSpan(children: [
59+
TextSpan(
60+
text: "Send OTP again in ",
61+
style: TextStyle(
62+
fontSize: 16,
63+
color: Colors.yellowAccent,
64+
),
65+
),
66+
TextSpan(
67+
text: " 00:$_start ",
68+
style: TextStyle(
69+
fontSize: 16,
70+
color: Colors.pinkAccent,
71+
),
72+
),
73+
TextSpan(
74+
text: "sec ",
75+
style: TextStyle(
76+
fontSize: 16,
77+
color: Colors.yellowAccent,
78+
),
79+
),
80+
]),
81+
),
82+
Expanded(child: Container()),
83+
Container(
84+
height: 60,
85+
width: MediaQuery.of(context).size.width - 60,
86+
decoration: BoxDecoration(
87+
color: Color(0xffff9601),
88+
borderRadius: BorderRadius.circular(15),
89+
),
90+
child: Center(
91+
child: Text(
92+
"Let's Go",
93+
style: TextStyle(
94+
color: Color(0xfffbe2ae),
95+
fontSize: 19,
96+
fontWeight: FontWeight.w700,
97+
),
98+
),
99+
),
100+
),
101+
SizedBox(
102+
height: 150,
103+
),
104+
],
105+
),
106+
),
107+
),
108+
);
109+
}
110+
111+
Widget subdivider(String text) {
112+
return Container(
113+
width: MediaQuery.of(context).size.width - 30,
114+
child: Row(
115+
children: [
116+
Expanded(
117+
child: Container(
118+
height: 1,
119+
margin: EdgeInsets.symmetric(horizontal: 12),
120+
color: Colors.grey,
121+
),
122+
),
123+
Text(
124+
text,
125+
style: TextStyle(color: Colors.white, fontSize: 15),
126+
),
127+
Expanded(
128+
child: Container(
129+
height: 1,
130+
margin: EdgeInsets.symmetric(horizontal: 12),
131+
color: Colors.grey,
132+
),
133+
),
134+
],
135+
),
136+
);
137+
}
138+
139+
Widget otp() {
140+
return OTPTextField(
141+
length: 6,
142+
width: MediaQuery.of(context).size.width - 34,
143+
fieldWidth: 58,
144+
otpFieldStyle: OtpFieldStyle(
145+
backgroundColor: Color(0xff1d1d1d),
146+
borderColor: Colors.white,
147+
),
148+
style: TextStyle(fontSize: 17, color: Colors.white),
149+
textFieldAlignment: MainAxisAlignment.spaceAround,
150+
fieldStyle: FieldStyle.underline,
151+
onCompleted: (pin) {
152+
print("Completed: " + pin);
153+
},
154+
);
155+
}
156+
157+
Widget textItem(
158+
String labeltext, TextEditingController controller, bool obscureText) {
159+
return Container(
160+
width: MediaQuery.of(context).size.width - 40,
161+
decoration: BoxDecoration(
162+
color: Color(0xff1d1d1d),
163+
borderRadius: BorderRadius.circular(15),
164+
),
165+
height: 60,
166+
child: TextFormField(
167+
controller: controller,
168+
obscureText: obscureText,
169+
keyboardType: TextInputType.number,
170+
style: TextStyle(
171+
fontSize: 17,
172+
color: Colors.white,
173+
),
174+
decoration: InputDecoration(
175+
border: InputBorder.none,
176+
hintText: labeltext,
177+
hintStyle: TextStyle(
178+
fontSize: 17,
179+
color: Colors.white54,
180+
),
181+
contentPadding: EdgeInsets.symmetric(vertical: 19, horizontal: 8),
182+
prefixIcon: Padding(
183+
padding: const EdgeInsets.symmetric(vertical: 14, horizontal: 15),
184+
child: Text(
185+
"(+91)",
186+
style: TextStyle(
187+
fontSize: 17,
188+
color: Colors.white,
189+
),
190+
),
191+
),
192+
suffixIcon: InkWell(
193+
onTap: wait
194+
? null
195+
: () {
196+
setState(() {
197+
_start = 30;
198+
buttonName = "Resnd";
199+
wait = true;
200+
});
201+
startTimer();
202+
},
203+
child: Padding(
204+
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
205+
child: Text(
206+
buttonName,
207+
style: TextStyle(
208+
fontSize: 17,
209+
fontWeight: FontWeight.bold,
210+
color: wait ? Colors.grey : Colors.white,
211+
),
212+
),
213+
),
214+
),
215+
),
216+
),
217+
);
218+
}
219+
220+
void startTimer() {
221+
const oneSec = const Duration(seconds: 1);
222+
Timer _timer = new Timer.periodic(
223+
oneSec,
224+
(Timer timer) {
225+
if (_start == 0) {
226+
setState(() {
227+
timer.cancel();
228+
wait = false;
229+
});
230+
} else {
231+
setState(() {
232+
_start--;
233+
});
234+
}
235+
},
236+
);
237+
}
238+
}

lib/pages/SignUpPage.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:firebase_app_web/Service/Auth_Service.dart';
22
import 'package:firebase_app_web/pages/HomePage.dart';
3+
import 'package:firebase_app_web/pages/PhoneAuth.dart';
34
import 'package:firebase_app_web/pages/SignInPage.dart';
45
import 'package:flutter/material.dart';
56
import 'package:flutter_svg/flutter_svg.dart';
@@ -48,7 +49,10 @@ class _SignUpPageState extends State<SignUpPage> {
4849
SizedBox(
4950
height: 15,
5051
),
51-
buttonItem("assets/phone.svg", "Continue with Mobile", 30, () {}),
52+
buttonItem("assets/phone.svg", "Continue with Mobile", 30, () {
53+
Navigator.push(context,
54+
MaterialPageRoute(builder: (builder) => PhoneAuth()));
55+
}),
5256
SizedBox(
5357
height: 18,
5458
),

pubspec.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ packages:
184184
url: "https://pub.dartlang.org"
185185
source: hosted
186186
version: "1.3.0"
187+
otp_text_field:
188+
dependency: "direct main"
189+
description:
190+
name: otp_text_field
191+
url: "https://pub.dartlang.org"
192+
source: hosted
193+
version: "1.1.1"
187194
path:
188195
dependency: transitive
189196
description:

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ dependencies:
3333
flutter_svg: ^0.22.0
3434
google_sign_in: ^5.0.2
3535
flutter_secure_storage: ^4.2.0
36+
otp_text_field: ^1.1.1
3637

3738
dev_dependencies:
3839
flutter_test:

0 commit comments

Comments
 (0)