forked from eatvio/eatvio_app
feature(registration): remove .env
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/app_router.dart';
|
||||
import 'package:eatvio_app/locator_service.dart';
|
||||
import 'package:eatvio_app/presentation/feed/blog_post_create_screen/models/blog_post_create_model.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
import '/core/app_export.dart';
|
||||
import 'package:eatvio_app/presentation/feed/blog_post_create_screen/models/blog_post_create_model.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
part 'blog_post_create_event.dart';
|
||||
part 'blog_post_create_state.dart';
|
||||
|
||||
/// A bloc that manages the state of a BlogPostCreate according to the event that is dispatched to it.
|
||||
class BlogPostCreateBloc
|
||||
extends Bloc<BlogPostCreateEvent, BlogPostCreateState> {
|
||||
class BlogPostCreateBloc extends Bloc<BlogPostCreateEvent, BlogPostCreateState> {
|
||||
BlogPostCreateBloc(BlogPostCreateState initialState) : super(initialState) {
|
||||
on<BlogPostCreateInitialEvent>(_onInitialize);
|
||||
on<CreateBlogPost>(_createBlogPost);
|
||||
@@ -79,8 +80,7 @@ class BlogPostCreateBloc
|
||||
}
|
||||
}
|
||||
|
||||
sendBlogPost(String? title, String? youtubeURL, String? description,
|
||||
XFile? image) async {
|
||||
sendBlogPost(String? title, String? youtubeURL, String? description, XFile? image) async {
|
||||
String url = '/blog_post/create';
|
||||
|
||||
final Map<String, dynamic> credentials = {
|
||||
@@ -99,8 +99,7 @@ class BlogPostCreateBloc
|
||||
return response;
|
||||
}
|
||||
|
||||
FutureOr<void> _uploadImages(
|
||||
UploadImages event, Emitter<BlogPostCreateState> emit) {
|
||||
FutureOr<void> _uploadImages(UploadImages event, Emitter<BlogPostCreateState> emit) {
|
||||
if (state is BlogPostCreateLoadedState) {
|
||||
var currentState = state as BlogPostCreateLoadedState;
|
||||
emit(
|
||||
|
||||
@@ -40,8 +40,7 @@ class BlogPostCreateLoadedState extends BlogPostCreateState {
|
||||
bool isLoading;
|
||||
XFile? image;
|
||||
@override
|
||||
List<Object?> get props =>
|
||||
[blog_postModelObj, title, description, youtubeURL];
|
||||
List<Object?> get props => [blog_postModelObj, title, description, youtubeURL];
|
||||
BlogPostCreateLoadedState copyWith({
|
||||
BlogPostCreateModel? blog_postModelObj,
|
||||
TextEditingController? title,
|
||||
@@ -73,6 +72,5 @@ class BlogPostCreateErrorState extends BlogPostCreateState {
|
||||
}
|
||||
|
||||
class BlogPostCreateInitialState extends BlogPostCreateState {
|
||||
BlogPostCreateInitialState({required BlogPostCreateModel blog_postModelObj})
|
||||
: super(blog_postModelObj: blog_postModelObj);
|
||||
BlogPostCreateInitialState({required BlogPostCreateModel blog_postModelObj}) : super(blog_postModelObj: blog_postModelObj);
|
||||
}
|
||||
|
||||
@@ -14,8 +14,7 @@ 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');
|
||||
|
||||
BlogPostCreateCredentialsModel _$BlogPostCreateCredentialsModelFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
BlogPostCreateCredentialsModel _$BlogPostCreateCredentialsModelFromJson(Map<String, dynamic> json) {
|
||||
return _BlogPostCreateCredentialsModel.fromJson(json);
|
||||
}
|
||||
|
||||
@@ -29,29 +28,19 @@ mixin _$BlogPostCreateCredentialsModel {
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$BlogPostCreateCredentialsModelCopyWith<BlogPostCreateCredentialsModel>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
$BlogPostCreateCredentialsModelCopyWith<BlogPostCreateCredentialsModel> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $BlogPostCreateCredentialsModelCopyWith<$Res> {
|
||||
factory $BlogPostCreateCredentialsModelCopyWith(
|
||||
BlogPostCreateCredentialsModel value,
|
||||
$Res Function(BlogPostCreateCredentialsModel) then) =
|
||||
_$BlogPostCreateCredentialsModelCopyWithImpl<$Res,
|
||||
BlogPostCreateCredentialsModel>;
|
||||
factory $BlogPostCreateCredentialsModelCopyWith(BlogPostCreateCredentialsModel value, $Res Function(BlogPostCreateCredentialsModel) then) =
|
||||
_$BlogPostCreateCredentialsModelCopyWithImpl<$Res, BlogPostCreateCredentialsModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String title,
|
||||
String description,
|
||||
@JsonKey(name: 'youtube_url') String youtubeUrl,
|
||||
String status});
|
||||
$Res call({String title, String description, @JsonKey(name: 'youtube_url') String youtubeUrl, String status});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$BlogPostCreateCredentialsModelCopyWithImpl<$Res,
|
||||
$Val extends BlogPostCreateCredentialsModel>
|
||||
implements $BlogPostCreateCredentialsModelCopyWith<$Res> {
|
||||
class _$BlogPostCreateCredentialsModelCopyWithImpl<$Res, $Val extends BlogPostCreateCredentialsModel> implements $BlogPostCreateCredentialsModelCopyWith<$Res> {
|
||||
_$BlogPostCreateCredentialsModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
@@ -89,29 +78,18 @@ class _$BlogPostCreateCredentialsModelCopyWithImpl<$Res,
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$BlogPostCreateCredentialsModelImplCopyWith<$Res>
|
||||
implements $BlogPostCreateCredentialsModelCopyWith<$Res> {
|
||||
factory _$$BlogPostCreateCredentialsModelImplCopyWith(
|
||||
_$BlogPostCreateCredentialsModelImpl value,
|
||||
$Res Function(_$BlogPostCreateCredentialsModelImpl) then) =
|
||||
abstract class _$$BlogPostCreateCredentialsModelImplCopyWith<$Res> implements $BlogPostCreateCredentialsModelCopyWith<$Res> {
|
||||
factory _$$BlogPostCreateCredentialsModelImplCopyWith(_$BlogPostCreateCredentialsModelImpl value, $Res Function(_$BlogPostCreateCredentialsModelImpl) then) =
|
||||
__$$BlogPostCreateCredentialsModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String title,
|
||||
String description,
|
||||
@JsonKey(name: 'youtube_url') String youtubeUrl,
|
||||
String status});
|
||||
$Res call({String title, String description, @JsonKey(name: 'youtube_url') String youtubeUrl, String status});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$BlogPostCreateCredentialsModelImplCopyWithImpl<$Res>
|
||||
extends _$BlogPostCreateCredentialsModelCopyWithImpl<$Res,
|
||||
_$BlogPostCreateCredentialsModelImpl>
|
||||
class __$$BlogPostCreateCredentialsModelImplCopyWithImpl<$Res> extends _$BlogPostCreateCredentialsModelCopyWithImpl<$Res, _$BlogPostCreateCredentialsModelImpl>
|
||||
implements _$$BlogPostCreateCredentialsModelImplCopyWith<$Res> {
|
||||
__$$BlogPostCreateCredentialsModelImplCopyWithImpl(
|
||||
_$BlogPostCreateCredentialsModelImpl _value,
|
||||
$Res Function(_$BlogPostCreateCredentialsModelImpl) _then)
|
||||
__$$BlogPostCreateCredentialsModelImplCopyWithImpl(_$BlogPostCreateCredentialsModelImpl _value, $Res Function(_$BlogPostCreateCredentialsModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@@ -145,17 +123,11 @@ class __$$BlogPostCreateCredentialsModelImplCopyWithImpl<$Res>
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$BlogPostCreateCredentialsModelImpl
|
||||
implements _BlogPostCreateCredentialsModel {
|
||||
class _$BlogPostCreateCredentialsModelImpl implements _BlogPostCreateCredentialsModel {
|
||||
const _$BlogPostCreateCredentialsModelImpl(
|
||||
{required this.title,
|
||||
required this.description,
|
||||
@JsonKey(name: 'youtube_url') required this.youtubeUrl,
|
||||
this.status = 'active'});
|
||||
{required this.title, required this.description, @JsonKey(name: 'youtube_url') required this.youtubeUrl, this.status = 'active'});
|
||||
|
||||
factory _$BlogPostCreateCredentialsModelImpl.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$$BlogPostCreateCredentialsModelImplFromJson(json);
|
||||
factory _$BlogPostCreateCredentialsModelImpl.fromJson(Map<String, dynamic> json) => _$$BlogPostCreateCredentialsModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String title;
|
||||
@@ -179,25 +151,20 @@ class _$BlogPostCreateCredentialsModelImpl
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$BlogPostCreateCredentialsModelImpl &&
|
||||
(identical(other.title, title) || other.title == title) &&
|
||||
(identical(other.description, description) ||
|
||||
other.description == description) &&
|
||||
(identical(other.youtubeUrl, youtubeUrl) ||
|
||||
other.youtubeUrl == youtubeUrl) &&
|
||||
(identical(other.description, description) || other.description == description) &&
|
||||
(identical(other.youtubeUrl, youtubeUrl) || other.youtubeUrl == youtubeUrl) &&
|
||||
(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, title, description, youtubeUrl, status);
|
||||
int get hashCode => Object.hash(runtimeType, title, description, youtubeUrl, status);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$BlogPostCreateCredentialsModelImplCopyWith<
|
||||
_$BlogPostCreateCredentialsModelImpl>
|
||||
get copyWith => __$$BlogPostCreateCredentialsModelImplCopyWithImpl<
|
||||
_$BlogPostCreateCredentialsModelImpl>(this, _$identity);
|
||||
_$$BlogPostCreateCredentialsModelImplCopyWith<_$BlogPostCreateCredentialsModelImpl> get copyWith =>
|
||||
__$$BlogPostCreateCredentialsModelImplCopyWithImpl<_$BlogPostCreateCredentialsModelImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
@@ -207,16 +174,14 @@ class _$BlogPostCreateCredentialsModelImpl
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _BlogPostCreateCredentialsModel
|
||||
implements BlogPostCreateCredentialsModel {
|
||||
abstract class _BlogPostCreateCredentialsModel implements BlogPostCreateCredentialsModel {
|
||||
const factory _BlogPostCreateCredentialsModel(
|
||||
{required final String title,
|
||||
required final String description,
|
||||
@JsonKey(name: 'youtube_url') required final String youtubeUrl,
|
||||
final String status}) = _$BlogPostCreateCredentialsModelImpl;
|
||||
|
||||
factory _BlogPostCreateCredentialsModel.fromJson(Map<String, dynamic> json) =
|
||||
_$BlogPostCreateCredentialsModelImpl.fromJson;
|
||||
factory _BlogPostCreateCredentialsModel.fromJson(Map<String, dynamic> json) = _$BlogPostCreateCredentialsModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get title;
|
||||
@@ -229,7 +194,5 @@ abstract class _BlogPostCreateCredentialsModel
|
||||
String get status;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$BlogPostCreateCredentialsModelImplCopyWith<
|
||||
_$BlogPostCreateCredentialsModelImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
_$$BlogPostCreateCredentialsModelImplCopyWith<_$BlogPostCreateCredentialsModelImpl> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@@ -6,18 +6,14 @@ part of '../../../../features/blog_post_create/models/blog_post_create_credentia
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$BlogPostCreateCredentialsModelImpl
|
||||
_$$BlogPostCreateCredentialsModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$BlogPostCreateCredentialsModelImpl(
|
||||
title: json['title'] as String,
|
||||
description: json['description'] as String,
|
||||
youtubeUrl: json['youtube_url'] as String,
|
||||
status: json['status'] as String? ?? 'active',
|
||||
);
|
||||
_$BlogPostCreateCredentialsModelImpl _$$BlogPostCreateCredentialsModelImplFromJson(Map<String, dynamic> json) => _$BlogPostCreateCredentialsModelImpl(
|
||||
title: json['title'] as String,
|
||||
description: json['description'] as String,
|
||||
youtubeUrl: json['youtube_url'] as String,
|
||||
status: json['status'] as String? ?? 'active',
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$BlogPostCreateCredentialsModelImplToJson(
|
||||
_$BlogPostCreateCredentialsModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
Map<String, dynamic> _$$BlogPostCreateCredentialsModelImplToJson(_$BlogPostCreateCredentialsModelImpl instance) => <String, dynamic>{
|
||||
'title': instance.title,
|
||||
'description': instance.description,
|
||||
'youtube_url': instance.youtubeUrl,
|
||||
|
||||
@@ -8,8 +8,7 @@ import 'package:equatable/equatable.dart';
|
||||
class BlogPostCreateModel extends Equatable {
|
||||
final String blog_postID;
|
||||
|
||||
BlogPostCreateModel({required String blog_postID})
|
||||
: blog_postID = blog_postID;
|
||||
BlogPostCreateModel({required String blog_postID}) : blog_postID = blog_postID;
|
||||
|
||||
BlogPostCreateModel copyWith(String blog_postID) {
|
||||
return BlogPostCreateModel(blog_postID: blog_postID);
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:eatvio_app/app_router.dart';
|
||||
import 'package:eatvio_app/presentation/feed/blog_post_edit_screen/models/blog_post_edit_model.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'dart:convert';
|
||||
|
||||
import '/core/app_export.dart';
|
||||
import 'package:eatvio_app/presentation/feed/blog_post_edit_screen/models/blog_post_edit_model.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
part 'blog_post_edit_event.dart';
|
||||
|
||||
part 'blog_post_edit_state.dart';
|
||||
|
||||
/// A bloc that manages the state of a BlogPostEdit according to the event that is dispatched to it.
|
||||
@@ -34,7 +33,7 @@ class BlogPostEditBloc extends Bloc<BlogPostEditEvent, BlogPostEditState> {
|
||||
}
|
||||
final String? blog_postID = state.blog_postModelObj?.blog_postID;
|
||||
final response = await http.get(
|
||||
Uri.parse(dotenv.env['SERVER_ROOT']! + '/feed/show/$blog_postID'),
|
||||
Uri.parse(baseUrl + '/api/feed/show/$blog_postID'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
@@ -65,8 +64,7 @@ class BlogPostEditBloc extends Bloc<BlogPostEditEvent, BlogPostEditState> {
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
emit(BlogPostEditErrorState(
|
||||
'Некоторые необходимые данные отсутствуют.'));
|
||||
emit(BlogPostEditErrorState('Некоторые необходимые данные отсутствуют.'));
|
||||
}
|
||||
} else {
|
||||
// Статус ответа не равен 200, обрабатываем ошибку
|
||||
@@ -78,8 +76,7 @@ class BlogPostEditBloc extends Bloc<BlogPostEditEvent, BlogPostEditState> {
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _editBlogPost(
|
||||
EditBlogPost event, Emitter<BlogPostEditState> emit) async {
|
||||
FutureOr<void> _editBlogPost(EditBlogPost event, Emitter<BlogPostEditState> emit) async {
|
||||
if (state is BlogPostEditLoadedState) {
|
||||
var currentState = state as BlogPostEditLoadedState;
|
||||
|
||||
@@ -91,11 +88,9 @@ class BlogPostEditBloc extends Bloc<BlogPostEditEvent, BlogPostEditState> {
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
AppRouter.navigatorKey.currentContext?.goNamed('blogPostScreen',
|
||||
extra: currentState.blog_post?['id'].toString());
|
||||
AppRouter.navigatorKey.currentContext?.goNamed('blogPostScreen', extra: currentState.blog_post?['id'].toString());
|
||||
} else {
|
||||
print(
|
||||
'Failed to edit blog post. Status Code: ${response.statusCode} ${response.body}');
|
||||
print('Failed to edit blog post. Status Code: ${response.statusCode} ${response.body}');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,7 +102,7 @@ class BlogPostEditBloc extends Bloc<BlogPostEditEvent, BlogPostEditState> {
|
||||
String? description,
|
||||
) async {
|
||||
int id = blog_post?['id'];
|
||||
String url = '${dotenv.env['SERVER_ROOT']!}/feed/update/$id';
|
||||
String url = '${baseUrl}/api/feed/update/$id';
|
||||
|
||||
final Map<String, dynamic> credentials = {
|
||||
'id': id,
|
||||
|
||||
@@ -36,8 +36,7 @@ class BlogPostEditLoadedState extends BlogPostEditState {
|
||||
TextEditingController? description;
|
||||
TextEditingController? youtubeURL;
|
||||
@override
|
||||
List<Object?> get props =>
|
||||
[blog_postModelObj, blog_post, title, description, youtubeURL];
|
||||
List<Object?> get props => [blog_postModelObj, blog_post, title, description, youtubeURL];
|
||||
BlogPostEditLoadedState copyWith({
|
||||
BlogPostEditModel? blog_postModelObj,
|
||||
Map<String, dynamic>? blog_post,
|
||||
@@ -65,6 +64,5 @@ class BlogPostEditErrorState extends BlogPostEditState {
|
||||
}
|
||||
|
||||
class BlogPostEditInitialState extends BlogPostEditState {
|
||||
BlogPostEditInitialState({required BlogPostEditModel blog_postModelObj})
|
||||
: super(blog_postModelObj: blog_postModelObj);
|
||||
BlogPostEditInitialState({required BlogPostEditModel blog_postModelObj}) : super(blog_postModelObj: blog_postModelObj);
|
||||
}
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
import 'bloc/blog_post_edit_bloc.dart';
|
||||
import 'models/blog_post_edit_model.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
import 'bloc/blog_post_edit_bloc.dart';
|
||||
import 'models/blog_post_edit_model.dart';
|
||||
|
||||
class BlogPostEditScreen extends StatelessWidget {
|
||||
const BlogPostEditScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context, blog_postID) {
|
||||
return BlocProvider<BlogPostEditBloc>(
|
||||
create: (context) => BlogPostEditBloc(BlogPostEditState(
|
||||
blog_postModelObj:
|
||||
BlogPostEditModel(blog_postID: blog_postID.toString())))
|
||||
..add(BlogPostEditInitialEvent()),
|
||||
create: (context) =>
|
||||
BlogPostEditBloc(BlogPostEditState(blog_postModelObj: BlogPostEditModel(blog_postID: blog_postID.toString())))..add(BlogPostEditInitialEvent()),
|
||||
child: BlogPostEditScreen(),
|
||||
);
|
||||
}
|
||||
@@ -77,8 +75,7 @@ class BlogPostEditScreen extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
CachedNetworkImage(
|
||||
imageUrl: dotenv.env['STORAGE_URL']! +
|
||||
(state.blog_post?['image'] ?? ''),
|
||||
imageUrl: baseUrl + '/storage/' + (state.blog_post?['image'] ?? ''),
|
||||
imageBuilder: (context, imageProvider) => CircleAvatar(
|
||||
backgroundImage: imageProvider,
|
||||
radius: 25,
|
||||
@@ -108,8 +105,7 @@ class BlogPostEditScreen extends StatelessWidget {
|
||||
SizedBox(height: 16.0),
|
||||
// Здесь нужно добавить виджет для загрузки картинки
|
||||
ElevatedButton(
|
||||
onPressed: () =>
|
||||
context.read<BlogPostEditBloc>().add(EditBlogPost()),
|
||||
onPressed: () => context.read<BlogPostEditBloc>().add(EditBlogPost()),
|
||||
child: Text('Сохранить'),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:eatvio_app/presentation/feed/blog_post_screen/models/comment_model.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class BlogPostModel extends Equatable {
|
||||
final String blog_postID;
|
||||
|
||||
@@ -4,12 +4,13 @@ import 'package:eatvio_app/core/app_export.dart';
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
class CommentModel {
|
||||
CommentModel(
|
||||
{this.userImage,
|
||||
this.username,
|
||||
this.dateText,
|
||||
this.greetingText,
|
||||
required this.id,}) {
|
||||
CommentModel({
|
||||
this.userImage,
|
||||
this.username,
|
||||
this.dateText,
|
||||
this.greetingText,
|
||||
required this.id,
|
||||
}) {
|
||||
userImage = userImage ?? ImageConstant.imageNotFound;
|
||||
username = username;
|
||||
dateText = dateText;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/presentation/feed/blog_post_screen/models/comment_model.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CommentWidget extends StatelessWidget {
|
||||
CommentWidget(this.commentModelObj, {Key? key})
|
||||
@@ -36,13 +35,11 @@ class CommentWidget extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.spaceBetween, // Move the main axis alignment to space between
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center, // Center the items vertically
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, // Move the main axis alignment to space between
|
||||
crossAxisAlignment: CrossAxisAlignment.center, // Center the items vertically
|
||||
children: [
|
||||
CachedNetworkImage(
|
||||
imageUrl: dotenv.env['STORAGE_URL']! + commentModelObj.userImage!,
|
||||
imageUrl: baseUrl + '/storage/' + commentModelObj.userImage!,
|
||||
imageBuilder: (context, imageProvider) => CircleAvatar(
|
||||
backgroundImage: imageProvider,
|
||||
radius: 25,
|
||||
@@ -69,10 +66,7 @@ class CommentWidget extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
commentModelObj.username!.length <= 15
|
||||
? commentModelObj.username!
|
||||
: commentModelObj.username!.substring(0, 15) +
|
||||
'...',
|
||||
commentModelObj.username!.length <= 15 ? commentModelObj.username! : commentModelObj.username!.substring(0, 15) + '...',
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
Spacer(),
|
||||
@@ -96,10 +90,11 @@ class CommentWidget extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
CustomImageView(
|
||||
imagePath: ImageConstant.imgSend,
|
||||
height: 30.v,
|
||||
width: 30.h,
|
||||
margin: EdgeInsets.only(left: 5),),
|
||||
imagePath: ImageConstant.imgSend,
|
||||
height: 30.v,
|
||||
width: 30.h,
|
||||
margin: EdgeInsets.only(left: 5),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ScrollItem extends StatelessWidget {
|
||||
final String title;
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomSearchView extends StatelessWidget {
|
||||
CustomSearchView(
|
||||
{Key? key,
|
||||
this.alignment,
|
||||
this.width,
|
||||
this.scrollPadding,
|
||||
this.controller,
|
||||
this.focusNode,
|
||||
this.autofocus = false,
|
||||
this.textStyle,
|
||||
this.textInputType = TextInputType.text,
|
||||
this.maxLines,
|
||||
this.hintText,
|
||||
this.hintStyle,
|
||||
this.prefix,
|
||||
this.prefixConstraints,
|
||||
this.suffix,
|
||||
this.suffixConstraints,
|
||||
this.contentPadding,
|
||||
this.borderDecoration,
|
||||
this.fillColor,
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.onChanged,})
|
||||
: super(
|
||||
CustomSearchView({
|
||||
Key? key,
|
||||
this.alignment,
|
||||
this.width,
|
||||
this.scrollPadding,
|
||||
this.controller,
|
||||
this.focusNode,
|
||||
this.autofocus = false,
|
||||
this.textStyle,
|
||||
this.textInputType = TextInputType.text,
|
||||
this.maxLines,
|
||||
this.hintText,
|
||||
this.hintStyle,
|
||||
this.prefix,
|
||||
this.prefixConstraints,
|
||||
this.suffix,
|
||||
this.suffixConstraints,
|
||||
this.contentPadding,
|
||||
this.borderDecoration,
|
||||
this.fillColor,
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.onChanged,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
|
||||
@@ -76,15 +76,15 @@ class CustomSearchView extends StatelessWidget {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: searchViewWidget(context),)
|
||||
child: searchViewWidget(context),
|
||||
)
|
||||
: searchViewWidget(context);
|
||||
}
|
||||
|
||||
searchViewWidget(BuildContext context) => SizedBox(
|
||||
width: width ?? double.maxFinite,
|
||||
child: TextFormField(
|
||||
scrollPadding:
|
||||
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
|
||||
scrollPadding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
onTapOutside: (event) => onTapOutside(),
|
||||
@@ -112,8 +112,9 @@ class CustomSearchView extends StatelessWidget {
|
||||
prefixIcon: prefix ??
|
||||
SizedBox(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Icon(Icons.search),),
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Icon(Icons.search),
|
||||
),
|
||||
),
|
||||
prefixIconConstraints: prefixConstraints ??
|
||||
BoxConstraints(
|
||||
|
||||
Reference in New Issue
Block a user