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
15 changes: 6 additions & 9 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "7482962148e8d758338d8a28f589f317e1e42ba4"
revision: "54e66469a933b60ddf175f858f82eaeb97e48c8d"
channel: "stable"

project_type: app
Expand All @@ -13,14 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: 7482962148e8d758338d8a28f589f317e1e42ba4
base_revision: 7482962148e8d758338d8a28f589f317e1e42ba4
- platform: android
create_revision: 7482962148e8d758338d8a28f589f317e1e42ba4
base_revision: 7482962148e8d758338d8a28f589f317e1e42ba4
- platform: ios
create_revision: 7482962148e8d758338d8a28f589f317e1e42ba4
base_revision: 7482962148e8d758338d8a28f589f317e1e42ba4
create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
- platform: windows
create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d

# User provided section

Expand Down
105 changes: 71 additions & 34 deletions lib/screens/ChatPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class ChatPage extends StatefulWidget {

class _ChatPageState extends State<ChatPage> {
final ScrollController _scrollController = ScrollController();
bool blocked = false;
@override
void initState() {
super.initState();
Expand Down Expand Up @@ -95,6 +96,12 @@ class _ChatPageState extends State<ChatPage> {
},
];

void toggleBlockStatus() {
setState(() {
blocked = !blocked;
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -110,9 +117,13 @@ class _ChatPageState extends State<ChatPage> {
subtitle: const Text("Online"),
trailing: SizedBox(
width: MediaQuery.of(context).size.width * 0.2,
child: const Row(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(
icon: Icon(blocked ? Icons.block : Icons.block_rounded),
onPressed: toggleBlockStatus,
),
Icon(Icons.video_call),
Icon(Icons.call),
Icon(Icons.more_vert),
Expand All @@ -123,43 +134,69 @@ class _ChatPageState extends State<ChatPage> {
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView.builder(
controller: _scrollController,
itemCount: messages.length,
itemBuilder: (context, index) {
int previous = index - 1 >= 0 ? index - 1 : 0;
int current = index;
return Padding(
padding: messages[previous]["sent"] == messages[current]["sent"]
? const EdgeInsets.only(left: 8, right: 8, top: 4)
: const EdgeInsets.only(left: 8, right: 8, top: 8),
child: Align(
alignment: messages[index]["sent"]
? Alignment.centerRight
: Alignment.centerLeft,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: messages[index]["sent"]
? Colors.amber[200]
: Colors.blue[200],
),
child: Padding(
padding: const EdgeInsets.all(10),
child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width * 0.8,
child: Column(
children: [
Container(
height: MediaQuery.of(context).size.height * 0.8,
child: ListView.builder(
controller: _scrollController,
itemCount: messages.length,
itemBuilder: (context, index) {
int previous = index - 1 >= 0 ? index - 1 : 0;
int current = index;
return Padding(
padding:
messages[previous]["sent"] == messages[current]["sent"]
? const EdgeInsets.only(left: 8, right: 8, top: 4)
: const EdgeInsets.only(left: 8, right: 8, top: 8),
child: Align(
alignment: messages[index]["sent"]
? Alignment.centerRight
: Alignment.centerLeft,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: messages[index]["sent"]
? Colors.amber[200]
: Colors.blue[200],
),
child: Text(
messages[index]["message"],
style: const TextStyle(fontSize: 18),
child: Padding(
padding: const EdgeInsets.all(10),
child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width * 0.8,
),
child: Text(
messages[index]["message"],
style: const TextStyle(fontSize: 18),
),
),
),
),
),
),
),
);
}),
);
},
),
),
blocked
? Container(
decoration: BoxDecoration(
color: Color.fromARGB(255, 114, 164, 169),
borderRadius: BorderRadius.circular(10)),
width: MediaQuery.of(context).size.width * 0.3,
padding: EdgeInsets.all(8),
child: Center(
child: Text(
"You blocked this contact",
style: TextStyle(color: Colors.black),
),
),
)
: SizedBox(
height: 0,
)
],
),
),
);
}
Expand Down
23 changes: 15 additions & 8 deletions lib/screens/HomePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,49 +25,56 @@ class _HomePageState extends State<HomePage> {
"Message": "I have reached Lanka",
"time": "11:11",
"readStatus": true,
"sent": false
"sent": false,
"blocked": false
},
{
"name": "Lakshman",
"Message": "Bhrata, mujhe aadesh dein, sabko mai akele maar dunga!",
"time": "11:11",
"readStatus": true,
"sent": false
"sent": false,
"blocked": false
},
{
"name": "Bharat",
"Message": "Kila fateh karke aaiye! Rajya aapka intezar kar raha hai!",
"time": "11:15",
"readStatus": true,
"sent": false
"sent": false,
"blocked": false
},
{
"name": "Shatrughna",
"Message": "ALl the best bhrata shree!",
"time": "11:12",
"readStatus": true,
"sent": false
"sent": false,
"blocked": false
},
{
"name": "Hanuman",
"Message": "Jai Shree Ram. On your command, my lord!",
"time": "11:11",
"readStatus": true,
"sent": false
"sent": false,
"blocked": false
},
{
"name": "Sita",
"Message": "I am waiting, Come soon!",
"time": "11:11",
"readStatus": true,
"sent": false
"sent": false,
"blocked": false
},
{
"name": "Dashrath",
"Message": "All the best!",
"time": "11:20",
"readStatus": true,
"sent": true
"sent": true,
"blocked": false
},
];

Expand All @@ -88,7 +95,7 @@ class _HomePageState extends State<HomePage> {
PopupMenuButton<String>(
onSelected: (value) => {print(value)},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
const <PopupMenuEntry<String>>[
PopupMenuItem(
value: "New Group",
child: Text("New Group"),
Expand Down
3 changes: 1 addition & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.6

dev_dependencies:
flutter_test:
sdk: flutter
Expand Down Expand Up @@ -88,4 +87,4 @@ flutter:
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
# see https://flutter.dev/custom-fonts/#from-packages
Binary file added web/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/icons/Icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/icons/Icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/icons/Icon-maskable-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/icons/Icon-maskable-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html>
<head>
<!--
If you are serving your web app in a path other than the root, change the
href value below to reflect the base path you are serving from.

The path provided below has to start and end with a slash "/" in order for
it to work correctly.

For more details:
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

This is a placeholder for base href that will be replaced by the value of
the `--base-href` argument provided to `flutter build`.
-->
<base href="$FLUTTER_BASE_HREF">

<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">

<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="bloc">
<link rel="apple-touch-icon" href="icons/Icon-192.png">

<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>

<title>bloc</title>
<link rel="manifest" href="manifest.json">

<script>
// The value below is injected by flutter build, do not touch.
const serviceWorkerVersion = null;
</script>
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
</head>
<body>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.initializeEngine().then(function(appRunner) {
appRunner.runApp();
});
}
});
});
</script>
</body>
</html>
35 changes: 35 additions & 0 deletions web/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "bloc",
"short_name": "bloc",
"start_url": ".",
"display": "standalone",
"background_color": "#0175C2",
"theme_color": "#0175C2",
"description": "A new Flutter project.",
"orientation": "portrait-primary",
"prefer_related_applications": false,
"icons": [
{
"src": "icons/Icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/Icon-512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "icons/Icon-maskable-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "icons/Icon-maskable-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
]
}
17 changes: 17 additions & 0 deletions windows/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
flutter/ephemeral/

# Visual Studio user-specific files.
*.suo
*.user
*.userosscache
*.sln.docstates

# Visual Studio build-related files.
x64/
x86/

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
Loading