fix: fixed analyzer issues and merge conflicts

This commit is contained in:
Username1548
2025-07-02 19:01:37 +07:00
parent d42604dc87
commit e80b660210
85 changed files with 276 additions and 272 deletions

View File

@@ -11,7 +11,7 @@ class PlansCubit extends Cubit<PlansState> {
required this.plansRepository,
}) : super(const PlansState());
getPlans(String slug) async {
Future<void> getPlans(String slug) async {
emit(const PlansState.loading());
try {
emit(PlansState.loaded(plansList: await plansRepository.getPlansBySlug(slug)));

View File

@@ -63,7 +63,7 @@ class ProfileCubit extends Cubit<ProfileState> {
}
}
updateFeedBlogPostList(FeedBlogPostModel feedBlogPostModel, bool wasLikedByMe) {
void updateFeedBlogPostList(FeedBlogPostModel feedBlogPostModel, bool wasLikedByMe) {
List<FeedBlogPostModel> feedBlogPostList = [...(state as ProfileStateLoaded).blogPosts];
final int index = feedBlogPostList.indexOf(feedBlogPostModel);
feedBlogPostList[index] = feedBlogPostModel.copyWith(
@@ -79,7 +79,7 @@ class ProfileCubit extends Cubit<ProfileState> {
);
}
addCircumference({
Future<void> addCircumference({
required int chestCircumference,
required int waistCircumference,
required int hipCircumference,
@@ -96,7 +96,7 @@ class ProfileCubit extends Cubit<ProfileState> {
}
}
addWeight({
Future<void> addWeight({
required double weight,
}) async {
try {
@@ -107,7 +107,7 @@ class ProfileCubit extends Cubit<ProfileState> {
}
}
getChatRoomIdBySlug({
Future<String?> getChatRoomIdBySlug({
required Author author,
}) async {
try {
@@ -126,19 +126,21 @@ class ProfileCubit extends Cubit<ProfileState> {
'chatId': chatIdOrError,
},
);
return chatIdOrError;
}
} catch (e, st) {
log(e.toString(), stackTrace: st);
return '';
}
return null;
}
uploadPhoto(File file) async {
Future<void> uploadPhoto(File file) async {
await profileRepository.uploadPhoto(await ImageCompressUtility.compressFile(file));
return await getMyProfile();
}
deletePhoto() async {
Future<void> deletePhoto() async {
await profileRepository.deletePhoto();
return await getMyProfile();
}

View File

@@ -9,7 +9,7 @@ class SubCubit extends Cubit<SubState> {
required this.profileRepository,
}) : super(const SubState());
getSubscriptions(String slug, [String? query]) async {
Future<void> getSubscriptions(String slug, [String? query]) async {
emit(const SubState.loading());
try {
emit(SubState.loaded(subList: await profileRepository.getSubscriptionsBySlug(slug, query)));
@@ -18,7 +18,7 @@ class SubCubit extends Cubit<SubState> {
}
}
getSubscribers(String slug, [String? query]) async {
Future<void> getSubscribers(String slug, [String? query]) async {
emit(const SubState.loading());
try {
emit(SubState.loaded(subList: await profileRepository.getSubscribersBySlug(slug, query)));
@@ -27,11 +27,11 @@ class SubCubit extends Cubit<SubState> {
}
}
subscribe(String slug) async {
Future<void> subscribe(String slug) async {
return await profileRepository.subscribe(slug);
}
unsubscribe(String slug) async {
Future<void> unsubscribe(String slug) async {
return await profileRepository.unsubscribe(slug);
}
}

View File

@@ -119,7 +119,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_profileScreen(ProfileStateLoaded state) {
Scaffold _profileScreen(ProfileStateLoaded state) {
return Scaffold(
backgroundColor: Colors.grey.shade200,
appBar: AppBar(),
@@ -213,7 +213,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_myProfileScreen(ProfileStateLoaded state) {
Scaffold _myProfileScreen(ProfileStateLoaded state) {
return Scaffold(
backgroundColor: Colors.grey.shade200,
appBar: AppBar(toolbarHeight: 0),
@@ -306,7 +306,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_activePlans(ProfileStateLoaded state) {
Widget _activePlans(ProfileStateLoaded state) {
if (!state.profile.roles.contains('consultant')) {
return const SizedBox.shrink();
}
@@ -365,7 +365,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_bullets(int currentBullet, int bulletCount) {
Container _bullets(int currentBullet, int bulletCount) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
@@ -384,7 +384,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_bullet(bool isActive) {
AnimatedContainer _bullet(bool isActive) {
return AnimatedContainer(
width: isActive ? 10 : 8,
height: isActive ? 10 : 8,
@@ -396,7 +396,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_newBlogPostButton() {
Material _newBlogPostButton() {
return Material(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
@@ -437,7 +437,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_diplomasAndCertificates(ProfileStateLoaded state) {
SingleChildRenderObjectWidget _diplomasAndCertificates(ProfileStateLoaded state) {
if (!state.profile.roles.contains('consultant') || state.consultantInfo!.photos.isEmpty) {
return const SizedBox.shrink();
}
@@ -510,7 +510,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_diplomaImage(String url) {
GestureDetector _diplomaImage(String url) {
return GestureDetector(
onTap: () {
context.pushTransparentRoute(
@@ -536,7 +536,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_education(ProfileStateLoaded state) {
SingleChildRenderObjectWidget _education(ProfileStateLoaded state) {
if (!state.profile.roles.contains('consultant') ||
state.consultantInfo!.educationModel.completedCourses == null ||
(state.consultantInfo!.educationModel.completedCourses?.isEmpty ?? false)) {
@@ -603,7 +603,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_educationBlock(String title, String date) {
SizedBox _educationBlock(String title, String date) {
final parsedDate = DateTime.tryParse(date);
final formattedDate = parsedDate != null ? DateFormat('d MMMM y', 'ru_RU').format(parsedDate) : date;
@@ -643,7 +643,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_socialLinks(ProfileStateLoaded state) {
SingleChildRenderObjectWidget _socialLinks(ProfileStateLoaded state) {
if (!state.profile.roles.contains('consultant')) {
return const SizedBox.shrink();
}
@@ -701,7 +701,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_socialLinkButton(Function() onTap, String icon, bool disabled) {
InkWell _socialLinkButton(Function() onTap, String icon, bool disabled) {
return InkWell(
onTap: disabled ? null : onTap,
borderRadius: BorderRadius.circular(20),
@@ -723,7 +723,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_badges(ProfileStateLoaded state) {
Padding _badges(ProfileStateLoaded state) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: InkWell(
@@ -815,7 +815,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_subscriptionsAndSubscribers(ProfileStateLoaded state) {
Padding _subscriptionsAndSubscribers(ProfileStateLoaded state) {
return Padding(
padding: const EdgeInsets.all(4),
child: Row(
@@ -924,7 +924,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_miniAvatars(List<String> urls) {
Row _miniAvatars(List<String> urls) {
int maxLength = urls.length > 2 ? 3 : urls.length;
return Row(
mainAxisAlignment: MainAxisAlignment.center,
@@ -944,7 +944,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_blogPosts(ProfileStateLoaded state) {
ListView _blogPosts(ProfileStateLoaded state) {
return ListView.separated(
padding: const EdgeInsets.symmetric(vertical: 16),
shrinkWrap: true,
@@ -958,7 +958,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_additionalInfo(ProfileStateLoaded state) {
Container _additionalInfo(ProfileStateLoaded state) {
String text = state.profileDetails.additionalInfo;
if (state.profileDetails.additionalInfo.length > 250) {
text = state.profileDetails.additionalInfo.substring(0, 250);
@@ -976,7 +976,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_header(ProfileStateLoaded state) {
Padding _header(ProfileStateLoaded state) {
return Padding(
padding: const EdgeInsets.all(16),
child: Row(
@@ -1212,7 +1212,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_additional(String title, String value) {
Row _additional(String title, String value) {
return Row(
children: [
Text(
@@ -1235,7 +1235,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_messageAndSubscribe(ProfileStateLoaded state) {
Row _messageAndSubscribe(ProfileStateLoaded state) {
return Row(
children: [
const SizedBox(width: 16),
@@ -1286,7 +1286,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_charts() {
Material _charts() {
return Material(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
@@ -1350,7 +1350,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_choiceIntervalChipWidget(int index) {
ChoiceChip _choiceIntervalChipWidget(int index) {
return ChoiceChip(
selectedColor: Colors.grey.withValues(alpha: 0.1),
pressElevation: 0,
@@ -1376,7 +1376,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_choiceChipWidget(int index) {
ChoiceChip _choiceChipWidget(int index) {
return ChoiceChip(
selectedColor: appTheme.blueA400,
pressElevation: 0,

View File

@@ -79,7 +79,7 @@ class _SubsScreenState extends State<SubsScreen> {
);
}
_buildStates(SubState state) {
StatelessWidget? _buildStates(SubState state) {
if (state is SubStateLoading) {
return const Loader();
}
@@ -94,5 +94,6 @@ class _SubsScreenState extends State<SubsScreen> {
itemCount: state.subList.length,
);
}
return null;
}
}

View File

@@ -191,7 +191,7 @@ class _ProfileBlogPostWidgetState extends State<ProfileBlogPostWidget> {
isLiked
? await context.read<FeedCubit>().likePost(state.blogPosts[widget.index].id)
: await context.read<FeedCubit>().unlikedPost(state.blogPosts[widget.index].id);
await widget.profileCubit.updateFeedBlogPostList(
widget.profileCubit.updateFeedBlogPostList(
state.blogPosts[widget.index],
isLiked ? false : true,
);