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

valueStyleBuilder enhancements #28

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 0.3.0

* BREAKING: formatters such as `valueFormatter` now takes node in addition to value
* BREAKING: `valueStyleBuilder` now takes node in addition to value
* `style` in `PropertyOverrides` is now optional
* `PropertyOverrides` can optionally specify `onSecondaryTap`, `onLongPress` and a mouse `cursor`
* Upgrade `golden_toolkit` to 0.15.0
* Upgrade example dependencies

## 0.2.0

* Upgrade `scrollable_positioned_list` to 0.3.2
* Upgrade `provider` to 6.0.3
* Upgrade `rows_lint` to 0.1.1

## 0.1.0

* Initial release.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ can be changed with a formatter:
```dart
JsonDataExplorer(
nodes: state.displayNodes,
propertyNameFormatter: (name) => '$name ->',
propertyNameFormatter: (node, name) => '$name ->',
)
```

Expand All @@ -183,7 +183,7 @@ An example is adding interaction to values that contains links:
```dart
JsonDataExplorer(
nodes: state.displayNodes,
valueStyleBuilder: (value, style) {
valueStyleBuilder: (node, value, style) {
final isUrl = _valueIsUrl(value);
return PropertyOverrides(
style: isUrl
Expand All @@ -203,7 +203,7 @@ value types:
```dart
JsonDataExplorer(
nodes: state.displayNodes,
valueStyleBuilder: (value, style) {
valueStyleBuilder: (node, value, style) {
if (value is num) {
return PropertyOverrides(
style: style.copyWith(
Expand Down
10 changes: 8 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ class _DataExplorerPageState extends State<DataExplorerPage> {
: const SizedBox(),

/// Creates a custom format for classes and array names.
rootNameFormatter: (dynamic name) => '$name',
rootNameFormatter: (dynamic node, dynamic name) => '$name',

/// Dynamically changes the property value style and
/// interaction when an URL is detected.
valueStyleBuilder: (dynamic value, style) {
valueStyleBuilder: (node, dynamic value, style) {
final isUrl = _valueIsUrl(value);
return PropertyOverrides(
style: isUrl
Expand All @@ -267,6 +267,12 @@ class _DataExplorerPageState extends State<DataExplorerPage> {
)
: style,
onTap: isUrl ? () => _launchUrl(value as String) : null,
onSecondaryTap: () {
print('onSecondaryTap: ${node.key}: $value');
},
onLongPress: () {
print('onLongPress: ${node.key}: $value');
},
);
},

Expand Down
2 changes: 1 addition & 1 deletion example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import FlutterMacOS
import Foundation

import path_provider_macos
import path_provider_foundation
import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
Expand Down
Loading