Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
n7484443 committed Mar 5, 2023
1 parent a916ffd commit dfdf3b2
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 3.5.2
## 디자인
* 선택지 메뉴 위치 수정
## 편의성
* 선택지 복사와 삭제된 선택지 복구를 분리


# 3.5.1
## 디자인
* 선택지 간 세로 여백을 '일반' 탭으로 이동
Expand Down
5 changes: 4 additions & 1 deletion lib/i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ extension Localization on String {
'compress_process': 'Compressing...',
'save_process': 'Saving...',
'create_tooltip': 'Create a choice',
'copy_tooltip':
'Drag and drop to make a copy a recently deleted choice',
'recently_tooltip':
'Drag and drop to make a copy or restore a recently deleted choice',
'Drag and drop to make a restore a recently deleted choice',
'update_variable_tooltip': 'Update the variable list',
'save_option': 'Saving options',
'extract': 'Save as Zip',
Expand Down Expand Up @@ -200,6 +202,7 @@ extension Localization on String {
'save_process': '저장중...',
'create_tooltip': '선택지 생성',
'recently_tooltip': '드래그로 삭제된 선택지 생성',
'copy_tooltip': '드래그로 복사된 선택지 생성',
'update_variable_tooltip': '변수 목록 갱신',
'save_option': '저장 관련 옵션',
'extract': 'zip 파일로 추출',
Expand Down
35 changes: 34 additions & 1 deletion lib/view/view_make.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,39 @@ class ViewMake extends ConsumerWidget {
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Visibility(
visible: ref.watch(copiedChoiceNode) != null,
child: Draggable<Pos>(
data: Pos(data: [copiedPositioned, copiedPositioned]),
feedback: Transform.scale(
scale: 0.9,
child: Opacity(
opacity: 0.6,
child: ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: 400,
),
child: ViewChoiceNode(
Pos(data: [copiedPositioned, copiedPositioned]))),
),
),
onDragStarted: () {
ref
.read(dragChoiceNodeProvider.notifier)
.dragStart(Pos(data: [copiedPositioned, copiedPositioned]));
},
onDragEnd: (DraggableDetails data) {
ref.read(dragChoiceNodeProvider.notifier).dragEnd();
},
onDragUpdate: (DragUpdateDetails details) => ref
.read(dragPositionProvider.notifier)
.state = details.localPosition.dy,
child: Tooltip(
message: 'recently_tooltip'.i18n,
child: const Icon(Icons.paste),
),
),
),
Visibility(
visible: ref.watch(removedChoiceNode) != null,
child: Draggable<Pos>(
Expand Down Expand Up @@ -107,7 +140,7 @@ class ViewMake extends ConsumerWidget {
.state = details.localPosition.dy,
child: Tooltip(
message: 'recently_tooltip'.i18n,
child: const Icon(Icons.paste),
child: const Icon(Icons.restore_from_trash),
),
),
),
Expand Down
7 changes: 5 additions & 2 deletions lib/viewModel/vm_choice_node.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import '../model/platform.dart';
import '../model/platform_system.dart';

const double nodeBaseHeight = 200;
const int copiedPositioned = -1;
const int removedPositioned = -2;

void refreshChild(Ref ref, Choice node) {
Expand All @@ -40,9 +41,11 @@ class ChoiceNodeNotifier extends ChangeNotifier {
Pos pos;

ChoiceNodeNotifier(this.ref, this.pos) {
if (pos.last == removedPositioned) {
if (pos.last == copiedPositioned) {
node = ref.read(copiedChoiceNode);
}else if (pos.last == removedPositioned) {
node = ref.read(removedChoiceNode);
} else if (pos.last == designSamplePosition) {
}else if (pos.last == designSamplePosition) {
node = ChoiceNode(
1,
"sample_title".i18n,
Expand Down
5 changes: 3 additions & 2 deletions lib/viewModel/vm_draggable_nested_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ final vmDraggableNestedMapProvider =
Provider.autoDispose((ref) => VMDraggableNestedMap(ref));

final removedChoiceNode = StateProvider<ChoiceNode?>((ref) => null);
final copiedChoiceNode = StateProvider<ChoiceNode?>((ref) => null);
final dragPositionProvider = StateProvider<double?>((ref) => null);

final dragChoiceNodeProvider =
Expand All @@ -46,14 +47,14 @@ class VMDraggableNestedMap {
VMDraggableNestedMap(this.ref);

void copyData(ChoiceNode choiceNode) {
ref.read(removedChoiceNode.notifier).state = choiceNode.clone();
ref.read(copiedChoiceNode.notifier).state = choiceNode.clone();
ref.read(draggableNestedMapChangedProvider.notifier).state = true;
refreshPage(ref);
}

void removeData(Pos pos) {
var choiceNode = getPlatform.removeData(pos);
copyData(choiceNode);
ref.read(removedChoiceNode.notifier).state = choiceNode.clone();
VariableDataBase().updateCheckList();
ref.read(draggableNestedMapChangedProvider.notifier).state = true;
refreshPage(ref);
Expand Down

0 comments on commit dfdf3b2

Please sign in to comment.