-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: UNN MOBILE runner <unnmobile@mail.ru>
- Loading branch information
1 parent
c0034e7
commit abbd377
Showing
11 changed files
with
142 additions
and
114 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
class _ScheduleSearchSuggestionItemKeys { | ||
static const String id = 'id'; | ||
static const String label = 'label'; | ||
static const String description = 'description'; | ||
} | ||
|
||
class ScheduleSearchSuggestionItem { | ||
final String _id; | ||
final String _label; | ||
final String _description; | ||
|
||
const ScheduleSearchSuggestionItem(this._id, this._label, this._description); | ||
|
||
String get id => _id; | ||
String get label => _label; | ||
String get description => _description; | ||
|
||
@override | ||
bool operator ==(other) => | ||
other is ScheduleSearchSuggestionItem && (_id == other._id); | ||
|
||
@override | ||
int get hashCode => Object.hash(_id, _label, _description); | ||
|
||
factory ScheduleSearchSuggestionItem.fromJson(Map<String, Object?> jsonMap) { | ||
return ScheduleSearchSuggestionItem( | ||
jsonMap[_ScheduleSearchSuggestionItemKeys.id] as String, | ||
jsonMap[_ScheduleSearchSuggestionItemKeys.label] as String, | ||
jsonMap[_ScheduleSearchSuggestionItemKeys.description] as String, | ||
); | ||
} | ||
|
||
Map<String, Object?> toJson() { | ||
return { | ||
_ScheduleSearchSuggestionItemKeys.id: _id, | ||
_ScheduleSearchSuggestionItemKeys.label: _label, | ||
_ScheduleSearchSuggestionItemKeys.description: _description, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
lib/core/services/interfaces/schedule_search_history_service.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:unn_mobile/core/models/schedule_filter.dart'; | ||
import 'package:unn_mobile/core/models/schedule_search_suggestion_item.dart'; | ||
|
||
abstract interface class ScheduleSearchHistoryService { | ||
FutureOr<List<String>> getHistory(IDType type); | ||
FutureOr<void> pushToHistory({required IDType type, required String value}); | ||
FutureOr<List<ScheduleSearchSuggestionItem>> getHistory(IDType type); | ||
FutureOr<void> pushToHistory(IDType type, ScheduleSearchSuggestionItem item); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
lib/ui/views/main_page/schedule/widgets/schedule_search_suggestion_item.dart
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
lib/ui/views/main_page/schedule/widgets/schedule_search_suggestion_item_view.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:unn_mobile/core/models/schedule_search_suggestion_item.dart'; | ||
|
||
class ScheduleSearchSuggestionItemView extends StatelessWidget { | ||
final ScheduleSearchSuggestionItem model; | ||
|
||
final void Function() onSelected; | ||
const ScheduleSearchSuggestionItemView({ | ||
super.key, | ||
required this.model, | ||
required this.onSelected, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final theme = Theme.of(context); | ||
return ListTile( | ||
shape: const Border(bottom: BorderSide(color: Colors.black12)), | ||
visualDensity: VisualDensity.compact, | ||
title: Text(model.label), | ||
subtitle: Text( | ||
model.description, | ||
style: theme.textTheme.labelSmall, | ||
), | ||
onTap: onSelected, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters