Skip to content

Commit

Permalink
Improve context menu looks and behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnurmi committed Sep 16, 2022
1 parent 02423f7 commit 4dc26bd
Show file tree
Hide file tree
Showing 11 changed files with 734 additions and 51 deletions.
11 changes: 6 additions & 5 deletions lib/home/home_menu.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:context_menu/context_menu.dart';
import 'package:flutter/material.dart';
import 'package:terminal_view/terminal_view.dart';

Expand All @@ -9,27 +10,27 @@ List<PopupMenuEntry> buildContextMenu({
required VoidCallback? onCloseTab,
}) {
return <PopupMenuEntry>[
PopupMenuItem(
ContextMenuItem(
onTap: onNewTab,
child: const Text('New Tab'),
),
PopupMenuItem(
ContextMenuItem(
onTap: onCloseTab,
enabled: tabCount > 1,
child: const Text('Close Tab'),
),
const PopupMenuDivider(),
PopupMenuItem(
ContextMenuItem(
onTap: current?.copy,
enabled: current?.selectedText?.isNotEmpty == true,
child: const Text('Copy'),
),
PopupMenuItem(
ContextMenuItem(
onTap: current?.paste,
enabled: current != null,
child: const Text('Paste'),
),
PopupMenuItem(
ContextMenuItem(
onTap: current?.selectAll,
enabled: current != null,
child: const Text('Select All'),
Expand Down
2 changes: 1 addition & 1 deletion lib/home/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';

import 'package:context_menu/context_menu.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lxd_service/lxd_service.dart';
Expand All @@ -10,7 +11,6 @@ import 'package:ubuntu_service/ubuntu_service.dart';
import '../instances/instance_view.dart';
import '../launcher/launcher_wizard.dart';
import '../terminal/terminal_page.dart';
import '../widgets/context_menu.dart';
import 'home_menu.dart';
import 'home_model.dart';

Expand Down
45 changes: 0 additions & 45 deletions lib/widgets/context_menu.dart

This file was deleted.

30 changes: 30 additions & 0 deletions packages/context_menu/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/
10 changes: 10 additions & 0 deletions packages/context_menu/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
channel: stable

project_type: package
25 changes: 25 additions & 0 deletions packages/context_menu/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright 2014 The Flutter Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3 changes: 3 additions & 0 deletions packages/context_menu/lib/context_menu.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library context_menu;

export 'src/context_menu.dart';

0 comments on commit 4dc26bd

Please sign in to comment.