2020-08-15 19:43:45 +02:00
|
|
|
import 'dart:io';
|
|
|
|
|
2020-08-14 14:13:10 +02:00
|
|
|
import 'package:equatable/equatable.dart';
|
2020-08-15 19:43:45 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import '../util/extension_helper.dart';
|
2020-06-27 03:33:01 +02:00
|
|
|
|
2020-08-14 14:13:10 +02:00
|
|
|
class PodcastLocal extends Equatable {
|
2020-02-09 13:29:09 +01:00
|
|
|
final String title;
|
|
|
|
final String imageUrl;
|
|
|
|
final String rssUrl;
|
|
|
|
final String author;
|
2020-06-10 18:36:53 +02:00
|
|
|
|
2020-02-09 13:29:09 +01:00
|
|
|
final String primaryColor;
|
2020-02-23 14:20:07 +01:00
|
|
|
final String id;
|
2020-02-20 16:44:42 +01:00
|
|
|
final String imagePath;
|
2020-02-23 14:20:07 +01:00
|
|
|
final String provider;
|
|
|
|
final String link;
|
2020-03-19 20:58:30 +01:00
|
|
|
|
|
|
|
final String description;
|
2020-08-14 14:13:10 +02:00
|
|
|
|
|
|
|
int _upateCount;
|
|
|
|
int get updateCount => _upateCount;
|
|
|
|
set updateCount(i) => _upateCount = i;
|
|
|
|
|
|
|
|
int _episodeCount;
|
|
|
|
int get episodeCount => _episodeCount;
|
|
|
|
set episodeCount(i) => _episodeCount = i;
|
|
|
|
|
2020-06-10 18:36:53 +02:00
|
|
|
PodcastLocal(this.title, this.imageUrl, this.rssUrl, this.primaryColor,
|
|
|
|
this.author, this.id, this.imagePath, this.provider, this.link,
|
2020-08-14 14:13:10 +02:00
|
|
|
{this.description = '', int upateCount, int episodeCount})
|
|
|
|
: assert(rssUrl != null),
|
|
|
|
_episodeCount = episodeCount ?? 0,
|
|
|
|
_upateCount = upateCount ?? 0;
|
2020-06-10 18:36:53 +02:00
|
|
|
|
2020-08-15 19:43:45 +02:00
|
|
|
ImageProvider get avatarImage {
|
|
|
|
return File(imagePath).existsSync()
|
|
|
|
? FileImage(File(imagePath))
|
|
|
|
: const AssetImage('assets/avatar_backup.png');
|
|
|
|
}
|
|
|
|
|
|
|
|
Color backgroudColor(BuildContext context) {
|
|
|
|
return context.brightness == Brightness.light
|
|
|
|
? primaryColor.colorizedark()
|
|
|
|
: primaryColor.colorizeLight();
|
|
|
|
}
|
|
|
|
|
2020-06-10 18:36:53 +02:00
|
|
|
@override
|
2020-08-14 14:13:10 +02:00
|
|
|
List<Object> get props => [id, rssUrl];
|
2020-02-20 10:09:21 +01:00
|
|
|
}
|