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: "ba393198430278b6595976de84fe170f553cc728"
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: ba393198430278b6595976de84fe170f553cc728
base_revision: ba393198430278b6595976de84fe170f553cc728
- platform: web
create_revision: ba393198430278b6595976de84fe170f553cc728
base_revision: ba393198430278b6595976de84fe170f553cc728

# User provided section

Expand Down
5 changes: 4 additions & 1 deletion android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ gradle-wrapper.jar
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

web/favicon.png
web/icons/Icon-192.png
web/icons/Icon-512.png
web/icons/Icon-maskable-192.png
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
Expand Down
96 changes: 71 additions & 25 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();

@override
void initState() {
super.initState();
Expand All @@ -20,81 +21,107 @@ class _ChatPageState extends State<ChatPage> {
});
}

// Updated messages list with isStarred attribute
List<Map> messages = [
{
"message": "Hola!",
"sent": false,
"isStarred": false, // Added isStarred attribute
},
{
"message": "Nevermind!",
"sent": false,
"isStarred": false,
},
{
"message": "Hello!",
"sent": true,
"isStarred": false,
},
{
"message": "Hi!",
"sent": false,
"isStarred": false,
},
{
"message": "How are you?",
"sent": true,
"isStarred": false,
},
{
"message": "All good! What about you?",
"sent": false,
"isStarred": false,
},
{
"message": "Same here!",
"sent": true,
"isStarred": false,
},
{
"message": "Had lunch?",
"sent": false,
"isStarred": false,
},
{
"message": "Yes! What about you?",
"sent": true,
"isStarred": false,
},
{
"message": "Not yet, Please order me a pizza",
"sent": false,
"isStarred": false,
},
{
"message": "Hahaha, Sure!",
"sent": true,
"isStarred": false,
},
{
"message": "From where do you want to eat?",
"sent": true,
"isStarred": false,
},
{
"message": "Dominos would be good!",
"sent": false,
"isStarred": false,
},
{
"message": "Okay!",
"sent": true,
"isStarred": false,
},
{
"message": "Which one?",
"sent": true,
"isStarred": false,
},
{
"message": "Golden corn with cheese burst would be great!",
"sent": false,
"isStarred": false,
},
{
"message": "Sure!",
"sent": true,
"isStarred": false,
},
{
"message": "I am ordering a Large Golden corn cheese burst",
"sent": true,
"isStarred": false,
},
];

// Method to toggle star status
void _toggleStarMessage(int index) {
setState(() {
messages[index]['isStarred'] = !messages[index]['isStarred'];
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down Expand Up @@ -129,30 +156,49 @@ class _ChatPageState extends State<ChatPage> {
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: Text(
messages[index]["message"],
style: const TextStyle(fontSize: 18),
return GestureDetector(
onLongPress: () =>
_toggleStarMessage(index), // Added GestureDetector
child: 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: Row(
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: Text(
messages[index]["message"],
style: const TextStyle(fontSize: 18),
),
),
if (messages[index]
['isStarred']) // Added star icon
const Icon(
Icons.star,
color: Colors.yellow,
size: 18,
),
],
),
),
),
),
Expand All @@ -163,4 +209,4 @@ class _ChatPageState extends State<ChatPage> {
),
);
}
}
}
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"
}
]
}