Skip to content

Commit

Permalink
Further improve Naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobkoerber committed Oct 31, 2024
1 parent d5137e1 commit 556e9a2
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';

class CafeteriasSearchResultView extends ConsumerWidget {
const CafeteriasSearchResultView({super.key, required this.viewModel});
const CafeteriasSearchResultView({super.key, required this.searchVM});

final Provider<SearchViewModel> viewModel;
final Provider<SearchViewModel> searchVM;

@override
Widget build(BuildContext context, WidgetRef ref) {
return SearchResultCardView<CafeteriaSearchViewModel, Cafeteria>(
searchCategory: SearchCategory.cafeterias,
searchVM: viewModel,
searchVM: searchVM,
searchCategoryVM: cafeteriaSearchViewModel,
body: (cafeteria) => ListTile(
title: Text(cafeteria.name),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';

class CalendarSearchResultView extends ConsumerWidget {
const CalendarSearchResultView({super.key, required this.viewModel});
const CalendarSearchResultView({super.key, required this.searchVM});

final Provider<SearchViewModel> viewModel;
final Provider<SearchViewModel> searchVM;

@override
Widget build(BuildContext context, WidgetRef ref) {
return SearchResultCardView<CalendarSearchViewModel, CalendarEvent>(
searchCategory: SearchCategory.calendar,
searchVM: viewModel,
searchVM: searchVM,
searchCategoryVM: calendarSearchViewModel,
body: (calendarEvent) => ListTile(
title: Text(calendarEvent.title ?? "-"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class GradeSearchResultView extends ConsumerWidget {
const GradeSearchResultView({super.key, required this.viewModel});
const GradeSearchResultView({super.key, required this.searchVM});

final Provider<SearchViewModel> viewModel;
final Provider<SearchViewModel> searchVM;

@override
Widget build(BuildContext context, WidgetRef ref) {
return SearchResultCardView<GradesSearchViewModel, Grade>(
searchCategory: SearchCategory.grade,
searchVM: viewModel,
searchVM: searchVM,
searchCategoryVM: gradesSearchViewModel,
body: (grade) => GradeRow(grade: grade),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class LectureSearchResultView extends ConsumerWidget {
const LectureSearchResultView({super.key, required this.viewModel});
const LectureSearchResultView({super.key, required this.searchVM});

final Provider<SearchViewModel> viewModel;
final Provider<SearchViewModel> searchVM;

@override
Widget build(BuildContext context, WidgetRef ref) {
return SearchResultCardView<LectureSearchViewModel, Lecture>(
searchCategory: SearchCategory.lectures,
searchVM: viewModel,
searchVM: searchVM,
searchCategoryVM: lectureSearchViewModel,
body: (lecture) => LectureView(
lecture: lecture,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class MovieSearchResultView extends ConsumerWidget {
const MovieSearchResultView({super.key, required this.viewModel});
const MovieSearchResultView({super.key, required this.searchVM});

final Provider<SearchViewModel> viewModel;
final Provider<SearchViewModel> searchVM;

@override
Widget build(BuildContext context, WidgetRef ref) {
return SearchResultCardView<MovieSearchViewModel, MovieSearch>(
searchCategory: SearchCategory.movie,
searchVM: viewModel,
searchVM: searchVM,
searchCategoryVM: movieSearchViewModel,
body: (movieSearch) => ListTile(
leading: ClipRRect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';

class NavigaTumSearchResultView extends ConsumerWidget {
const NavigaTumSearchResultView({super.key, required this.viewModel});
const NavigaTumSearchResultView({super.key, required this.searchVM});

final Provider<SearchViewModel> viewModel;
final Provider<SearchViewModel> searchVM;

@override
Widget build(BuildContext context, WidgetRef ref) {
return SearchResultCardView<NavigaTumSearchViewModel,
NavigaTumNavigationEntity>(
searchCategory: SearchCategory.rooms,
searchVM: viewModel,
searchVM: searchVM,
searchCategoryVM: navigaTumSearchViewModel,
body: (entity) => ListTile(
title: Text(entity.getFormattedName()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';

class NewsSearchResultView extends ConsumerWidget {
const NewsSearchResultView({super.key, required this.viewModel});
const NewsSearchResultView({super.key, required this.searchVM});

final Provider<SearchViewModel> viewModel;
final Provider<SearchViewModel> searchVM;

@override
Widget build(BuildContext context, WidgetRef ref) {
return SearchResultCardView<NewsSearchViewModel, NewsSearch>(
searchCategory: SearchCategory.news,
searchVM: viewModel,
searchVM: searchVM,
searchCategoryVM: newsSearchViewModel,
body: (newsSearch) {
final imageUrl =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';

class PersonSearchResultView extends ConsumerWidget {
const PersonSearchResultView({super.key, required this.viewModel});
const PersonSearchResultView({super.key, required this.searchVM});

final Provider<SearchViewModel> viewModel;
final Provider<SearchViewModel> searchVM;

@override
Widget build(BuildContext context, WidgetRef ref) {
return SearchResultCardView<PersonSearchViewModel, Person>(
searchCategory: SearchCategory.persons,
searchVM: viewModel,
searchVM: searchVM,
searchCategoryVM: personSearchViewModel,
body: (person) => ListTile(
title: Text(person.fullNameWithTitle),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class PersonalLectureSearchResultView extends ConsumerWidget {
const PersonalLectureSearchResultView({super.key, required this.viewModel});
const PersonalLectureSearchResultView({super.key, required this.searchVM});

final Provider<SearchViewModel> viewModel;
final Provider<SearchViewModel> searchVM;

@override
Widget build(BuildContext context, WidgetRef ref) {
return SearchResultCardView<PersonalLectureSearchViewModel, Lecture>(
searchCategory: SearchCategory.personalLectures,
searchVM: viewModel,
searchVM: searchVM,
searchCategoryVM: personalLectureSearchViewModel,
body: (lecture) => LectureView(
lecture: lecture,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';

class StudentClubSearchResultView extends ConsumerWidget {
const StudentClubSearchResultView({super.key, required this.viewModel});
const StudentClubSearchResultView({super.key, required this.searchVM});

final Provider<SearchViewModel> viewModel;
final Provider<SearchViewModel> searchVM;

@override
Widget build(BuildContext context, WidgetRef ref) {
return SearchResultCardView<StudentClubSearchViewModel, StudentClubSearch>(
searchCategory: SearchCategory.studentClub,
searchVM: viewModel,
searchVM: searchVM,
searchCategoryVM: studentClubSearchViewModel,
body: (studentClubSearch) {
return ListTile(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class StudyRoomSearchResultView extends ConsumerWidget {
const StudyRoomSearchResultView({super.key, required this.viewModel});
const StudyRoomSearchResultView({super.key, required this.searchVM});

final Provider<SearchViewModel> viewModel;
final Provider<SearchViewModel> searchVM;

@override
Widget build(BuildContext context, WidgetRef ref) {
return SearchResultCardView<StudyRoomSearchViewModel,
StudyRoomSearchResult>(
searchCategory: SearchCategory.studyRoom,
searchVM: viewModel,
searchVM: searchVM,
searchCategoryVM: studyRoomSearchViewModel,
body: (studyRoomSearchResult) =>
StudyRoomWidgetView(studyRoomSearchResult.studyRoomGroup),
Expand Down
22 changes: 11 additions & 11 deletions lib/searchComponent/views/search_result_view_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@ class SearchResultViewBuilder extends StatelessWidget {
Widget build(BuildContext context) {
switch (searchCategory) {
case SearchCategory.grade:
return GradeSearchResultView(viewModel: searchVM);
return GradeSearchResultView(searchVM: searchVM);
case SearchCategory.cafeterias:
return CafeteriasSearchResultView(viewModel: searchVM);
return CafeteriasSearchResultView(searchVM: searchVM);
case SearchCategory.calendar:
return CalendarSearchResultView(viewModel: searchVM);
return CalendarSearchResultView(searchVM: searchVM);
case SearchCategory.movie:
return MovieSearchResultView(viewModel: searchVM);
return MovieSearchResultView(searchVM: searchVM);
case SearchCategory.news:
return NewsSearchResultView(viewModel: searchVM);
return NewsSearchResultView(searchVM: searchVM);
case SearchCategory.studentClub:
return StudentClubSearchResultView(viewModel: searchVM);
return StudentClubSearchResultView(searchVM: searchVM);
case SearchCategory.studyRoom:
return StudyRoomSearchResultView(viewModel: searchVM);
return StudyRoomSearchResultView(searchVM: searchVM);
case SearchCategory.lectures:
return LectureSearchResultView(viewModel: searchVM);
return LectureSearchResultView(searchVM: searchVM);
case SearchCategory.personalLectures:
return PersonalLectureSearchResultView(viewModel: searchVM);
return PersonalLectureSearchResultView(searchVM: searchVM);
case SearchCategory.persons:
return PersonSearchResultView(viewModel: searchVM);
return PersonSearchResultView(searchVM: searchVM);
case SearchCategory.rooms:
return NavigaTumSearchResultView(viewModel: searchVM);
return NavigaTumSearchResultView(searchVM: searchVM);
default:
return Container();
}
Expand Down

0 comments on commit 556e9a2

Please sign in to comment.