Merge pull request #844 from ente-io/menu_item_tweaks
Menu item improvements
This commit is contained in:
commit
e18cd6e773
1 changed files with 14 additions and 0 deletions
|
@ -129,6 +129,12 @@ class _MenuItemWidgetState extends State<MenuItemWidget> {
|
|||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant MenuItemWidget oldWidget) {
|
||||
menuItemColor = widget.menuItemColor;
|
||||
super.didUpdateWidget(oldWidget);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
if (widget.expandableController != null) {
|
||||
|
@ -210,6 +216,8 @@ class _MenuItemWidgetState extends State<MenuItemWidget> {
|
|||
}
|
||||
|
||||
Future<void> _onTap() async {
|
||||
if (executionStateNotifier.value == ExecutionState.inProgress ||
|
||||
executionStateNotifier.value == ExecutionState.successful) return;
|
||||
_debouncer.run(
|
||||
() => Future(
|
||||
() {
|
||||
|
@ -245,6 +253,8 @@ class _MenuItemWidgetState extends State<MenuItemWidget> {
|
|||
}
|
||||
|
||||
void _onTapDown(details) {
|
||||
if (executionStateNotifier.value == ExecutionState.inProgress ||
|
||||
executionStateNotifier.value == ExecutionState.successful) return;
|
||||
setState(() {
|
||||
if (widget.pressedColor == null) {
|
||||
hasPassedGestureCallbacks()
|
||||
|
@ -261,6 +271,8 @@ class _MenuItemWidgetState extends State<MenuItemWidget> {
|
|||
}
|
||||
|
||||
void _onTapUp(details) {
|
||||
if (executionStateNotifier.value == ExecutionState.inProgress ||
|
||||
executionStateNotifier.value == ExecutionState.successful) return;
|
||||
Future.delayed(
|
||||
const Duration(milliseconds: 100),
|
||||
() => setState(() {
|
||||
|
@ -270,6 +282,8 @@ class _MenuItemWidgetState extends State<MenuItemWidget> {
|
|||
}
|
||||
|
||||
void _onCancel() {
|
||||
if (executionStateNotifier.value == ExecutionState.inProgress ||
|
||||
executionStateNotifier.value == ExecutionState.successful) return;
|
||||
setState(() {
|
||||
menuItemColor = widget.menuItemColor;
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue