Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions lib/screens/CallPage.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class CallPage extends StatefulWidget {
const CallPage({super.key});

@override
State<CallPage> createState() => _CallPageState();
}

class _CallPageState extends State<CallPage> {
final List<Map> callPeople = [
{
'name': 'John',
"time": "10:42",
"type": ["All", "none"]
},
{
'name': 'John',
"time": "9:42",
"type": ["All", "missed"]
},
{
'name': 'John',
"time": "8:42",
"type": ["All", "missed"]
},
{
'name': 'John',
"time": "7:42",
"type": ["All", "none"]
}
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 20.0, bottom: 10, top: 20),
child: Align(
alignment: Alignment.topLeft,
child: Text(
"Calls",
style: TextStyle(fontSize: 28),
),
),
),
Expanded(
child: Container(
child: ListView.builder(
itemCount: callPeople.length,
itemBuilder: (context, index) {
return ListTile(
leading: CircleAvatar(
child: Icon(Icons.person),
),
title: Text(callPeople[index]['name']),
subtitle: Text(callPeople[index]['time']),
trailing: Icon(Icons.call),
);
}),
),
)
],
),
);
}
}
197 changes: 65 additions & 132 deletions lib/screens/HomePage.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// ignore_for_file: file_names

import 'package:flutter/material.dart';
import 'package:test_app/screens/CallPage.dart';
import 'package:test_app/screens/ChatPage.dart';
import 'package:test_app/screens/HomeScreen.dart';

class HomePage extends StatefulWidget {
const HomePage({super.key});
Expand All @@ -11,6 +13,15 @@ class HomePage extends StatefulWidget {
}

class _HomePageState extends State<HomePage> {
int _selectedIndex = 0;
final _pageOptions = <Widget>[HomeScreen(), CallPage()];

void changepage(value) {
setState(() {
_selectedIndex = value;
});
}

List menuItems = [
"New Group",
"New Broadcast",
Expand All @@ -19,142 +30,64 @@ class _HomePageState extends State<HomePage> {
"Payment",
"Settings"
];
List chats = [
{
"name": "Ram",
"Message": "I have reached Lanka",
"time": "11:11",
"readStatus": true,
"sent": false
},
{
"name": "Lakshman",
"Message": "Bhrata, mujhe aadesh dein, sabko mai akele maar dunga!",
"time": "11:11",
"readStatus": true,
"sent": false
},
{
"name": "Bharat",
"Message": "Kila fateh karke aaiye! Rajya aapka intezar kar raha hai!",
"time": "11:15",
"readStatus": true,
"sent": false
},
{
"name": "Shatrughna",
"Message": "ALl the best bhrata shree!",
"time": "11:12",
"readStatus": true,
"sent": false
},
{
"name": "Hanuman",
"Message": "Jai Shree Ram. On your command, my lord!",
"time": "11:11",
"readStatus": true,
"sent": false
},
{
"name": "Sita",
"Message": "I am waiting, Come soon!",
"time": "11:11",
"readStatus": true,
"sent": false
},
{
"name": "Dashrath",
"Message": "All the best!",
"time": "11:20",
"readStatus": true,
"sent": true
},
];

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("What's UP"),
Row(
children: [
Icon(Icons.search),
PopupMenuButton<String>(
onSelected: (value) => {print(value)},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
PopupMenuItem(
value: "New Group",
child: Text("New Group"),
),
PopupMenuItem(
value: "New Broadcast",
child: Text("New Broadcast"),
),
PopupMenuItem(
value: "Linked devices",
child: Text("Linked devices"),
),
PopupMenuItem(
value: "Starred message",
child: Text("Starred message"),
),
PopupMenuItem(
value: "Payment",
child: Text("Payment"),
),
PopupMenuItem(
value: "Settings",
child: Text("Settings"),
),
])
],
),
],
),
),
body: ListView.builder(
itemCount: chats.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(chats[index]["name"]),
subtitle: chats[index]["sent"]
? Row(
children: [
const Icon(Icons.done_all),
Text(
chats[index]["Message"],
style: const TextStyle(
overflow: TextOverflow.ellipsis),
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("M Whatsapp"),
Row(
children: [
Icon(Icons.search),
PopupMenuButton<String>(
onSelected: (value) => {print(value)},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
PopupMenuItem(
value: "New Group",
child: Text("New Group"),
),
PopupMenuItem(
value: "New Broadcast",
child: Text("New Broadcast"),
),
],
)
: Text(
chats[index]["Message"],
style: const TextStyle(overflow: TextOverflow.ellipsis),
),
leading: ClipRRect(
borderRadius: BorderRadius.circular(40),
child: index % 2 == 0
? Image.asset("assets/srk.png")
: Image.asset("assets/srk1.png"),
),
trailing: Text(chats[index]["time"]),
onTap: () => Navigator.push(context,
MaterialPageRoute(builder: (context) {
return ChatPage(
name: chats[index]["name"],
image:
index % 2 == 0 ? "assets/srk.png" : "assets/srk1.png",
);
})),
);
}));
PopupMenuItem(
value: "Linked devices",
child: Text("Linked devices"),
),
PopupMenuItem(
value: "Starred message",
child: Text("Starred message"),
),
PopupMenuItem(
value: "Payment",
child: Text("Payment"),
),
PopupMenuItem(
value: "Settings",
child: Text("Settings"),
),
])
],
),
],
),
),
body: _pageOptions[_selectedIndex],
bottomNavigationBar: BottomNavigationBar(
onTap: changepage,
currentIndex: _selectedIndex,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.chat_bubble), label: "chat"),
BottomNavigationBarItem(icon: Icon(Icons.call), label: "call"),
]),
);
}
}
101 changes: 101 additions & 0 deletions lib/screens/HomeScreen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import 'package:flutter/material.dart';
import 'package:test_app/screens/ChatPage.dart';

class HomeScreen extends StatefulWidget {
const HomeScreen({super.key});

@override
State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
List chats = [
{
"name": "Ram",
"Message": "I have reached Lanka",
"time": "11:11",
"readStatus": true,
"sent": false
},
{
"name": "Lakshman",
"Message": "Bhrata, mujhe aadesh dein, sabko mai akele maar dunga!",
"time": "11:11",
"readStatus": true,
"sent": false
},
{
"name": "Bharat",
"Message": "Kila fateh karke aaiye! Rajya aapka intezar kar raha hai!",
"time": "11:15",
"readStatus": true,
"sent": false
},
{
"name": "Shatrughna",
"Message": "ALl the best bhrata shree!",
"time": "11:12",
"readStatus": true,
"sent": false
},
{
"name": "Hanuman",
"Message": "Jai Shree Ram. On your command, my lord!",
"time": "11:11",
"readStatus": true,
"sent": false
},
{
"name": "Sita",
"Message": "I am waiting, Come soon!",
"time": "11:11",
"readStatus": true,
"sent": false
},
{
"name": "Dashrath",
"Message": "All the best!",
"time": "11:20",
"readStatus": true,
"sent": true
},
];
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: chats.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(chats[index]["name"]),
subtitle: chats[index]["sent"]
? Row(
children: [
const Icon(Icons.done_all),
Text(
chats[index]["Message"],
style: const TextStyle(overflow: TextOverflow.ellipsis),
),
],
)
: Text(
chats[index]["Message"],
style: const TextStyle(overflow: TextOverflow.ellipsis),
),
leading: ClipRRect(
borderRadius: BorderRadius.circular(40),
child: index % 2 == 0
? Image.asset("assets/srk.png")
: Image.asset("assets/srk1.png"),
),
trailing: Text(chats[index]["time"]),
onTap: () =>
Navigator.push(context, MaterialPageRoute(builder: (context) {
return ChatPage(
name: chats[index]["name"],
image: index % 2 == 0 ? "assets/srk.png" : "assets/srk1.png",
);
})),
);
});
}
}