Создание карточки в коллекции + экран поиска коллекции

This commit is contained in:
2025-04-02 21:40:31 +03:00
parent fb7ff84087
commit 17dff72655
36 changed files with 2495 additions and 277 deletions

View File

@@ -1,42 +0,0 @@
// To parse this JSON data, do
//
// final collectionDto = collectionDtoFromJson(jsonString);
import 'dart:convert';
import 'dart:typed_data';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'collection_dto.freezed.dart';
// part 'collection_dto.g.dart';
// CollectionDto collectionDtoFromJson(String str) =>
// CollectionDto.fromJson(json.decode(str));
// String collectionDtoToJson(CollectionDto data) => json.encode(data.toJson());
// class Uint8ListConverter implements JsonConverter<Uint8List?, List<int>?> {
// const Uint8ListConverter();
// @override
// Uint8List? fromJson(List<int>? json) {
// return json == null ? null : Uint8List.fromList(json);
// }
// @override
// List<int>? toJson(Uint8List? object) {
// return object?.toList();
// }
// }
@Freezed(copyWith: true, equal: true, fromJson: false, toJson: false)
abstract class CollectionDto with _$CollectionDto {
const factory CollectionDto({
required String desc,
required String title,
required bool isPublic,
Uint8List? avatar,
}) = _CollectionDto;
// factory CollectionDto.fromJson(Map<String, dynamic> json) =>
// _$CollectionDtoFromJson(json);
}

View File

@@ -0,0 +1,22 @@
// To parse this JSON data, do
//
// final collectionDto = collectionDtoFromJson(jsonString);
import 'dart:convert';
import 'dart:typed_data';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:remever/database/database.dart';
part 'create_ticket_dto.freezed.dart';
@Freezed(copyWith: true, equal: true, fromJson: false, toJson: false)
abstract class CreateTicketDto with _$CreateTicketDto {
const factory CreateTicketDto({
Collection? collection,
String? question,
Uint8List? questionImage,
String? answer,
Uint8List? answerImage,
bool? needRevert,
}) = _CreateTicketDto;
}

View File

@@ -0,0 +1,294 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'create_ticket_dto.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
/// @nodoc
mixin _$CreateTicketDto {
Collection? get collection => throw _privateConstructorUsedError;
String? get question => throw _privateConstructorUsedError;
Uint8List? get questionImage => throw _privateConstructorUsedError;
String? get answer => throw _privateConstructorUsedError;
Uint8List? get answerImage => throw _privateConstructorUsedError;
bool? get needRevert => throw _privateConstructorUsedError;
/// Create a copy of CreateTicketDto
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$CreateTicketDtoCopyWith<CreateTicketDto> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $CreateTicketDtoCopyWith<$Res> {
factory $CreateTicketDtoCopyWith(
CreateTicketDto value,
$Res Function(CreateTicketDto) then,
) = _$CreateTicketDtoCopyWithImpl<$Res, CreateTicketDto>;
@useResult
$Res call({
Collection? collection,
String? question,
Uint8List? questionImage,
String? answer,
Uint8List? answerImage,
bool? needRevert,
});
}
/// @nodoc
class _$CreateTicketDtoCopyWithImpl<$Res, $Val extends CreateTicketDto>
implements $CreateTicketDtoCopyWith<$Res> {
_$CreateTicketDtoCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of CreateTicketDto
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? collection = freezed,
Object? question = freezed,
Object? questionImage = freezed,
Object? answer = freezed,
Object? answerImage = freezed,
Object? needRevert = freezed,
}) {
return _then(
_value.copyWith(
collection:
freezed == collection
? _value.collection
: collection // ignore: cast_nullable_to_non_nullable
as Collection?,
question:
freezed == question
? _value.question
: question // ignore: cast_nullable_to_non_nullable
as String?,
questionImage:
freezed == questionImage
? _value.questionImage
: questionImage // ignore: cast_nullable_to_non_nullable
as Uint8List?,
answer:
freezed == answer
? _value.answer
: answer // ignore: cast_nullable_to_non_nullable
as String?,
answerImage:
freezed == answerImage
? _value.answerImage
: answerImage // ignore: cast_nullable_to_non_nullable
as Uint8List?,
needRevert:
freezed == needRevert
? _value.needRevert
: needRevert // ignore: cast_nullable_to_non_nullable
as bool?,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$CreateTicketDtoImplCopyWith<$Res>
implements $CreateTicketDtoCopyWith<$Res> {
factory _$$CreateTicketDtoImplCopyWith(
_$CreateTicketDtoImpl value,
$Res Function(_$CreateTicketDtoImpl) then,
) = __$$CreateTicketDtoImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
Collection? collection,
String? question,
Uint8List? questionImage,
String? answer,
Uint8List? answerImage,
bool? needRevert,
});
}
/// @nodoc
class __$$CreateTicketDtoImplCopyWithImpl<$Res>
extends _$CreateTicketDtoCopyWithImpl<$Res, _$CreateTicketDtoImpl>
implements _$$CreateTicketDtoImplCopyWith<$Res> {
__$$CreateTicketDtoImplCopyWithImpl(
_$CreateTicketDtoImpl _value,
$Res Function(_$CreateTicketDtoImpl) _then,
) : super(_value, _then);
/// Create a copy of CreateTicketDto
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? collection = freezed,
Object? question = freezed,
Object? questionImage = freezed,
Object? answer = freezed,
Object? answerImage = freezed,
Object? needRevert = freezed,
}) {
return _then(
_$CreateTicketDtoImpl(
collection:
freezed == collection
? _value.collection
: collection // ignore: cast_nullable_to_non_nullable
as Collection?,
question:
freezed == question
? _value.question
: question // ignore: cast_nullable_to_non_nullable
as String?,
questionImage:
freezed == questionImage
? _value.questionImage
: questionImage // ignore: cast_nullable_to_non_nullable
as Uint8List?,
answer:
freezed == answer
? _value.answer
: answer // ignore: cast_nullable_to_non_nullable
as String?,
answerImage:
freezed == answerImage
? _value.answerImage
: answerImage // ignore: cast_nullable_to_non_nullable
as Uint8List?,
needRevert:
freezed == needRevert
? _value.needRevert
: needRevert // ignore: cast_nullable_to_non_nullable
as bool?,
),
);
}
}
/// @nodoc
class _$CreateTicketDtoImpl implements _CreateTicketDto {
const _$CreateTicketDtoImpl({
this.collection,
this.question,
this.questionImage,
this.answer,
this.answerImage,
this.needRevert,
});
@override
final Collection? collection;
@override
final String? question;
@override
final Uint8List? questionImage;
@override
final String? answer;
@override
final Uint8List? answerImage;
@override
final bool? needRevert;
@override
String toString() {
return 'CreateTicketDto(collection: $collection, question: $question, questionImage: $questionImage, answer: $answer, answerImage: $answerImage, needRevert: $needRevert)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CreateTicketDtoImpl &&
const DeepCollectionEquality().equals(
other.collection,
collection,
) &&
(identical(other.question, question) ||
other.question == question) &&
const DeepCollectionEquality().equals(
other.questionImage,
questionImage,
) &&
(identical(other.answer, answer) || other.answer == answer) &&
const DeepCollectionEquality().equals(
other.answerImage,
answerImage,
) &&
(identical(other.needRevert, needRevert) ||
other.needRevert == needRevert));
}
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(collection),
question,
const DeepCollectionEquality().hash(questionImage),
answer,
const DeepCollectionEquality().hash(answerImage),
needRevert,
);
/// Create a copy of CreateTicketDto
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$CreateTicketDtoImplCopyWith<_$CreateTicketDtoImpl> get copyWith =>
__$$CreateTicketDtoImplCopyWithImpl<_$CreateTicketDtoImpl>(
this,
_$identity,
);
}
abstract class _CreateTicketDto implements CreateTicketDto {
const factory _CreateTicketDto({
final Collection? collection,
final String? question,
final Uint8List? questionImage,
final String? answer,
final Uint8List? answerImage,
final bool? needRevert,
}) = _$CreateTicketDtoImpl;
@override
Collection? get collection;
@override
String? get question;
@override
Uint8List? get questionImage;
@override
String? get answer;
@override
Uint8List? get answerImage;
@override
bool? get needRevert;
/// Create a copy of CreateTicketDto
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$CreateTicketDtoImplCopyWith<_$CreateTicketDtoImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,19 @@
// To parse this JSON data, do
//
// final collectionDto = collectionDtoFromJson(jsonString);
import 'dart:convert';
import 'dart:typed_data';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'crud_collection_dto.freezed.dart';
@Freezed(copyWith: true, equal: true, fromJson: false, toJson: false)
abstract class CrudCollectionDto with _$CrudCollectionDto {
const factory CrudCollectionDto({
required String desc,
required String title,
required bool isPublic,
Uint8List? avatar,
}) = _CrudCollectionDto;
}

View File

@@ -3,7 +3,7 @@
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'collection_dto.dart';
part of 'crud_collection_dto.dart';
// **************************************************************************
// FreezedGenerator
@@ -16,40 +16,40 @@ final _privateConstructorUsedError = UnsupportedError(
);
/// @nodoc
mixin _$CollectionDto {
mixin _$CrudCollectionDto {
String get desc => throw _privateConstructorUsedError;
String get title => throw _privateConstructorUsedError;
bool get isPublic => throw _privateConstructorUsedError;
Uint8List? get avatar => throw _privateConstructorUsedError;
/// Create a copy of CollectionDto
/// Create a copy of CrudCollectionDto
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$CollectionDtoCopyWith<CollectionDto> get copyWith =>
$CrudCollectionDtoCopyWith<CrudCollectionDto> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $CollectionDtoCopyWith<$Res> {
factory $CollectionDtoCopyWith(
CollectionDto value,
$Res Function(CollectionDto) then,
) = _$CollectionDtoCopyWithImpl<$Res, CollectionDto>;
abstract class $CrudCollectionDtoCopyWith<$Res> {
factory $CrudCollectionDtoCopyWith(
CrudCollectionDto value,
$Res Function(CrudCollectionDto) then,
) = _$CrudCollectionDtoCopyWithImpl<$Res, CrudCollectionDto>;
@useResult
$Res call({String desc, String title, bool isPublic, Uint8List? avatar});
}
/// @nodoc
class _$CollectionDtoCopyWithImpl<$Res, $Val extends CollectionDto>
implements $CollectionDtoCopyWith<$Res> {
_$CollectionDtoCopyWithImpl(this._value, this._then);
class _$CrudCollectionDtoCopyWithImpl<$Res, $Val extends CrudCollectionDto>
implements $CrudCollectionDtoCopyWith<$Res> {
_$CrudCollectionDtoCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of CollectionDto
/// Create a copy of CrudCollectionDto
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
@@ -88,27 +88,27 @@ class _$CollectionDtoCopyWithImpl<$Res, $Val extends CollectionDto>
}
/// @nodoc
abstract class _$$CollectionDtoImplCopyWith<$Res>
implements $CollectionDtoCopyWith<$Res> {
factory _$$CollectionDtoImplCopyWith(
_$CollectionDtoImpl value,
$Res Function(_$CollectionDtoImpl) then,
) = __$$CollectionDtoImplCopyWithImpl<$Res>;
abstract class _$$CrudCollectionDtoImplCopyWith<$Res>
implements $CrudCollectionDtoCopyWith<$Res> {
factory _$$CrudCollectionDtoImplCopyWith(
_$CrudCollectionDtoImpl value,
$Res Function(_$CrudCollectionDtoImpl) then,
) = __$$CrudCollectionDtoImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String desc, String title, bool isPublic, Uint8List? avatar});
}
/// @nodoc
class __$$CollectionDtoImplCopyWithImpl<$Res>
extends _$CollectionDtoCopyWithImpl<$Res, _$CollectionDtoImpl>
implements _$$CollectionDtoImplCopyWith<$Res> {
__$$CollectionDtoImplCopyWithImpl(
_$CollectionDtoImpl _value,
$Res Function(_$CollectionDtoImpl) _then,
class __$$CrudCollectionDtoImplCopyWithImpl<$Res>
extends _$CrudCollectionDtoCopyWithImpl<$Res, _$CrudCollectionDtoImpl>
implements _$$CrudCollectionDtoImplCopyWith<$Res> {
__$$CrudCollectionDtoImplCopyWithImpl(
_$CrudCollectionDtoImpl _value,
$Res Function(_$CrudCollectionDtoImpl) _then,
) : super(_value, _then);
/// Create a copy of CollectionDto
/// Create a copy of CrudCollectionDto
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
@@ -119,7 +119,7 @@ class __$$CollectionDtoImplCopyWithImpl<$Res>
Object? avatar = freezed,
}) {
return _then(
_$CollectionDtoImpl(
_$CrudCollectionDtoImpl(
desc:
null == desc
? _value.desc
@@ -147,8 +147,8 @@ class __$$CollectionDtoImplCopyWithImpl<$Res>
/// @nodoc
class _$CollectionDtoImpl implements _CollectionDto {
const _$CollectionDtoImpl({
class _$CrudCollectionDtoImpl implements _CrudCollectionDto {
const _$CrudCollectionDtoImpl({
required this.desc,
required this.title,
required this.isPublic,
@@ -166,14 +166,14 @@ class _$CollectionDtoImpl implements _CollectionDto {
@override
String toString() {
return 'CollectionDto(desc: $desc, title: $title, isPublic: $isPublic, avatar: $avatar)';
return 'CrudCollectionDto(desc: $desc, title: $title, isPublic: $isPublic, avatar: $avatar)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CollectionDtoImpl &&
other is _$CrudCollectionDtoImpl &&
(identical(other.desc, desc) || other.desc == desc) &&
(identical(other.title, title) || other.title == title) &&
(identical(other.isPublic, isPublic) ||
@@ -190,22 +190,25 @@ class _$CollectionDtoImpl implements _CollectionDto {
const DeepCollectionEquality().hash(avatar),
);
/// Create a copy of CollectionDto
/// Create a copy of CrudCollectionDto
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$CollectionDtoImplCopyWith<_$CollectionDtoImpl> get copyWith =>
__$$CollectionDtoImplCopyWithImpl<_$CollectionDtoImpl>(this, _$identity);
_$$CrudCollectionDtoImplCopyWith<_$CrudCollectionDtoImpl> get copyWith =>
__$$CrudCollectionDtoImplCopyWithImpl<_$CrudCollectionDtoImpl>(
this,
_$identity,
);
}
abstract class _CollectionDto implements CollectionDto {
const factory _CollectionDto({
abstract class _CrudCollectionDto implements CrudCollectionDto {
const factory _CrudCollectionDto({
required final String desc,
required final String title,
required final bool isPublic,
final Uint8List? avatar,
}) = _$CollectionDtoImpl;
}) = _$CrudCollectionDtoImpl;
@override
String get desc;
@@ -216,10 +219,10 @@ abstract class _CollectionDto implements CollectionDto {
@override
Uint8List? get avatar;
/// Create a copy of CollectionDto
/// Create a copy of CrudCollectionDto
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$CollectionDtoImplCopyWith<_$CollectionDtoImpl> get copyWith =>
_$$CrudCollectionDtoImplCopyWith<_$CrudCollectionDtoImpl> get copyWith =>
throw _privateConstructorUsedError;
}