Skip to content

Commit

Permalink
Merge pull request #305 from shiosyakeyakini-info/feature/fix_304
Browse files Browse the repository at this point in the history
#304 修正
  • Loading branch information
shiosyakeyakini-info authored Sep 9, 2023
2 parents 5d53acb + 28029d9 commit 819d4f3
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import 'package:miria/model/account.dart';
import 'package:miria/model/misskey_emoji_data.dart';
import 'package:miria/providers.dart';
import 'package:miria/view/common/misskey_notes/custom_emoji.dart';
import 'package:miria/view/dialogs/simple_confirm_dialog.dart';
import 'package:miria/view/reaction_picker_dialog/reaction_picker_dialog.dart';
import 'package:miria/view/several_account_settings_page/reaction_deck_page/add_reactions_dialog.dart';
import 'package:reorderables/reorderables.dart';

enum ReactionDeckPageMenuType { addMany, copy }
enum ReactionDeckPageMenuType { addMany, copy, clear }

@RoutePage()
class ReactionDeckPage extends ConsumerStatefulWidget {
Expand Down Expand Up @@ -58,12 +59,18 @@ class ReactionDeckPageState extends ConsumerState<ReactionDeckPage> {
ReactionDeckPageMenuType.addMany =>
showAddReactionsDialog(context: context),
ReactionDeckPageMenuType.copy => copyReactions(context: context),
ReactionDeckPageMenuType.clear =>
clearReactions(context: context),
},
itemBuilder: (context) => const [
PopupMenuItem(
value: ReactionDeckPageMenuType.addMany,
child: Text("一括追加"),
),
PopupMenuItem(
value: ReactionDeckPageMenuType.clear,
child: Text("クリア"),
),
PopupMenuItem(
value: ReactionDeckPageMenuType.copy,
child: Text("コピー"),
Expand Down Expand Up @@ -192,4 +199,18 @@ class ReactionDeckPageState extends ConsumerState<ReactionDeckPage> {
const SnackBar(content: Text("コピーしました")),
);
}

Future<void> clearReactions({required BuildContext context}) async {
if (await SimpleConfirmDialog.show(
context: context,
message: "すでに設定済みのリアクションデッキをいったんすべてクリアしますか?",
primary: "クリアする",
secondary: "やっぱりやめる") ==
true) {
setState(() {
reactions.clear();
save();
});
}
}
}

0 comments on commit 819d4f3

Please sign in to comment.