diff --git a/lib/screens/GroupPage.dart b/lib/screens/GroupPage.dart new file mode 100644 index 0000000..4efded5 --- /dev/null +++ b/lib/screens/GroupPage.dart @@ -0,0 +1,88 @@ +import 'package:flutter/material.dart'; + +class GroupPage extends StatefulWidget { + const GroupPage({super.key}); + + @override + State createState() => _GroupPageState(); +} + +class _GroupPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('INFO BVCA', style: TextStyle(color: Colors.white)), + backgroundColor: Colors.black, + leading: IconButton( + icon: Icon(Icons.arrow_back, color: Colors.white), + onPressed: () { + // Handle back button press + }, + ), + ), + body: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListTile( + leading: Icon(Icons.announcement, color: Colors.teal), + title: + Text('Announcements', style: TextStyle(color: Colors.white)), + subtitle: Text('Mona: Submit your assignment', + style: TextStyle(color: Colors.grey)), + trailing: Text('11:29 AM', style: TextStyle(color: Colors.grey)), + onTap: () { + // Handle Announcements tap + }, + ), + Divider(color: Colors.grey), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Text('Groups you\'re in', + style: TextStyle(color: Colors.white, fontSize: 16)), + ), + ListTile( + leading: CircleAvatar( + backgroundColor: Colors.red, + child: Icon(Icons.group, color: Colors.white), + ), + title: Text('B.Voc C.A (UNITED 🧑‍💻🏴‍☠️)', + style: TextStyle(color: Colors.white)), + subtitle: Text('CR: All classes are cancel', + style: TextStyle(color: Colors.grey)), + trailing: Text('4:05 PM', style: TextStyle(color: Colors.grey)), + onTap: () { + // Handle Group tap + }, + ), + Divider(color: Colors.grey), + Spacer(), + Center( + child: Text( + 'Other groups added to the community will appear here.\nCommunity members can join these groups.', + textAlign: TextAlign.center, + style: TextStyle(color: Colors.grey)), + ), + Spacer(), + Padding( + padding: const EdgeInsets.only(bottom: 16.0), + child: Center( + child: ElevatedButton( + onPressed: () { + // Handle Add group button press + }, + child: Text('Add group'), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.teal, + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/HomePage.dart b/lib/screens/HomePage.dart index 5266eb5..8d3c88e 100644 --- a/lib/screens/HomePage.dart +++ b/lib/screens/HomePage.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:test_app/screens/ChatPage.dart'; +import 'package:test_app/screens/GroupPage.dart'; class HomePage extends StatefulWidget { const HomePage({super.key}); @@ -119,42 +120,58 @@ class _HomePageState extends State { ], ), ), - 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( + body: Column( + children: [ + 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), ), - ], - ) - : 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"]), + 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", + ); + })), + ); + }), + Row(children: [ + ListTile( + title: Text("Info BVCA"), + trailing: Icon(Icons.chevron_right), onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) { - return ChatPage( - name: chats[index]["name"], - image: - index % 2 == 0 ? "assets/srk.png" : "assets/srk1.png", - ); + return GroupPage(); })), - ); - })); + ), + ]) + ], + )); } }