Skip to content

Commit

Permalink
アーカイブ時にはノートボタンを非表示に
Browse files Browse the repository at this point in the history
  • Loading branch information
4ster1sk authored and Npepperlinux committed Nov 10, 2024
1 parent 2af2092 commit 7b2c3d6
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions lib/view/channels_page/channel_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,21 @@ class ChannelDetailFloatingActionButton extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final channelDetail = ref.watch(channelDetailProvider(channelId));
return switch (channelDetail) {
AsyncData(:final value) => FloatingActionButton(
child: const Icon(Icons.edit),
onPressed: () async {
if (!context.mounted) return;
await context.pushRoute(
NoteCreateRoute(
initialAccount: ref.read(accountContextProvider).postAccount,
channel: value.channel,
),
);
},
),
AsyncData(:final value) => (value.channel.isArchived)
? const SizedBox.shrink()
: FloatingActionButton(
child: const Icon(Icons.edit),
onPressed: () async {
if (!context.mounted) return;
await context.pushRoute(
NoteCreateRoute(
initialAccount:
ref.read(accountContextProvider).postAccount,
channel: value.channel,
),
);
},
),
_ => const SizedBox.shrink(),
};
}
Expand Down

0 comments on commit 7b2c3d6

Please sign in to comment.