mirror of
https://github.com/Dvorinka/1356.git
synced 2026-06-04 12:02:56 +00:00
Initial commit: Project documentation and git setup
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class Goal extends Equatable {
|
||||
final String id;
|
||||
final String ownerId;
|
||||
final String title;
|
||||
final String? description;
|
||||
final int progress;
|
||||
final double? locationLat;
|
||||
final double? locationLng;
|
||||
final String? locationName;
|
||||
final String? imageUrl;
|
||||
final bool completed;
|
||||
final DateTime createdAt;
|
||||
final DateTime updatedAt;
|
||||
|
||||
const Goal({
|
||||
required this.id,
|
||||
required this.ownerId,
|
||||
required this.title,
|
||||
this.description,
|
||||
this.progress = 0,
|
||||
this.locationLat,
|
||||
this.locationLng,
|
||||
this.locationName,
|
||||
this.imageUrl,
|
||||
this.completed = false,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
bool get hasLocation => locationLat != null && locationLng != null;
|
||||
|
||||
bool get hasImage => imageUrl != null && imageUrl!.isNotEmpty;
|
||||
|
||||
Goal copyWith({
|
||||
String? id,
|
||||
String? ownerId,
|
||||
String? title,
|
||||
String? description,
|
||||
int? progress,
|
||||
double? locationLat,
|
||||
double? locationLng,
|
||||
String? locationName,
|
||||
String? imageUrl,
|
||||
bool? completed,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
}) {
|
||||
return Goal(
|
||||
id: id ?? this.id,
|
||||
ownerId: ownerId ?? this.ownerId,
|
||||
title: title ?? this.title,
|
||||
description: description ?? this.description,
|
||||
progress: progress ?? this.progress,
|
||||
locationLat: locationLat ?? this.locationLat,
|
||||
locationLng: locationLng ?? this.locationLng,
|
||||
locationName: locationName ?? this.locationName,
|
||||
imageUrl: imageUrl ?? this.imageUrl,
|
||||
completed: completed ?? this.completed,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
id,
|
||||
ownerId,
|
||||
title,
|
||||
description,
|
||||
progress,
|
||||
locationLat,
|
||||
locationLng,
|
||||
locationName,
|
||||
imageUrl,
|
||||
completed,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class User extends Equatable {
|
||||
final String id;
|
||||
final String username;
|
||||
final String email;
|
||||
final String? avatarUrl;
|
||||
final String? bio;
|
||||
final bool isPublicProfile;
|
||||
final DateTime? countdownStartDate;
|
||||
final DateTime? countdownEndDate;
|
||||
final DateTime createdAt;
|
||||
final DateTime updatedAt;
|
||||
|
||||
const User({
|
||||
required this.id,
|
||||
required this.username,
|
||||
required this.email,
|
||||
this.avatarUrl,
|
||||
this.bio,
|
||||
this.isPublicProfile = false,
|
||||
this.countdownStartDate,
|
||||
this.countdownEndDate,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
bool get hasCountdownStarted => countdownStartDate != null;
|
||||
|
||||
bool get isCountdownActive {
|
||||
if (!hasCountdownStarted || countdownEndDate == null) return false;
|
||||
return DateTime.now().isBefore(countdownEndDate!);
|
||||
}
|
||||
|
||||
int? get daysRemaining {
|
||||
if (!isCountdownActive) return null;
|
||||
return countdownEndDate!.difference(DateTime.now()).inDays;
|
||||
}
|
||||
|
||||
User copyWith({
|
||||
String? id,
|
||||
String? username,
|
||||
String? email,
|
||||
String? avatarUrl,
|
||||
String? bio,
|
||||
bool? isPublicProfile,
|
||||
DateTime? countdownStartDate,
|
||||
DateTime? countdownEndDate,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
}) {
|
||||
return User(
|
||||
id: id ?? this.id,
|
||||
username: username ?? this.username,
|
||||
email: email ?? this.email,
|
||||
avatarUrl: avatarUrl ?? this.avatarUrl,
|
||||
bio: bio ?? this.bio,
|
||||
isPublicProfile: isPublicProfile ?? this.isPublicProfile,
|
||||
countdownStartDate: countdownStartDate ?? this.countdownStartDate,
|
||||
countdownEndDate: countdownEndDate ?? this.countdownEndDate,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
id,
|
||||
username,
|
||||
email,
|
||||
avatarUrl,
|
||||
bio,
|
||||
isPublicProfile,
|
||||
countdownStartDate,
|
||||
countdownEndDate,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user