Skip to content

Commit

Permalink
Post merge cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nailsonseat committed Feb 16, 2024
1 parent 47071cb commit 0b60eee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion frontend/lib/components/material_textformfield.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MaterialTextFormField extends StatelessWidget {
this.enabled,
this.controllerLessValue,
this.textAlign,
this.inputFormatters});
this.inputFormatters,
this.onTap});

final TextEditingController? controller;
Expand Down
18 changes: 6 additions & 12 deletions frontend/lib/provider/home_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import '../components/menu_tile.dart';
import '../models/student.dart';
import '../models/faculty.dart';

final homeProvider =
StateNotifierProvider<UserProvider, HomeState>((ref) => UserProvider(ref));
final homeProvider = StateNotifierProvider<UserProvider, HomeState>((ref) => UserProvider(ref));

class HomeState {
final bool toggleSearch;
Expand Down Expand Up @@ -44,6 +43,7 @@ class UserProvider extends StateNotifier<HomeState> {
menuTiles: [],
),
);

get searchController => state.searchController;

get toggleSearch => state.toggleSearch;
Expand Down Expand Up @@ -87,28 +87,22 @@ class UserProvider extends StateNotifier<HomeState> {
),
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,
),
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() {
Expand Down

0 comments on commit 0b60eee

Please sign in to comment.