Skip to content

Commit

Permalink
fix: remove unused callbacks when user has been selected
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-kreios committed Jan 9, 2025
1 parent 1767156 commit ecda415
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
// SPDX-License-Identifier: ice License 1.0

import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:go_router/go_router.dart';
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_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';
import 'package:ion/app/router/components/sheet_content/sheet_content.dart';
import 'package:ion/generated/assets.gen.dart';

class NewChatModal extends HookConsumerWidget {
class NewChatModal extends StatelessWidget {
const NewChatModal({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
final onUserSelected = useCallback(
(UserMetadataEntity user) {
context.pop();
},
[],
);

Widget build(BuildContext context) {
return SheetContent(
topPadding: 0,
body: UserPickerSheet(
Expand All @@ -35,7 +25,7 @@ class NewChatModal extends HookConsumerWidget {
actions: const [NavigationCloseButton()],
),
initialUserListType: UserListType.follower,
onUserSelected: onUserSelected,
onUserSelected: (_) => context.pop(),
header: Row(
children: [
_HeaderButton(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
// SPDX-License-Identifier: ice License 1.0

import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
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_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';

class ShareProfileModal extends HookConsumerWidget {
class ShareProfileModal extends StatelessWidget {
const ShareProfileModal({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
final onUserSelected = useCallback(
(UserMetadataEntity user) {
context.pop();
},
[],
);

Widget build(BuildContext context) {
return SheetContent(
topPadding: 0,
body: UserPickerSheet(
Expand All @@ -31,7 +21,7 @@ class ShareProfileModal extends HookConsumerWidget {
title: Text(context.i18n.chat_profile_share_modal_title),
actions: [NavigationCloseButton(onPressed: () => context.pop())],
),
onUserSelected: onUserSelected,
onUserSelected: (_) => context.pop(),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
// SPDX-License-Identifier: ice License 1.0

import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
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_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';

class FriendsModal extends HookConsumerWidget {
class FriendsModal extends StatelessWidget {
const FriendsModal({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
final onUserSelected = useCallback(
(UserMetadataEntity user) {
context.pop(user.masterPubkey);
},
[],
);

Widget build(BuildContext context) {
return SheetContent(
topPadding: 0,
body: UserPickerSheet(
navigationBar: NavigationAppBar.modal(
title: Text(context.i18n.friends_modal_title),
actions: const [NavigationCloseButton()],
),
onUserSelected: onUserSelected,
onUserSelected: (user) => context.pop(user.masterPubkey),
),
);
}
Expand Down

0 comments on commit ecda415

Please sign in to comment.