Skip to content

Commit

Permalink
PAINTROID-454: Flutter: Add Layers - hide after clicking on canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenkomotive committed Oct 9, 2024
1 parent 08de768 commit 0f84aa8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/core/providers/state/layer_menu_state_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ class LayerMenuStateProvider extends _$LayerMenuStateProvider {
void toggleVisibility() {
state = state.copyWith(isVisible: !state.isVisible);
}

void hide() {
state = state.copyWith(isVisible: false);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'package:flutter/material.dart';

import 'package:flutter_riverpod/flutter_riverpod.dart';

import 'package:paintroid/core/enums/tool_types.dart';
import 'package:paintroid/core/providers/object/canvas_painter_provider.dart';
import 'package:paintroid/core/providers/object/device_service.dart';
import 'package:paintroid/core/providers/state/canvas_state_provider.dart';
import 'package:paintroid/core/providers/state/layer_menu_state_provider.dart';
import 'package:paintroid/core/providers/state/toolbox_state_provider.dart';
import 'package:paintroid/core/providers/state/workspace_state_notifier.dart';
import 'package:paintroid/ui/pages/workspace_page/components/drawing_surface/canvas_painter.dart';
Expand Down Expand Up @@ -46,6 +45,7 @@ class _DrawingCanvasState extends ConsumerState<DrawingCanvas> {
});

void _onPointerDown(PointerDownEvent _) {
ref.read(layerMenuStateProvider.notifier).hide();
_pointersOnScreen++;
if (_pointersOnScreen >= 2) {
_isZooming = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class LayerMenu extends ConsumerWidget {
layerMenuStateProvider.select((state) => state.isVisible),
);
return Positioned(
top: 32,
bottom: 32,
top: 54,
bottom: 54,
right: 8,
child: FadeInOutWidget(
isVisible: isVisible,
Expand Down

0 comments on commit 0f84aa8

Please sign in to comment.