From 0b60eeeae89208cbe422f0a9e95eca3c0f1fcdf9 Mon Sep 17 00:00:00 2001 From: nailsonseat Date: Fri, 16 Feb 2024 15:29:53 +0530 Subject: [PATCH] Post merge cleanup --- .../lib/components/material_textformfield.dart | 2 +- frontend/lib/provider/home_provider.dart | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/frontend/lib/components/material_textformfield.dart b/frontend/lib/components/material_textformfield.dart index 7ea6e7b..dec7de6 100644 --- a/frontend/lib/components/material_textformfield.dart +++ b/frontend/lib/components/material_textformfield.dart @@ -14,7 +14,7 @@ class MaterialTextFormField extends StatelessWidget { this.enabled, this.controllerLessValue, this.textAlign, - this.inputFormatters}); + this.inputFormatters, this.onTap}); final TextEditingController? controller; diff --git a/frontend/lib/provider/home_provider.dart b/frontend/lib/provider/home_provider.dart index 70d2027..cce4962 100644 --- a/frontend/lib/provider/home_provider.dart +++ b/frontend/lib/provider/home_provider.dart @@ -7,8 +7,7 @@ import '../components/menu_tile.dart'; import '../models/student.dart'; import '../models/faculty.dart'; -final homeProvider = - StateNotifierProvider((ref) => UserProvider(ref)); +final homeProvider = StateNotifierProvider((ref) => UserProvider(ref)); class HomeState { final bool toggleSearch; @@ -44,6 +43,7 @@ class UserProvider extends StateNotifier { menuTiles: [], ), ); + get searchController => state.searchController; get toggleSearch => state.toggleSearch; @@ -87,10 +87,7 @@ class UserProvider extends StateNotifier { ), MenuTile( title: 'Broadcast', - onTap: () { - // Navigate to the broadcast page - context.push('/user_home/broadcast'); - }, + onTap: () => context.push('/user_home/broadcast'), icon: Icons.announcement, primaryColor: Colors.greenAccent.shade100, secondaryColor: Colors.greenAccent.shade200, @@ -98,17 +95,14 @@ class UserProvider extends StateNotifier { MenuTile( title: "Chat\nRoom", onTap: () => context.push('/user_home/chat_room'), - primaryColor: Colors.blueAccent.shade100, - secondaryColor: Colors.blueAccent.shade200, + primaryColor: Colors.redAccent.shade100, + secondaryColor: Colors.redAccent.shade200, icon: Icons.search, ), ]; String query = state.searchController.text; state = state.copyWith( - menuTiles: menuTiles - .where((element) => - element.title.toLowerCase().contains(query.toLowerCase())) - .toList()); + menuTiles: menuTiles.where((element) => element.title.toLowerCase().contains(query.toLowerCase())).toList()); } void toggleSearchBar() {