forked from eatvio/eatvio_app
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -100,7 +100,7 @@ jobs:
|
|||||||
run: flutter test
|
run: flutter test
|
||||||
|
|
||||||
- name: Build apk
|
- name: Build apk
|
||||||
run: flutter build apk
|
run: flutter build apk --release
|
||||||
|
|
||||||
- name: Rename and move apk
|
- name: Rename and move apk
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -6,22 +6,22 @@ plugins {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.eatvioapp.app"
|
namespace = "com.eatvioapp.app"
|
||||||
compileSdk = 35
|
compileSdk = flutter.compileSdkVersion
|
||||||
ndkVersion = "28.0.12433566"
|
ndkVersion = flutter.ndkVersion
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_21
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
targetCompatibility JavaVersion.VERSION_21
|
targetCompatibility = JavaVersion.VERSION_21
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = 21
|
jvmTarget = JavaVersion.VERSION_21
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "com.eatvioapp.app"
|
applicationId = "com.eatvioapp.app"
|
||||||
minSdk = flutter.minSdkVersion
|
minSdk = flutter.minSdkVersion
|
||||||
targetSdk = 35
|
targetSdk = flutter.targetSdkVersion
|
||||||
versionCode = flutter.versionCode
|
versionCode = flutter.versionCode
|
||||||
versionName = flutter.versionName
|
versionName = flutter.versionName
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,16 @@
|
|||||||
allprojects {
|
allprojects {
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
|
||||||
}
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.buildDir = '../build'
|
rootProject.buildDir = "../build"
|
||||||
subprojects {
|
subprojects {
|
||||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||||
}
|
}
|
||||||
subprojects {
|
subprojects {
|
||||||
project.evaluationDependsOn(':app')
|
project.evaluationDependsOn(":app")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("clean", Delete) {
|
tasks.register("clean", Delete) {
|
||||||
|
|||||||
663
android/build/reports/problems/problems-report.html
Normal file
663
android/build/reports/problems/problems-report.html
Normal file
File diff suppressed because one or more lines are too long
@@ -23,6 +23,7 @@ import 'package:eatvio_app/features/notifications/presentation/pages/notificatio
|
|||||||
import 'package:eatvio_app/features/plans/models/plan_pagination_model.dart';
|
import 'package:eatvio_app/features/plans/models/plan_pagination_model.dart';
|
||||||
import 'package:eatvio_app/features/plans/presentation/pages/about_plan_screen.dart';
|
import 'package:eatvio_app/features/plans/presentation/pages/about_plan_screen.dart';
|
||||||
import 'package:eatvio_app/features/profile/presentation/pages/profile_screen.dart';
|
import 'package:eatvio_app/features/profile/presentation/pages/profile_screen.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/presentation/pages/subs_screen.dart';
|
||||||
import 'package:eatvio_app/features/recipes/presentation/pages/about_recipes_screen.dart';
|
import 'package:eatvio_app/features/recipes/presentation/pages/about_recipes_screen.dart';
|
||||||
import 'package:eatvio_app/features/recipes/presentation/pages/recipe_create_screen.dart';
|
import 'package:eatvio_app/features/recipes/presentation/pages/recipe_create_screen.dart';
|
||||||
import 'package:eatvio_app/features/recipes/presentation/pages/recipe_edit_screen.dart';
|
import 'package:eatvio_app/features/recipes/presentation/pages/recipe_edit_screen.dart';
|
||||||
@@ -77,32 +78,32 @@ class AppRouter {
|
|||||||
await context.read<InitializationCubit>().runInitialization();
|
await context.read<InitializationCubit>().runInitialization();
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
builder: (context, state) => ProfileScreen(),
|
pageBuilder: (context, state) => NoTransitionPage(child: ProfileScreen()),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/feed-screen',
|
path: '/feed-screen',
|
||||||
name: 'feedScreen',
|
name: 'feedScreen',
|
||||||
builder: (context, state) => FeedScreen(),
|
pageBuilder: (context, state) => NoTransitionPage(child: FeedScreen()),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/diary-screen',
|
path: '/diary-screen',
|
||||||
name: 'diaryScreen',
|
name: 'diaryScreen',
|
||||||
builder: (context, state) => DiaryScreen(),
|
pageBuilder: (context, state) => NoTransitionPage(child: DiaryScreen()),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/chat-select-screen',
|
path: '/chat-select-screen',
|
||||||
name: 'chatSelectScreen',
|
name: 'chatSelectScreen',
|
||||||
builder: (context, state) => ChatSelectScreen(),
|
pageBuilder: (context, state) => NoTransitionPage(child: ChatSelectScreen()),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/notifications-screen',
|
path: '/notifications-screen',
|
||||||
name: 'notificationsScreen',
|
name: 'notificationsScreen',
|
||||||
builder: (context, state) => NotificationsScreen(),
|
pageBuilder: (context, state) => NoTransitionPage(child: NotificationsScreen()),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/menu-screen',
|
path: '/menu-screen',
|
||||||
name: 'menuScreen',
|
name: 'menuScreen',
|
||||||
builder: (context, state) => MenuScreen(),
|
pageBuilder: (context, state) => NoTransitionPage(child: MenuScreen()),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -139,16 +140,24 @@ class AppRouter {
|
|||||||
author: state.extra as Author,
|
author: state.extra as Author,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: '/subs-screen/:slug',
|
||||||
|
name: 'subsScreen',
|
||||||
|
builder: (context, state) => SubsScreen(
|
||||||
|
slug: state.pathParameters['slug']!,
|
||||||
|
subType: state.extra as SubType,
|
||||||
|
),
|
||||||
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/about-diet-screen',
|
path: '/about-diet-screen',
|
||||||
name: 'aboutDietScreen',
|
name: 'aboutDietScreen',
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final data = state.extra as Map<String, dynamic>;
|
final data = state.extra as Map<String, dynamic>;
|
||||||
return AboutDietScreen(
|
return AboutDietScreen(
|
||||||
diet: data['diet'] as Diet,
|
diet: data['diet'] as Diet,
|
||||||
index: data['index'] as int,
|
index: data['index'] as int,
|
||||||
navigateToComments: data['navigateToComments'] as bool,
|
navigateToComments: data['navigateToComments'] as bool,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import 'package:eatvio_app/features/plans/presentation/bloc/plans_cubit/plans_cu
|
|||||||
import 'package:eatvio_app/features/plans/repositories/plans_repository.dart';
|
import 'package:eatvio_app/features/plans/repositories/plans_repository.dart';
|
||||||
import 'package:eatvio_app/features/plans/services/plans_service.dart';
|
import 'package:eatvio_app/features/plans/services/plans_service.dart';
|
||||||
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
|
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/presentation/bloc/sub_cubit/sub_cubit.dart';
|
||||||
import 'package:eatvio_app/features/profile/repositories/profile_repository.dart';
|
import 'package:eatvio_app/features/profile/repositories/profile_repository.dart';
|
||||||
import 'package:eatvio_app/features/profile/services/profile_service.dart';
|
import 'package:eatvio_app/features/profile/services/profile_service.dart';
|
||||||
import 'package:eatvio_app/features/recipes/presentation/bloc/recipe_create_cubit.dart';
|
import 'package:eatvio_app/features/recipes/presentation/bloc/recipe_create_cubit.dart';
|
||||||
@@ -77,6 +78,7 @@ Future<void> init() async {
|
|||||||
sl.registerFactory<DiaryCubit>(() => DiaryCubit(diaryRepository: sl(), glossaryRepository: sl()));
|
sl.registerFactory<DiaryCubit>(() => DiaryCubit(diaryRepository: sl(), glossaryRepository: sl()));
|
||||||
sl.registerFactory<AboutDietCubit>(() => AboutDietCubit(dietsRepository: sl()));
|
sl.registerFactory<AboutDietCubit>(() => AboutDietCubit(dietsRepository: sl()));
|
||||||
sl.registerFactory<BlogPostCreateCubit>(() => BlogPostCreateCubit(blogPostRepository: sl()));
|
sl.registerFactory<BlogPostCreateCubit>(() => BlogPostCreateCubit(blogPostRepository: sl()));
|
||||||
|
sl.registerFactory<SubCubit>(() => SubCubit(profileRepository: sl()));
|
||||||
sl.registerFactory<CreateDietCubit>(() => CreateDietCubit(createDietRepository: sl()));
|
sl.registerFactory<CreateDietCubit>(() => CreateDietCubit(createDietRepository: sl()));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
19
lib/core/widgets/loader.dart
Normal file
19
lib/core/widgets/loader.dart
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rive/rive.dart';
|
||||||
|
|
||||||
|
class Loader extends StatelessWidget {
|
||||||
|
const Loader({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: SizedBox(
|
||||||
|
height: 32,
|
||||||
|
width: 32,
|
||||||
|
child: RiveAnimation.asset(
|
||||||
|
'assets/rive_animations/loading.riv',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ import 'dart:io';
|
|||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:eatvio_app/core/const.dart';
|
import 'package:eatvio_app/core/const.dart';
|
||||||
import 'package:eatvio_app/core/utils/date_time_utils.dart';
|
import 'package:eatvio_app/core/utils/date_time_utils.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
||||||
import 'package:eatvio_app/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart';
|
import 'package:eatvio_app/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart';
|
||||||
import 'package:eatvio_app/features/feed/presentation/bloc/comments_cubit/comments_state.dart';
|
import 'package:eatvio_app/features/feed/presentation/bloc/comments_cubit/comments_state.dart';
|
||||||
@@ -13,7 +14,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_html/flutter_html.dart';
|
import 'package:flutter_html/flutter_html.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:rive/rive.dart';
|
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
class BlogPostScreen extends StatefulWidget {
|
class BlogPostScreen extends StatefulWidget {
|
||||||
@@ -319,16 +319,7 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
|||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
if (state is CommentsStateLoading)
|
if (state is CommentsStateLoading)
|
||||||
Padding(
|
const Loader(),
|
||||||
padding: const EdgeInsets.all(32),
|
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (state is CommentsStateLoaded)
|
if (state is CommentsStateLoaded)
|
||||||
CommentsWidget(
|
CommentsWidget(
|
||||||
id: widget.blogPost.id.toString(),
|
id: widget.blogPost.id.toString(),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:eatvio_app/core/theme/app_decoration.dart';
|
import 'package:eatvio_app/core/theme/app_decoration.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
import 'package:eatvio_app/features/calendar/presentation/bloc/calendar_cubit.dart';
|
import 'package:eatvio_app/features/calendar/presentation/bloc/calendar_cubit.dart';
|
||||||
import 'package:eatvio_app/features/calendar/presentation/bloc/calendar_state.dart';
|
import 'package:eatvio_app/features/calendar/presentation/bloc/calendar_state.dart';
|
||||||
import 'package:eatvio_app/core/locator_service.dart';
|
import 'package:eatvio_app/core/locator_service.dart';
|
||||||
@@ -9,7 +10,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:rive/rive.dart';
|
|
||||||
|
|
||||||
class CalendarScreen extends StatelessWidget {
|
class CalendarScreen extends StatelessWidget {
|
||||||
CalendarScreen({Key? key}) : super(key: key);
|
CalendarScreen({Key? key}) : super(key: key);
|
||||||
@@ -23,15 +23,7 @@ class CalendarScreen extends StatelessWidget {
|
|||||||
return _buildCalendar(context, state);
|
return _buildCalendar(context, state);
|
||||||
} else if (state is CalendarStateLoading) {
|
} else if (state is CalendarStateLoading) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
body: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else if (state is CalendarStateError) {
|
} else if (state is CalendarStateError) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart';
|
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart';
|
||||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.dart';
|
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.dart';
|
||||||
import 'package:eatvio_app/features/chat/presentation/widgets/chat_bubble_widget.dart';
|
import 'package:eatvio_app/features/chat/presentation/widgets/chat_bubble_widget.dart';
|
||||||
@@ -10,7 +11,6 @@ import 'package:file_picker/file_picker.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:rive/rive.dart';
|
|
||||||
|
|
||||||
class ChatScreen extends StatefulWidget {
|
class ChatScreen extends StatefulWidget {
|
||||||
final String chatId;
|
final String chatId;
|
||||||
@@ -65,15 +65,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
body: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -175,15 +167,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
} else {
|
} else {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: Center(
|
child: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:easy_debounce/easy_debounce.dart';
|
import 'package:easy_debounce/easy_debounce.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_select_cubit/chat_select_cubit.dart';
|
import 'package:eatvio_app/features/chat/presentation/bloc/chat_select_cubit/chat_select_cubit.dart';
|
||||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_select_cubit/chat_select_state.dart';
|
import 'package:eatvio_app/features/chat/presentation/bloc/chat_select_cubit/chat_select_state.dart';
|
||||||
import 'package:eatvio_app/features/chat/presentation/widgets/chat_entry_widget.dart';
|
import 'package:eatvio_app/features/chat/presentation/widgets/chat_entry_widget.dart';
|
||||||
@@ -6,7 +7,6 @@ import 'package:eatvio_app/features/chat/presentation/widgets/chat_search_bar_wi
|
|||||||
import 'package:eatvio_app/core/locator_service.dart';
|
import 'package:eatvio_app/core/locator_service.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:rive/rive.dart';
|
|
||||||
|
|
||||||
class ChatSelectScreen extends StatefulWidget {
|
class ChatSelectScreen extends StatefulWidget {
|
||||||
const ChatSelectScreen({Key? key}) : super(key: key);
|
const ChatSelectScreen({Key? key}) : super(key: key);
|
||||||
@@ -78,15 +78,7 @@ class _ChatSelectScreenState extends State<ChatSelectScreen> {
|
|||||||
stateBuilder(state) {
|
stateBuilder(state) {
|
||||||
if (state is ChatSelectStateLoading) {
|
if (state is ChatSelectStateLoading) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
body: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else if (state is ChatSelectStateLoaded) {
|
} else if (state is ChatSelectStateLoaded) {
|
||||||
return _buildChatList(context, state);
|
return _buildChatList(context, state);
|
||||||
@@ -97,15 +89,7 @@ class _ChatSelectScreenState extends State<ChatSelectScreen> {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
body: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,15 +46,13 @@ class _ChatEntryWidgetState extends State<ChatEntryWidget> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
widget.chatRoom.users.toChatUser.profilePhotoPath == null
|
CircleAvatar(
|
||||||
? buildAvatarByUsername(widget.chatRoom.users.toChatUser.name)
|
radius: 24,
|
||||||
: CircleAvatar(
|
backgroundImage: NetworkImage(
|
||||||
radius: 24,
|
widget.chatRoom.users.toChatUser.profilePhotoUrl,
|
||||||
backgroundImage: NetworkImage(
|
),
|
||||||
widget.chatRoom.users.toChatUser.profilePhotoUrl,
|
backgroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.white,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -95,25 +93,4 @@ class _ChatEntryWidgetState extends State<ChatEntryWidget> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
buildAvatarByUsername(String username) {
|
|
||||||
username = username.trim();
|
|
||||||
return Container(
|
|
||||||
width: 48,
|
|
||||||
height: 48,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0xFFEBF4FF),
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
username.split(' ').first[0] + username.split(' ')[1][0],
|
|
||||||
style: TextStyle(
|
|
||||||
color: Color(0xFF7F9CF5),
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
fontSize: 20,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ class ProductModerationModel with _$ProductModerationModel {
|
|||||||
const factory ProductModerationModel({
|
const factory ProductModerationModel({
|
||||||
required String name,
|
required String name,
|
||||||
@JsonKey(name: 'energy_on_100gr')
|
@JsonKey(name: 'energy_on_100gr')
|
||||||
required int energy,
|
required double energy,
|
||||||
@JsonKey(name: 'proteins_on_100gr')
|
@JsonKey(name: 'proteins_on_100gr')
|
||||||
required int proteins,
|
required double proteins,
|
||||||
@JsonKey(name: 'fats_on_100gr')
|
@JsonKey(name: 'fats_on_100gr')
|
||||||
required int fats,
|
required double fats,
|
||||||
@JsonKey(name: 'carbohydrates_on_100gr')
|
@JsonKey(name: 'carbohydrates_on_100gr')
|
||||||
required int carbohydrates,
|
required double carbohydrates,
|
||||||
}) = _ProductModerationModel;
|
}) = _ProductModerationModel;
|
||||||
|
|
||||||
factory ProductModerationModel.fromJson(Map<String, Object?> json) => _$ProductModerationModelFromJson(json);
|
factory ProductModerationModel.fromJson(Map<String, Object?> json) => _$ProductModerationModelFromJson(json);
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ ProductModerationModel _$ProductModerationModelFromJson(
|
|||||||
mixin _$ProductModerationModel {
|
mixin _$ProductModerationModel {
|
||||||
String get name => throw _privateConstructorUsedError;
|
String get name => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'energy_on_100gr')
|
@JsonKey(name: 'energy_on_100gr')
|
||||||
int get energy => throw _privateConstructorUsedError;
|
double get energy => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'proteins_on_100gr')
|
@JsonKey(name: 'proteins_on_100gr')
|
||||||
int get proteins => throw _privateConstructorUsedError;
|
double get proteins => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'fats_on_100gr')
|
@JsonKey(name: 'fats_on_100gr')
|
||||||
int get fats => throw _privateConstructorUsedError;
|
double get fats => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'carbohydrates_on_100gr')
|
@JsonKey(name: 'carbohydrates_on_100gr')
|
||||||
int get carbohydrates => throw _privateConstructorUsedError;
|
double get carbohydrates => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Serializes this ProductModerationModel to a JSON map.
|
/// Serializes this ProductModerationModel to a JSON map.
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
@@ -49,10 +49,10 @@ abstract class $ProductModerationModelCopyWith<$Res> {
|
|||||||
@useResult
|
@useResult
|
||||||
$Res call(
|
$Res call(
|
||||||
{String name,
|
{String name,
|
||||||
@JsonKey(name: 'energy_on_100gr') int energy,
|
@JsonKey(name: 'energy_on_100gr') double energy,
|
||||||
@JsonKey(name: 'proteins_on_100gr') int proteins,
|
@JsonKey(name: 'proteins_on_100gr') double proteins,
|
||||||
@JsonKey(name: 'fats_on_100gr') int fats,
|
@JsonKey(name: 'fats_on_100gr') double fats,
|
||||||
@JsonKey(name: 'carbohydrates_on_100gr') int carbohydrates});
|
@JsonKey(name: 'carbohydrates_on_100gr') double carbohydrates});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -85,19 +85,19 @@ class _$ProductModerationModelCopyWithImpl<$Res,
|
|||||||
energy: null == energy
|
energy: null == energy
|
||||||
? _value.energy
|
? _value.energy
|
||||||
: energy // ignore: cast_nullable_to_non_nullable
|
: energy // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as double,
|
||||||
proteins: null == proteins
|
proteins: null == proteins
|
||||||
? _value.proteins
|
? _value.proteins
|
||||||
: proteins // ignore: cast_nullable_to_non_nullable
|
: proteins // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as double,
|
||||||
fats: null == fats
|
fats: null == fats
|
||||||
? _value.fats
|
? _value.fats
|
||||||
: fats // ignore: cast_nullable_to_non_nullable
|
: fats // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as double,
|
||||||
carbohydrates: null == carbohydrates
|
carbohydrates: null == carbohydrates
|
||||||
? _value.carbohydrates
|
? _value.carbohydrates
|
||||||
: carbohydrates // ignore: cast_nullable_to_non_nullable
|
: carbohydrates // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as double,
|
||||||
) as $Val);
|
) as $Val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,10 +113,10 @@ abstract class _$$ProductModerationModelImplCopyWith<$Res>
|
|||||||
@useResult
|
@useResult
|
||||||
$Res call(
|
$Res call(
|
||||||
{String name,
|
{String name,
|
||||||
@JsonKey(name: 'energy_on_100gr') int energy,
|
@JsonKey(name: 'energy_on_100gr') double energy,
|
||||||
@JsonKey(name: 'proteins_on_100gr') int proteins,
|
@JsonKey(name: 'proteins_on_100gr') double proteins,
|
||||||
@JsonKey(name: 'fats_on_100gr') int fats,
|
@JsonKey(name: 'fats_on_100gr') double fats,
|
||||||
@JsonKey(name: 'carbohydrates_on_100gr') int carbohydrates});
|
@JsonKey(name: 'carbohydrates_on_100gr') double carbohydrates});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -148,19 +148,19 @@ class __$$ProductModerationModelImplCopyWithImpl<$Res>
|
|||||||
energy: null == energy
|
energy: null == energy
|
||||||
? _value.energy
|
? _value.energy
|
||||||
: energy // ignore: cast_nullable_to_non_nullable
|
: energy // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as double,
|
||||||
proteins: null == proteins
|
proteins: null == proteins
|
||||||
? _value.proteins
|
? _value.proteins
|
||||||
: proteins // ignore: cast_nullable_to_non_nullable
|
: proteins // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as double,
|
||||||
fats: null == fats
|
fats: null == fats
|
||||||
? _value.fats
|
? _value.fats
|
||||||
: fats // ignore: cast_nullable_to_non_nullable
|
: fats // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as double,
|
||||||
carbohydrates: null == carbohydrates
|
carbohydrates: null == carbohydrates
|
||||||
? _value.carbohydrates
|
? _value.carbohydrates
|
||||||
: carbohydrates // ignore: cast_nullable_to_non_nullable
|
: carbohydrates // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as double,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,16 +182,16 @@ class _$ProductModerationModelImpl implements _ProductModerationModel {
|
|||||||
final String name;
|
final String name;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'energy_on_100gr')
|
@JsonKey(name: 'energy_on_100gr')
|
||||||
final int energy;
|
final double energy;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'proteins_on_100gr')
|
@JsonKey(name: 'proteins_on_100gr')
|
||||||
final int proteins;
|
final double proteins;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'fats_on_100gr')
|
@JsonKey(name: 'fats_on_100gr')
|
||||||
final int fats;
|
final double fats;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'carbohydrates_on_100gr')
|
@JsonKey(name: 'carbohydrates_on_100gr')
|
||||||
final int carbohydrates;
|
final double carbohydrates;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
@@ -237,11 +237,11 @@ class _$ProductModerationModelImpl implements _ProductModerationModel {
|
|||||||
abstract class _ProductModerationModel implements ProductModerationModel {
|
abstract class _ProductModerationModel implements ProductModerationModel {
|
||||||
const factory _ProductModerationModel(
|
const factory _ProductModerationModel(
|
||||||
{required final String name,
|
{required final String name,
|
||||||
@JsonKey(name: 'energy_on_100gr') required final int energy,
|
@JsonKey(name: 'energy_on_100gr') required final double energy,
|
||||||
@JsonKey(name: 'proteins_on_100gr') required final int proteins,
|
@JsonKey(name: 'proteins_on_100gr') required final double proteins,
|
||||||
@JsonKey(name: 'fats_on_100gr') required final int fats,
|
@JsonKey(name: 'fats_on_100gr') required final double fats,
|
||||||
@JsonKey(name: 'carbohydrates_on_100gr')
|
@JsonKey(name: 'carbohydrates_on_100gr')
|
||||||
required final int carbohydrates}) = _$ProductModerationModelImpl;
|
required final double carbohydrates}) = _$ProductModerationModelImpl;
|
||||||
|
|
||||||
factory _ProductModerationModel.fromJson(Map<String, dynamic> json) =
|
factory _ProductModerationModel.fromJson(Map<String, dynamic> json) =
|
||||||
_$ProductModerationModelImpl.fromJson;
|
_$ProductModerationModelImpl.fromJson;
|
||||||
@@ -250,16 +250,16 @@ abstract class _ProductModerationModel implements ProductModerationModel {
|
|||||||
String get name;
|
String get name;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'energy_on_100gr')
|
@JsonKey(name: 'energy_on_100gr')
|
||||||
int get energy;
|
double get energy;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'proteins_on_100gr')
|
@JsonKey(name: 'proteins_on_100gr')
|
||||||
int get proteins;
|
double get proteins;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'fats_on_100gr')
|
@JsonKey(name: 'fats_on_100gr')
|
||||||
int get fats;
|
double get fats;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'carbohydrates_on_100gr')
|
@JsonKey(name: 'carbohydrates_on_100gr')
|
||||||
int get carbohydrates;
|
double get carbohydrates;
|
||||||
|
|
||||||
/// Create a copy of ProductModerationModel
|
/// Create a copy of ProductModerationModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ _$ProductModerationModelImpl _$$ProductModerationModelImplFromJson(
|
|||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json) =>
|
||||||
_$ProductModerationModelImpl(
|
_$ProductModerationModelImpl(
|
||||||
name: json['name'] as String,
|
name: json['name'] as String,
|
||||||
energy: (json['energy_on_100gr'] as num).toInt(),
|
energy: (json['energy_on_100gr'] as num).toDouble(),
|
||||||
proteins: (json['proteins_on_100gr'] as num).toInt(),
|
proteins: (json['proteins_on_100gr'] as num).toDouble(),
|
||||||
fats: (json['fats_on_100gr'] as num).toInt(),
|
fats: (json['fats_on_100gr'] as num).toDouble(),
|
||||||
carbohydrates: (json['carbohydrates_on_100gr'] as num).toInt(),
|
carbohydrates: (json['carbohydrates_on_100gr'] as num).toDouble(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$ProductModerationModelImplToJson(
|
Map<String, dynamic> _$$ProductModerationModelImplToJson(
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
class DiaryCubit extends Cubit<DiaryState> {
|
class DiaryCubit extends Cubit<DiaryState> {
|
||||||
final DiaryRepository diaryRepository;
|
final DiaryRepository diaryRepository;
|
||||||
final GlossaryRepository glossaryRepository;
|
final GlossaryRepository glossaryRepository;
|
||||||
double currentSelectedSatietyRating = 3;
|
|
||||||
|
|
||||||
DiaryCubit({
|
DiaryCubit({
|
||||||
required this.diaryRepository,
|
required this.diaryRepository,
|
||||||
@@ -22,11 +21,16 @@ class DiaryCubit extends Cubit<DiaryState> {
|
|||||||
getDiaryDay(String date, [bool needLoading = true]) async {
|
getDiaryDay(String date, [bool needLoading = true]) async {
|
||||||
if (needLoading) emit(const DiaryState.loading());
|
if (needLoading) emit(const DiaryState.loading());
|
||||||
try {
|
try {
|
||||||
|
final diaryDay = await diaryRepository.getDiaryByDate(date);
|
||||||
|
final List<int> satiety = [];
|
||||||
|
for (int i = 0; i < diaryDay.meals.length; i++) {
|
||||||
|
satiety.add(diaryDay.meals[i].satiety);
|
||||||
|
}
|
||||||
emit(
|
emit(
|
||||||
DiaryState.loaded(
|
DiaryState.loaded(
|
||||||
diary: await diaryRepository.getDiaryByDate(date),
|
diary: diaryDay,
|
||||||
nutrition: await getNutrition((await diaryRepository.getDiaryByDate(date)).id),
|
nutrition: await getNutrition((await diaryRepository.getDiaryByDate(date)).id),
|
||||||
currentSelectedSatietyRating: currentSelectedSatietyRating,
|
currentSelectedSatietyRating: satiety,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -136,17 +140,23 @@ class DiaryCubit extends Cubit<DiaryState> {
|
|||||||
await getDiaryDay(date, false);
|
await getDiaryDay(date, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCurrentSelectedSatietyRating(double value) {
|
updateCurrentSelectedSatietyRating({
|
||||||
currentSelectedSatietyRating = value;
|
required int diaryId,
|
||||||
emit((state as DiaryStateLoaded).copyWith(currentSelectedSatietyRating: currentSelectedSatietyRating));
|
required int meal,
|
||||||
|
required int value,
|
||||||
|
}) {
|
||||||
|
List<int> satiety = [...(state as DiaryStateLoaded).currentSelectedSatietyRating];
|
||||||
|
satiety[meal] = value;
|
||||||
|
diaryRepository.fillSatiety(diaryId: diaryId, meal: meal, satiety: value.toInt() - 1);
|
||||||
|
emit((state as DiaryStateLoaded).copyWith(currentSelectedSatietyRating: satiety));
|
||||||
}
|
}
|
||||||
|
|
||||||
sendProductToModeration({
|
sendProductToModeration({
|
||||||
required String name,
|
required String name,
|
||||||
required int energy,
|
required double energy,
|
||||||
required int proteins,
|
required double proteins,
|
||||||
required int fats,
|
required double fats,
|
||||||
required int carbohydrates,
|
required double carbohydrates,
|
||||||
}) async {
|
}) async {
|
||||||
return await diaryRepository.sendProductToModeration(
|
return await diaryRepository.sendProductToModeration(
|
||||||
name: name,
|
name: name,
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ class DiaryState with _$DiaryState {
|
|||||||
const factory DiaryState.loaded({
|
const factory DiaryState.loaded({
|
||||||
required DiaryDayModel diary,
|
required DiaryDayModel diary,
|
||||||
required NutritionDataModel nutrition,
|
required NutritionDataModel nutrition,
|
||||||
required double currentSelectedSatietyRating,
|
required List<int> currentSelectedSatietyRating,
|
||||||
}) = DiaryStateLoaded;
|
}) = DiaryStateLoaded;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ mixin _$DiaryState {
|
|||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String errorMessage) error,
|
required TResult Function(String errorMessage) error,
|
||||||
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)
|
List<int> currentSelectedSatietyRating)
|
||||||
loaded,
|
loaded,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@@ -32,7 +32,7 @@ mixin _$DiaryState {
|
|||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String errorMessage)? error,
|
TResult? Function(String errorMessage)? error,
|
||||||
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)?
|
List<int> currentSelectedSatietyRating)?
|
||||||
loaded,
|
loaded,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@@ -42,7 +42,7 @@ mixin _$DiaryState {
|
|||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String errorMessage)? error,
|
TResult Function(String errorMessage)? error,
|
||||||
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)?
|
List<int> currentSelectedSatietyRating)?
|
||||||
loaded,
|
loaded,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
@@ -140,7 +140,7 @@ class _$DiaryStateImpl implements _DiaryState {
|
|||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String errorMessage) error,
|
required TResult Function(String errorMessage) error,
|
||||||
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)
|
List<int> currentSelectedSatietyRating)
|
||||||
loaded,
|
loaded,
|
||||||
}) {
|
}) {
|
||||||
return $default();
|
return $default();
|
||||||
@@ -153,7 +153,7 @@ class _$DiaryStateImpl implements _DiaryState {
|
|||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String errorMessage)? error,
|
TResult? Function(String errorMessage)? error,
|
||||||
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)?
|
List<int> currentSelectedSatietyRating)?
|
||||||
loaded,
|
loaded,
|
||||||
}) {
|
}) {
|
||||||
return $default?.call();
|
return $default?.call();
|
||||||
@@ -166,7 +166,7 @@ class _$DiaryStateImpl implements _DiaryState {
|
|||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String errorMessage)? error,
|
TResult Function(String errorMessage)? error,
|
||||||
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)?
|
List<int> currentSelectedSatietyRating)?
|
||||||
loaded,
|
loaded,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@@ -263,7 +263,7 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading {
|
|||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String errorMessage) error,
|
required TResult Function(String errorMessage) error,
|
||||||
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)
|
List<int> currentSelectedSatietyRating)
|
||||||
loaded,
|
loaded,
|
||||||
}) {
|
}) {
|
||||||
return loading();
|
return loading();
|
||||||
@@ -276,7 +276,7 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading {
|
|||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String errorMessage)? error,
|
TResult? Function(String errorMessage)? error,
|
||||||
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)?
|
List<int> currentSelectedSatietyRating)?
|
||||||
loaded,
|
loaded,
|
||||||
}) {
|
}) {
|
||||||
return loading?.call();
|
return loading?.call();
|
||||||
@@ -289,7 +289,7 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading {
|
|||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String errorMessage)? error,
|
TResult Function(String errorMessage)? error,
|
||||||
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)?
|
List<int> currentSelectedSatietyRating)?
|
||||||
loaded,
|
loaded,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@@ -415,7 +415,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
|
|||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String errorMessage) error,
|
required TResult Function(String errorMessage) error,
|
||||||
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)
|
List<int> currentSelectedSatietyRating)
|
||||||
loaded,
|
loaded,
|
||||||
}) {
|
}) {
|
||||||
return error(errorMessage);
|
return error(errorMessage);
|
||||||
@@ -428,7 +428,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
|
|||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String errorMessage)? error,
|
TResult? Function(String errorMessage)? error,
|
||||||
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)?
|
List<int> currentSelectedSatietyRating)?
|
||||||
loaded,
|
loaded,
|
||||||
}) {
|
}) {
|
||||||
return error?.call(errorMessage);
|
return error?.call(errorMessage);
|
||||||
@@ -441,7 +441,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
|
|||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String errorMessage)? error,
|
TResult Function(String errorMessage)? error,
|
||||||
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)?
|
List<int> currentSelectedSatietyRating)?
|
||||||
loaded,
|
loaded,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@@ -511,7 +511,7 @@ abstract class _$$DiaryStateLoadedImplCopyWith<$Res> {
|
|||||||
$Res call(
|
$Res call(
|
||||||
{DiaryDayModel diary,
|
{DiaryDayModel diary,
|
||||||
NutritionDataModel nutrition,
|
NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating});
|
List<int> currentSelectedSatietyRating});
|
||||||
|
|
||||||
$DiaryDayModelCopyWith<$Res> get diary;
|
$DiaryDayModelCopyWith<$Res> get diary;
|
||||||
$NutritionDataModelCopyWith<$Res> get nutrition;
|
$NutritionDataModelCopyWith<$Res> get nutrition;
|
||||||
@@ -544,9 +544,9 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
|
|||||||
: nutrition // ignore: cast_nullable_to_non_nullable
|
: nutrition // ignore: cast_nullable_to_non_nullable
|
||||||
as NutritionDataModel,
|
as NutritionDataModel,
|
||||||
currentSelectedSatietyRating: null == currentSelectedSatietyRating
|
currentSelectedSatietyRating: null == currentSelectedSatietyRating
|
||||||
? _value.currentSelectedSatietyRating
|
? _value._currentSelectedSatietyRating
|
||||||
: currentSelectedSatietyRating // ignore: cast_nullable_to_non_nullable
|
: currentSelectedSatietyRating // ignore: cast_nullable_to_non_nullable
|
||||||
as double,
|
as List<int>,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,14 +577,21 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
const _$DiaryStateLoadedImpl(
|
const _$DiaryStateLoadedImpl(
|
||||||
{required this.diary,
|
{required this.diary,
|
||||||
required this.nutrition,
|
required this.nutrition,
|
||||||
required this.currentSelectedSatietyRating});
|
required final List<int> currentSelectedSatietyRating})
|
||||||
|
: _currentSelectedSatietyRating = currentSelectedSatietyRating;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final DiaryDayModel diary;
|
final DiaryDayModel diary;
|
||||||
@override
|
@override
|
||||||
final NutritionDataModel nutrition;
|
final NutritionDataModel nutrition;
|
||||||
|
final List<int> _currentSelectedSatietyRating;
|
||||||
@override
|
@override
|
||||||
final double currentSelectedSatietyRating;
|
List<int> get currentSelectedSatietyRating {
|
||||||
|
if (_currentSelectedSatietyRating is EqualUnmodifiableListView)
|
||||||
|
return _currentSelectedSatietyRating;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_currentSelectedSatietyRating);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
@@ -599,15 +606,14 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
(identical(other.diary, diary) || other.diary == diary) &&
|
(identical(other.diary, diary) || other.diary == diary) &&
|
||||||
(identical(other.nutrition, nutrition) ||
|
(identical(other.nutrition, nutrition) ||
|
||||||
other.nutrition == nutrition) &&
|
other.nutrition == nutrition) &&
|
||||||
(identical(other.currentSelectedSatietyRating,
|
const DeepCollectionEquality().equals(
|
||||||
currentSelectedSatietyRating) ||
|
other._currentSelectedSatietyRating,
|
||||||
other.currentSelectedSatietyRating ==
|
_currentSelectedSatietyRating));
|
||||||
currentSelectedSatietyRating));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode => Object.hash(runtimeType, diary, nutrition,
|
||||||
Object.hash(runtimeType, diary, nutrition, currentSelectedSatietyRating);
|
const DeepCollectionEquality().hash(_currentSelectedSatietyRating));
|
||||||
|
|
||||||
/// Create a copy of DiaryState
|
/// Create a copy of DiaryState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@@ -625,7 +631,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String errorMessage) error,
|
required TResult Function(String errorMessage) error,
|
||||||
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
required TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)
|
List<int> currentSelectedSatietyRating)
|
||||||
loaded,
|
loaded,
|
||||||
}) {
|
}) {
|
||||||
return loaded(diary, nutrition, currentSelectedSatietyRating);
|
return loaded(diary, nutrition, currentSelectedSatietyRating);
|
||||||
@@ -638,7 +644,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String errorMessage)? error,
|
TResult? Function(String errorMessage)? error,
|
||||||
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
TResult? Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)?
|
List<int> currentSelectedSatietyRating)?
|
||||||
loaded,
|
loaded,
|
||||||
}) {
|
}) {
|
||||||
return loaded?.call(diary, nutrition, currentSelectedSatietyRating);
|
return loaded?.call(diary, nutrition, currentSelectedSatietyRating);
|
||||||
@@ -651,7 +657,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
|
|||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String errorMessage)? error,
|
TResult Function(String errorMessage)? error,
|
||||||
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
TResult Function(DiaryDayModel diary, NutritionDataModel nutrition,
|
||||||
double currentSelectedSatietyRating)?
|
List<int> currentSelectedSatietyRating)?
|
||||||
loaded,
|
loaded,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@@ -703,12 +709,12 @@ abstract class DiaryStateLoaded implements DiaryState {
|
|||||||
const factory DiaryStateLoaded(
|
const factory DiaryStateLoaded(
|
||||||
{required final DiaryDayModel diary,
|
{required final DiaryDayModel diary,
|
||||||
required final NutritionDataModel nutrition,
|
required final NutritionDataModel nutrition,
|
||||||
required final double currentSelectedSatietyRating}) =
|
required final List<int> currentSelectedSatietyRating}) =
|
||||||
_$DiaryStateLoadedImpl;
|
_$DiaryStateLoadedImpl;
|
||||||
|
|
||||||
DiaryDayModel get diary;
|
DiaryDayModel get diary;
|
||||||
NutritionDataModel get nutrition;
|
NutritionDataModel get nutrition;
|
||||||
double get currentSelectedSatietyRating;
|
List<int> get currentSelectedSatietyRating;
|
||||||
|
|
||||||
/// Create a copy of DiaryState
|
/// Create a copy of DiaryState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:eatvio_app/core/const.dart';
|
import 'package:eatvio_app/core/const.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
import 'package:eatvio_app/features/diary/models/diary_day_model.dart';
|
import 'package:eatvio_app/features/diary/models/diary_day_model.dart';
|
||||||
import 'package:eatvio_app/features/diary/models/nutrition_model.dart';
|
import 'package:eatvio_app/features/diary/models/nutrition_model.dart';
|
||||||
import 'package:eatvio_app/features/diary/presentation/bloc/diary_cubit.dart';
|
import 'package:eatvio_app/features/diary/presentation/bloc/diary_cubit.dart';
|
||||||
@@ -18,7 +19,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:rive/rive.dart';
|
|
||||||
import 'package:syncfusion_flutter_gauges/gauges.dart';
|
import 'package:syncfusion_flutter_gauges/gauges.dart';
|
||||||
import 'package:table_calendar/table_calendar.dart';
|
import 'package:table_calendar/table_calendar.dart';
|
||||||
|
|
||||||
@@ -42,7 +42,6 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
int currentSelectedPhotoIndex = 0;
|
int currentSelectedPhotoIndex = 0;
|
||||||
String time = "${DateTime.now().hour.toString().padLeft(2, '0')}:${DateTime.now().minute.toString().padLeft(2, '0')}";
|
String time = "${DateTime.now().hour.toString().padLeft(2, '0')}:${DateTime.now().minute.toString().padLeft(2, '0')}";
|
||||||
DateTime _time = DateTime.now();
|
DateTime _time = DateTime.now();
|
||||||
bool enableQuantity = false;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -124,7 +123,7 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_calendar(state),
|
_calendar(state),
|
||||||
if (state is DiaryStateLoading) _loader(),
|
if (state is DiaryStateLoading) const Loader(),
|
||||||
if (state is DiaryStateLoaded)
|
if (state is DiaryStateLoaded)
|
||||||
_meals(
|
_meals(
|
||||||
state.diary,
|
state.diary,
|
||||||
@@ -249,7 +248,7 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
|
|
||||||
_meals(
|
_meals(
|
||||||
DiaryDayModel diaryDay,
|
DiaryDayModel diaryDay,
|
||||||
double currentSelectedSatietyRating,
|
List<int> satietyRating,
|
||||||
) {
|
) {
|
||||||
return Material(
|
return Material(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
@@ -322,7 +321,9 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
_selectedDay!.compareTo(today!) == 1
|
_selectedDay!.compareTo(today!) == 1
|
||||||
? const SizedBox.shrink()
|
? const SizedBox.shrink()
|
||||||
: SatietyRatingWidget(
|
: SatietyRatingWidget(
|
||||||
currentSelectedSatietyRating: currentSelectedSatietyRating,
|
currentSelectedSatietyRating: satietyRating,
|
||||||
|
diaryId: diaryDay.id,
|
||||||
|
meal: currentSelectedMealNumber,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -586,6 +587,7 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
actions: [
|
actions: [
|
||||||
CupertinoActionSheetAction(
|
CupertinoActionSheetAction(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
Navigator.of(context).pop();
|
||||||
final picker = ImagePicker();
|
final picker = ImagePicker();
|
||||||
XFile? image = await picker.pickImage(source: ImageSource.camera);
|
XFile? image = await picker.pickImage(source: ImageSource.camera);
|
||||||
if (image != null)
|
if (image != null)
|
||||||
@@ -595,7 +597,6 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
mealId: diaryDay.meals[currentSelectedMealNumber - 1].id,
|
mealId: diaryDay.meals[currentSelectedMealNumber - 1].id,
|
||||||
date: _selectedDay.toString(),
|
date: _selectedDay.toString(),
|
||||||
);
|
);
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
},
|
||||||
child: const Row(
|
child: const Row(
|
||||||
children: const [
|
children: const [
|
||||||
@@ -607,6 +608,7 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
),
|
),
|
||||||
CupertinoActionSheetAction(
|
CupertinoActionSheetAction(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
Navigator.of(context).pop();
|
||||||
final picker = ImagePicker();
|
final picker = ImagePicker();
|
||||||
List<XFile>? images = await picker.pickMultiImage();
|
List<XFile>? images = await picker.pickMultiImage();
|
||||||
if (images.isNotEmpty)
|
if (images.isNotEmpty)
|
||||||
@@ -616,7 +618,6 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
mealId: diaryDay.meals[currentSelectedMealNumber - 1].id,
|
mealId: diaryDay.meals[currentSelectedMealNumber - 1].id,
|
||||||
date: _selectedDay.toString(),
|
date: _selectedDay.toString(),
|
||||||
);
|
);
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
},
|
||||||
child: const Row(
|
child: const Row(
|
||||||
children: const [
|
children: const [
|
||||||
@@ -767,18 +768,6 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_loader() {
|
|
||||||
return Center(
|
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
_calendar(DiaryState state) {
|
_calendar(DiaryState state) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@@ -883,77 +872,74 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
TypeAheadField(
|
Row(
|
||||||
controller: productNameController,
|
mainAxisSize: MainAxisSize.min,
|
||||||
itemBuilder: (context, glossary) {
|
children: [
|
||||||
return Padding(
|
SizedBox(
|
||||||
padding: const EdgeInsets.all(8.0),
|
width: MediaQuery.of(context).size.width * 0.8 - 32,
|
||||||
child: Text(
|
child: TypeAheadField(
|
||||||
glossary.name,
|
controller: productNameController,
|
||||||
style: TextStyle(
|
itemBuilder: (context, glossary) {
|
||||||
height: 1,
|
return Padding(
|
||||||
fontSize: 16,
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
glossary.name,
|
||||||
|
style: TextStyle(
|
||||||
|
height: 1,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemSeparatorBuilder: (context, index) => _divider(context),
|
||||||
|
onSelected: (newSelectedGlossary) async {
|
||||||
|
setState(() {
|
||||||
|
selectedGlossary = newSelectedGlossary;
|
||||||
|
productNameController.text = selectedGlossary!.name;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
suggestionsCallback: (query) async {
|
||||||
|
if (query.length < 1) return [];
|
||||||
|
final suggestionsList = await diaryCubit.getGlossaryListByQuery(query);
|
||||||
|
return suggestionsList;
|
||||||
|
},
|
||||||
|
builder: (context, controller, focusNode) {
|
||||||
|
return CustomTextFormField(
|
||||||
|
controller: controller,
|
||||||
|
autofocus: true,
|
||||||
|
focusNode: focusNode,
|
||||||
|
hintText: 'Введите название продукта/блюда',
|
||||||
|
);
|
||||||
|
},
|
||||||
|
emptyBuilder: (context) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
},
|
||||||
|
errorBuilder: (context, object) => Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text('Нет подходящих вариантов'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
|
||||||
},
|
|
||||||
itemSeparatorBuilder: (context, index) => _divider(context),
|
|
||||||
onSelected: (newSelectedGlossary) {
|
|
||||||
setState(() {
|
|
||||||
selectedGlossary = newSelectedGlossary;
|
|
||||||
productNameController.text = selectedGlossary!.name;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
suggestionsCallback: (query) async {
|
|
||||||
if (query.length < 1) return [];
|
|
||||||
final suggestionsList = await diaryCubit.getGlossaryListByQuery(query);
|
|
||||||
if (suggestionsList.length == 1) {
|
|
||||||
setState(() {
|
|
||||||
selectedGlossary = suggestionsList.first;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (suggestionsList.length == 0) {
|
|
||||||
setState(() {
|
|
||||||
enableQuantity = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return suggestionsList;
|
|
||||||
},
|
|
||||||
builder: (context, controller, focusNode) {
|
|
||||||
return CustomTextFormField(
|
|
||||||
controller: controller,
|
|
||||||
autofocus: true,
|
|
||||||
focusNode: focusNode,
|
|
||||||
hintText: 'Введите название продукта/блюда',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
emptyBuilder: (context) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
},
|
|
||||||
errorBuilder: (context, object) => Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text('Нет подходящих вариантов'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (selectedGlossary != null || enableQuantity)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(top: 8),
|
|
||||||
child: CustomTextFormField(
|
|
||||||
controller: quantityController,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
hintText: selectedGlossary == null
|
|
||||||
? '100'
|
|
||||||
: selectedGlossary!.grInPortion == 0
|
|
||||||
? '100'
|
|
||||||
: '1',
|
|
||||||
autofocus: true,
|
|
||||||
suffixText: selectedGlossary == null
|
|
||||||
? 'гр'
|
|
||||||
: selectedGlossary?.grInPortion == 0
|
|
||||||
? 'гр'
|
|
||||||
: 'шт',
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 4),
|
||||||
|
SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.2 - 4,
|
||||||
|
child: CustomTextFormField(
|
||||||
|
controller: quantityController,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
hintText: selectedGlossary == null
|
||||||
|
? '100'
|
||||||
|
: selectedGlossary!.grInPortion == 0
|
||||||
|
? '100'
|
||||||
|
: '1',
|
||||||
|
suffixText: selectedGlossary == null
|
||||||
|
? 'гр'
|
||||||
|
: selectedGlossary?.grInPortion == 0
|
||||||
|
? 'гр'
|
||||||
|
: 'шт',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -1014,7 +1000,7 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
if (enableQuantity) {
|
if (selectedGlossary == null) {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
@@ -1030,9 +1016,6 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
setState(() {
|
|
||||||
enableQuantity = false;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
child: Ink(
|
child: Ink(
|
||||||
@@ -1071,7 +1054,6 @@ class _DiaryScreenState extends State<DiaryScreen> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedGlossary = null;
|
selectedGlossary = null;
|
||||||
enableQuantity = false;
|
|
||||||
productNameController.clear();
|
productNameController.clear();
|
||||||
quantityController.clear();
|
quantityController.clear();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -264,10 +264,10 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
widget.diaryCubit.sendProductToModeration(
|
widget.diaryCubit.sendProductToModeration(
|
||||||
name: productNameController.text,
|
name: productNameController.text,
|
||||||
energy: int.parse(energyController.text),
|
energy: double.parse(energyController.text),
|
||||||
proteins: int.parse(proteinsController.text),
|
proteins: double.parse(proteinsController.text),
|
||||||
fats: int.parse(fatsController.text),
|
fats: double.parse(fatsController.text),
|
||||||
carbohydrates: int.parse(carbohydratesController.text),
|
carbohydrates: double.parse(carbohydratesController.text),
|
||||||
);
|
);
|
||||||
setState(() {
|
setState(() {
|
||||||
glossaryState = GlossaryState.success;
|
glossaryState = GlossaryState.success;
|
||||||
|
|||||||
@@ -5,11 +5,15 @@ import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
|||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
|
||||||
class SatietyRatingWidget extends StatefulWidget {
|
class SatietyRatingWidget extends StatefulWidget {
|
||||||
final double currentSelectedSatietyRating;
|
final List<int> currentSelectedSatietyRating;
|
||||||
|
final int diaryId;
|
||||||
|
final int meal;
|
||||||
|
|
||||||
const SatietyRatingWidget({
|
const SatietyRatingWidget({
|
||||||
super.key,
|
super.key,
|
||||||
required this.currentSelectedSatietyRating,
|
required this.currentSelectedSatietyRating,
|
||||||
|
required this.diaryId,
|
||||||
|
required this.meal,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -39,7 +43,7 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
|||||||
width: 32,
|
width: 32,
|
||||||
),
|
),
|
||||||
RatingBar.builder(
|
RatingBar.builder(
|
||||||
initialRating: 3,
|
initialRating: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1,
|
||||||
itemCount: 6,
|
itemCount: 6,
|
||||||
itemSize: MediaQuery.of(context).size.width / 6 - (124 / 6),
|
itemSize: MediaQuery.of(context).size.width / 6 - (124 / 6),
|
||||||
updateOnDrag: true,
|
updateOnDrag: true,
|
||||||
@@ -49,17 +53,17 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
|||||||
return Container(
|
return Container(
|
||||||
width: MediaQuery.of(context).size.width / 6,
|
width: MediaQuery.of(context).size.width / 6,
|
||||||
height: 24,
|
height: 24,
|
||||||
margin: widget.currentSelectedSatietyRating == 1 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
margin: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 1 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color(0xFFC82222),
|
color: Color(0xFFC82222),
|
||||||
border: widget.currentSelectedSatietyRating == 1
|
border: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 1
|
||||||
? Border.all(
|
? Border.all(
|
||||||
width: 2,
|
width: 2,
|
||||||
color: Color(0xFFAA3333),
|
color: Color(0xFFAA3333),
|
||||||
strokeAlign: BorderSide.strokeAlignOutside,
|
strokeAlign: BorderSide.strokeAlignOutside,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
borderRadius: widget.currentSelectedSatietyRating == 1
|
borderRadius: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 1
|
||||||
? BorderRadius.horizontal(
|
? BorderRadius.horizontal(
|
||||||
left: Radius.circular(8),
|
left: Radius.circular(8),
|
||||||
right: Radius.circular(2),
|
right: Radius.circular(2),
|
||||||
@@ -73,85 +77,85 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
|||||||
return Container(
|
return Container(
|
||||||
width: MediaQuery.of(context).size.width / 6,
|
width: MediaQuery.of(context).size.width / 6,
|
||||||
height: 24,
|
height: 24,
|
||||||
margin: widget.currentSelectedSatietyRating == 2 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
margin: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 2 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color(0xFFFF3E3E),
|
color: Color(0xFFFF3E3E),
|
||||||
border: widget.currentSelectedSatietyRating == 2
|
border: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 2
|
||||||
? Border.all(
|
? Border.all(
|
||||||
width: 2,
|
width: 2,
|
||||||
color: Color(0xFF550000),
|
color: Color(0xFF550000),
|
||||||
strokeAlign: BorderSide.strokeAlignOutside,
|
strokeAlign: BorderSide.strokeAlignOutside,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
borderRadius: widget.currentSelectedSatietyRating == 2 ? BorderRadius.circular(2) : null,
|
borderRadius: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 2 ? BorderRadius.circular(2) : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
case 2:
|
case 2:
|
||||||
return Container(
|
return Container(
|
||||||
width: MediaQuery.of(context).size.width / 6,
|
width: MediaQuery.of(context).size.width / 6,
|
||||||
height: 24,
|
height: 24,
|
||||||
margin: widget.currentSelectedSatietyRating == 3 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
margin: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 3 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color(0xFFF8C926),
|
color: Color(0xFFF8C926),
|
||||||
border: widget.currentSelectedSatietyRating == 3
|
border: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 3
|
||||||
? Border.all(
|
? Border.all(
|
||||||
width: 2,
|
width: 2,
|
||||||
color: Color(0xFF8C5D00),
|
color: Color(0xFF8C5D00),
|
||||||
strokeAlign: BorderSide.strokeAlignOutside,
|
strokeAlign: BorderSide.strokeAlignOutside,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
borderRadius: widget.currentSelectedSatietyRating == 3 ? BorderRadius.circular(2) : null,
|
borderRadius: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 3 ? BorderRadius.circular(2) : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
case 3:
|
case 3:
|
||||||
return Container(
|
return Container(
|
||||||
width: MediaQuery.of(context).size.width / 6,
|
width: MediaQuery.of(context).size.width / 6,
|
||||||
height: 24,
|
height: 24,
|
||||||
margin: widget.currentSelectedSatietyRating == 4 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
margin: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 4 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color(0xFFFFF3BF),
|
color: Color(0xFFFFF3BF),
|
||||||
border: widget.currentSelectedSatietyRating == 4
|
border: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 4
|
||||||
? Border.all(
|
? Border.all(
|
||||||
width: 2,
|
width: 2,
|
||||||
color: Color(0xFFB5911B),
|
color: Color(0xFFB5911B),
|
||||||
strokeAlign: BorderSide.strokeAlignOutside,
|
strokeAlign: BorderSide.strokeAlignOutside,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
borderRadius: widget.currentSelectedSatietyRating == 4 ? BorderRadius.circular(2) : null,
|
borderRadius: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 4 ? BorderRadius.circular(2) : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
case 4:
|
case 4:
|
||||||
return Container(
|
return Container(
|
||||||
width: MediaQuery.of(context).size.width / 6,
|
width: MediaQuery.of(context).size.width / 6,
|
||||||
height: 24,
|
height: 24,
|
||||||
margin: widget.currentSelectedSatietyRating == 5 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
margin: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 5 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color(0xFF62E833),
|
color: Color(0xFF62E833),
|
||||||
border: widget.currentSelectedSatietyRating == 5
|
border: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 5
|
||||||
? Border.all(
|
? Border.all(
|
||||||
width: 2,
|
width: 2,
|
||||||
color: Color(0xFF276918),
|
color: Color(0xFF276918),
|
||||||
strokeAlign: BorderSide.strokeAlignOutside,
|
strokeAlign: BorderSide.strokeAlignOutside,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
borderRadius: widget.currentSelectedSatietyRating == 5 ? BorderRadius.circular(2) : null,
|
borderRadius: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 5 ? BorderRadius.circular(2) : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return Container(
|
return Container(
|
||||||
width: MediaQuery.of(context).size.width / 6,
|
width: MediaQuery.of(context).size.width / 6,
|
||||||
height: 24,
|
height: 24,
|
||||||
margin: widget.currentSelectedSatietyRating == 6 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
margin: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 6 ? EdgeInsets.symmetric(horizontal: 2) : null,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color(0xFF4DCE20),
|
color: Color(0xFF4DCE20),
|
||||||
border: widget.currentSelectedSatietyRating == 6
|
border: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 6
|
||||||
? Border.all(
|
? Border.all(
|
||||||
width: 2,
|
width: 2,
|
||||||
color: Color(0xFF184D12),
|
color: Color(0xFF184D12),
|
||||||
strokeAlign: BorderSide.strokeAlignOutside,
|
strokeAlign: BorderSide.strokeAlignOutside,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
borderRadius: widget.currentSelectedSatietyRating == 6
|
borderRadius: widget.currentSelectedSatietyRating[widget.meal - 1].toDouble() + 1 == 6
|
||||||
? BorderRadius.horizontal(
|
? BorderRadius.horizontal(
|
||||||
left: Radius.circular(2),
|
left: Radius.circular(2),
|
||||||
right: Radius.circular(8),
|
right: Radius.circular(8),
|
||||||
@@ -163,7 +167,11 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onRatingUpdate: (value) => context.read<DiaryCubit>().updateCurrentSelectedSatietyRating(value),
|
onRatingUpdate: (value) => context.read<DiaryCubit>().updateCurrentSelectedSatietyRating(
|
||||||
|
diaryId: widget.diaryId,
|
||||||
|
meal: widget.meal,
|
||||||
|
value: value.toInt(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SvgPicture.asset(
|
SvgPicture.asset(
|
||||||
'assets/icons/satiety_emoji_right.svg',
|
'assets/icons/satiety_emoji_right.svg',
|
||||||
|
|||||||
@@ -124,10 +124,10 @@ class DiaryRepository {
|
|||||||
|
|
||||||
Future<void> sendProductToModeration({
|
Future<void> sendProductToModeration({
|
||||||
required String name,
|
required String name,
|
||||||
required int energy,
|
required double energy,
|
||||||
required int proteins,
|
required double proteins,
|
||||||
required int fats,
|
required double fats,
|
||||||
required int carbohydrates,
|
required double carbohydrates,
|
||||||
}) async {
|
}) async {
|
||||||
return await diaryService.sendProductToModeration(
|
return await diaryService.sendProductToModeration(
|
||||||
data: ProductModerationModel(
|
data: ProductModerationModel(
|
||||||
@@ -139,4 +139,16 @@ class DiaryRepository {
|
|||||||
).toJson(),
|
).toJson(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> fillSatiety({
|
||||||
|
required int diaryId,
|
||||||
|
required int meal,
|
||||||
|
required int satiety,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
return await diaryService.fillSatiety(diaryId: diaryId, meal: meal, satiety: satiety);
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,13 @@ abstract class DiaryService {
|
|||||||
// @Body() required FinishDiaryDayModel finishDiaryDayModel,
|
// @Body() required FinishDiaryDayModel finishDiaryDayModel,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@POST('/api/diary/{diary_id}/meal/{meal}/satiety/fill')
|
||||||
|
Future<void> fillSatiety({
|
||||||
|
@Path('diary_id') required int diaryId,
|
||||||
|
@Path('meal') required int meal,
|
||||||
|
@Field() required int satiety,
|
||||||
|
});
|
||||||
|
|
||||||
@POST('/api/diary/product_nutritional_values/sendToModeration')
|
@POST('/api/diary/product_nutritional_values/sendToModeration')
|
||||||
Future<void> sendProductToModeration({
|
Future<void> sendProductToModeration({
|
||||||
@Body() required Map<String, dynamic> data,
|
@Body() required Map<String, dynamic> data,
|
||||||
|
|||||||
@@ -320,6 +320,35 @@ class _DiaryService implements DiaryService {
|
|||||||
await _dio.fetch<void>(_options);
|
await _dio.fetch<void>(_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> fillSatiety({
|
||||||
|
required int diaryId,
|
||||||
|
required int meal,
|
||||||
|
required int satiety,
|
||||||
|
}) async {
|
||||||
|
final _extra = <String, dynamic>{};
|
||||||
|
final queryParameters = <String, dynamic>{};
|
||||||
|
final _headers = <String, dynamic>{};
|
||||||
|
final _data = {'satiety': satiety};
|
||||||
|
final _options = _setStreamType<void>(Options(
|
||||||
|
method: 'POST',
|
||||||
|
headers: _headers,
|
||||||
|
extra: _extra,
|
||||||
|
)
|
||||||
|
.compose(
|
||||||
|
_dio.options,
|
||||||
|
'/api/diary/${diaryId}/meal/${meal}/satiety/fill',
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
data: _data,
|
||||||
|
)
|
||||||
|
.copyWith(
|
||||||
|
baseUrl: _combineBaseUrls(
|
||||||
|
_dio.options.baseUrl,
|
||||||
|
baseUrl,
|
||||||
|
)));
|
||||||
|
await _dio.fetch<void>(_options);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> sendProductToModeration(
|
Future<void> sendProductToModeration(
|
||||||
{required Map<String, dynamic> data}) async {
|
{required Map<String, dynamic> data}) async {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:eatvio_app/core/utils/string_extentions.dart';
|
|||||||
import 'package:eatvio_app/core/widgets/bookmark_button.dart';
|
import 'package:eatvio_app/core/widgets/bookmark_button.dart';
|
||||||
import 'package:eatvio_app/core/widgets/custom_divider.dart';
|
import 'package:eatvio_app/core/widgets/custom_divider.dart';
|
||||||
import 'package:eatvio_app/core/widgets/diet_info_row.dart';
|
import 'package:eatvio_app/core/widgets/diet_info_row.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
import 'package:eatvio_app/features/diets/presentation/bloc/about_diet_cubit.dart';
|
import 'package:eatvio_app/features/diets/presentation/bloc/about_diet_cubit.dart';
|
||||||
import 'package:eatvio_app/features/diets/presentation/bloc/about_diet_state.dart';
|
import 'package:eatvio_app/features/diets/presentation/bloc/about_diet_state.dart';
|
||||||
import 'package:eatvio_app/features/diets/presentation/widgets/author_card.dart';
|
import 'package:eatvio_app/features/diets/presentation/widgets/author_card.dart';
|
||||||
@@ -28,7 +29,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_portal/flutter_portal.dart';
|
import 'package:flutter_portal/flutter_portal.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:rive/rive.dart' hide LinearGradient;
|
|
||||||
|
|
||||||
class AboutDietScreen extends StatefulWidget {
|
class AboutDietScreen extends StatefulWidget {
|
||||||
final Diet diet;
|
final Diet diet;
|
||||||
@@ -441,16 +441,7 @@ class _AboutDietScreenState extends State<AboutDietScreen> {
|
|||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
if (state is CommentsStateLoading)
|
if (state is CommentsStateLoading)
|
||||||
Padding(
|
const Loader(),
|
||||||
padding: const EdgeInsets.all(32),
|
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (state is CommentsStateLoaded)
|
if (state is CommentsStateLoaded)
|
||||||
CommentsWidget(
|
CommentsWidget(
|
||||||
id: widget.diet.id.toString(),
|
id: widget.diet.id.toString(),
|
||||||
@@ -467,15 +458,7 @@ class _AboutDietScreenState extends State<AboutDietScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
body: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:easy_debounce/easy_debounce.dart';
|
import 'package:easy_debounce/easy_debounce.dart';
|
||||||
import 'package:eatvio_app/features/create_diet/presentation/create_diet_screen.dart';
|
import 'package:eatvio_app/features/create_diet/presentation/create_diet_screen.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart';
|
import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart';
|
||||||
import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_state.dart';
|
import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_state.dart';
|
||||||
import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart';
|
import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart';
|
||||||
@@ -21,7 +22,6 @@ import 'package:eatvio_app/core/theme/theme_helper.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:rive/rive.dart';
|
|
||||||
|
|
||||||
final bucket = PageStorageBucket();
|
final bucket = PageStorageBucket();
|
||||||
|
|
||||||
@@ -180,16 +180,7 @@ class _FeedScreenState extends State<FeedScreen> {
|
|||||||
physics: BouncingScrollPhysics(),
|
physics: BouncingScrollPhysics(),
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
if (index == state.feedBlogPostList.length) {
|
if (index == state.feedBlogPostList.length) {
|
||||||
return Container(
|
return const Loader();
|
||||||
alignment: Alignment.center,
|
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return BlogPostWidget(feedBlogPostModel: state.feedBlogPostList[index]);
|
return BlogPostWidget(feedBlogPostModel: state.feedBlogPostList[index]);
|
||||||
},
|
},
|
||||||
@@ -211,15 +202,7 @@ class _FeedScreenState extends State<FeedScreen> {
|
|||||||
} else {
|
} else {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.grey.shade200,
|
backgroundColor: Colors.grey.shade200,
|
||||||
body: Center(
|
body: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -261,15 +244,7 @@ class _FeedScreenState extends State<FeedScreen> {
|
|||||||
} else {
|
} else {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.grey.shade200,
|
backgroundColor: Colors.grey.shade200,
|
||||||
body: Center(
|
body: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -288,15 +263,7 @@ class _FeedScreenState extends State<FeedScreen> {
|
|||||||
if (state.isLoading) {
|
if (state.isLoading) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.grey.shade200,
|
backgroundColor: Colors.grey.shade200,
|
||||||
body: Center(
|
body: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else if (state.errorMessage != null) {
|
} else if (state.errorMessage != null) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -375,15 +342,7 @@ class _FeedScreenState extends State<FeedScreen> {
|
|||||||
} else {
|
} else {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.grey.shade200,
|
backgroundColor: Colors.grey.shade200,
|
||||||
body: Center(
|
body: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_html/flutter_html.dart';
|
import 'package:flutter_html/flutter_html.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
@@ -87,6 +88,27 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
const Spacer(),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Fluttertoast.showToast(msg: 'ща доделаем');
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
child: Ink(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
color: appTheme.gray200,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Подписаться',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
38
lib/features/profile/models/sub_model.dart
Normal file
38
lib/features/profile/models/sub_model.dart
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import 'package:eatvio_app/core/models/pagination_model.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'sub_model.freezed.dart';
|
||||||
|
|
||||||
|
part 'sub_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class SubPaginationModel with _$SubPaginationModel {
|
||||||
|
const factory SubPaginationModel({
|
||||||
|
required List<SubModel> data,
|
||||||
|
required Links links,
|
||||||
|
required Meta meta,
|
||||||
|
}) = _SubPaginationModel;
|
||||||
|
|
||||||
|
factory SubPaginationModel.fromJson(Map<String, Object?> json) => _$SubPaginationModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class SubModel with _$SubModel {
|
||||||
|
const factory SubModel({
|
||||||
|
required int id,
|
||||||
|
required String slug,
|
||||||
|
required String name,
|
||||||
|
required String city,
|
||||||
|
required DateTime birthdate,
|
||||||
|
@JsonKey(name: 'is_subscribe')
|
||||||
|
required bool isSubscribe,
|
||||||
|
required String email,
|
||||||
|
@JsonKey(name: 'profile_photo_url') required String profilePhotoUrl,
|
||||||
|
required String role,
|
||||||
|
@JsonKey(name: 'is_public_profile') required bool isPublicProfile,
|
||||||
|
@JsonKey(name: 'created_at') required DateTime createdAt,
|
||||||
|
@JsonKey(name: 'updated_at') required DateTime updatedAt,
|
||||||
|
}) = _SubModel;
|
||||||
|
|
||||||
|
factory SubModel.fromJson(Map<String, Object?> json) => _$SubModelFromJson(json);
|
||||||
|
}
|
||||||
646
lib/features/profile/models/sub_model.freezed.dart
Normal file
646
lib/features/profile/models/sub_model.freezed.dart
Normal file
@@ -0,0 +1,646 @@
|
|||||||
|
// 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 'sub_model.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');
|
||||||
|
|
||||||
|
SubPaginationModel _$SubPaginationModelFromJson(Map<String, dynamic> json) {
|
||||||
|
return _SubPaginationModel.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$SubPaginationModel {
|
||||||
|
List<SubModel> get data => throw _privateConstructorUsedError;
|
||||||
|
Links get links => throw _privateConstructorUsedError;
|
||||||
|
Meta get meta => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Serializes this SubPaginationModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of SubPaginationModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$SubPaginationModelCopyWith<SubPaginationModel> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $SubPaginationModelCopyWith<$Res> {
|
||||||
|
factory $SubPaginationModelCopyWith(
|
||||||
|
SubPaginationModel value, $Res Function(SubPaginationModel) then) =
|
||||||
|
_$SubPaginationModelCopyWithImpl<$Res, SubPaginationModel>;
|
||||||
|
@useResult
|
||||||
|
$Res call({List<SubModel> data, Links links, Meta meta});
|
||||||
|
|
||||||
|
$LinksCopyWith<$Res> get links;
|
||||||
|
$MetaCopyWith<$Res> get meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$SubPaginationModelCopyWithImpl<$Res, $Val extends SubPaginationModel>
|
||||||
|
implements $SubPaginationModelCopyWith<$Res> {
|
||||||
|
_$SubPaginationModelCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of SubPaginationModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? data = null,
|
||||||
|
Object? links = null,
|
||||||
|
Object? meta = null,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
data: null == data
|
||||||
|
? _value.data
|
||||||
|
: data // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<SubModel>,
|
||||||
|
links: null == links
|
||||||
|
? _value.links
|
||||||
|
: links // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Links,
|
||||||
|
meta: null == meta
|
||||||
|
? _value.meta
|
||||||
|
: meta // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Meta,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of SubPaginationModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$LinksCopyWith<$Res> get links {
|
||||||
|
return $LinksCopyWith<$Res>(_value.links, (value) {
|
||||||
|
return _then(_value.copyWith(links: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of SubPaginationModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$MetaCopyWith<$Res> get meta {
|
||||||
|
return $MetaCopyWith<$Res>(_value.meta, (value) {
|
||||||
|
return _then(_value.copyWith(meta: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubPaginationModelImplCopyWith<$Res>
|
||||||
|
implements $SubPaginationModelCopyWith<$Res> {
|
||||||
|
factory _$$SubPaginationModelImplCopyWith(_$SubPaginationModelImpl value,
|
||||||
|
$Res Function(_$SubPaginationModelImpl) then) =
|
||||||
|
__$$SubPaginationModelImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({List<SubModel> data, Links links, Meta meta});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$LinksCopyWith<$Res> get links;
|
||||||
|
@override
|
||||||
|
$MetaCopyWith<$Res> get meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubPaginationModelImplCopyWithImpl<$Res>
|
||||||
|
extends _$SubPaginationModelCopyWithImpl<$Res, _$SubPaginationModelImpl>
|
||||||
|
implements _$$SubPaginationModelImplCopyWith<$Res> {
|
||||||
|
__$$SubPaginationModelImplCopyWithImpl(_$SubPaginationModelImpl _value,
|
||||||
|
$Res Function(_$SubPaginationModelImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of SubPaginationModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? data = null,
|
||||||
|
Object? links = null,
|
||||||
|
Object? meta = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$SubPaginationModelImpl(
|
||||||
|
data: null == data
|
||||||
|
? _value._data
|
||||||
|
: data // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<SubModel>,
|
||||||
|
links: null == links
|
||||||
|
? _value.links
|
||||||
|
: links // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Links,
|
||||||
|
meta: null == meta
|
||||||
|
? _value.meta
|
||||||
|
: meta // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Meta,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$SubPaginationModelImpl implements _SubPaginationModel {
|
||||||
|
const _$SubPaginationModelImpl(
|
||||||
|
{required final List<SubModel> data,
|
||||||
|
required this.links,
|
||||||
|
required this.meta})
|
||||||
|
: _data = data;
|
||||||
|
|
||||||
|
factory _$SubPaginationModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$SubPaginationModelImplFromJson(json);
|
||||||
|
|
||||||
|
final List<SubModel> _data;
|
||||||
|
@override
|
||||||
|
List<SubModel> get data {
|
||||||
|
if (_data is EqualUnmodifiableListView) return _data;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
final Links links;
|
||||||
|
@override
|
||||||
|
final Meta meta;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SubPaginationModel(data: $data, links: $links, meta: $meta)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$SubPaginationModelImpl &&
|
||||||
|
const DeepCollectionEquality().equals(other._data, _data) &&
|
||||||
|
(identical(other.links, links) || other.links == links) &&
|
||||||
|
(identical(other.meta, meta) || other.meta == meta));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType, const DeepCollectionEquality().hash(_data), links, meta);
|
||||||
|
|
||||||
|
/// Create a copy of SubPaginationModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$SubPaginationModelImplCopyWith<_$SubPaginationModelImpl> get copyWith =>
|
||||||
|
__$$SubPaginationModelImplCopyWithImpl<_$SubPaginationModelImpl>(
|
||||||
|
this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$SubPaginationModelImplToJson(
|
||||||
|
this,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _SubPaginationModel implements SubPaginationModel {
|
||||||
|
const factory _SubPaginationModel(
|
||||||
|
{required final List<SubModel> data,
|
||||||
|
required final Links links,
|
||||||
|
required final Meta meta}) = _$SubPaginationModelImpl;
|
||||||
|
|
||||||
|
factory _SubPaginationModel.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$SubPaginationModelImpl.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<SubModel> get data;
|
||||||
|
@override
|
||||||
|
Links get links;
|
||||||
|
@override
|
||||||
|
Meta get meta;
|
||||||
|
|
||||||
|
/// Create a copy of SubPaginationModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$SubPaginationModelImplCopyWith<_$SubPaginationModelImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
SubModel _$SubModelFromJson(Map<String, dynamic> json) {
|
||||||
|
return _SubModel.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$SubModel {
|
||||||
|
int get id => throw _privateConstructorUsedError;
|
||||||
|
String get slug => throw _privateConstructorUsedError;
|
||||||
|
String get name => throw _privateConstructorUsedError;
|
||||||
|
String get city => throw _privateConstructorUsedError;
|
||||||
|
DateTime get birthdate => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'is_subscribe')
|
||||||
|
bool get isSubscribe => throw _privateConstructorUsedError;
|
||||||
|
String get email => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'profile_photo_url')
|
||||||
|
String get profilePhotoUrl => throw _privateConstructorUsedError;
|
||||||
|
String get role => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'is_public_profile')
|
||||||
|
bool get isPublicProfile => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'created_at')
|
||||||
|
DateTime get createdAt => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'updated_at')
|
||||||
|
DateTime get updatedAt => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Serializes this SubModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of SubModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$SubModelCopyWith<SubModel> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $SubModelCopyWith<$Res> {
|
||||||
|
factory $SubModelCopyWith(SubModel value, $Res Function(SubModel) then) =
|
||||||
|
_$SubModelCopyWithImpl<$Res, SubModel>;
|
||||||
|
@useResult
|
||||||
|
$Res call(
|
||||||
|
{int id,
|
||||||
|
String slug,
|
||||||
|
String name,
|
||||||
|
String city,
|
||||||
|
DateTime birthdate,
|
||||||
|
@JsonKey(name: 'is_subscribe') bool isSubscribe,
|
||||||
|
String email,
|
||||||
|
@JsonKey(name: 'profile_photo_url') String profilePhotoUrl,
|
||||||
|
String role,
|
||||||
|
@JsonKey(name: 'is_public_profile') bool isPublicProfile,
|
||||||
|
@JsonKey(name: 'created_at') DateTime createdAt,
|
||||||
|
@JsonKey(name: 'updated_at') DateTime updatedAt});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$SubModelCopyWithImpl<$Res, $Val extends SubModel>
|
||||||
|
implements $SubModelCopyWith<$Res> {
|
||||||
|
_$SubModelCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of SubModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? id = null,
|
||||||
|
Object? slug = null,
|
||||||
|
Object? name = null,
|
||||||
|
Object? city = null,
|
||||||
|
Object? birthdate = null,
|
||||||
|
Object? isSubscribe = null,
|
||||||
|
Object? email = null,
|
||||||
|
Object? profilePhotoUrl = null,
|
||||||
|
Object? role = null,
|
||||||
|
Object? isPublicProfile = null,
|
||||||
|
Object? createdAt = null,
|
||||||
|
Object? updatedAt = null,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
id: null == id
|
||||||
|
? _value.id
|
||||||
|
: id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
slug: null == slug
|
||||||
|
? _value.slug
|
||||||
|
: slug // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
name: null == name
|
||||||
|
? _value.name
|
||||||
|
: name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
city: null == city
|
||||||
|
? _value.city
|
||||||
|
: city // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
birthdate: null == birthdate
|
||||||
|
? _value.birthdate
|
||||||
|
: birthdate // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
isSubscribe: null == isSubscribe
|
||||||
|
? _value.isSubscribe
|
||||||
|
: isSubscribe // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
email: null == email
|
||||||
|
? _value.email
|
||||||
|
: email // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
profilePhotoUrl: null == profilePhotoUrl
|
||||||
|
? _value.profilePhotoUrl
|
||||||
|
: profilePhotoUrl // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
role: null == role
|
||||||
|
? _value.role
|
||||||
|
: role // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
isPublicProfile: null == isPublicProfile
|
||||||
|
? _value.isPublicProfile
|
||||||
|
: isPublicProfile // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
createdAt: null == createdAt
|
||||||
|
? _value.createdAt
|
||||||
|
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
updatedAt: null == updatedAt
|
||||||
|
? _value.updatedAt
|
||||||
|
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubModelImplCopyWith<$Res>
|
||||||
|
implements $SubModelCopyWith<$Res> {
|
||||||
|
factory _$$SubModelImplCopyWith(
|
||||||
|
_$SubModelImpl value, $Res Function(_$SubModelImpl) then) =
|
||||||
|
__$$SubModelImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call(
|
||||||
|
{int id,
|
||||||
|
String slug,
|
||||||
|
String name,
|
||||||
|
String city,
|
||||||
|
DateTime birthdate,
|
||||||
|
@JsonKey(name: 'is_subscribe') bool isSubscribe,
|
||||||
|
String email,
|
||||||
|
@JsonKey(name: 'profile_photo_url') String profilePhotoUrl,
|
||||||
|
String role,
|
||||||
|
@JsonKey(name: 'is_public_profile') bool isPublicProfile,
|
||||||
|
@JsonKey(name: 'created_at') DateTime createdAt,
|
||||||
|
@JsonKey(name: 'updated_at') DateTime updatedAt});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubModelImplCopyWithImpl<$Res>
|
||||||
|
extends _$SubModelCopyWithImpl<$Res, _$SubModelImpl>
|
||||||
|
implements _$$SubModelImplCopyWith<$Res> {
|
||||||
|
__$$SubModelImplCopyWithImpl(
|
||||||
|
_$SubModelImpl _value, $Res Function(_$SubModelImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of SubModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? id = null,
|
||||||
|
Object? slug = null,
|
||||||
|
Object? name = null,
|
||||||
|
Object? city = null,
|
||||||
|
Object? birthdate = null,
|
||||||
|
Object? isSubscribe = null,
|
||||||
|
Object? email = null,
|
||||||
|
Object? profilePhotoUrl = null,
|
||||||
|
Object? role = null,
|
||||||
|
Object? isPublicProfile = null,
|
||||||
|
Object? createdAt = null,
|
||||||
|
Object? updatedAt = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$SubModelImpl(
|
||||||
|
id: null == id
|
||||||
|
? _value.id
|
||||||
|
: id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
slug: null == slug
|
||||||
|
? _value.slug
|
||||||
|
: slug // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
name: null == name
|
||||||
|
? _value.name
|
||||||
|
: name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
city: null == city
|
||||||
|
? _value.city
|
||||||
|
: city // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
birthdate: null == birthdate
|
||||||
|
? _value.birthdate
|
||||||
|
: birthdate // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
isSubscribe: null == isSubscribe
|
||||||
|
? _value.isSubscribe
|
||||||
|
: isSubscribe // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
email: null == email
|
||||||
|
? _value.email
|
||||||
|
: email // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
profilePhotoUrl: null == profilePhotoUrl
|
||||||
|
? _value.profilePhotoUrl
|
||||||
|
: profilePhotoUrl // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
role: null == role
|
||||||
|
? _value.role
|
||||||
|
: role // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
isPublicProfile: null == isPublicProfile
|
||||||
|
? _value.isPublicProfile
|
||||||
|
: isPublicProfile // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
createdAt: null == createdAt
|
||||||
|
? _value.createdAt
|
||||||
|
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
updatedAt: null == updatedAt
|
||||||
|
? _value.updatedAt
|
||||||
|
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$SubModelImpl implements _SubModel {
|
||||||
|
const _$SubModelImpl(
|
||||||
|
{required this.id,
|
||||||
|
required this.slug,
|
||||||
|
required this.name,
|
||||||
|
required this.city,
|
||||||
|
required this.birthdate,
|
||||||
|
@JsonKey(name: 'is_subscribe') required this.isSubscribe,
|
||||||
|
required this.email,
|
||||||
|
@JsonKey(name: 'profile_photo_url') required this.profilePhotoUrl,
|
||||||
|
required this.role,
|
||||||
|
@JsonKey(name: 'is_public_profile') required this.isPublicProfile,
|
||||||
|
@JsonKey(name: 'created_at') required this.createdAt,
|
||||||
|
@JsonKey(name: 'updated_at') required this.updatedAt});
|
||||||
|
|
||||||
|
factory _$SubModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$SubModelImplFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final int id;
|
||||||
|
@override
|
||||||
|
final String slug;
|
||||||
|
@override
|
||||||
|
final String name;
|
||||||
|
@override
|
||||||
|
final String city;
|
||||||
|
@override
|
||||||
|
final DateTime birthdate;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'is_subscribe')
|
||||||
|
final bool isSubscribe;
|
||||||
|
@override
|
||||||
|
final String email;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'profile_photo_url')
|
||||||
|
final String profilePhotoUrl;
|
||||||
|
@override
|
||||||
|
final String role;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'is_public_profile')
|
||||||
|
final bool isPublicProfile;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'created_at')
|
||||||
|
final DateTime createdAt;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'updated_at')
|
||||||
|
final DateTime updatedAt;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SubModel(id: $id, slug: $slug, name: $name, city: $city, birthdate: $birthdate, isSubscribe: $isSubscribe, email: $email, profilePhotoUrl: $profilePhotoUrl, role: $role, isPublicProfile: $isPublicProfile, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$SubModelImpl &&
|
||||||
|
(identical(other.id, id) || other.id == id) &&
|
||||||
|
(identical(other.slug, slug) || other.slug == slug) &&
|
||||||
|
(identical(other.name, name) || other.name == name) &&
|
||||||
|
(identical(other.city, city) || other.city == city) &&
|
||||||
|
(identical(other.birthdate, birthdate) ||
|
||||||
|
other.birthdate == birthdate) &&
|
||||||
|
(identical(other.isSubscribe, isSubscribe) ||
|
||||||
|
other.isSubscribe == isSubscribe) &&
|
||||||
|
(identical(other.email, email) || other.email == email) &&
|
||||||
|
(identical(other.profilePhotoUrl, profilePhotoUrl) ||
|
||||||
|
other.profilePhotoUrl == profilePhotoUrl) &&
|
||||||
|
(identical(other.role, role) || other.role == role) &&
|
||||||
|
(identical(other.isPublicProfile, isPublicProfile) ||
|
||||||
|
other.isPublicProfile == isPublicProfile) &&
|
||||||
|
(identical(other.createdAt, createdAt) ||
|
||||||
|
other.createdAt == createdAt) &&
|
||||||
|
(identical(other.updatedAt, updatedAt) ||
|
||||||
|
other.updatedAt == updatedAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
id,
|
||||||
|
slug,
|
||||||
|
name,
|
||||||
|
city,
|
||||||
|
birthdate,
|
||||||
|
isSubscribe,
|
||||||
|
email,
|
||||||
|
profilePhotoUrl,
|
||||||
|
role,
|
||||||
|
isPublicProfile,
|
||||||
|
createdAt,
|
||||||
|
updatedAt);
|
||||||
|
|
||||||
|
/// Create a copy of SubModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$SubModelImplCopyWith<_$SubModelImpl> get copyWith =>
|
||||||
|
__$$SubModelImplCopyWithImpl<_$SubModelImpl>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$SubModelImplToJson(
|
||||||
|
this,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _SubModel implements SubModel {
|
||||||
|
const factory _SubModel(
|
||||||
|
{required final int id,
|
||||||
|
required final String slug,
|
||||||
|
required final String name,
|
||||||
|
required final String city,
|
||||||
|
required final DateTime birthdate,
|
||||||
|
@JsonKey(name: 'is_subscribe') required final bool isSubscribe,
|
||||||
|
required final String email,
|
||||||
|
@JsonKey(name: 'profile_photo_url') required final String profilePhotoUrl,
|
||||||
|
required final String role,
|
||||||
|
@JsonKey(name: 'is_public_profile') required final bool isPublicProfile,
|
||||||
|
@JsonKey(name: 'created_at') required final DateTime createdAt,
|
||||||
|
@JsonKey(name: 'updated_at')
|
||||||
|
required final DateTime updatedAt}) = _$SubModelImpl;
|
||||||
|
|
||||||
|
factory _SubModel.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$SubModelImpl.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get id;
|
||||||
|
@override
|
||||||
|
String get slug;
|
||||||
|
@override
|
||||||
|
String get name;
|
||||||
|
@override
|
||||||
|
String get city;
|
||||||
|
@override
|
||||||
|
DateTime get birthdate;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'is_subscribe')
|
||||||
|
bool get isSubscribe;
|
||||||
|
@override
|
||||||
|
String get email;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'profile_photo_url')
|
||||||
|
String get profilePhotoUrl;
|
||||||
|
@override
|
||||||
|
String get role;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'is_public_profile')
|
||||||
|
bool get isPublicProfile;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'created_at')
|
||||||
|
DateTime get createdAt;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'updated_at')
|
||||||
|
DateTime get updatedAt;
|
||||||
|
|
||||||
|
/// Create a copy of SubModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$SubModelImplCopyWith<_$SubModelImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
57
lib/features/profile/models/sub_model.g.dart
Normal file
57
lib/features/profile/models/sub_model.g.dart
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'sub_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_$SubPaginationModelImpl _$$SubPaginationModelImplFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
_$SubPaginationModelImpl(
|
||||||
|
data: (json['data'] as List<dynamic>)
|
||||||
|
.map((e) => SubModel.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
links: Links.fromJson(json['links'] as Map<String, dynamic>),
|
||||||
|
meta: Meta.fromJson(json['meta'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$SubPaginationModelImplToJson(
|
||||||
|
_$SubPaginationModelImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'data': instance.data,
|
||||||
|
'links': instance.links,
|
||||||
|
'meta': instance.meta,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$SubModelImpl _$$SubModelImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$SubModelImpl(
|
||||||
|
id: (json['id'] as num).toInt(),
|
||||||
|
slug: json['slug'] as String,
|
||||||
|
name: json['name'] as String,
|
||||||
|
city: json['city'] as String,
|
||||||
|
birthdate: DateTime.parse(json['birthdate'] as String),
|
||||||
|
isSubscribe: json['is_subscribe'] as bool,
|
||||||
|
email: json['email'] as String,
|
||||||
|
profilePhotoUrl: json['profile_photo_url'] as String,
|
||||||
|
role: json['role'] as String,
|
||||||
|
isPublicProfile: json['is_public_profile'] as bool,
|
||||||
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$SubModelImplToJson(_$SubModelImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'slug': instance.slug,
|
||||||
|
'name': instance.name,
|
||||||
|
'city': instance.city,
|
||||||
|
'birthdate': instance.birthdate.toIso8601String(),
|
||||||
|
'is_subscribe': instance.isSubscribe,
|
||||||
|
'email': instance.email,
|
||||||
|
'profile_photo_url': instance.profilePhotoUrl,
|
||||||
|
'role': instance.role,
|
||||||
|
'is_public_profile': instance.isPublicProfile,
|
||||||
|
'created_at': instance.createdAt.toIso8601String(),
|
||||||
|
'updated_at': instance.updatedAt.toIso8601String(),
|
||||||
|
};
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import 'package:eatvio_app/features/profile/presentation/bloc/sub_cubit/sub_state.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/repositories/profile_repository.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
|
class SubCubit extends Cubit<SubState> {
|
||||||
|
final ProfileRepository profileRepository;
|
||||||
|
|
||||||
|
SubCubit({
|
||||||
|
required this.profileRepository,
|
||||||
|
}) : super(const SubState());
|
||||||
|
|
||||||
|
getSubscriptions(String slug, [String? query]) async {
|
||||||
|
emit(const SubState.loading());
|
||||||
|
try {
|
||||||
|
emit(SubState.loaded(subList: await profileRepository.getSubscriptionsBySlug(slug, query)));
|
||||||
|
} catch (e) {
|
||||||
|
emit(SubState.error(errorMessage: e.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getSubscribers(String slug, [String? query]) async {
|
||||||
|
emit(const SubState.loading());
|
||||||
|
try {
|
||||||
|
emit(SubState.loaded(subList: await profileRepository.getSubscribersBySlug(slug, query)));
|
||||||
|
} catch (e) {
|
||||||
|
emit(SubState.error(errorMessage: e.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
subscribe(String slug) async {
|
||||||
|
return await profileRepository.subscribe(slug);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsubscribe(String slug) async {
|
||||||
|
return await profileRepository.unsubscribe(slug);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import 'package:eatvio_app/features/profile/models/sub_model.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'sub_state.freezed.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class SubState with _$SubState {
|
||||||
|
const factory SubState() = _SubState;
|
||||||
|
|
||||||
|
const factory SubState.loading() = SubStateLoading;
|
||||||
|
|
||||||
|
const factory SubState.loaded({
|
||||||
|
required List<SubModel> subList,
|
||||||
|
}) = SubStateLoaded;
|
||||||
|
|
||||||
|
const factory SubState.error({
|
||||||
|
required String errorMessage,
|
||||||
|
}) = SubStateError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,638 @@
|
|||||||
|
// 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 'sub_state.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 _$SubState {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>(
|
||||||
|
TResult Function() $default, {
|
||||||
|
required TResult Function() loading,
|
||||||
|
required TResult Function(List<SubModel> subList) loaded,
|
||||||
|
required TResult Function(String errorMessage) error,
|
||||||
|
}) =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>(
|
||||||
|
TResult? Function()? $default, {
|
||||||
|
TResult? Function()? loading,
|
||||||
|
TResult? Function(List<SubModel> subList)? loaded,
|
||||||
|
TResult? Function(String errorMessage)? error,
|
||||||
|
}) =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>(
|
||||||
|
TResult Function()? $default, {
|
||||||
|
TResult Function()? loading,
|
||||||
|
TResult Function(List<SubModel> subList)? loaded,
|
||||||
|
TResult Function(String errorMessage)? error,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>(
|
||||||
|
TResult Function(_SubState value) $default, {
|
||||||
|
required TResult Function(SubStateLoading value) loading,
|
||||||
|
required TResult Function(SubStateLoaded value) loaded,
|
||||||
|
required TResult Function(SubStateError value) error,
|
||||||
|
}) =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>(
|
||||||
|
TResult? Function(_SubState value)? $default, {
|
||||||
|
TResult? Function(SubStateLoading value)? loading,
|
||||||
|
TResult? Function(SubStateLoaded value)? loaded,
|
||||||
|
TResult? Function(SubStateError value)? error,
|
||||||
|
}) =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>(
|
||||||
|
TResult Function(_SubState value)? $default, {
|
||||||
|
TResult Function(SubStateLoading value)? loading,
|
||||||
|
TResult Function(SubStateLoaded value)? loaded,
|
||||||
|
TResult Function(SubStateError value)? error,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $SubStateCopyWith<$Res> {
|
||||||
|
factory $SubStateCopyWith(SubState value, $Res Function(SubState) then) =
|
||||||
|
_$SubStateCopyWithImpl<$Res, SubState>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$SubStateCopyWithImpl<$Res, $Val extends SubState>
|
||||||
|
implements $SubStateCopyWith<$Res> {
|
||||||
|
_$SubStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of SubState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubStateImplCopyWith<$Res> {
|
||||||
|
factory _$$SubStateImplCopyWith(
|
||||||
|
_$SubStateImpl value, $Res Function(_$SubStateImpl) then) =
|
||||||
|
__$$SubStateImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$SubStateCopyWithImpl<$Res, _$SubStateImpl>
|
||||||
|
implements _$$SubStateImplCopyWith<$Res> {
|
||||||
|
__$$SubStateImplCopyWithImpl(
|
||||||
|
_$SubStateImpl _value, $Res Function(_$SubStateImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of SubState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$SubStateImpl implements _SubState {
|
||||||
|
const _$SubStateImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SubState()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$SubStateImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>(
|
||||||
|
TResult Function() $default, {
|
||||||
|
required TResult Function() loading,
|
||||||
|
required TResult Function(List<SubModel> subList) loaded,
|
||||||
|
required TResult Function(String errorMessage) error,
|
||||||
|
}) {
|
||||||
|
return $default();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>(
|
||||||
|
TResult? Function()? $default, {
|
||||||
|
TResult? Function()? loading,
|
||||||
|
TResult? Function(List<SubModel> subList)? loaded,
|
||||||
|
TResult? Function(String errorMessage)? error,
|
||||||
|
}) {
|
||||||
|
return $default?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>(
|
||||||
|
TResult Function()? $default, {
|
||||||
|
TResult Function()? loading,
|
||||||
|
TResult Function(List<SubModel> subList)? loaded,
|
||||||
|
TResult Function(String errorMessage)? error,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if ($default != null) {
|
||||||
|
return $default();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>(
|
||||||
|
TResult Function(_SubState value) $default, {
|
||||||
|
required TResult Function(SubStateLoading value) loading,
|
||||||
|
required TResult Function(SubStateLoaded value) loaded,
|
||||||
|
required TResult Function(SubStateError value) error,
|
||||||
|
}) {
|
||||||
|
return $default(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>(
|
||||||
|
TResult? Function(_SubState value)? $default, {
|
||||||
|
TResult? Function(SubStateLoading value)? loading,
|
||||||
|
TResult? Function(SubStateLoaded value)? loaded,
|
||||||
|
TResult? Function(SubStateError value)? error,
|
||||||
|
}) {
|
||||||
|
return $default?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>(
|
||||||
|
TResult Function(_SubState value)? $default, {
|
||||||
|
TResult Function(SubStateLoading value)? loading,
|
||||||
|
TResult Function(SubStateLoaded value)? loaded,
|
||||||
|
TResult Function(SubStateError value)? error,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if ($default != null) {
|
||||||
|
return $default(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _SubState implements SubState {
|
||||||
|
const factory _SubState() = _$SubStateImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubStateLoadingImplCopyWith<$Res> {
|
||||||
|
factory _$$SubStateLoadingImplCopyWith(_$SubStateLoadingImpl value,
|
||||||
|
$Res Function(_$SubStateLoadingImpl) then) =
|
||||||
|
__$$SubStateLoadingImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubStateLoadingImplCopyWithImpl<$Res>
|
||||||
|
extends _$SubStateCopyWithImpl<$Res, _$SubStateLoadingImpl>
|
||||||
|
implements _$$SubStateLoadingImplCopyWith<$Res> {
|
||||||
|
__$$SubStateLoadingImplCopyWithImpl(
|
||||||
|
_$SubStateLoadingImpl _value, $Res Function(_$SubStateLoadingImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of SubState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$SubStateLoadingImpl implements SubStateLoading {
|
||||||
|
const _$SubStateLoadingImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SubState.loading()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$SubStateLoadingImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>(
|
||||||
|
TResult Function() $default, {
|
||||||
|
required TResult Function() loading,
|
||||||
|
required TResult Function(List<SubModel> subList) loaded,
|
||||||
|
required TResult Function(String errorMessage) error,
|
||||||
|
}) {
|
||||||
|
return loading();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>(
|
||||||
|
TResult? Function()? $default, {
|
||||||
|
TResult? Function()? loading,
|
||||||
|
TResult? Function(List<SubModel> subList)? loaded,
|
||||||
|
TResult? Function(String errorMessage)? error,
|
||||||
|
}) {
|
||||||
|
return loading?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>(
|
||||||
|
TResult Function()? $default, {
|
||||||
|
TResult Function()? loading,
|
||||||
|
TResult Function(List<SubModel> subList)? loaded,
|
||||||
|
TResult Function(String errorMessage)? error,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (loading != null) {
|
||||||
|
return loading();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>(
|
||||||
|
TResult Function(_SubState value) $default, {
|
||||||
|
required TResult Function(SubStateLoading value) loading,
|
||||||
|
required TResult Function(SubStateLoaded value) loaded,
|
||||||
|
required TResult Function(SubStateError value) error,
|
||||||
|
}) {
|
||||||
|
return loading(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>(
|
||||||
|
TResult? Function(_SubState value)? $default, {
|
||||||
|
TResult? Function(SubStateLoading value)? loading,
|
||||||
|
TResult? Function(SubStateLoaded value)? loaded,
|
||||||
|
TResult? Function(SubStateError value)? error,
|
||||||
|
}) {
|
||||||
|
return loading?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>(
|
||||||
|
TResult Function(_SubState value)? $default, {
|
||||||
|
TResult Function(SubStateLoading value)? loading,
|
||||||
|
TResult Function(SubStateLoaded value)? loaded,
|
||||||
|
TResult Function(SubStateError value)? error,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (loading != null) {
|
||||||
|
return loading(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class SubStateLoading implements SubState {
|
||||||
|
const factory SubStateLoading() = _$SubStateLoadingImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubStateLoadedImplCopyWith<$Res> {
|
||||||
|
factory _$$SubStateLoadedImplCopyWith(_$SubStateLoadedImpl value,
|
||||||
|
$Res Function(_$SubStateLoadedImpl) then) =
|
||||||
|
__$$SubStateLoadedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({List<SubModel> subList});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubStateLoadedImplCopyWithImpl<$Res>
|
||||||
|
extends _$SubStateCopyWithImpl<$Res, _$SubStateLoadedImpl>
|
||||||
|
implements _$$SubStateLoadedImplCopyWith<$Res> {
|
||||||
|
__$$SubStateLoadedImplCopyWithImpl(
|
||||||
|
_$SubStateLoadedImpl _value, $Res Function(_$SubStateLoadedImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of SubState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? subList = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$SubStateLoadedImpl(
|
||||||
|
subList: null == subList
|
||||||
|
? _value._subList
|
||||||
|
: subList // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<SubModel>,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$SubStateLoadedImpl implements SubStateLoaded {
|
||||||
|
const _$SubStateLoadedImpl({required final List<SubModel> subList})
|
||||||
|
: _subList = subList;
|
||||||
|
|
||||||
|
final List<SubModel> _subList;
|
||||||
|
@override
|
||||||
|
List<SubModel> get subList {
|
||||||
|
if (_subList is EqualUnmodifiableListView) return _subList;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_subList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SubState.loaded(subList: $subList)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$SubStateLoadedImpl &&
|
||||||
|
const DeepCollectionEquality().equals(other._subList, _subList));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
Object.hash(runtimeType, const DeepCollectionEquality().hash(_subList));
|
||||||
|
|
||||||
|
/// Create a copy of SubState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$SubStateLoadedImplCopyWith<_$SubStateLoadedImpl> get copyWith =>
|
||||||
|
__$$SubStateLoadedImplCopyWithImpl<_$SubStateLoadedImpl>(
|
||||||
|
this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>(
|
||||||
|
TResult Function() $default, {
|
||||||
|
required TResult Function() loading,
|
||||||
|
required TResult Function(List<SubModel> subList) loaded,
|
||||||
|
required TResult Function(String errorMessage) error,
|
||||||
|
}) {
|
||||||
|
return loaded(subList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>(
|
||||||
|
TResult? Function()? $default, {
|
||||||
|
TResult? Function()? loading,
|
||||||
|
TResult? Function(List<SubModel> subList)? loaded,
|
||||||
|
TResult? Function(String errorMessage)? error,
|
||||||
|
}) {
|
||||||
|
return loaded?.call(subList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>(
|
||||||
|
TResult Function()? $default, {
|
||||||
|
TResult Function()? loading,
|
||||||
|
TResult Function(List<SubModel> subList)? loaded,
|
||||||
|
TResult Function(String errorMessage)? error,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (loaded != null) {
|
||||||
|
return loaded(subList);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>(
|
||||||
|
TResult Function(_SubState value) $default, {
|
||||||
|
required TResult Function(SubStateLoading value) loading,
|
||||||
|
required TResult Function(SubStateLoaded value) loaded,
|
||||||
|
required TResult Function(SubStateError value) error,
|
||||||
|
}) {
|
||||||
|
return loaded(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>(
|
||||||
|
TResult? Function(_SubState value)? $default, {
|
||||||
|
TResult? Function(SubStateLoading value)? loading,
|
||||||
|
TResult? Function(SubStateLoaded value)? loaded,
|
||||||
|
TResult? Function(SubStateError value)? error,
|
||||||
|
}) {
|
||||||
|
return loaded?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>(
|
||||||
|
TResult Function(_SubState value)? $default, {
|
||||||
|
TResult Function(SubStateLoading value)? loading,
|
||||||
|
TResult Function(SubStateLoaded value)? loaded,
|
||||||
|
TResult Function(SubStateError value)? error,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (loaded != null) {
|
||||||
|
return loaded(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class SubStateLoaded implements SubState {
|
||||||
|
const factory SubStateLoaded({required final List<SubModel> subList}) =
|
||||||
|
_$SubStateLoadedImpl;
|
||||||
|
|
||||||
|
List<SubModel> get subList;
|
||||||
|
|
||||||
|
/// Create a copy of SubState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$SubStateLoadedImplCopyWith<_$SubStateLoadedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubStateErrorImplCopyWith<$Res> {
|
||||||
|
factory _$$SubStateErrorImplCopyWith(
|
||||||
|
_$SubStateErrorImpl value, $Res Function(_$SubStateErrorImpl) then) =
|
||||||
|
__$$SubStateErrorImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String errorMessage});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubStateErrorImplCopyWithImpl<$Res>
|
||||||
|
extends _$SubStateCopyWithImpl<$Res, _$SubStateErrorImpl>
|
||||||
|
implements _$$SubStateErrorImplCopyWith<$Res> {
|
||||||
|
__$$SubStateErrorImplCopyWithImpl(
|
||||||
|
_$SubStateErrorImpl _value, $Res Function(_$SubStateErrorImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of SubState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? errorMessage = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$SubStateErrorImpl(
|
||||||
|
errorMessage: null == errorMessage
|
||||||
|
? _value.errorMessage
|
||||||
|
: errorMessage // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$SubStateErrorImpl implements SubStateError {
|
||||||
|
const _$SubStateErrorImpl({required this.errorMessage});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String errorMessage;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SubState.error(errorMessage: $errorMessage)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$SubStateErrorImpl &&
|
||||||
|
(identical(other.errorMessage, errorMessage) ||
|
||||||
|
other.errorMessage == errorMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, errorMessage);
|
||||||
|
|
||||||
|
/// Create a copy of SubState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$SubStateErrorImplCopyWith<_$SubStateErrorImpl> get copyWith =>
|
||||||
|
__$$SubStateErrorImplCopyWithImpl<_$SubStateErrorImpl>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>(
|
||||||
|
TResult Function() $default, {
|
||||||
|
required TResult Function() loading,
|
||||||
|
required TResult Function(List<SubModel> subList) loaded,
|
||||||
|
required TResult Function(String errorMessage) error,
|
||||||
|
}) {
|
||||||
|
return error(errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>(
|
||||||
|
TResult? Function()? $default, {
|
||||||
|
TResult? Function()? loading,
|
||||||
|
TResult? Function(List<SubModel> subList)? loaded,
|
||||||
|
TResult? Function(String errorMessage)? error,
|
||||||
|
}) {
|
||||||
|
return error?.call(errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>(
|
||||||
|
TResult Function()? $default, {
|
||||||
|
TResult Function()? loading,
|
||||||
|
TResult Function(List<SubModel> subList)? loaded,
|
||||||
|
TResult Function(String errorMessage)? error,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (error != null) {
|
||||||
|
return error(errorMessage);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>(
|
||||||
|
TResult Function(_SubState value) $default, {
|
||||||
|
required TResult Function(SubStateLoading value) loading,
|
||||||
|
required TResult Function(SubStateLoaded value) loaded,
|
||||||
|
required TResult Function(SubStateError value) error,
|
||||||
|
}) {
|
||||||
|
return error(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>(
|
||||||
|
TResult? Function(_SubState value)? $default, {
|
||||||
|
TResult? Function(SubStateLoading value)? loading,
|
||||||
|
TResult? Function(SubStateLoaded value)? loaded,
|
||||||
|
TResult? Function(SubStateError value)? error,
|
||||||
|
}) {
|
||||||
|
return error?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>(
|
||||||
|
TResult Function(_SubState value)? $default, {
|
||||||
|
TResult Function(SubStateLoading value)? loading,
|
||||||
|
TResult Function(SubStateLoaded value)? loaded,
|
||||||
|
TResult Function(SubStateError value)? error,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (error != null) {
|
||||||
|
return error(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class SubStateError implements SubState {
|
||||||
|
const factory SubStateError({required final String errorMessage}) =
|
||||||
|
_$SubStateErrorImpl;
|
||||||
|
|
||||||
|
String get errorMessage;
|
||||||
|
|
||||||
|
/// Create a copy of SubState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$SubStateErrorImplCopyWith<_$SubStateErrorImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:eatvio_app/core/const.dart';
|
import 'package:eatvio_app/core/const.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||||
import 'package:eatvio_app/features/feed/presentation/widgets/blog_post_widget.dart';
|
import 'package:eatvio_app/features/feed/presentation/widgets/blog_post_widget.dart';
|
||||||
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
|
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
|
||||||
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
||||||
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
|
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
|
||||||
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_state.dart';
|
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_state.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/presentation/pages/subs_screen.dart';
|
||||||
import 'package:eatvio_app/features/profile/presentation/widgets/circumference_chart_widget.dart';
|
import 'package:eatvio_app/features/profile/presentation/widgets/circumference_chart_widget.dart';
|
||||||
import 'package:eatvio_app/features/profile/presentation/widgets/imt_chart_widget.dart';
|
import 'package:eatvio_app/features/profile/presentation/widgets/imt_chart_widget.dart';
|
||||||
import 'package:eatvio_app/features/profile/presentation/widgets/weight_chart_widget.dart';
|
import 'package:eatvio_app/features/profile/presentation/widgets/weight_chart_widget.dart';
|
||||||
@@ -14,7 +16,6 @@ import 'package:eatvio_app/core/theme/theme_helper.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:rive/rive.dart';
|
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
|
||||||
class ProfileScreen extends StatefulWidget {
|
class ProfileScreen extends StatefulWidget {
|
||||||
@@ -56,7 +57,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
circumferencePoints = state.circumferencePoints!;
|
circumferencePoints = state.circumferencePoints!;
|
||||||
weightPoints = state.weightPoints!;
|
weightPoints = state.weightPoints!;
|
||||||
}
|
}
|
||||||
return _profileScreen(state);
|
return widget.author == null ? _myProfileScreen(state) : _profileScreen(state);
|
||||||
} else if (state is ProfileStateError) {
|
} else if (state is ProfileStateError) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(),
|
appBar: AppBar(),
|
||||||
@@ -70,15 +71,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
} else {
|
} else {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(),
|
appBar: AppBar(),
|
||||||
body: Center(
|
body: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -88,7 +81,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
_profileScreen(ProfileStateLoaded state) {
|
_profileScreen(ProfileStateLoaded state) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.grey.shade200,
|
backgroundColor: Colors.grey.shade200,
|
||||||
appBar: widget.author == null ? AppBar(toolbarHeight: 0) : AppBar(),
|
appBar: AppBar(),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -105,26 +98,56 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
children: [
|
children: [
|
||||||
_header(state),
|
_header(state),
|
||||||
if (state.profileDetails.additionalInfo.isNotEmpty) _additionalInfo(state),
|
if (state.profileDetails.additionalInfo.isNotEmpty) _additionalInfo(state),
|
||||||
if (widget.author != null) const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
if (widget.author != null) _messageAndSubscribe(),
|
_messageAndSubscribe(),
|
||||||
if (widget.author != null) const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
_subscriptionsAndSubscribers(state),
|
_subscriptionsAndSubscribers(state),
|
||||||
if(state.profile.badges.isNotEmpty) _badges(state),
|
if (state.profile.badges.isNotEmpty) _badges(state),
|
||||||
if (widget.author == null) const SizedBox(height: 16),
|
|
||||||
_socialLinks(state),
|
_socialLinks(state),
|
||||||
if (widget.author == null) const SizedBox(height: 16),
|
|
||||||
_education(state),
|
_education(state),
|
||||||
if (widget.author == null) const SizedBox(height: 16),
|
|
||||||
_diplomasAndCertificates(state),
|
_diplomasAndCertificates(state),
|
||||||
if (widget.author == null) const SizedBox(height: 16),
|
|
||||||
if (widget.author == null) _charts(),
|
|
||||||
if (widget.author == null) const SizedBox(height: 16),
|
|
||||||
_activePlans(state),
|
_activePlans(state),
|
||||||
if (widget.author == null) const SizedBox(height: 16),
|
_blogPosts(state),
|
||||||
if (widget.author == null) _newBlogPostButton(),
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_myProfileScreen(ProfileStateLoaded state) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.grey.shade200,
|
||||||
|
appBar: AppBar(toolbarHeight: 0),
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.vertical(
|
||||||
|
bottom: Radius.circular(16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
_header(state),
|
||||||
|
if (state.profileDetails.additionalInfo.isNotEmpty) _additionalInfo(state),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
_subscriptionsAndSubscribers(state),
|
||||||
|
if (state.profile.badges.isNotEmpty) Padding(padding: EdgeInsets.only(bottom: 16), child: _badges(state)),
|
||||||
|
if (state.profile.role == 'consultant') Padding(padding: EdgeInsets.only(bottom: 16), child: _socialLinks(state)),
|
||||||
|
if (state.profile.role == 'consultant') Padding(padding: EdgeInsets.only(bottom: 16), child: _education(state)),
|
||||||
|
if (state.profile.role == 'consultant') Padding(padding: EdgeInsets.only(bottom: 16), child: _diplomasAndCertificates(state)),
|
||||||
|
Padding(padding: EdgeInsets.only(bottom: 16), child: _charts()),
|
||||||
|
if (state.profile.role == 'consultant') Padding(padding: EdgeInsets.only(bottom: 16), child: _activePlans(state)),
|
||||||
|
_newBlogPostButton(),
|
||||||
_blogPosts(state),
|
_blogPosts(state),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -511,7 +534,13 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {},
|
onTap: () => GoRouter.of(context).pushNamed(
|
||||||
|
'subsScreen',
|
||||||
|
extra: SubType.Subscriptions,
|
||||||
|
pathParameters: {
|
||||||
|
'slug': state.profile.slug,
|
||||||
|
},
|
||||||
|
),
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
child: Ink(
|
child: Ink(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
@@ -555,7 +584,13 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
),
|
),
|
||||||
SizedBox(width: 4),
|
SizedBox(width: 4),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {},
|
onTap: () => GoRouter.of(context).pushNamed(
|
||||||
|
'subsScreen',
|
||||||
|
extra: SubType.Subscribers,
|
||||||
|
pathParameters: {
|
||||||
|
'slug': state.profile.slug,
|
||||||
|
},
|
||||||
|
),
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
child: Ink(
|
child: Ink(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
|
|||||||
98
lib/features/profile/presentation/pages/subs_screen.dart
Normal file
98
lib/features/profile/presentation/pages/subs_screen.dart
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import 'package:easy_debounce/easy_debounce.dart';
|
||||||
|
import 'package:eatvio_app/core/locator_service.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/presentation/bloc/sub_cubit/sub_cubit.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/presentation/bloc/sub_cubit/sub_state.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/presentation/widgets/sub_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
|
enum SubType { Subscribers, Subscriptions }
|
||||||
|
|
||||||
|
class SubsScreen extends StatefulWidget {
|
||||||
|
final SubType subType;
|
||||||
|
final String slug;
|
||||||
|
|
||||||
|
const SubsScreen({
|
||||||
|
super.key,
|
||||||
|
required this.slug,
|
||||||
|
required this.subType,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SubsScreen> createState() => _SubsScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SubsScreenState extends State<SubsScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BlocProvider<SubCubit>(
|
||||||
|
create: (BuildContext context) => widget.subType == SubType.Subscriptions
|
||||||
|
? (sl<SubCubit>()
|
||||||
|
..getSubscriptions(
|
||||||
|
widget.slug,
|
||||||
|
))
|
||||||
|
: (sl<SubCubit>()
|
||||||
|
..getSubscribers(
|
||||||
|
widget.slug,
|
||||||
|
)),
|
||||||
|
child: BlocBuilder<SubCubit, SubState>(
|
||||||
|
builder: (BuildContext context, SubState state) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
bottom: PreferredSize(
|
||||||
|
preferredSize: Size(MediaQuery.of(context).size.width, 40),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
|
child: CupertinoSearchTextField(
|
||||||
|
prefixIcon: Icon(Icons.search),
|
||||||
|
placeholder: 'Поиск',
|
||||||
|
onChanged: (query) {
|
||||||
|
if (query.length > 2) {
|
||||||
|
EasyDebounce.debounce(
|
||||||
|
'searchSubs',
|
||||||
|
Duration(milliseconds: 300),
|
||||||
|
() {
|
||||||
|
widget.subType == SubType.Subscriptions
|
||||||
|
? (context.read<SubCubit>().getSubscriptions(widget.slug, query))
|
||||||
|
: (context.read<SubCubit>().getSubscribers(widget.slug, query));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
widget.subType == SubType.Subscriptions
|
||||||
|
? (context.read<SubCubit>().getSubscriptions(widget.slug))
|
||||||
|
: (context.read<SubCubit>().getSubscribers(widget.slug));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
widget.subType == SubType.Subscriptions ? 'Подписки' : 'Подписчики',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: _buildStates(state),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_buildStates(SubState state) {
|
||||||
|
if (state is SubStateLoading) {
|
||||||
|
return Loader();
|
||||||
|
}
|
||||||
|
if (state is SubStateError) {
|
||||||
|
return Text(state.errorMessage);
|
||||||
|
}
|
||||||
|
if (state is SubStateLoaded) {
|
||||||
|
return ListView.builder(
|
||||||
|
itemBuilder: (context, index) => SubWidget(
|
||||||
|
subModel: state.subList[index],
|
||||||
|
),
|
||||||
|
itemCount: state.subList.length,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
import 'package:eatvio_app/core/locator_service.dart';
|
||||||
|
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/presentation/bloc/sub_cubit/sub_cubit.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
|
enum SubActionType { SendMessage, Subscribe }
|
||||||
|
|
||||||
|
class SubActionButtonWidget extends StatefulWidget {
|
||||||
|
final SubActionType subActionType;
|
||||||
|
final String slug;
|
||||||
|
|
||||||
|
const SubActionButtonWidget({
|
||||||
|
super.key,
|
||||||
|
required this.subActionType,
|
||||||
|
required this.slug,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SubActionButtonWidget> createState() => _SubActionButtonWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SubActionButtonWidgetState extends State<SubActionButtonWidget> {
|
||||||
|
late SubActionType subActionType;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
subActionType = widget.subActionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (subActionType == SubActionType.Subscribe) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
context.read<SubCubit>().subscribe(widget.slug);
|
||||||
|
setState(() {
|
||||||
|
subActionType = SubActionType.SendMessage;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
child: Ink(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
color: appTheme.blueA400,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Подписаться',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
GoRouter.of(context).pushNamed(
|
||||||
|
'chatScreen',
|
||||||
|
extra: await sl<ProfileCubit>().getChatRoomIdBySlug(slug: widget.slug),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
child: Ink(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
color: Color(0xFFF1F2F6),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Сообщение',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Color(0xFF6D6F71),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
76
lib/features/profile/presentation/widgets/sub_widget.dart
Normal file
76
lib/features/profile/presentation/widgets/sub_widget.dart
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/models/sub_model.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/presentation/widgets/sub_action_button_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
|
class SubWidget extends StatefulWidget {
|
||||||
|
final SubModel subModel;
|
||||||
|
|
||||||
|
const SubWidget({
|
||||||
|
super.key,
|
||||||
|
required this.subModel,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SubWidget> createState() => _SubWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SubWidgetState extends State<SubWidget> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () => GoRouter.of(context).pushNamed(
|
||||||
|
'profileScreen',
|
||||||
|
extra: Author(
|
||||||
|
authorSlug: widget.subModel.slug,
|
||||||
|
authorName: widget.subModel.name,
|
||||||
|
authorProfileIcon: widget.subModel.profilePhotoUrl,
|
||||||
|
authorIsMe: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Ink(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
CircleAvatar(
|
||||||
|
backgroundImage: NetworkImage(widget.subModel.profilePhotoUrl),
|
||||||
|
radius: 28,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
widget.subModel.name,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF323F4B),
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
height: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
'${DateTime.now().year - widget.subModel.birthdate.year - (DateTime.now().isBefore(DateTime(DateTime.now().year, widget.subModel.birthdate.month, widget.subModel.birthdate.day)) ? 1 : 0)} лет, ${widget.subModel.city}',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF6D6F71),
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
height: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
SubActionButtonWidget(
|
||||||
|
subActionType: widget.subModel.isSubscribe ? SubActionType.SendMessage : SubActionType.Subscribe,
|
||||||
|
slug: widget.subModel.slug,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
||||||
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
|
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
|
||||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/models/sub_model.dart';
|
||||||
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
||||||
import 'package:eatvio_app/features/profile/services/profile_service.dart';
|
import 'package:eatvio_app/features/profile/services/profile_service.dart';
|
||||||
|
|
||||||
@@ -112,4 +113,36 @@ class ProfileRepository {
|
|||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<List<SubModel>> getSubscribersBySlug(String slug, [String? query]) async {
|
||||||
|
try {
|
||||||
|
return (await profileService.getSubscribers(slug: slug, query: query)).data;
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<SubModel>> getSubscriptionsBySlug(String slug, [String? query]) async {
|
||||||
|
try {
|
||||||
|
return (await profileService.getSubscriptions(slug: slug, query: query)).data;
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> subscribe(String slug) async {
|
||||||
|
try {
|
||||||
|
return await profileService.subscribe(slug: slug);
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> unsubscribe(String slug) async {
|
||||||
|
try {
|
||||||
|
return await profileService.unsubscribe(slug: slug);
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
||||||
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
|
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
|
||||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||||
|
import 'package:eatvio_app/features/profile/models/sub_model.dart';
|
||||||
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
||||||
import 'package:retrofit/retrofit.dart';
|
import 'package:retrofit/retrofit.dart';
|
||||||
part 'profile_service.g.dart';
|
part 'profile_service.g.dart';
|
||||||
@@ -59,4 +60,26 @@ abstract class ProfileService {
|
|||||||
@Path() required String period,
|
@Path() required String period,
|
||||||
@Path() required String slug,
|
@Path() required String slug,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@GET('/api/profile/{slug}/subscribers')
|
||||||
|
Future<SubPaginationModel> getSubscribers({
|
||||||
|
@Path() required String slug,
|
||||||
|
@Query('filters[name][\$startsWith]') String? query,
|
||||||
|
});
|
||||||
|
|
||||||
|
@GET('/api/profile/{slug}/subscriptions')
|
||||||
|
Future<SubPaginationModel> getSubscriptions({
|
||||||
|
@Path() required String slug,
|
||||||
|
@Query('filters[name][\$startsWith]') String? query,
|
||||||
|
});
|
||||||
|
|
||||||
|
@POST('/api/profile/subscribe/{slug}')
|
||||||
|
Future<void> subscribe({
|
||||||
|
@Path() required String slug,
|
||||||
|
});
|
||||||
|
|
||||||
|
@POST('/api/profile/unsubscribe/{slug}')
|
||||||
|
Future<void> unsubscribe({
|
||||||
|
@Path() required String slug,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -376,6 +376,134 @@ class _ProfileService implements ProfileService {
|
|||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<SubPaginationModel> getSubscribers({
|
||||||
|
required String slug,
|
||||||
|
String? query,
|
||||||
|
}) async {
|
||||||
|
final _extra = <String, dynamic>{};
|
||||||
|
final queryParameters = <String, dynamic>{
|
||||||
|
r'filters[name][$startsWith]': query
|
||||||
|
};
|
||||||
|
queryParameters.removeWhere((k, v) => v == null);
|
||||||
|
final _headers = <String, dynamic>{};
|
||||||
|
const Map<String, dynamic>? _data = null;
|
||||||
|
final _options = _setStreamType<SubPaginationModel>(Options(
|
||||||
|
method: 'GET',
|
||||||
|
headers: _headers,
|
||||||
|
extra: _extra,
|
||||||
|
)
|
||||||
|
.compose(
|
||||||
|
_dio.options,
|
||||||
|
'/api/profile/${slug}/subscribers',
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
data: _data,
|
||||||
|
)
|
||||||
|
.copyWith(
|
||||||
|
baseUrl: _combineBaseUrls(
|
||||||
|
_dio.options.baseUrl,
|
||||||
|
baseUrl,
|
||||||
|
)));
|
||||||
|
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||||
|
late SubPaginationModel _value;
|
||||||
|
try {
|
||||||
|
_value = SubPaginationModel.fromJson(_result.data!);
|
||||||
|
} on Object catch (e, s) {
|
||||||
|
errorLogger?.logError(e, s, _options);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
return _value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<SubPaginationModel> getSubscriptions({
|
||||||
|
required String slug,
|
||||||
|
String? query,
|
||||||
|
}) async {
|
||||||
|
final _extra = <String, dynamic>{};
|
||||||
|
final queryParameters = <String, dynamic>{
|
||||||
|
r'filters[name][$startsWith]': query
|
||||||
|
};
|
||||||
|
queryParameters.removeWhere((k, v) => v == null);
|
||||||
|
final _headers = <String, dynamic>{};
|
||||||
|
const Map<String, dynamic>? _data = null;
|
||||||
|
final _options = _setStreamType<SubPaginationModel>(Options(
|
||||||
|
method: 'GET',
|
||||||
|
headers: _headers,
|
||||||
|
extra: _extra,
|
||||||
|
)
|
||||||
|
.compose(
|
||||||
|
_dio.options,
|
||||||
|
'/api/profile/${slug}/subscriptions',
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
data: _data,
|
||||||
|
)
|
||||||
|
.copyWith(
|
||||||
|
baseUrl: _combineBaseUrls(
|
||||||
|
_dio.options.baseUrl,
|
||||||
|
baseUrl,
|
||||||
|
)));
|
||||||
|
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||||
|
late SubPaginationModel _value;
|
||||||
|
try {
|
||||||
|
_value = SubPaginationModel.fromJson(_result.data!);
|
||||||
|
} on Object catch (e, s) {
|
||||||
|
errorLogger?.logError(e, s, _options);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
return _value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> subscribe({required String slug}) async {
|
||||||
|
final _extra = <String, dynamic>{};
|
||||||
|
final queryParameters = <String, dynamic>{};
|
||||||
|
final _headers = <String, dynamic>{};
|
||||||
|
const Map<String, dynamic>? _data = null;
|
||||||
|
final _options = _setStreamType<void>(Options(
|
||||||
|
method: 'POST',
|
||||||
|
headers: _headers,
|
||||||
|
extra: _extra,
|
||||||
|
)
|
||||||
|
.compose(
|
||||||
|
_dio.options,
|
||||||
|
'/api/profile/subscribe/${slug}',
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
data: _data,
|
||||||
|
)
|
||||||
|
.copyWith(
|
||||||
|
baseUrl: _combineBaseUrls(
|
||||||
|
_dio.options.baseUrl,
|
||||||
|
baseUrl,
|
||||||
|
)));
|
||||||
|
await _dio.fetch<void>(_options);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> unsubscribe({required String slug}) async {
|
||||||
|
final _extra = <String, dynamic>{};
|
||||||
|
final queryParameters = <String, dynamic>{};
|
||||||
|
final _headers = <String, dynamic>{};
|
||||||
|
const Map<String, dynamic>? _data = null;
|
||||||
|
final _options = _setStreamType<void>(Options(
|
||||||
|
method: 'POST',
|
||||||
|
headers: _headers,
|
||||||
|
extra: _extra,
|
||||||
|
)
|
||||||
|
.compose(
|
||||||
|
_dio.options,
|
||||||
|
'/api/profile/unsubscribe/${slug}',
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
data: _data,
|
||||||
|
)
|
||||||
|
.copyWith(
|
||||||
|
baseUrl: _combineBaseUrls(
|
||||||
|
_dio.options.baseUrl,
|
||||||
|
baseUrl,
|
||||||
|
)));
|
||||||
|
await _dio.fetch<void>(_options);
|
||||||
|
}
|
||||||
|
|
||||||
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
|
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
|
||||||
if (T != dynamic &&
|
if (T != dynamic &&
|
||||||
!(requestOptions.responseType == ResponseType.bytes ||
|
!(requestOptions.responseType == ResponseType.bytes ||
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:eatvio_app/core/const.dart';
|
import 'package:eatvio_app/core/const.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
|
|
||||||
import 'package:eatvio_app/features/feed/models/recipes_model.dart' as step;
|
import 'package:eatvio_app/features/feed/models/recipes_model.dart' as step;
|
||||||
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
|
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
|
||||||
@@ -13,7 +14,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_html/flutter_html.dart';
|
import 'package:flutter_html/flutter_html.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:rive/rive.dart';
|
|
||||||
|
|
||||||
class AboutRecipesScreen extends StatefulWidget {
|
class AboutRecipesScreen extends StatefulWidget {
|
||||||
final Recipes recipes;
|
final Recipes recipes;
|
||||||
@@ -348,13 +348,7 @@ class _AboutRecipesScreenState extends State<AboutRecipesScreen> {
|
|||||||
if (state is CommentsStateLoading)
|
if (state is CommentsStateLoading)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(32),
|
padding: const EdgeInsets.all(32),
|
||||||
child: SizedBox(
|
child: const Loader(),
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
if (state is CommentsStateLoaded)
|
if (state is CommentsStateLoaded)
|
||||||
CommentsWidget(
|
CommentsWidget(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:eatvio_app/core/theme/app_decoration.dart';
|
import 'package:eatvio_app/core/theme/app_decoration.dart';
|
||||||
import 'package:eatvio_app/core/widgets/custom_drop_down.dart';
|
import 'package:eatvio_app/core/widgets/custom_drop_down.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
import 'package:eatvio_app/features/recipes/models/product.dart';
|
import 'package:eatvio_app/features/recipes/models/product.dart';
|
||||||
import 'package:eatvio_app/features/recipes/models/ingredient.dart';
|
import 'package:eatvio_app/features/recipes/models/ingredient.dart';
|
||||||
import 'package:eatvio_app/features/recipes/models/recipe_model.dart';
|
import 'package:eatvio_app/features/recipes/models/recipe_model.dart';
|
||||||
@@ -15,7 +16,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:rive/rive.dart' as rive;
|
|
||||||
|
|
||||||
class RecipeCreateScreen extends StatelessWidget {
|
class RecipeCreateScreen extends StatelessWidget {
|
||||||
RecipeCreateScreen({Key? key}) : super(key: key);
|
RecipeCreateScreen({Key? key}) : super(key: key);
|
||||||
@@ -29,15 +29,7 @@ class RecipeCreateScreen extends StatelessWidget {
|
|||||||
return _buildRecipeCreate(context, state);
|
return _buildRecipeCreate(context, state);
|
||||||
} else if (state is RecipeCreateStateLoading) {
|
} else if (state is RecipeCreateStateLoading) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
body: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: rive.RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else if (state is RecipeCreateStateError) {
|
} else if (state is RecipeCreateStateError) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:eatvio_app/core/const.dart';
|
import 'package:eatvio_app/core/const.dart';
|
||||||
import 'package:eatvio_app/core/theme/app_decoration.dart';
|
import 'package:eatvio_app/core/theme/app_decoration.dart';
|
||||||
import 'package:eatvio_app/core/widgets/custom_drop_down.dart';
|
import 'package:eatvio_app/core/widgets/custom_drop_down.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
import 'package:eatvio_app/features/recipes/models/product.dart';
|
import 'package:eatvio_app/features/recipes/models/product.dart';
|
||||||
import 'package:eatvio_app/features/recipes/models/ingredient.dart';
|
import 'package:eatvio_app/features/recipes/models/ingredient.dart';
|
||||||
import 'package:eatvio_app/features/recipes/models/recipe_model.dart';
|
import 'package:eatvio_app/features/recipes/models/recipe_model.dart';
|
||||||
@@ -14,7 +15,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:rive/rive.dart' as rive;
|
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class RecipeEditScreen extends StatelessWidget {
|
class RecipeEditScreen extends StatelessWidget {
|
||||||
@@ -35,15 +35,7 @@ class RecipeEditScreen extends StatelessWidget {
|
|||||||
return _buildRecipeCreate(context, state);
|
return _buildRecipeCreate(context, state);
|
||||||
} else if (state is RecipeCreateStateLoading) {
|
} else if (state is RecipeCreateStateLoading) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
body: Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: rive.RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else if (state is RecipeCreateStateError) {
|
} else if (state is RecipeCreateStateError) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:eatvio_app/core/utils/image_constant.dart';
|
import 'package:eatvio_app/core/utils/image_constant.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
|
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
|
||||||
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_state.dart';
|
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_state.dart';
|
||||||
import 'package:eatvio_app/features/registration/presentation/pages/additional_information_screen.dart';
|
import 'package:eatvio_app/features/registration/presentation/pages/additional_information_screen.dart';
|
||||||
@@ -23,7 +24,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:rive/rive.dart' as rive;
|
|
||||||
import 'package:validators/validators.dart';
|
import 'package:validators/validators.dart';
|
||||||
|
|
||||||
class RegistrationScreen extends StatefulWidget {
|
class RegistrationScreen extends StatefulWidget {
|
||||||
@@ -322,15 +322,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (context) => PopScope(
|
builder: (context) => PopScope(
|
||||||
canPop: false,
|
canPop: false,
|
||||||
child: Center(
|
child: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: rive.RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await registrationCubit.tryRegistration();
|
await registrationCubit.tryRegistration();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:eatvio_app/core/const.dart';
|
import 'package:eatvio_app/core/const.dart';
|
||||||
|
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||||
import 'package:eatvio_app/features/settings/entities/settings_entity.dart';
|
import 'package:eatvio_app/features/settings/entities/settings_entity.dart';
|
||||||
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_cubit.dart';
|
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_cubit.dart';
|
||||||
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.dart';
|
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.dart';
|
||||||
@@ -8,7 +9,6 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:rive/rive.dart';
|
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class SettingsScreen extends StatefulWidget {
|
class SettingsScreen extends StatefulWidget {
|
||||||
@@ -76,15 +76,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
body: const Loader(),
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
child: RiveAnimation.asset(
|
|
||||||
'assets/rive_animations/loading.riv',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: eatvio_app
|
name: eatvio_app
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
version: 1.0.2+17
|
version: 1.0.4+19
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
Reference in New Issue
Block a user