Skip to content

Commit

Permalink
feat: rename props
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-kreios committed Jan 8, 2025
1 parent a45376c commit 36e50db
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:ion/app/extensions/extensions.dart';
import 'package:ion/app/features/chat/model/channel_admin_type.dart';
import 'package:ion/app/features/chat/providers/channel_admins_provider.c.dart';
import 'package:ion/app/features/user/model/user_metadata.c.dart';
import 'package:ion/app/features/user/pages/user_search_modal/user_search_modal.dart';
import 'package:ion/app/features/user/pages/user_picker_sheet/user_picker_sheet.dart';
import 'package:ion/app/router/components/navigation_app_bar/navigation_app_bar.dart';
import 'package:ion/app/router/components/navigation_app_bar/navigation_close_button.dart';
import 'package:ion/generated/assets.gen.dart';
Expand All @@ -26,10 +26,10 @@ class AddAdminModal extends HookConsumerWidget {

return SizedBox(
height: MediaQuery.sizeOf(context).height * 0.8,
child: UserSearchModal(
child: UserPickerSheet(
onUserSelected: (UserMetadataEntity user) => selectedPubkey.value = user.masterPubkey,
selectedPubkeys: selectedPubkey.value != null ? [selectedPubkey.value!] : null,
isMultiple: true,
selectable: true,
navigationBar: NavigationAppBar.modal(
title: Text(context.i18n.channel_create_admins_action),
showBackButton: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:ion/app/components/button/button.dart';
import 'package:ion/app/extensions/extensions.dart';
import 'package:ion/app/features/user/model/user_metadata.c.dart';
import 'package:ion/app/features/user/pages/user_search_modal/user_search_modal.dart';
import 'package:ion/app/features/user/pages/user_picker_sheet/user_picker_sheet.dart';
import 'package:ion/app/router/app_routes.c.dart';
import 'package:ion/app/router/components/navigation_app_bar/navigation_app_bar.dart';
import 'package:ion/app/router/components/navigation_app_bar/navigation_close_button.dart';
Expand All @@ -28,7 +28,7 @@ class NewChatModal extends HookConsumerWidget {

return SheetContent(
topPadding: 0,
body: UserSearchModal(
body: UserPickerSheet(
navigationBar: NavigationAppBar.modal(
showBackButton: false,
title: Text(context.i18n.new_chat_modal_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:ion/app/components/screen_offset/screen_side_offset.dart';
import 'package:ion/app/components/separated/separator.dart';
import 'package:ion/app/extensions/extensions.dart';
import 'package:ion/app/features/chat/providers/create_group_form_controller_provider.c.dart';
import 'package:ion/app/features/user/pages/user_search_modal/user_search_modal.dart';
import 'package:ion/app/features/user/pages/user_picker_sheet/user_picker_sheet.dart';
import 'package:ion/app/router/app_routes.c.dart';
import 'package:ion/app/router/components/navigation_app_bar/navigation_app_bar.dart';
import 'package:ion/app/router/components/navigation_app_bar/navigation_close_button.dart';
Expand All @@ -25,10 +25,10 @@ class AddGroupParticipantsModal extends HookConsumerWidget {

return SheetContent(
topPadding: 0,
body: UserSearchModal(
body: UserPickerSheet(
key: const Key('add-group-participants-modal'),
selectedPubkeys: createGroupForm.members.toList(),
isMultiple: true,
selectable: true,
initialUserListType: UserListType.follower,
onUserSelected: (user) {
createGroupFormNotifier.toggleMember(user.masterPubkey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:ion/app/extensions/extensions.dart';
import 'package:ion/app/features/user/model/user_metadata.c.dart';
import 'package:ion/app/features/user/pages/user_search_modal/user_search_modal.dart';
import 'package:ion/app/features/user/pages/user_picker_sheet/user_picker_sheet.dart';
import 'package:ion/app/router/components/navigation_app_bar/navigation_app_bar.dart';
import 'package:ion/app/router/components/navigation_app_bar/navigation_close_button.dart';
import 'package:ion/app/router/components/sheet_content/sheet_content.dart';
Expand All @@ -25,7 +25,7 @@ class ShareProfileModal extends HookConsumerWidget {

return SheetContent(
topPadding: 0,
body: UserSearchModal(
body: UserPickerSheet(
navigationBar: NavigationAppBar.modal(
showBackButton: false,
title: Text(context.i18n.chat_profile_share_modal_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import 'package:ion/generated/assets.gen.dart';
class FollowerUsers extends ConsumerWidget {
const FollowerUsers({
required this.onUserSelected,
this.isMultiple = false,
this.selectable = false,
this.selectedPubkeys,
super.key,
});

final void Function(UserMetadataEntity user) onUserSelected;
final bool isMultiple;
final bool selectable;
final List<String>? selectedPubkeys;

@override
Expand All @@ -45,7 +45,7 @@ class FollowerUsers extends ConsumerWidget {
subtitle: Text(prefixUsername(username: user.data.name, context: context)),
profilePicture: user.data.picture,
onTap: () => onUserSelected(user),
trailing: !isMultiple
trailing: !selectable
? null
: isSelected
? Assets.svg.iconBlockCheckboxOnblue.icon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:ion/app/components/list_item/list_item.dart';
import 'package:ion/app/extensions/extensions.dart';
import 'package:ion/app/features/user/model/user_metadata.c.dart';
import 'package:ion/app/features/user/pages/user_search_modal/components/no_user_view.dart';
import 'package:ion/app/features/user/pages/user_picker_sheet/components/no_user_view.dart';
import 'package:ion/app/features/user/providers/follow_list_provider.c.dart';
import 'package:ion/app/features/user/providers/user_metadata_provider.c.dart';
import 'package:ion/app/utils/username.dart';
Expand All @@ -15,13 +15,13 @@ class FollowingUsers extends ConsumerWidget {
const FollowingUsers({
required this.onUserSelected,
this.selectedPubkeys,
this.isMultiple = false,
this.selectable = false,
super.key,
});

final void Function(UserMetadataEntity user) onUserSelected;
final List<String>? selectedPubkeys;
final bool isMultiple;
final bool selectable;

@override
Widget build(BuildContext context, WidgetRef ref) {
Expand All @@ -39,7 +39,7 @@ class FollowingUsers extends ConsumerWidget {
pubkey: pubkeys[index],
onUserSelected: onUserSelected,
selectedPubkeys: selectedPubkeys,
isMultiple: isMultiple,
selectable: selectable,
);
},
itemCount: pubkeys.length,
Expand All @@ -57,13 +57,13 @@ class _FollowingUserListItem extends ConsumerWidget {
required this.pubkey,
required this.onUserSelected,
this.selectedPubkeys,
this.isMultiple = false,
this.selectable = false,
});

final String pubkey;
final void Function(UserMetadataEntity user) onUserSelected;
final List<String>? selectedPubkeys;
final bool isMultiple;
final bool selectable;

@override
Widget build(BuildContext context, WidgetRef ref) {
Expand All @@ -74,7 +74,7 @@ class _FollowingUserListItem extends ConsumerWidget {
title: Text(user?.data.displayName ?? ''),
subtitle: Text(prefixUsername(username: user?.data.name ?? '', context: context)),
profilePicture: user?.data.picture,
trailing: !isMultiple
trailing: !selectable
? null
: isSelected
? Assets.svg.iconBlockCheckboxOnblue.icon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import 'package:ion/generated/assets.gen.dart';
class SearchedUsers extends ConsumerWidget {
const SearchedUsers({
required this.onUserSelected,
this.isMultiple = false,
this.selectable = false,
this.selectedPubkeys,
super.key,
});

final void Function(UserMetadataEntity user) onUserSelected;
final bool isMultiple;
final bool selectable;
final List<String>? selectedPubkeys;

@override
Expand All @@ -43,7 +43,7 @@ class SearchedUsers extends ConsumerWidget {
subtitle: Text(prefixUsername(username: user.data.name, context: context)),
profilePicture: user.data.picture,
onTap: () => onUserSelected(user),
trailing: !isMultiple
trailing: !selectable
? null
: isSelected
? Assets.svg.iconBlockCheckboxOnblue.icon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import 'package:ion/app/components/inputs/search_input/search_input.dart';
import 'package:ion/app/components/screen_offset/screen_side_offset.dart';
import 'package:ion/app/extensions/extensions.dart';
import 'package:ion/app/features/user/model/user_metadata.c.dart';
import 'package:ion/app/features/user/pages/user_search_modal/components/follower_users.dart';
import 'package:ion/app/features/user/pages/user_search_modal/components/following_users.dart';
import 'package:ion/app/features/user/pages/user_search_modal/components/searched_users.dart';
import 'package:ion/app/features/user/pages/user_picker_sheet/components/follower_users.dart';
import 'package:ion/app/features/user/pages/user_picker_sheet/components/following_users.dart';
import 'package:ion/app/features/user/pages/user_picker_sheet/components/searched_users.dart';
import 'package:ion/app/features/user/providers/search_users_data_source_provider.c.dart';
import 'package:ion/app/router/components/navigation_app_bar/navigation_app_bar.dart';

Expand All @@ -17,22 +17,22 @@ enum UserListType {
following,
}

class UserSearchModal extends HookConsumerWidget {
const UserSearchModal({
class UserPickerSheet extends HookConsumerWidget {
const UserPickerSheet({
required this.navigationBar,
required this.onUserSelected,
this.header,
super.key,
this.selectedPubkeys,
this.isMultiple = false,
this.selectable = false,
this.bottomContent,
this.initialUserListType = UserListType.following,
});

final NavigationAppBar navigationBar;
final Widget? header;
final List<String>? selectedPubkeys;
final bool isMultiple;
final bool selectable;
final Widget? bottomContent;
final void Function(UserMetadataEntity user) onUserSelected;
final UserListType initialUserListType;
Expand Down Expand Up @@ -67,17 +67,17 @@ class UserSearchModal extends HookConsumerWidget {
? FollowerUsers(
onUserSelected: onUserSelected,
selectedPubkeys: selectedPubkeys,
isMultiple: isMultiple,
selectable: selectable,
)
: FollowingUsers(
onUserSelected: onUserSelected,
selectedPubkeys: selectedPubkeys,
isMultiple: isMultiple,
selectable: selectable,
)
: SearchedUsers(
onUserSelected: onUserSelected,
selectedPubkeys: selectedPubkeys,
isMultiple: isMultiple,
selectable: selectable,
),
),
bottomContent ?? const SizedBox.shrink(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:ion/app/extensions/extensions.dart';
import 'package:ion/app/features/user/model/user_metadata.c.dart';
import 'package:ion/app/features/user/pages/user_search_modal/user_search_modal.dart';
import 'package:ion/app/features/user/pages/user_picker_sheet/user_picker_sheet.dart';
import 'package:ion/app/router/components/navigation_app_bar/navigation_app_bar.dart';
import 'package:ion/app/router/components/navigation_app_bar/navigation_close_button.dart';
import 'package:ion/app/router/components/sheet_content/sheet_content.dart';
Expand All @@ -25,7 +25,7 @@ class FriendsModal extends HookConsumerWidget {

return SheetContent(
topPadding: 0,
body: UserSearchModal(
body: UserPickerSheet(
navigationBar: NavigationAppBar.modal(
title: Text(context.i18n.friends_modal_title),
actions: const [NavigationCloseButton()],
Expand Down

0 comments on commit 36e50db

Please sign in to comment.