23 lines
624 B
Dart
23 lines
624 B
Dart
|
import 'VideoCards.dart';
|
||
|
|
||
|
class VideoCardsManager {
|
||
|
final List<VideoCards> _videocards = [];
|
||
|
|
||
|
void addVideoCards(VideoCards videocards) {
|
||
|
_videocards.add(videocards);
|
||
|
}
|
||
|
|
||
|
List<VideoCards> filterVideoCardsByCategory(VideoCardsCategory category) {
|
||
|
return _videocards.where((videocards) => videocards.category == category).toList();
|
||
|
}
|
||
|
|
||
|
double calculateTotalAmount() {
|
||
|
return _videocards.fold(0.0, (sum,videocards) => sum + videocards.price);
|
||
|
}
|
||
|
|
||
|
Future<void> clearVideoCards() async {
|
||
|
await Future.delayed(Duration(seconds: 3));
|
||
|
_videocards.clear();
|
||
|
print('Список чист!');
|
||
|
}
|
||
|
}
|