import 'package:flutter/material.dart'; import 'package:plan/widgets/ui_kit/popup/popup_action.dart'; import 'package:remixicon/remixicon.dart'; import '../viewmodel/plan_list_store.dart'; class BarActions extends StatefulWidget { final PlanListStore store; const BarActions({super.key, required this.store}); @override State createState() => _BarActionsState(); } class _BarActionsState extends State { void _onSelected(String value) { switch (value) { case "Unarchived": widget.store.setPlanStatus( widget.store.planStatus.copyWith( unarchived: !widget.store.planStatus.unarchived, ), ); break; case "Archived": widget.store.setPlanStatus( widget.store.planStatus.copyWith( archived: !widget.store.planStatus.archived, ), ); break; } } @override Widget build(BuildContext context) { return Row( mainAxisSize: MainAxisSize.min, children: [ PopupAction( onSelected: _onSelected, items: [ PopupMenuItem( value: "Unarchived", child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text("Unarchived"), Visibility( visible: widget.store.planStatus.unarchived, child: Icon(RemixIcons.check_fill, size: 20), ), ], ), ), PopupMenuItem( value: "Archived", child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text("Archived"), Visibility( visible: widget.store.planStatus.archived, child: Icon(RemixIcons.check_fill, size: 20), ), ], ), ), ], child: Icon(RemixIcons.more_fill), ), ], ); } }