Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Tooltip #68

Merged
merged 6 commits into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## [0.0.12]
* Implement `Tooltip`
* Add mouse cursors to help button, push button and `TextField`

## [0.0.11]
Expand Down
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Flutter widgets and themes implementing the current macOS design language.
- [RadioButton](#radiobutton)
- [PushButton](#pushbutton)
- [Switch](#switch)
- [Fields and Labels](#fields-and-labels)
- [Fields](#fields)
- [TextField](#textfield)
- [Indicators](#indicators)
- [Progress Indicators](#progress-indicators)
Expand Down Expand Up @@ -156,7 +156,7 @@ Switch(
),
```

# Fields and Labels
# Fields

## TextField

Expand All @@ -170,6 +170,27 @@ Here's an example of how to create a basic text field:
TextField(),
```

# Labels

Labels are a short description of what an element on the screen does.

## Tooltip

Tooltips succinctly describe how to use controls without shifting people’s focus away from the primary interface. Help tags appear when the user positions the pointer over a control for a few seconds. A tooltip remains visible for 10 seconds, or until the pointer moves away from the control.

![Tooltip Example](https://developer.apple.com/design/human-interface-guidelines/macos/images/help_Tooltip.png)

To create a tooltip, wrap any widget on a `Tooltip`:

```dart
Tooltip(
message: 'This is a tooltip',
child: Text('Hover or long press to show a tooltip'),
),
```

You can customize the tooltip the way you want using its `style` property. A tooltip automatically adapts to its environment, responding to touch and pointer events.

# Indicators

## Progress Indicators
Expand Down
7 changes: 5 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ class _DemoState extends State<Demo> {
onChanged: (v) => setState(() => value = v),
),
SizedBox(height: 20),
HelpButton(
onPressed: () {},
Tooltip(
message: 'This button shows help',
child: HelpButton(
onPressed: () {},
),
),
SizedBox(height: 20),
CapacityIndicator(
Expand Down
1 change: 1 addition & 0 deletions lib/macos_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export 'src/indicators/capacity_indicators.dart';
export 'src/indicators/progress_indicators.dart';
export 'src/indicators/rating_indicator.dart';
export 'src/indicators/relevance_indicator.dart';
export 'src/labels/tooltip.dart';
export 'src/layout/content_area.dart';
export 'src/layout/resizable_pane.dart';
export 'src/layout/scaffold.dart';
Expand Down
Loading