You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class HomeScreen extends StatelessWidget { @OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blue, // Blue background
body: Center(
child: Text(
'Hello from Jayant Bista!', // Greeting message
style: TextStyle(
fontSize: 24,
color: Colors.black, // Black text
),
),
),
);
}
}
class SignUpScreen extends StatelessWidget {
final TextEditingController emailController = TextEditingController();
final TextEditingController passwordController = TextEditingController();
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'dart:io';
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
home: HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blue, // Blue background
body: Center(
child: Text(
'Hello from Jayant Bista!', // Greeting message
style: TextStyle(
fontSize: 24,
color: Colors.black, // Black text
),
),
),
);
}
}
class SignUpScreen extends StatelessWidget {
final TextEditingController emailController = TextEditingController();
final TextEditingController passwordController = TextEditingController();
void signUp() async {
try {
await FirebaseAuth.instance.createUserWithEmailAndPassword(
email: emailController.text,
password: passwordController.text,
);
print("User signed up!");
} catch (e) {
print("Error: $e");
}
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Sign Up')),
body: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: [
TextField(
controller: emailController,
decoration: InputDecoration(labelText: 'Email'),
),
TextField(
controller: passwordController,
decoration: InputDecoration(labelText: 'Password'),
obscureText: true,
),
ElevatedButton(onPressed: signUp, child: Text('Sign Up')),
],
),
),
);
}
}
class ChatScreen extends StatefulWidget {
@OverRide
_ChatScreenState createState() => _ChatScreenState();
}
class _ChatScreenState extends State {
final TextEditingController messageController = TextEditingController();
void sendMessage() {
FirebaseFirestore.instance.collection('chats').add({
'message': messageController.text,
'timestamp': FieldValue.serverTimestamp(),
});
messageController.clear();
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Chat')),
body: Column(
children: [
Expanded(
child: StreamBuilder(
stream: FirebaseFirestore.instance
.collection('chats')
.orderBy('timestamp')
.snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) return CircularProgressIndicator();
var messages = snapshot.data!.docs;
return ListView.builder(
itemCount: messages.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(messages[index]['message']),
);
},
);
},
),
),
Padding(
padding: EdgeInsets.all(8.0),
child: Row(
children: [
Expanded(
child: TextField(
controller: messageController,
decoration: InputDecoration(hintText: 'Type a message'),
),
),
IconButton(
icon: Icon(Icons.send),
onPressed: sendMessage,
),
],
),
),
],
),
);
}
}
class UploadScreen extends StatelessWidget {
void uploadFile() async {
final ImagePicker picker = ImagePicker();
final XFile? image = await picker.pickImage(source: ImageSource.gallery);
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Upload Photo')),
body: Center(
child: ElevatedButton(
onPressed: uploadFile,
child: Text('Upload Photo'),
),
),
);
}
}
class VideoCallScreen extends StatelessWidget {
static const String appId = "YOUR_AGORA_APP_ID";
void initializeAgora() {
AgoraRtcEngine.create(appId);
AgoraRtcEngine.enableVideo();
AgoraRtcEngine.joinChannel(null, 'test', null, 0);
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Video Call')),
body: Center(
child: ElevatedButton(
onPressed: initializeAgora,
child: Text('Start Video Call'),
),
),
);
}
}
The text was updated successfully, but these errors were encountered: