Skip to content

Commit

Permalink
fix: [MDS-408] Rewrite Tooltip to add ordinal directions functionality (
Browse files Browse the repository at this point in the history
  • Loading branch information
Kypsis committed Mar 8, 2023
1 parent 5d2a254 commit 5cbed50
Show file tree
Hide file tree
Showing 11 changed files with 881 additions and 1,064 deletions.
57 changes: 44 additions & 13 deletions example/lib/src/storybook/stories/tooltip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,46 @@ class TooltipStory extends Story {
Option(label: "bottom", value: MoonTooltipPosition.bottom),
Option(label: "left", value: MoonTooltipPosition.left),
Option(label: "right", value: MoonTooltipPosition.right),
Option(label: "topLeft", value: MoonTooltipPosition.topLeft),
Option(label: "topRight", value: MoonTooltipPosition.topRight),
Option(label: "bottomLeft", value: MoonTooltipPosition.bottomLeft),
Option(label: "bottomRight", value: MoonTooltipPosition.bottomRight),
Option(label: "vertical", value: MoonTooltipPosition.vertical),
Option(label: "horizontal", value: MoonTooltipPosition.horizontal),
],
);

final colorsKnob = context.knobs.options(
label: "backgroundColor",
description: "MoonColors variants for base MoonButton.",
initial: 4, // gohan
options: colorOptions,
);

final color = colorTable(context)[colorsKnob];

final arrowOffsetKnob = context.knobs.slider(
label: "arrowOffsetValue",
description: "Set the offset of the tooltip arrow.",
initial: 0,
min: -100,
max: 100,
);

final arrowBaseWidthKnob = context.knobs.slider(
label: "arrowBaseWidth",
description: "Set the base width of the tooltip arrow.",
initial: 16,
max: 100,
);

final arrowLengthKnob = context.knobs.slider(
label: "arrowLength",
description: "Set the length of the tooltip arrow.",
initial: 8,
max: 100,
);

final showTooltipKnob = context.knobs.boolean(
label: "show",
description: "Show the tooltip.",
Expand All @@ -44,22 +81,13 @@ class TooltipStory extends Story {
initial: true,
);

final colorsKnob = context.knobs.options(
label: "backgroundColor",
description: "MoonColors variants for base MoonButton.",
initial: 4, // gohan
options: colorOptions,
);

final color = colorTable(context)[colorsKnob];

/* final setRtlModeKnob = context.knobs.boolean(
final setRtlModeKnob = context.knobs.boolean(
label: "RTL mode",
description: "Switch between LTR and RTL modes.",
); */
);

return Directionality(
textDirection: /* setRtlModeKnob ? TextDirection.rtl : */ TextDirection.ltr,
textDirection: setRtlModeKnob ? TextDirection.rtl : TextDirection.ltr,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
Expand All @@ -68,6 +96,9 @@ class TooltipStory extends Story {
const TextDivider(text: "Customisable tooltip"),
const SizedBox(height: 32),
MoonTooltip(
arrowBaseWidth: arrowBaseWidthKnob,
arrowLength: arrowLengthKnob,
arrowOffsetValue: arrowOffsetKnob,
show: showTooltipKnob,
tooltipPosition: tooltipPositionsKnob,
hasArrow: showArrowKnob,
Expand All @@ -77,7 +108,7 @@ class TooltipStory extends Story {
child: MoonButton(
backgroundColor: context.moonColors!.bulma,
onTap: () {},
label: const Text("MoonButton"),
label: const Text("MDS"),
),
),
const SizedBox(height: 40),
Expand Down
22 changes: 22 additions & 0 deletions example/macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
PODS:
- FlutterMacOS (1.0.0)
- package_info_plus (0.0.1):
- FlutterMacOS

DEPENDENCIES:
- FlutterMacOS (from `Flutter/ephemeral`)
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)

EXTERNAL SOURCES:
FlutterMacOS:
:path: Flutter/ephemeral
package_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos

SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce

PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7

COCOAPODS: 1.11.3
71 changes: 66 additions & 5 deletions example/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXAggregateTarget section */
Expand All @@ -21,6 +21,7 @@
/* End PBXAggregateTarget section */

/* Begin PBXBuildFile section */
1EF1E79BCD11BF26546B861E /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA88C8C2270ADA5901582BC8 /* Pods_Runner.framework */; };
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; };
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; };
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
Expand Down Expand Up @@ -52,9 +53,10 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
0E022814F9E8D6D636B0F8C8 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; };
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
Expand All @@ -66,15 +68,19 @@
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
7A5CA261013764F6D8F802B2 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
CBDB310A91F07FBF8FD07981 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
DA88C8C2270ADA5901582BC8 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
33CC10EA2044A3C60003C045 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1EF1E79BCD11BF26546B861E /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -99,6 +105,7 @@
33CEB47122A05771004F2AC0 /* Flutter */,
33CC10EE2044A3C60003C045 /* Products */,
D73912EC22F37F3D000D13A0 /* Frameworks */,
C1D765107FF44E3BD2777E9C /* Pods */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -145,9 +152,21 @@
path = Runner;
sourceTree = "<group>";
};
C1D765107FF44E3BD2777E9C /* Pods */ = {
isa = PBXGroup;
children = (
CBDB310A91F07FBF8FD07981 /* Pods-Runner.debug.xcconfig */,
0E022814F9E8D6D636B0F8C8 /* Pods-Runner.release.xcconfig */,
7A5CA261013764F6D8F802B2 /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
isa = PBXGroup;
children = (
DA88C8C2270ADA5901582BC8 /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -159,11 +178,13 @@
isa = PBXNativeTarget;
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
B5F514E057DC68FCAECA12D5 /* [CP] Check Pods Manifest.lock */,
33CC10E92044A3C60003C045 /* Sources */,
33CC10EA2044A3C60003C045 /* Frameworks */,
33CC10EB2044A3C60003C045 /* Resources */,
33CC110E2044A8840003C045 /* Bundle Framework */,
3399D490228B24CF009A79C7 /* ShellScript */,
BA7507CA2EAD7F7EB46B6C54 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -235,6 +256,7 @@
/* Begin PBXShellScriptBuildPhase section */
3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -270,6 +292,45 @@
shellPath = /bin/sh;
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
};
B5F514E057DC68FCAECA12D5 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
BA7507CA2EAD7F7EB46B6C54 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -344,7 +405,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down Expand Up @@ -423,7 +484,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
Expand Down Expand Up @@ -470,7 +531,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down
3 changes: 3 additions & 0 deletions example/macos/Runner.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions lib/src/widgets/common/base_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,6 @@ class _MoonBaseControlState extends State<MoonBaseControl> {
}

_effectiveFocusNode.canRequestFocus = _isEnabled;

/* if (_isPressed && mounted) {
setState(() => _isPressed = false);
} */
}

@override
Expand Down Expand Up @@ -386,13 +382,13 @@ class _MoonBaseControlState extends State<MoonBaseControl> {
onVerticalDragEnd: _handleVerticalDragEnd,
child: FocusableActionDetector(
enabled: _isEnabled && widget.isFocusable,
actions: _actions,
mouseCursor: _cursor,
focusNode: _effectiveFocusNode,
autofocus: _isEnabled && widget.autofocus,
mouseCursor: _cursor,
onShowHoverHighlight: _handleHover,
onShowFocusHighlight: _handleFocus,
onFocusChange: _handleFocusChange,
actions: _actions,
onShowFocusHighlight: _handleFocus,
onShowHoverHighlight: _handleHover,
child: TouchTargetPadding(
minSize: widget.ensureMinimalTouchTargetSize
? Size(widget.minTouchTargetSize, widget.minTouchTargetSize)
Expand Down
Loading

0 comments on commit 5cbed50

Please sign in to comment.