132 lines
3.1 KiB
Plaintext
132 lines
3.1 KiB
Plaintext
import 'package:built_value/built_value.dart';
|
|
import 'package:built_collection/built_collection.dart';
|
|
import 'package:built_value/serializer.dart';
|
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
|
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
|
|
|
part 'stub_model.g.dart';
|
|
|
|
abstract class StubListResponse
|
|
implements Built<StubListResponse, StubListResponseBuilder> {
|
|
factory StubListResponse([void updates(StubListResponseBuilder b)]) =
|
|
_$StubListResponse;
|
|
|
|
StubListResponse._();
|
|
|
|
BuiltList<StubEntity> get data;
|
|
|
|
static Serializer<StubListResponse> get serializer =>
|
|
_$stubListResponseSerializer;
|
|
}
|
|
|
|
abstract class StubItemResponse
|
|
implements Built<StubItemResponse, StubItemResponseBuilder> {
|
|
factory StubItemResponse([void updates(StubItemResponseBuilder b)]) =
|
|
_$StubItemResponse;
|
|
|
|
StubItemResponse._();
|
|
|
|
StubEntity get data;
|
|
|
|
static Serializer<StubItemResponse> get serializer =>
|
|
_$stubItemResponseSerializer;
|
|
}
|
|
|
|
class StubFields {
|
|
// STARTER: fields - do not remove comment
|
|
}
|
|
|
|
abstract class StubEntity extends Object with BaseEntity implements Built<StubEntity, StubEntityBuilder> {
|
|
|
|
// STARTER: properties - do not remove comment
|
|
|
|
factory StubEntity({String id, AppState state}) {
|
|
return _$StubEntity._(
|
|
id: id ?? BaseEntity.nextId,
|
|
isChanged: false,
|
|
// STARTER: constructor - do not remove comment
|
|
);
|
|
}
|
|
|
|
StubEntity._();
|
|
|
|
@override
|
|
EntityType get entityType => EntityType.stub;
|
|
|
|
String get displayName {
|
|
// STARTER: display name - do not remove comment
|
|
}
|
|
|
|
|
|
@override
|
|
List<EntityAction> getActions(
|
|
{UserCompanyEntity userCompany,
|
|
ClientEntity client,
|
|
bool includeEdit = false,
|
|
bool multiselect = false}) {
|
|
final actions = <EntityAction>[];
|
|
|
|
if (!isDeleted) {
|
|
if (!multiselect && includeEdit && userCompany.canEditEntity(this)) {
|
|
actions.add(EntityAction.edit);
|
|
}
|
|
}
|
|
|
|
if (actions.isNotEmpty) {
|
|
actions.add(null);
|
|
}
|
|
|
|
return actions..addAll(super.getActions(userCompany: userCompany));
|
|
}
|
|
|
|
int compareTo(StubEntity stub, String sortField, bool sortAscending) {
|
|
int response = 0;
|
|
final stubA = sortAscending ? this : stub;
|
|
final stubB = sortAscending ? stub: this;
|
|
|
|
switch (sortField) {
|
|
// STARTER: sort switch - do not remove comment
|
|
}
|
|
|
|
if (response == 0) {
|
|
// STARTER: sort default - do not remove comment
|
|
} else {
|
|
return response;
|
|
}
|
|
}
|
|
|
|
@override
|
|
bool matchesFilter(String filter) {
|
|
if (filter == null || filter.isEmpty) {
|
|
return true;
|
|
}
|
|
|
|
filter = filter.toLowerCase();
|
|
|
|
return false;
|
|
}
|
|
|
|
@override
|
|
String matchesFilterValue(String filter) {
|
|
if (filter == null || filter.isEmpty) {
|
|
return null;
|
|
}
|
|
|
|
filter = filter.toLowerCase();
|
|
|
|
return null;
|
|
}
|
|
|
|
@override
|
|
String get listDisplayName => null;
|
|
|
|
@override
|
|
double get listDisplayAmount => null;
|
|
|
|
@override
|
|
FormatNumberType get listDisplayAmountType => null;
|
|
|
|
static Serializer<StubEntity> get serializer => _$stubEntitySerializer;
|
|
}
|