Frontend first draft
This commit is contained in:
35
frontend/pshared/lib/models/account/base.dart
Normal file
35
frontend/pshared/lib/models/account/base.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'package:pshared/models/storable.dart';
|
||||
|
||||
|
||||
class AccountBase implements Storable {
|
||||
final Storable storable;
|
||||
|
||||
@override
|
||||
String get id => storable.id;
|
||||
@override
|
||||
DateTime get createdAt => storable.createdAt;
|
||||
@override
|
||||
DateTime get updatedAt => storable.updatedAt;
|
||||
|
||||
final String? avatarUrl;
|
||||
final String name;
|
||||
final String locale;
|
||||
|
||||
const AccountBase({
|
||||
required this.storable,
|
||||
required this.name,
|
||||
required this.locale,
|
||||
required this.avatarUrl,
|
||||
});
|
||||
|
||||
AccountBase copyWith({
|
||||
String? Function()? avatarUrl,
|
||||
String? name,
|
||||
String? locale,
|
||||
}) => AccountBase(
|
||||
storable: storable,
|
||||
avatarUrl: avatarUrl != null ? avatarUrl() : this.avatarUrl,
|
||||
locale: locale ?? this.locale,
|
||||
name: name ?? this.name,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user