From 3551e2c11ed75eba29f9981845192da1626ff17b Mon Sep 17 00:00:00 2001 From: cp-ishita-g Date: Thu, 6 Jun 2024 10:57:20 +0530 Subject: [PATCH] make ui related changes --- .../ui/flow/home/components/home_top_bar.dart | 3 +- .../contact_support_screen.dart | 61 +++++++---------- .../contact_support_view_model.dart | 47 +++++++------ .../contact_support_view_model.freezed.dart | 67 +++++++++++++------ .../flow/setting/profile/profile_screen.dart | 6 +- .../setting/profile/profile_view_model.dart | 8 +-- .../profile/profile_view_model.freezed.dart | 26 +++---- app/lib/ui/flow/setting/setting_screen.dart | 6 +- .../flow/setting/space/edit_space_screen.dart | 4 +- .../setting/space/edit_space_view_model.dart | 2 +- .../space/create/create_space_screen.dart | 3 +- data/lib/api/support/api_support_service.dart | 3 +- data/lib/service/space_service.dart | 3 +- 13 files changed, 128 insertions(+), 111 deletions(-) diff --git a/app/lib/ui/flow/home/components/home_top_bar.dart b/app/lib/ui/flow/home/components/home_top_bar.dart index fe0b7881..7f3f8f38 100644 --- a/app/lib/ui/flow/home/components/home_top_bar.dart +++ b/app/lib/ui/flow/home/components/home_top_bar.dart @@ -165,8 +165,7 @@ class _HomeTopBarState extends State with TickerProviderStateMixin { .copyWith(color: context.colorScheme.textPrimary), ), ), - const Spacer(), - if (widget.fetchingInviteCode || widget.selectedSpace == null) ...[ + if (widget.fetchingInviteCode || (widget.selectedSpace == null && widget.spaces.isNotEmpty)) ...[ const AppProgressIndicator(size: AppProgressIndicatorSize.small) ] else ...[ Icon( diff --git a/app/lib/ui/flow/setting/contact_support/contact_support_screen.dart b/app/lib/ui/flow/setting/contact_support/contact_support_screen.dart index 56f1160b..fd4c1151 100644 --- a/app/lib/ui/flow/setting/contact_support/contact_support_screen.dart +++ b/app/lib/ui/flow/setting/contact_support/contact_support_screen.dart @@ -31,17 +31,16 @@ class _ContactSupportScreenState extends ConsumerState { @override Widget build(BuildContext context) { notifier = ref.watch(contactSupportViewStateProvider.notifier); + final state = ref.watch(contactSupportViewStateProvider); _observePop(); return AppPage( title: context.l10n.contact_support_title, - body: _body(context), + body: _body(context, state), ); } - Widget _body(BuildContext context) { - final state = ref.watch(contactSupportViewStateProvider); - + Widget _body(BuildContext context, ContactSupportViewState state) { return Builder( builder: (context) => Stack( children: [ @@ -50,14 +49,16 @@ class _ContactSupportScreenState extends ConsumerState { const EdgeInsets.all(16) + BottomStickyOverlay.padding, children: [ - _titleView( - context: context, + AppTextField( controller: state.title, + label: context.l10n.contact_support_title_field, ), const SizedBox(height: 40), - _descriptionView( - context: context, + AppTextField( + label: context.l10n.contact_support_description_title, + borderType: AppTextFieldBorderType.outline, controller: state.description, + maxLines: 8, ), const SizedBox(height: 40), _attachmentButton( @@ -80,14 +81,19 @@ class _ContactSupportScreenState extends ConsumerState { shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemCount: state.attachments.length, - itemBuilder: (context, index) => _attachmentItem( + itemBuilder: (context, index) { + final file = state.attachments[index]; + final isLoading = state.attachmentUploading.contains(file); + return _attachmentItem( context: context, - path: state.attachments[index].path, - name: state.attachments[index].path.split('/').last, - loading: false, + path: file.path, + name: file.path.split('/').last, + loading: isLoading, onCancelTap: () { notifier.onAttachmentRemoved(index); - }), + }, + ); + }, separatorBuilder: (context, index) => const SizedBox(height: 8), ); } @@ -158,29 +164,6 @@ class _ContactSupportScreenState extends ConsumerState { ); } - Widget _titleView({ - required BuildContext context, - required TextEditingController controller, - }) { - return AppTextField( - label: context.l10n.contact_support_title_field, - controller: controller, - onChanged: (value) => notifier.onTitleChanged(value), - ); - } - - Widget _descriptionView({ - required BuildContext context, - required TextEditingController controller, - }) { - return AppTextField( - label: context.l10n.contact_support_description_title, - borderType: AppTextFieldBorderType.outline, - controller: controller, - maxLines: 8, - ); - } - Widget _attachmentButton({ required BuildContext context, required VoidCallback onAttachmentTap, @@ -207,7 +190,7 @@ class _ContactSupportScreenState extends ConsumerState { Widget _submitButton(BuildContext context, ContactSupportViewState state) { return BottomStickyOverlay( child: PrimaryButton( - enabled: !state.submitting && state.title.text.length >= 3, + enabled: !state.submitting && state.enableSubmit, progress: state.submitting, context.l10n.contact_support_submit_title, onPressed: () { @@ -218,7 +201,9 @@ class _ContactSupportScreenState extends ConsumerState { } void _observePop() { - ref.listen(contactSupportViewStateProvider.select((state) => state.requestSent), (previous, next) { + ref.listen( + contactSupportViewStateProvider.select((state) => state.requestSent), + (previous, next) { if (next) { context.pop(); } diff --git a/app/lib/ui/flow/setting/contact_support/contact_support_view_model.dart b/app/lib/ui/flow/setting/contact_support/contact_support_view_model.dart index 21f97b05..fdff4d9d 100644 --- a/app/lib/ui/flow/setting/contact_support/contact_support_view_model.dart +++ b/app/lib/ui/flow/setting/contact_support/contact_support_view_model.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:data/api/support/api_support_service.dart'; import 'package:data/log/logger.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:image_picker/image_picker.dart'; @@ -24,22 +25,21 @@ class ContactSupportViewNotifier ContactSupportViewNotifier(this.supportService, this.picker) : super( - ContactSupportViewState( - title: TextEditingController(), - description: TextEditingController(), - ), - ); + ContactSupportViewState( + title: TextEditingController(), + description: TextEditingController(), + ), + ) { + state.title.addListener(verifySubmitButton); + } final List attachmentsToUpload = []; final Map uploadedAttachments = {}; - void onTitleChanged(String title) { - state = state.copyWith(title: TextEditingController(text: title)); - } - - void onDescriptionChanged(String description) { - state = - state.copyWith(description: TextEditingController(text: description)); + void verifySubmitButton() { + state = state.copyWith( + enableSubmit: state.title.text.trim().isNotEmpty && state.attachmentUploading.isEmpty, + ); } void pickAttachments() async { @@ -52,7 +52,7 @@ class ContactSupportViewNotifier onAttachmentAdded(files); } catch (error, stackTrace) { logger.e( - "ContactSupportViewStateNotifier: Error while pick image!", + "ContactSupportViewNotifier: Error while picking image!", error: error, stackTrace: stackTrace, ); @@ -72,6 +72,7 @@ class ContactSupportViewNotifier state = state.copyWith( attachments: attachments, attachmentSizeLimitExceed: false); uploadPendingAttachments(); + verifySubmitButton(); } void uploadPendingAttachments() async { @@ -84,20 +85,22 @@ class ContactSupportViewNotifier _uploadedAttachment(file, uri); } catch (error, stack) { logger.e( - 'ContactSupportViewNotifier: error while upload attachments', - error: error, + 'ContactSupportViewNotifier: error while uploading attachments', + error: error, stackTrace: stack, ); _uploadedAttachment(file, null); state = state.copyWith(error: error); } } + verifySubmitButton(); } void _uploadingAttachment(File file) { final uploading = state.attachmentUploading.toList(); uploading.add(file); state = state.copyWith(attachmentUploading: uploading); + verifySubmitButton(); } void _uploadedAttachment(File file, String? uri) { @@ -105,17 +108,22 @@ class ContactSupportViewNotifier uploading.remove(file); uploadedAttachments[file] = uri; state = state.copyWith(attachmentUploading: uploading); + verifySubmitButton(); } void onAttachmentRemoved(int index) { - state = state.copyWith(attachments: state.attachments.toList()..removeAt(index)); + final attachments = state.attachments.toList(); + final removedFile = attachments.removeAt(index); + uploadedAttachments.remove(removedFile); + state = state.copyWith(attachments: attachments); + verifySubmitButton(); } void submitSupportRequest() async { try { state = state.copyWith(submitting: true, error: null, attachmentSizeLimitExceed: false); final attachments = - uploadedAttachments.values.whereType().toList(); + uploadedAttachments.values.whereType().toList(); await supportService.submitSupportRequest( state.title.text, state.description.text, @@ -124,7 +132,7 @@ class ContactSupportViewNotifier state = state.copyWith(requestSent: true, submitting: false); } catch (error, stack) { logger.e( - 'ContactSupportViewNotifier: error while submit response', + 'ContactSupportViewNotifier: error while submitting response', error: error, stackTrace: stack, ); @@ -139,9 +147,10 @@ class ContactSupportViewState with _$ContactSupportViewState { @Default(false) bool submitting, @Default(false) bool requestSent, @Default(false) bool attachmentSizeLimitExceed, + @Default(false) bool enableSubmit, Object? error, - required TextEditingController title, required TextEditingController description, + required TextEditingController title, @Default([]) List attachments, @Default([]) List attachmentUploading, }) = _ContactSupportViewState; diff --git a/app/lib/ui/flow/setting/contact_support/contact_support_view_model.freezed.dart b/app/lib/ui/flow/setting/contact_support/contact_support_view_model.freezed.dart index 58bfba0c..2c6a9ec8 100644 --- a/app/lib/ui/flow/setting/contact_support/contact_support_view_model.freezed.dart +++ b/app/lib/ui/flow/setting/contact_support/contact_support_view_model.freezed.dart @@ -19,9 +19,10 @@ mixin _$ContactSupportViewState { bool get submitting => throw _privateConstructorUsedError; bool get requestSent => throw _privateConstructorUsedError; bool get attachmentSizeLimitExceed => throw _privateConstructorUsedError; + bool get enableSubmit => throw _privateConstructorUsedError; Object? get error => throw _privateConstructorUsedError; - TextEditingController get title => throw _privateConstructorUsedError; TextEditingController get description => throw _privateConstructorUsedError; + TextEditingController get title => throw _privateConstructorUsedError; List get attachments => throw _privateConstructorUsedError; List get attachmentUploading => throw _privateConstructorUsedError; @@ -40,9 +41,10 @@ abstract class $ContactSupportViewStateCopyWith<$Res> { {bool submitting, bool requestSent, bool attachmentSizeLimitExceed, + bool enableSubmit, Object? error, - TextEditingController title, TextEditingController description, + TextEditingController title, List attachments, List attachmentUploading}); } @@ -64,9 +66,10 @@ class _$ContactSupportViewStateCopyWithImpl<$Res, Object? submitting = null, Object? requestSent = null, Object? attachmentSizeLimitExceed = null, + Object? enableSubmit = null, Object? error = freezed, - Object? title = null, Object? description = null, + Object? title = null, Object? attachments = null, Object? attachmentUploading = null, }) { @@ -83,15 +86,19 @@ class _$ContactSupportViewStateCopyWithImpl<$Res, ? _value.attachmentSizeLimitExceed : attachmentSizeLimitExceed // ignore: cast_nullable_to_non_nullable as bool, + enableSubmit: null == enableSubmit + ? _value.enableSubmit + : enableSubmit // ignore: cast_nullable_to_non_nullable + as bool, error: freezed == error ? _value.error : error, - title: null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as TextEditingController, description: null == description ? _value.description : description // ignore: cast_nullable_to_non_nullable as TextEditingController, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as TextEditingController, attachments: null == attachments ? _value.attachments : attachments // ignore: cast_nullable_to_non_nullable @@ -117,9 +124,10 @@ abstract class _$$ContactSupportViewStateImplCopyWith<$Res> {bool submitting, bool requestSent, bool attachmentSizeLimitExceed, + bool enableSubmit, Object? error, - TextEditingController title, TextEditingController description, + TextEditingController title, List attachments, List attachmentUploading}); } @@ -140,9 +148,10 @@ class __$$ContactSupportViewStateImplCopyWithImpl<$Res> Object? submitting = null, Object? requestSent = null, Object? attachmentSizeLimitExceed = null, + Object? enableSubmit = null, Object? error = freezed, - Object? title = null, Object? description = null, + Object? title = null, Object? attachments = null, Object? attachmentUploading = null, }) { @@ -159,15 +168,19 @@ class __$$ContactSupportViewStateImplCopyWithImpl<$Res> ? _value.attachmentSizeLimitExceed : attachmentSizeLimitExceed // ignore: cast_nullable_to_non_nullable as bool, + enableSubmit: null == enableSubmit + ? _value.enableSubmit + : enableSubmit // ignore: cast_nullable_to_non_nullable + as bool, error: freezed == error ? _value.error : error, - title: null == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as TextEditingController, description: null == description ? _value.description : description // ignore: cast_nullable_to_non_nullable as TextEditingController, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as TextEditingController, attachments: null == attachments ? _value._attachments : attachments // ignore: cast_nullable_to_non_nullable @@ -187,9 +200,10 @@ class _$ContactSupportViewStateImpl implements _ContactSupportViewState { {this.submitting = false, this.requestSent = false, this.attachmentSizeLimitExceed = false, + this.enableSubmit = false, this.error, - required this.title, required this.description, + required this.title, final List attachments = const [], final List attachmentUploading = const []}) : _attachments = attachments, @@ -205,11 +219,14 @@ class _$ContactSupportViewStateImpl implements _ContactSupportViewState { @JsonKey() final bool attachmentSizeLimitExceed; @override - final Object? error; + @JsonKey() + final bool enableSubmit; @override - final TextEditingController title; + final Object? error; @override final TextEditingController description; + @override + final TextEditingController title; final List _attachments; @override @JsonKey() @@ -231,7 +248,7 @@ class _$ContactSupportViewStateImpl implements _ContactSupportViewState { @override String toString() { - return 'ContactSupportViewState(submitting: $submitting, requestSent: $requestSent, attachmentSizeLimitExceed: $attachmentSizeLimitExceed, error: $error, title: $title, description: $description, attachments: $attachments, attachmentUploading: $attachmentUploading)'; + return 'ContactSupportViewState(submitting: $submitting, requestSent: $requestSent, attachmentSizeLimitExceed: $attachmentSizeLimitExceed, enableSubmit: $enableSubmit, error: $error, description: $description, title: $title, attachments: $attachments, attachmentUploading: $attachmentUploading)'; } @override @@ -246,10 +263,12 @@ class _$ContactSupportViewStateImpl implements _ContactSupportViewState { (identical(other.attachmentSizeLimitExceed, attachmentSizeLimitExceed) || other.attachmentSizeLimitExceed == attachmentSizeLimitExceed) && + (identical(other.enableSubmit, enableSubmit) || + other.enableSubmit == enableSubmit) && const DeepCollectionEquality().equals(other.error, error) && - (identical(other.title, title) || other.title == title) && (identical(other.description, description) || other.description == description) && + (identical(other.title, title) || other.title == title) && const DeepCollectionEquality() .equals(other._attachments, _attachments) && const DeepCollectionEquality() @@ -262,9 +281,10 @@ class _$ContactSupportViewStateImpl implements _ContactSupportViewState { submitting, requestSent, attachmentSizeLimitExceed, + enableSubmit, const DeepCollectionEquality().hash(error), - title, description, + title, const DeepCollectionEquality().hash(_attachments), const DeepCollectionEquality().hash(_attachmentUploading)); @@ -281,9 +301,10 @@ abstract class _ContactSupportViewState implements ContactSupportViewState { {final bool submitting, final bool requestSent, final bool attachmentSizeLimitExceed, + final bool enableSubmit, final Object? error, - required final TextEditingController title, required final TextEditingController description, + required final TextEditingController title, final List attachments, final List attachmentUploading}) = _$ContactSupportViewStateImpl; @@ -294,12 +315,14 @@ abstract class _ContactSupportViewState implements ContactSupportViewState { @override bool get attachmentSizeLimitExceed; @override - Object? get error; + bool get enableSubmit; @override - TextEditingController get title; + Object? get error; @override TextEditingController get description; @override + TextEditingController get title; + @override List get attachments; @override List get attachmentUploading; diff --git a/app/lib/ui/flow/setting/profile/profile_screen.dart b/app/lib/ui/flow/setting/profile/profile_screen.dart index 3bbcd051..9e1a4cb0 100644 --- a/app/lib/ui/flow/setting/profile/profile_screen.dart +++ b/app/lib/ui/flow/setting/profile/profile_screen.dart @@ -113,7 +113,7 @@ class _ProfileScreenState extends ConsumerState { color: context.colorScheme.primary, borderRadius: BorderRadius.circular(64), ), - child: (state.profileUrl!.isEmpty) + child: (state.profileUrl.isEmpty) ? Center(child: Text( notifier.user?.userNameFirstLetter ?? '', style: TextStyle( @@ -123,7 +123,7 @@ class _ProfileScreenState extends ConsumerState { ) )) : CachedNetworkImage( - imageUrl: state.profileUrl ?? '', + imageUrl: state.profileUrl, fit: BoxFit.cover, ), ), @@ -203,7 +203,7 @@ class _ProfileScreenState extends ConsumerState { } }, ), - if (state.profileUrl!.isNotEmpty) + if (state.profileUrl.isNotEmpty) BottomSheetAction( title: context.l10n.edit_profile_remove_photo_option_text, icon: SvgPicture.asset( diff --git a/app/lib/ui/flow/setting/profile/profile_view_model.dart b/app/lib/ui/flow/setting/profile/profile_view_model.dart index 34acc9d3..de875a69 100644 --- a/app/lib/ui/flow/setting/profile/profile_view_model.dart +++ b/app/lib/ui/flow/setting/profile/profile_view_model.dart @@ -34,7 +34,7 @@ class EditProfileViewNotifier extends StateNotifier { phone: TextEditingController(text: user?.phone), enableEmail: user?.auth_type == LOGIN_TYPE_GOOGLE, enablePhone: user?.auth_type == LOGIN_TYPE_PHONE, - profileUrl: user?.profile_image, + profileUrl: user?.profile_image ?? '', )); void deleteAccount() { @@ -112,13 +112,13 @@ class EditProfileViewNotifier extends StateNotifier { error: error, stackTrace: stack, ); - state = state.copyWith(profileUrl: null, uploadingImage: false); + state = state.copyWith(profileUrl: '', uploadingImage: false); onChange(); } } void onRemoveImage() { - state = state.copyWith(profileUrl: null); + state = state.copyWith(profileUrl: '', allowSave: true); onChange(); } } @@ -138,6 +138,6 @@ class EditProfileViewState with _$EditProfileViewState { required TextEditingController lastName, required TextEditingController email, required TextEditingController phone, - String? profileUrl, + required String profileUrl, }) = _EditProfileViewState; } diff --git a/app/lib/ui/flow/setting/profile/profile_view_model.freezed.dart b/app/lib/ui/flow/setting/profile/profile_view_model.freezed.dart index 89f33a18..a1acaa11 100644 --- a/app/lib/ui/flow/setting/profile/profile_view_model.freezed.dart +++ b/app/lib/ui/flow/setting/profile/profile_view_model.freezed.dart @@ -28,7 +28,7 @@ mixin _$EditProfileViewState { TextEditingController get lastName => throw _privateConstructorUsedError; TextEditingController get email => throw _privateConstructorUsedError; TextEditingController get phone => throw _privateConstructorUsedError; - String? get profileUrl => throw _privateConstructorUsedError; + String get profileUrl => throw _privateConstructorUsedError; @JsonKey(ignore: true) $EditProfileViewStateCopyWith get copyWith => @@ -54,7 +54,7 @@ abstract class $EditProfileViewStateCopyWith<$Res> { TextEditingController lastName, TextEditingController email, TextEditingController phone, - String? profileUrl}); + String profileUrl}); } /// @nodoc @@ -83,7 +83,7 @@ class _$EditProfileViewStateCopyWithImpl<$Res, Object? lastName = null, Object? email = null, Object? phone = null, - Object? profileUrl = freezed, + Object? profileUrl = null, }) { return _then(_value.copyWith( saving: null == saving @@ -134,10 +134,10 @@ class _$EditProfileViewStateCopyWithImpl<$Res, ? _value.phone : phone // ignore: cast_nullable_to_non_nullable as TextEditingController, - profileUrl: freezed == profileUrl + profileUrl: null == profileUrl ? _value.profileUrl : profileUrl // ignore: cast_nullable_to_non_nullable - as String?, + as String, ) as $Val); } } @@ -163,7 +163,7 @@ abstract class _$$EditProfileViewStateImplCopyWith<$Res> TextEditingController lastName, TextEditingController email, TextEditingController phone, - String? profileUrl}); + String profileUrl}); } /// @nodoc @@ -189,7 +189,7 @@ class __$$EditProfileViewStateImplCopyWithImpl<$Res> Object? lastName = null, Object? email = null, Object? phone = null, - Object? profileUrl = freezed, + Object? profileUrl = null, }) { return _then(_$EditProfileViewStateImpl( saving: null == saving @@ -240,10 +240,10 @@ class __$$EditProfileViewStateImplCopyWithImpl<$Res> ? _value.phone : phone // ignore: cast_nullable_to_non_nullable as TextEditingController, - profileUrl: freezed == profileUrl + profileUrl: null == profileUrl ? _value.profileUrl : profileUrl // ignore: cast_nullable_to_non_nullable - as String?, + as String, )); } } @@ -264,7 +264,7 @@ class _$EditProfileViewStateImpl implements _EditProfileViewState { required this.lastName, required this.email, required this.phone, - this.profileUrl}); + required this.profileUrl}); @override @JsonKey() @@ -299,7 +299,7 @@ class _$EditProfileViewStateImpl implements _EditProfileViewState { @override final TextEditingController phone; @override - final String? profileUrl; + final String profileUrl; @override String toString() { @@ -375,7 +375,7 @@ abstract class _EditProfileViewState implements EditProfileViewState { required final TextEditingController lastName, required final TextEditingController email, required final TextEditingController phone, - final String? profileUrl}) = _$EditProfileViewStateImpl; + required final String profileUrl}) = _$EditProfileViewStateImpl; @override bool get saving; @@ -402,7 +402,7 @@ abstract class _EditProfileViewState implements EditProfileViewState { @override TextEditingController get phone; @override - String? get profileUrl; + String get profileUrl; @override @JsonKey(ignore: true) _$$EditProfileViewStateImplCopyWith<_$EditProfileViewStateImpl> diff --git a/app/lib/ui/flow/setting/setting_screen.dart b/app/lib/ui/flow/setting/setting_screen.dart index 13f6b420..3f233969 100644 --- a/app/lib/ui/flow/setting/setting_screen.dart +++ b/app/lib/ui/flow/setting/setting_screen.dart @@ -37,6 +37,7 @@ class _SettingScreenState extends ConsumerState { @override Widget build(BuildContext context) { + final state = ref.watch(settingViewStateProvider); _observeLogOut(); return AppPage( @@ -45,12 +46,11 @@ class _SettingScreenState extends ConsumerState { onResume: () { notifier.getUser(); notifier.getUserSpace(); - }, child: _body(context)), + }, child: _body(context, state)), ); } - Widget _body(BuildContext context) { - final state = ref.watch(settingViewStateProvider); + Widget _body(BuildContext context, SettingViewState state) { if (state.loading) { return const Center(child: AppProgressIndicator()); } diff --git a/app/lib/ui/flow/setting/space/edit_space_screen.dart b/app/lib/ui/flow/setting/space/edit_space_screen.dart index 66c6e81f..09817ebb 100644 --- a/app/lib/ui/flow/setting/space/edit_space_screen.dart +++ b/app/lib/ui/flow/setting/space/edit_space_screen.dart @@ -255,7 +255,7 @@ class _EditSpaceScreenState extends ConsumerState { edgeInsets: const EdgeInsets.symmetric(vertical: 16, horizontal: 32), showIcon: state.isAdmin ? true : false, foreground: context.colorScheme.alert, - background: context.colorScheme.containerLow, + background: context.colorScheme.containerLowOnSurface, onPressed: () { showConfirmation( context, @@ -268,7 +268,7 @@ class _EditSpaceScreenState extends ConsumerState { message: state.isAdmin ? context.l10n.edit_space_delete_space_alert_message : context.l10n.edit_space_leave_space_alert_message, - onConfirm: () => notifier.deleteSpace(), + onConfirm: () => state.isAdmin ? notifier.deleteSpace() : notifier.leaveSpace(), ); }, ), diff --git a/app/lib/ui/flow/setting/space/edit_space_view_model.dart b/app/lib/ui/flow/setting/space/edit_space_view_model.dart index 54f1f9a2..65801952 100644 --- a/app/lib/ui/flow/setting/space/edit_space_view_model.dart +++ b/app/lib/ui/flow/setting/space/edit_space_view_model.dart @@ -62,7 +62,7 @@ class EditSpaceViewNotifier extends StateNotifier { if (state.currentUserInfo!.user.location_enabled != state.locationEnabled) { await spaceService.enableLocation(state.space!.space.id, state.currentUserInfo!.user.id, state.locationEnabled); } - state = state.copyWith(saving: false); + state = state.copyWith(saving: false, allowSave: false); } catch (error, stack) { logger.e( 'EditSpaceViewNotifier: error while update space info', diff --git a/app/lib/ui/flow/space/create/create_space_screen.dart b/app/lib/ui/flow/space/create/create_space_screen.dart index 1fe36c94..b9561443 100644 --- a/app/lib/ui/flow/space/create/create_space_screen.dart +++ b/app/lib/ui/flow/space/create/create_space_screen.dart @@ -39,8 +39,7 @@ class _CreateSpaceState extends ConsumerState { Widget _body(BuildContext context, CreateSpaceViewState state) { return Stack(children: [ ListView( - padding: MediaQuery.of(context).padding + - const EdgeInsets.all(16) + + padding: const EdgeInsets.all(16) + BottomStickyOverlay.padding, children: [ const SizedBox(height: 8), diff --git a/data/lib/api/support/api_support_service.dart b/data/lib/api/support/api_support_service.dart index 090d462d..3ee96dc4 100644 --- a/data/lib/api/support/api_support_service.dart +++ b/data/lib/api/support/api_support_service.dart @@ -44,6 +44,7 @@ class ApiSupportService { "attachments": attachments, }; - FirebaseFunctions.instance.httpsCallable('name').call(report); + final callable = FirebaseFunctions.instance.httpsCallable('sendSupportRequest'); + await callable.call(report); } } diff --git a/data/lib/service/space_service.dart b/data/lib/service/space_service.dart index df8ec340..1b87b161 100644 --- a/data/lib/service/space_service.dart +++ b/data/lib/service/space_service.dart @@ -13,7 +13,7 @@ final spaceServiceProvider = Provider((ref) => SpaceService( ref.read(currentUserPod), ref.read(apiSpaceServiceProvider), ref.read(apiSpaceInvitationServiceProvider), - ref.read(currentUserSessionJsonPod.notifier), + ref.read(currentSpaceId.notifier), ref.read(apiUserServiceProvider), )); @@ -172,6 +172,7 @@ class SpaceService { for (final space in joinedSpace) { await spaceService.removeUserFromSpace(space!.id, userId); } + _currentSpaceIdController.state = null; } Future deleteSpace(String spaceId) async {