diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index e4934ec22..54edc19b4 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,3 +1,4 @@ +# cspell:words subosito name: build_and_test on: pull_request: @@ -5,6 +6,12 @@ on: workflow_dispatch: jobs: + cspell: + name: 🔤 Check Spelling + uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/spell_check.yml@v1 + with: + config: cspell.config.yaml + build: runs-on: ubuntu-latest steps: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 262bbbf79..224ad4767 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,7 +36,7 @@ Ensure that your contributions include appropriate tests and that all existing t Unit tests are not enough. All UI changes require widget tests, and even better if those widget tests double as integration tests. -It's sually a good idea to capture at least one golden of the charts, and there are plenty of examples of that in the existing tests. +It's usually a good idea to capture at least one golden of the charts, and there are plenty of examples of that in the existing tests. ## Community diff --git a/README.md b/README.md index 61ca8e7a9..edbb49b5a 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This project is a resurrection of the discontinued [charts_flutter](https://pub. ### Dart 3, Type Safety, Tests, and Bug Fixes -Type safety and rigourous tests ensure that this package is reliable and maintainable. We applied thousands of automatic and manual fixes to the code to bring type safety up, and ensure that it's harder to break this library. There are also many new widget tests with goldens, which means that changes should not affect the UI behavior. +Type safety and rigorous tests ensure that this package is reliable and maintainable. We applied thousands of automatic and manual fixes to the code to bring type safety up, and ensure that it's harder to break this library. There are also many new widget tests with goldens, which means that changes should not affect the UI behavior. This fork provides the most solid foundation for future development, and we will continue to maintain this library. diff --git a/charts_common/README.md b/charts_common/README.md index 5fcb2c4f5..1e84e5f7b 100644 --- a/charts_common/README.md +++ b/charts_common/README.md @@ -15,7 +15,7 @@ This project is a resurrection of the discontinued [charts_flutter](https://pub. ### Dart 3, Type Safety, Tests, and Bug Fixes -Type safety and rigourous tests ensure that this package is reliable and maintainable. We applied thousands of automatic and manual fixes to the code to bring type safety up, and ensure that it's harder to break this library. There are also many new widget tests with goldens, which means that changes should not affect the UI behavior. +Type safety and rigorous tests ensure that this package is reliable and maintainable. We applied thousands of automatic and manual fixes to the code to bring type safety up, and ensure that it's harder to break this library. There are also many new widget tests with goldens, which means that changes should not affect the UI behavior. This fork provides the most solid foundation for future development, and we will continue to maintain this library. diff --git a/charts_common/analysis_options.yaml b/charts_common/analysis_options.yaml index 122c99583..46c29de23 100644 --- a/charts_common/analysis_options.yaml +++ b/charts_common/analysis_options.yaml @@ -1,3 +1,4 @@ +# cspell:words runtimetype tostring include: package:austerity/analysis_options.yaml analyzer: diff --git a/charts_common/lib/src/chart/bar/bar_label_decorator.dart b/charts_common/lib/src/chart/bar/bar_label_decorator.dart index fde8dc2be..b99382ae9 100644 --- a/charts_common/lib/src/chart/bar/bar_label_decorator.dart +++ b/charts_common/lib/src/chart/bar/bar_label_decorator.dart @@ -444,7 +444,7 @@ class BarLabelDecorator extends BarRendererDecorator { : defaultStyle; } - /// Helper function to get the bar label anchor when BarLabelPostion is + /// Helper function to get the bar label anchor when BarLabelPosition is /// inside. BarLabelAnchor _resolveLabelAnchor(num measure, BarLabelAnchor anchor) { if (labelPlacement == BarLabelPlacement.opposeAxisBaseline) { @@ -484,7 +484,7 @@ enum BarLabelPlacement { followMeasureAxis, /// Places the label with respect to the zero baseline. The bar end is the - /// absolute value aways from the zero baseline. + /// absolute value always from the zero baseline. opposeAxisBaseline, } diff --git a/charts_common/lib/src/chart/bar/bar_lane_renderer_config.dart b/charts_common/lib/src/chart/bar/bar_lane_renderer_config.dart index 981d1a164..53e26ecb9 100644 --- a/charts_common/lib/src/chart/bar/bar_lane_renderer_config.dart +++ b/charts_common/lib/src/chart/bar/bar_lane_renderer_config.dart @@ -18,7 +18,7 @@ import 'package:nimble_charts_common/src/chart/bar/bar_label_decorator.dart' import 'package:nimble_charts_common/src/chart/bar/bar_lane_renderer.dart' show BarLaneRenderer; import 'package:nimble_charts_common/src/chart/bar/bar_renderer_config.dart' - show BarRendererConfig, CornerStrategy; + show BarRendererConfig; import 'package:nimble_charts_common/src/chart/bar/base_bar_renderer_config.dart' show BarGroupingType; import 'package:nimble_charts_common/src/common/color.dart' show Color; diff --git a/charts_common/lib/src/chart/bar/bar_renderer_config.dart b/charts_common/lib/src/chart/bar/bar_renderer_config.dart index f89afd957..c941c3323 100644 --- a/charts_common/lib/src/chart/bar/bar_renderer_config.dart +++ b/charts_common/lib/src/chart/bar/bar_renderer_config.dart @@ -65,9 +65,8 @@ class BarRendererConfig extends BaseBarRendererConfig { @override int get hashCode { - var hash = super.hashCode; - hash = hash * 31 + cornerStrategy.hashCode; - return hash; + final hash = super.hashCode; + return hash * 31 + cornerStrategy.hashCode; } } diff --git a/charts_common/lib/src/chart/bar/bar_target_line_renderer.dart b/charts_common/lib/src/chart/bar/bar_target_line_renderer.dart index a1c2d2ae8..4844c5f0f 100644 --- a/charts_common/lib/src/chart/bar/bar_target_line_renderer.dart +++ b/charts_common/lib/src/chart/bar/bar_target_line_renderer.dart @@ -378,7 +378,7 @@ class BarTargetLineRenderer extends BaseBarRenderer getBoundsForBar(BarTargetLineRendererElement bar) { final points = bar.points; - assert(points.isNotEmpty); + assert(points.isNotEmpty, 'Bar must have at least one point.'); var top = points.first.y; var bottom = points.first.y; var left = points.first.x; diff --git a/charts_common/lib/src/chart/bar/bar_target_line_renderer_config.dart b/charts_common/lib/src/chart/bar/bar_target_line_renderer_config.dart index 6ef9c0675..6098ffcdc 100644 --- a/charts_common/lib/src/chart/bar/bar_target_line_renderer_config.dart +++ b/charts_common/lib/src/chart/bar/bar_target_line_renderer_config.dart @@ -16,7 +16,7 @@ import 'package:nimble_charts_common/src/chart/bar/bar_target_line_renderer.dart' show BarTargetLineRenderer; import 'package:nimble_charts_common/src/chart/bar/base_bar_renderer_config.dart' - show BarGroupingType, BaseBarRendererConfig; + show BaseBarRendererConfig; import 'package:nimble_charts_common/src/chart/layout/layout_view.dart' show LayoutViewPaintOrder; import 'package:nimble_charts_common/src/common/symbol_renderer.dart' diff --git a/charts_common/lib/src/chart/bar/base_bar_renderer.dart b/charts_common/lib/src/chart/bar/base_bar_renderer.dart index 63e28d8cb..3ad4ea3be 100644 --- a/charts_common/lib/src/chart/bar/base_bar_renderer.dart +++ b/charts_common/lib/src/chart/bar/base_bar_renderer.dart @@ -426,7 +426,7 @@ abstract class BaseBarRenderer []); - // If we already have an AnimatingBarfor that index, use it. + // If we already have an AnimatingBar for that index, use it. var animatingBar = barStackList.firstWhereOrNull((bar) => bar.key == barKey); @@ -830,7 +830,7 @@ abstract class BaseBarRenderer chart.context.isRtl; } -/// Iterable wrapping the seriesList that returns the ReversedSeriesItertor. +/// Iterable wrapping the seriesList that returns the ReversedSeriesIterator. class _ReversedSeriesIterable> extends Iterable { _ReversedSeriesIterable(this.seriesList); diff --git a/charts_common/lib/src/chart/bar/base_bar_renderer_config.dart b/charts_common/lib/src/chart/bar/base_bar_renderer_config.dart index b1a06a54a..c04e80502 100644 --- a/charts_common/lib/src/chart/bar/base_bar_renderer_config.dart +++ b/charts_common/lib/src/chart/bar/base_bar_renderer_config.dart @@ -156,7 +156,7 @@ abstract class BaseBarRendererConfig extends LayoutViewConfig } } -/// Defines the way multiple series of bars are renderered per domain. +/// Defines the way multiple series of bars are rendered per domain. /// /// * [grouped] - Render bars for each series that shares a domain value /// side-by-side. diff --git a/charts_common/lib/src/chart/cartesian/axis/axis.dart b/charts_common/lib/src/chart/cartesian/axis/axis.dart index a2f258ef0..fd22fc865 100644 --- a/charts_common/lib/src/chart/cartesian/axis/axis.dart +++ b/charts_common/lib/src/chart/cartesian/axis/axis.dart @@ -240,7 +240,7 @@ abstract class Axis extends ImmutableAxis implements LayoutView { final domainLocation = scale[domain]!.toDouble(); // If domain location is outside of scale range but only outside by less - // than epsilon, correct the potential mislocation caused by floating + // than epsilon, correct the potential mis-location caused by floating // point computation by moving it inside of scale range. if (domainLocation > range.max && domainLocation - epsilon < range.max) { return domainLocation - epsilon; diff --git a/charts_common/lib/src/chart/cartesian/axis/draw_strategy/range_tick_draw_strategy.dart b/charts_common/lib/src/chart/cartesian/axis/draw_strategy/range_tick_draw_strategy.dart index 652286612..110988416 100644 --- a/charts_common/lib/src/chart/cartesian/axis/draw_strategy/range_tick_draw_strategy.dart +++ b/charts_common/lib/src/chart/cartesian/axis/draw_strategy/range_tick_draw_strategy.dart @@ -89,7 +89,7 @@ class RangeTickRendererSpec extends SmallTickRendererSpec { final int? rangeTickLengthPx; // Specifies range shade's height. final int? rangeShadeHeightPx; - // Specifies the starting offet of range shade from axis in pixels. + // Specifies the starting offset of range shade from axis in pixels. final int? rangeShadeOffsetFromAxisPx; // A range tick offset from the original location. The start point offset is // toward the origin and end point offset is toward the end of axis. @@ -268,7 +268,7 @@ class RangeTickDrawStrategy extends SmallTickDrawStrategy { getLabelWidth(labelElements), ) + labelOffsetFromAxisPx(collision: collision), - //TODO: possible precission loss + //TODO: possible precision loss ).toInt(), labelOffsetFromAxisPx(collision: collision) + rangeShadeHeightPx, ); @@ -281,7 +281,7 @@ class RangeTickDrawStrategy extends SmallTickDrawStrategy { getLabelWidth(labelElements), ) + labelOffsetFromAxisPx(collision: collision), - //TODO: possible precission loss + //TODO: possible precision loss ).toInt(); } }); @@ -314,7 +314,7 @@ class RangeTickDrawStrategy extends SmallTickDrawStrategy { getLabelWidth(labelElements), ) + rangeShadeOffsetFromAxisPx, - //TODO: possible precission loss + //TODO: possible precision loss ).toInt(), rangeShadeOffsetFromAxisPx + rangeShadeHeightPx, ); @@ -326,7 +326,7 @@ class RangeTickDrawStrategy extends SmallTickDrawStrategy { getLabelHeight(labelElements), getLabelWidth(labelElements), ), - //TODO: possible precission loss + //TODO: possible precision loss ).toInt() + labelOffsetFromAxisPx(collision: collision); } diff --git a/charts_common/lib/src/chart/cartesian/axis/ordinal_extents.dart b/charts_common/lib/src/chart/cartesian/axis/ordinal_extents.dart index cbe40c75c..2b32e71df 100644 --- a/charts_common/lib/src/chart/cartesian/axis/ordinal_extents.dart +++ b/charts_common/lib/src/chart/cartesian/axis/ordinal_extents.dart @@ -14,6 +14,7 @@ // limitations under the License. import 'dart:collection' show HashSet; + import 'package:nimble_charts_common/src/chart/cartesian/axis/scale.dart' show Extents; @@ -22,8 +23,6 @@ class OrdinalExtents extends Extents { /// The extents representing the ordinal values in [range]. /// /// The elements of [range] must all be unique. - /// - /// [D] is the domain class type for the elements in the extents. OrdinalExtents(List range) : _range = range { // This asserts that all elements in [range] are unique. assert(() { diff --git a/charts_common/lib/src/chart/cartesian/axis/ordinal_scale_domain_info.dart b/charts_common/lib/src/chart/cartesian/axis/ordinal_scale_domain_info.dart index 38562aeb1..6fa76afdf 100644 --- a/charts_common/lib/src/chart/cartesian/axis/ordinal_scale_domain_info.dart +++ b/charts_common/lib/src/chart/cartesian/axis/ordinal_scale_domain_info.dart @@ -21,8 +21,6 @@ import 'package:nimble_charts_common/src/chart/cartesian/axis/ordinal_scale.dart /// A domain processor for [OrdinalScale]. /// -/// [D] domain class type of the values being tracked. -/// /// Unique domain values are kept, so duplicates will not increase the extent. class OrdinalScaleDomainInfo { OrdinalScaleDomainInfo(); diff --git a/charts_common/lib/src/chart/cartesian/axis/spec/end_points_time_axis_spec.dart b/charts_common/lib/src/chart/cartesian/axis/spec/end_points_time_axis_spec.dart index cd5ac02bb..03752ad79 100644 --- a/charts_common/lib/src/chart/cartesian/axis/spec/end_points_time_axis_spec.dart +++ b/charts_common/lib/src/chart/cartesian/axis/spec/end_points_time_axis_spec.dart @@ -52,9 +52,5 @@ class EndPointsTimeAxisSpec extends DateTimeAxisSpec { (other is EndPointsTimeAxisSpec && super == other); @override - int get hashCode { - var hashcode = super.hashCode; - hashcode = (hashcode * 37) + runtimeType.hashCode; - return hashcode; - } + int get hashCode => (super.hashCode * 37) + runtimeType.hashCode; } diff --git a/charts_common/lib/src/chart/cartesian/axis/spec/numeric_axis_spec.dart b/charts_common/lib/src/chart/cartesian/axis/spec/numeric_axis_spec.dart index 5b965b3bb..6908875d9 100644 --- a/charts_common/lib/src/chart/cartesian/axis/spec/numeric_axis_spec.dart +++ b/charts_common/lib/src/chart/cartesian/axis/spec/numeric_axis_spec.dart @@ -94,11 +94,7 @@ class NumericAxisSpec extends AxisSpec { other is NumericAxisSpec && viewport == other.viewport && super == other; @override - int get hashCode { - var hashcode = super.hashCode; - hashcode = (hashcode * 37) + viewport.hashCode; - return hashcode; - } + int get hashCode => (super.hashCode * 37) + viewport.hashCode; } abstract class NumericTickProviderSpec extends TickProviderSpec {} @@ -239,9 +235,5 @@ class BasicNumericTickFormatterSpec implements NumericTickFormatterSpec { numberFormat == other.numberFormat); @override - int get hashCode { - var hashcode = formatter.hashCode; - hashcode = (hashcode * 37) + numberFormat.hashCode; - return hashcode; - } + int get hashCode => (formatter.hashCode * 37) + numberFormat.hashCode; } diff --git a/charts_common/lib/src/chart/cartesian/axis/spec/ordinal_axis_spec.dart b/charts_common/lib/src/chart/cartesian/axis/spec/ordinal_axis_spec.dart index 3a4013561..c4906bda3 100644 --- a/charts_common/lib/src/chart/cartesian/axis/spec/ordinal_axis_spec.dart +++ b/charts_common/lib/src/chart/cartesian/axis/spec/ordinal_axis_spec.dart @@ -83,11 +83,7 @@ class OrdinalAxisSpec extends AxisSpec { super == other); @override - int get hashCode { - var hashcode = super.hashCode; - hashcode = (hashcode * 37) + viewport.hashCode; - return hashcode; - } + int get hashCode => (super.hashCode * 37) + viewport.hashCode; } abstract class OrdinalTickProviderSpec extends TickProviderSpec {} diff --git a/charts_common/lib/src/chart/cartesian/axis/spec/percent_axis_spec.dart b/charts_common/lib/src/chart/cartesian/axis/spec/percent_axis_spec.dart index f5be82d06..f44a9fb72 100644 --- a/charts_common/lib/src/chart/cartesian/axis/spec/percent_axis_spec.dart +++ b/charts_common/lib/src/chart/cartesian/axis/spec/percent_axis_spec.dart @@ -18,7 +18,7 @@ import 'package:meta/meta.dart' show immutable; import 'package:nimble_charts_common/src/chart/cartesian/axis/numeric_extents.dart' show NumericExtents; import 'package:nimble_charts_common/src/chart/cartesian/axis/spec/axis_spec.dart' - show AxisSpec, RenderSpec; + show AxisSpec; import 'package:nimble_charts_common/src/chart/cartesian/axis/spec/numeric_axis_spec.dart' show BasicNumericTickFormatterSpec, @@ -51,9 +51,5 @@ class PercentAxisSpec extends NumericAxisSpec { bool operator ==(Object other) => other is PercentAxisSpec && super == other; @override - int get hashCode { - var hashcode = super.hashCode; - hashcode = (hashcode * 37) + runtimeType.hashCode; - return hashcode; - } + int get hashCode => (super.hashCode * 37) + runtimeType.hashCode; } diff --git a/charts_common/lib/src/chart/cartesian/axis/time/auto_adjusting_date_time_tick_provider.dart b/charts_common/lib/src/chart/cartesian/axis/time/auto_adjusting_date_time_tick_provider.dart index 7f63b744b..6c45afc03 100644 --- a/charts_common/lib/src/chart/cartesian/axis/time/auto_adjusting_date_time_tick_provider.dart +++ b/charts_common/lib/src/chart/cartesian/axis/time/auto_adjusting_date_time_tick_provider.dart @@ -60,7 +60,7 @@ import 'package:nimble_charts_common/src/common/graphics_factory.dart' class AutoAdjustingDateTimeTickProvider implements TickProvider { AutoAdjustingDateTimeTickProvider._internal( List tickProviders, - ) : assert(tickProviders.isNotEmpty), + ) : assert(tickProviders.isNotEmpty, 'At least one tick provider required'), _potentialTickProviders = tickProviders; /// Creates a default [AutoAdjustingDateTimeTickProvider] for day and time. diff --git a/charts_common/lib/src/chart/cartesian/axis/time/day_time_stepper.dart b/charts_common/lib/src/chart/cartesian/axis/time/day_time_stepper.dart index 58886c81b..75387d16b 100644 --- a/charts_common/lib/src/chart/cartesian/axis/time/day_time_stepper.dart +++ b/charts_common/lib/src/chart/cartesian/axis/time/day_time_stepper.dart @@ -27,7 +27,10 @@ class DayTimeStepper extends BaseTimeStepper { // Set the default increments if null. allowedTickIncrements ??= _defaultIncrements; - assert(allowedTickIncrements.every((increment) => increment > 0)); + assert( + allowedTickIncrements.every((increment) => increment > 0), + 'Tick increments must be greater than 0.', + ); return DayTimeStepper._internal(dateTimeFactory, allowedTickIncrements); } diff --git a/charts_common/lib/src/chart/cartesian/axis/time/minute_time_stepper.dart b/charts_common/lib/src/chart/cartesian/axis/time/minute_time_stepper.dart index 1e1657758..a07201ab4 100644 --- a/charts_common/lib/src/chart/cartesian/axis/time/minute_time_stepper.dart +++ b/charts_common/lib/src/chart/cartesian/axis/time/minute_time_stepper.dart @@ -29,6 +29,7 @@ class MinuteTimeStepper extends BaseTimeStepper { assert( allowedTickIncrements .every((increment) => increment >= 1 && increment <= 60), + 'Tick increments must be between 1 and 60.', ); return MinuteTimeStepper._internal(dateTimeFactory, allowedTickIncrements); diff --git a/charts_common/lib/src/chart/cartesian/axis/time/month_time_stepper.dart b/charts_common/lib/src/chart/cartesian/axis/time/month_time_stepper.dart index 2547e0bc1..94b89b16f 100644 --- a/charts_common/lib/src/chart/cartesian/axis/time/month_time_stepper.dart +++ b/charts_common/lib/src/chart/cartesian/axis/time/month_time_stepper.dart @@ -27,7 +27,10 @@ class MonthTimeStepper extends BaseTimeStepper { // Set the default increments if null. allowedTickIncrements ??= _defaultIncrements; - assert(allowedTickIncrements.every((increment) => increment > 0)); + assert( + allowedTickIncrements.every((increment) => increment > 0), + 'Tick increments must be greater than 0.', + ); return MonthTimeStepper._internal(dateTimeFactory, allowedTickIncrements); } diff --git a/charts_common/lib/src/chart/cartesian/axis/time/time_range_tick_provider_impl.dart b/charts_common/lib/src/chart/cartesian/axis/time/time_range_tick_provider_impl.dart index 4c1aa214a..4a91cbfb2 100644 --- a/charts_common/lib/src/chart/cartesian/axis/time/time_range_tick_provider_impl.dart +++ b/charts_common/lib/src/chart/cartesian/axis/time/time_range_tick_provider_impl.dart @@ -59,7 +59,7 @@ class TimeRangeTickProviderImpl extends TimeRangeTickProvider { int? minDifference; late int closestIncrement; - assert(timeStepper.allowedTickIncrements.isNotEmpty); + assert(timeStepper.allowedTickIncrements.isNotEmpty, 'No increments set.'); for (final increment in timeStepper.allowedTickIncrements) { final difference = (stepSize - (timeStepper.typicalStepSizeMs * increment)).abs(); diff --git a/charts_common/lib/src/chart/cartesian/cartesian_renderer.dart b/charts_common/lib/src/chart/cartesian/cartesian_renderer.dart index 972b65ce6..39e97f2e3 100644 --- a/charts_common/lib/src/chart/cartesian/cartesian_renderer.dart +++ b/charts_common/lib/src/chart/cartesian/cartesian_renderer.dart @@ -172,7 +172,7 @@ abstract class BaseCartesianRenderer extends BaseSeriesRenderer AccessorFn domainFn, List data, ) { - assert(data.isNotEmpty); + assert(data.isNotEmpty, 'Data must not be empty.'); // Quick optimization for full viewport (likely). if (domainAxis.compareDomainValueToViewport(domainFn(0)) == 0) { diff --git a/charts_common/lib/src/chart/common/behavior/a11y/a11y_explore_behavior.dart b/charts_common/lib/src/chart/common/behavior/a11y/a11y_explore_behavior.dart index 6fe5666c1..cd31d2f4a 100644 --- a/charts_common/lib/src/chart/common/behavior/a11y/a11y_explore_behavior.dart +++ b/charts_common/lib/src/chart/common/behavior/a11y/a11y_explore_behavior.dart @@ -39,7 +39,7 @@ abstract class A11yExploreBehavior implements ChartBehavior { this.exploreModeDisabledAnnouncement, }) : exploreModeTrigger = exploreModeTrigger ?? ExploreModeTrigger.pressHold, minimumWidth = minimumWidth ?? 1.0 { - assert(this.minimumWidth >= 1.0); + assert(this.minimumWidth >= 1.0, 'minimumWidth must be 1 or greater.'); switch (this.exploreModeTrigger) { case ExploreModeTrigger.pressHold: diff --git a/charts_common/lib/src/chart/common/behavior/a11y/domain_a11y_explore_behavior.dart b/charts_common/lib/src/chart/common/behavior/a11y/domain_a11y_explore_behavior.dart index 3468c5d79..885693474 100644 --- a/charts_common/lib/src/chart/common/behavior/a11y/domain_a11y_explore_behavior.dart +++ b/charts_common/lib/src/chart/common/behavior/a11y/domain_a11y_explore_behavior.dart @@ -22,7 +22,7 @@ import 'package:nimble_charts_common/src/chart/cartesian/cartesian_chart.dart' import 'package:nimble_charts_common/src/chart/common/base_chart.dart' show BaseChart, LifecycleListener; import 'package:nimble_charts_common/src/chart/common/behavior/a11y/a11y_explore_behavior.dart' - show A11yExploreBehavior, ExploreModeTrigger; + show A11yExploreBehavior; import 'package:nimble_charts_common/src/chart/common/behavior/a11y/a11y_node.dart' show A11yNode, OnFocus; import 'package:nimble_charts_common/src/chart/common/processed_series.dart' diff --git a/charts_common/lib/src/chart/common/behavior/a11y/keyboard_domain_navigator.dart b/charts_common/lib/src/chart/common/behavior/a11y/keyboard_domain_navigator.dart index dd06747f4..638b2d520 100644 --- a/charts_common/lib/src/chart/common/behavior/a11y/keyboard_domain_navigator.dart +++ b/charts_common/lib/src/chart/common/behavior/a11y/keyboard_domain_navigator.dart @@ -221,7 +221,7 @@ abstract class KeyboardDomainNavigator implements ChartBehavior { } // If the currentIndex is the same as the firstSelectedDetail we don't have - // to do a linear seach to find the domain. + // to do a linear search to find the domain. final firstDomain = details.first.domain as D; if (0 <= _currentIndex && diff --git a/charts_common/lib/src/chart/common/behavior/legend/legend_entry.dart b/charts_common/lib/src/chart/common/behavior/legend/legend_entry.dart index 368a1b958..d53cd2740 100644 --- a/charts_common/lib/src/chart/common/behavior/legend/legend_entry.dart +++ b/charts_common/lib/src/chart/common/behavior/legend/legend_entry.dart @@ -87,7 +87,6 @@ class LegendCategory extends LegendEntryBase { /// Holder for the information used for a legend row. /// -/// [T] the datum class type for the series passed in. /// [D] the domain class type for the datum. class LegendEntry extends LegendEntryBase { // TODO: Forward the default formatters from series and allow for diff --git a/charts_common/lib/src/chart/common/behavior/line_point_highlighter.dart b/charts_common/lib/src/chart/common/behavior/line_point_highlighter.dart index b0eb143e6..e0a9a862c 100644 --- a/charts_common/lib/src/chart/common/behavior/line_point_highlighter.dart +++ b/charts_common/lib/src/chart/common/behavior/line_point_highlighter.dart @@ -134,7 +134,10 @@ class LinePointHighlighter implements ChartBehavior { if (chart is CartesianChart) { // Only vertical rendering is supported by this behavior. - assert((chart as CartesianChart).vertical); + assert( + (chart as CartesianChart).vertical, + 'Only vertical charts are supported for LinePointHighlighter.', + ); } chart diff --git a/charts_common/lib/src/chart/common/behavior/selection/lock_selection.dart b/charts_common/lib/src/chart/common/behavior/selection/lock_selection.dart index 0009efb59..61112d7c0 100644 --- a/charts_common/lib/src/chart/common/behavior/selection/lock_selection.dart +++ b/charts_common/lib/src/chart/common/behavior/selection/lock_selection.dart @@ -17,7 +17,7 @@ import 'dart:math'; import 'package:nimble_charts_common/common.dart'; -/// Chart behavior that listens to tap event trigges and locks the specified +/// Chart behavior that listens to tap event triggers and locks the specified /// [SelectionModel]. This is used to prevent further updates to the selection /// model, until it is unlocked again. /// diff --git a/charts_common/lib/src/chart/layout/layout_manager_impl.dart b/charts_common/lib/src/chart/layout/layout_manager_impl.dart index a5c9166f8..df388a3a6 100644 --- a/charts_common/lib/src/chart/layout/layout_manager_impl.dart +++ b/charts_common/lib/src/chart/layout/layout_manager_impl.dart @@ -29,7 +29,7 @@ class LayoutManagerImpl implements LayoutManager { static const _minDrawWidth = 20; static const _minDrawHeight = 20; - // Allow [Layoutconfig] to be mutable so it can be modified without requiring + // Allow [LayoutConfig] to be mutable so it can be modified without requiring // a new copy of [DefaultLayoutManager] to be created. LayoutConfig config; diff --git a/charts_common/lib/src/chart/pie/arc_label_decorator.dart b/charts_common/lib/src/chart/pie/arc_label_decorator.dart index fc2e39e39..fafb21432 100644 --- a/charts_common/lib/src/chart/pie/arc_label_decorator.dart +++ b/charts_common/lib/src/chart/pie/arc_label_decorator.dart @@ -219,7 +219,7 @@ class ArcLabelDecorator extends ArcRendererDecorator { TextStyle labelStyle, int insideArcWidth, int outsideArcWidth, - ArcRendererElement arcRendererelement, + ArcRendererElement arcRendererElement, ArcLabelPosition labelPosition, ) { if (labelPosition == ArcLabelPosition.auto) { @@ -312,7 +312,7 @@ class ArcLabelDecorator extends ArcRendererDecorator { arcElements.center.y + labelRadius * sin(centerAngle), ); - // Use the label's chart quandrant to determine whether it's rendered to the + // Use the label's chart quadrant to determine whether it's rendered to the // right or left. final centerAbs = centerAngle.abs() % (2 * pi); final labelLeftOfChart = pi / 2 < centerAbs && centerAbs < pi * 3 / 2; diff --git a/charts_common/lib/src/chart/pie/base_arc_renderer.dart b/charts_common/lib/src/chart/pie/base_arc_renderer.dart index 7a6966d47..489d36028 100644 --- a/charts_common/lib/src/chart/pie/base_arc_renderer.dart +++ b/charts_common/lib/src/chart/pie/base_arc_renderer.dart @@ -35,11 +35,7 @@ import 'package:nimble_charts_common/src/chart/pie/arc_renderer_config.dart' import 'package:nimble_charts_common/src/chart/pie/arc_renderer_decorator.dart' show ArcRendererDecorator; import 'package:nimble_charts_common/src/chart/pie/arc_renderer_element.dart' - show - AnimatedArc, - AnimatedArcList, - ArcRendererElement, - ArcRendererElementList; + show AnimatedArcList, ArcRendererElement, ArcRendererElementList; import 'package:nimble_charts_common/src/chart/pie/base_arc_renderer_config.dart' show BaseArcRendererConfig; import 'package:nimble_charts_common/src/common/math.dart' show NullablePoint; diff --git a/charts_common/lib/src/chart/sunburst/sunburst_arc_label_decorator.dart b/charts_common/lib/src/chart/sunburst/sunburst_arc_label_decorator.dart index e8490a711..bb52ba9a2 100644 --- a/charts_common/lib/src/chart/sunburst/sunburst_arc_label_decorator.dart +++ b/charts_common/lib/src/chart/sunburst/sunburst_arc_label_decorator.dart @@ -167,28 +167,28 @@ class SunburstArcLabelDecorator extends ArcLabelDecorator { TextStyle labelStyle, int insideArcWidth, int outsideArcWidth, - ArcRendererElement arcRendererelement, + ArcRendererElement arcRendererElement, ArcLabelPosition labelPosition, ) { - assert(arcRendererelement is SunburstArcRendererElement); + assert(arcRendererElement is SunburstArcRendererElement); - if ((arcRendererelement as SunburstArcRendererElement).isOuterMostRing == + if ((arcRendererElement as SunburstArcRendererElement).isOuterMostRing == true) { return super.calculateLabelPosition( labelElement, labelStyle, insideArcWidth, outsideArcWidth, - arcRendererelement, + arcRendererElement, outerRingArcLabelPosition, ); - } else if (arcRendererelement.isLeaf == true) { + } else if (arcRendererElement.isLeaf == true) { return super.calculateLabelPosition( labelElement, labelStyle, insideArcWidth, outsideArcWidth, - arcRendererelement, + arcRendererElement, innerRingLeafArcLabelPosition, ); } else { diff --git a/charts_common/lib/src/chart/sunburst/sunburst_arc_renderer_config.dart b/charts_common/lib/src/chart/sunburst/sunburst_arc_renderer_config.dart index e7be584c2..b316276d9 100644 --- a/charts_common/lib/src/chart/sunburst/sunburst_arc_renderer_config.dart +++ b/charts_common/lib/src/chart/sunburst/sunburst_arc_renderer_config.dart @@ -84,7 +84,7 @@ class SunburstArcRendererConfig extends BaseArcRendererConfig { SunburstArcRenderer(config: this, rendererId: customRendererId); } -/// Strategies for assinging color to the arcs if colorFn is not provided for +/// Strategies for assigning color to the arcs if colorFn is not provided for /// Series. enum SunburstColorStrategy { /// Assign a new shade to each of the arcs. diff --git a/charts_common/lib/src/chart/time_series/time_series_chart.dart b/charts_common/lib/src/chart/time_series/time_series_chart.dart index f595f5c0b..45c32523f 100644 --- a/charts_common/lib/src/chart/time_series/time_series_chart.dart +++ b/charts_common/lib/src/chart/time_series/time_series_chart.dart @@ -14,7 +14,7 @@ // limitations under the License. import 'package:nimble_charts_common/src/chart/cartesian/axis/axis.dart' - show Axis, NumericAxis; + show Axis; import 'package:nimble_charts_common/src/chart/cartesian/axis/draw_strategy/small_tick_draw_strategy.dart' show SmallTickRendererSpec; import 'package:nimble_charts_common/src/chart/cartesian/axis/spec/axis_spec.dart' diff --git a/charts_common/lib/src/chart/treemap/treemap_label_decorator.dart b/charts_common/lib/src/chart/treemap/treemap_label_decorator.dart index cbf92a79c..0adacdbaf 100644 --- a/charts_common/lib/src/chart/treemap/treemap_label_decorator.dart +++ b/charts_common/lib/src/chart/treemap/treemap_label_decorator.dart @@ -120,7 +120,7 @@ class TreeMapLabelDecorator extends TreeMapRendererDecorator { // Draws a label inside of a treemap renderer element. canvas.drawText( segment.text, - segment.xOffet, + segment.xOffset, segment.yOffset, rotation: segment.rotationAngle, ); @@ -197,7 +197,7 @@ class TreeMapLabelDecorator extends TreeMapRendererDecorator { class _TreeMapLabelSegment { _TreeMapLabelSegment( this.text, - this.xOffet, + this.xOffset, this.yOffset, this.rotationAngle, ); @@ -206,7 +206,7 @@ class _TreeMapLabelSegment { final TextElement text; /// x-coordinate offset for [text]. - final int xOffet; + final int xOffset; /// y-coordinate offset for [text]. final int yOffset; diff --git a/charts_common/lib/src/common/gesture_listener.dart b/charts_common/lib/src/common/gesture_listener.dart index dbb98bb87..db0b82677 100644 --- a/charts_common/lib/src/common/gesture_listener.dart +++ b/charts_common/lib/src/common/gesture_listener.dart @@ -76,7 +76,7 @@ class GestureListener { /// Called when the chart is focused. final GestureCallback? onFocus; - /// Called when the chart is blured. + /// Called when the chart is blurred. final GestureCallback? onBlur; /// Called when the tap event has moved beyond a threshold indicating that diff --git a/charts_common/lib/src/data/graph.dart b/charts_common/lib/src/data/graph.dart index 1ad817b9d..14a169579 100644 --- a/charts_common/lib/src/data/graph.dart +++ b/charts_common/lib/src/data/graph.dart @@ -277,7 +277,7 @@ class Link extends GraphElement { List> _cloneLinkList(List> linkList) => linkList.map(Link.clone).toList(); -/// A [Link] or [Node] elmeent in a graph containing user defined data. +/// A [Link] or [Node] element in a graph containing user defined data. abstract class GraphElement { GraphElement(this.data); diff --git a/charts_common/test/chart/bar/bar_label_decorator_test.dart b/charts_common/test/chart/bar/bar_label_decorator_test.dart index d639a35c4..356a573dd 100644 --- a/charts_common/test/chart/bar/bar_label_decorator_test.dart +++ b/charts_common/test/chart/bar/bar_label_decorator_test.dart @@ -256,8 +256,8 @@ void main() { }); test('LabelPosition.inside always paints inside the bar', () { - //This code looks like it does nothing, but the weird mutable - //heirarchy means that it's necessary. + // This code looks like it does nothing, but the weird mutable + // hierarchy means that it's necessary. final barElements = [ // 'LabelABC' would not fit inside the bar in auto setting because it // has a width of 8. @@ -855,8 +855,8 @@ void main() { test('Inside and outside label styles are applied', () { final data = ['A', 'B']; - //This code looks like it does nothing, but the weird mutable - //heirarchy means that it's necessary. + // This code looks like it does nothing, but the weird mutable + // hierarchy means that it's necessary. // ignore: unused_local_variable final barElements = [ // 'LabelA' and 'LabelB' both have lengths of 6. diff --git a/charts_common/test/chart/cartesian/axis/time/date_time_tick_formatter_test.dart b/charts_common/test/chart/cartesian/axis/time/date_time_tick_formatter_test.dart index 3339c7754..9f49ddc74 100644 --- a/charts_common/test/chart/cartesian/axis/time/date_time_tick_formatter_test.dart +++ b/charts_common/test/chart/cartesian/axis/time/date_time_tick_formatter_test.dart @@ -176,7 +176,7 @@ void main() { expect(actualLabels, equals(expectedLabels)); }); - test('on empty input doesnt break', () { + test('on empty input does not break', () { final formatter = DateTimeTickFormatter.withFormatters({10: timeFormatter1}); final formatterCache = {}; @@ -218,7 +218,7 @@ void main() { }); group('check custom time tick formatters', () { - test('throws arugment error if time resolution key is not positive', () { + test('throws argument error if time resolution key is not positive', () { // -1 is reserved for any, if there is only one formatter, -1 is allowed. expect( () => DateTimeTickFormatter.withFormatters( @@ -235,7 +235,7 @@ void main() { ); }); - test('throws arugment error if formatters are not sorted', () { + test('throws argument error if formatters are not sorted', () { expect( () => DateTimeTickFormatter.withFormatters({ 3: timeFormatter1, diff --git a/charts_common/test/common/text_utils_test.dart b/charts_common/test/common/text_utils_test.dart index 6aaab2086..0dea470c1 100644 --- a/charts_common/test/common/text_utils_test.dart +++ b/charts_common/test/common/text_utils_test.dart @@ -13,6 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// cspell:words texttexttexttext texttextte xttext + import 'package:mockito/mockito.dart'; import 'package:nimble_charts_common/src/common/color.dart' show Color; import 'package:nimble_charts_common/src/common/graphics_factory.dart' @@ -149,6 +151,7 @@ void main() { test( 'when label can not fit in a single line, enable allowLabelOverflow, ' 'disable multiline, return ellipsized text', () { + // cspell:disable-next-line final textElement = FakeTextElement('texttexttexttext') ..textStyle = textStyle; final textElements = wrapLabelLines( @@ -161,6 +164,7 @@ void main() { ); expect(textElements, hasLength(1)); + // cspell:disable-next-line expect(textElements.first.text, 'textte...'); }); @@ -184,7 +188,7 @@ void main() { }); test( - 'when both label and ellpisis can not fit in a single line, disable ' + 'when both label and ellipsis can not fit in a single line, disable ' 'allowLabelOverflow and multiline, return empty', () { const maxWidth = 2; final textElement = FakeTextElement('texttexttexttext') @@ -202,7 +206,7 @@ void main() { }); test( - 'when both label and ellpisis can not fit in a single line, disable ' + 'when both label and ellipsis can not fit in a single line, disable ' 'allowLabelOverflow but enable multiline, return textElements', () { const maxWidth = 2; final textElement = FakeTextElement('t ex text')..textStyle = textStyle; diff --git a/charts_flutter/README.md b/charts_flutter/README.md index 61ca8e7a9..edbb49b5a 100644 --- a/charts_flutter/README.md +++ b/charts_flutter/README.md @@ -13,7 +13,7 @@ This project is a resurrection of the discontinued [charts_flutter](https://pub. ### Dart 3, Type Safety, Tests, and Bug Fixes -Type safety and rigourous tests ensure that this package is reliable and maintainable. We applied thousands of automatic and manual fixes to the code to bring type safety up, and ensure that it's harder to break this library. There are also many new widget tests with goldens, which means that changes should not affect the UI behavior. +Type safety and rigorous tests ensure that this package is reliable and maintainable. We applied thousands of automatic and manual fixes to the code to bring type safety up, and ensure that it's harder to break this library. There are also many new widget tests with goldens, which means that changes should not affect the UI behavior. This fork provides the most solid foundation for future development, and we will continue to maintain this library. diff --git a/charts_flutter/analysis_options.yaml b/charts_flutter/analysis_options.yaml index 80d60d33a..2defa2cec 100644 --- a/charts_flutter/analysis_options.yaml +++ b/charts_flutter/analysis_options.yaml @@ -1,3 +1,5 @@ +#cspell:words runtimetype tostring + include: package:austerity/analysis_options.yaml analyzer: diff --git a/charts_flutter/lib/src/behaviors/legend/legend_entry_layout.dart b/charts_flutter/lib/src/behaviors/legend/legend_entry_layout.dart index f64efc724..ded984616 100644 --- a/charts_flutter/lib/src/behaviors/legend/legend_entry_layout.dart +++ b/charts_flutter/lib/src/behaviors/legend/legend_entry_layout.dart @@ -143,7 +143,7 @@ class SimpleLegendEntryLayout implements LegendEntryLayout { @override int get hashCode => runtimeType.hashCode; - /// Convert the charts common TextStlyeSpec into a standard TextStyle, while + /// Convert the charts common TextStyleSpec into a standard TextStyle, while /// reducing the color opacity to 26% if the entry is hidden. /// /// For non-specified values, override the hidden text color to use the body 1 diff --git a/cspell.config.yaml b/cspell.config.yaml new file mode 100644 index 000000000..eee65416e --- /dev/null +++ b/cspell.config.yaml @@ -0,0 +1,62 @@ +$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json +version: "0.2" +ignorePaths: + # Various platform-specific API names we can just ignore. + - charts_flutter/example/windows/ + - charts_flutter/example/macos/ + - charts_flutter/example/ios/ + - charts_flutter/example/linux/ + - charts_flutter/example/android/ + - "gradlew" + - "gradlew.bat" + - "build" + - "*.iml" + - "charts_common/test/data/" + - 'coverage' +words: +- Aplos # Group inside Google which wrote the original flutter_charts. +- barchart +- cbraun +- credentialless # CORS policy name (in serve.json for web) +- cupertino +- dasharray +- defaultlabel # Probably could be capitalized +- ellipsize +- ellipsized +- Findlay +- focusable +- Gemlock +- genhtml +- goldens +- gradlew +- gridline +- gridlines +- hashcode +- hotfixes +- hovercard +- Jaspr +- LTWH +- niced +- nicing +- Nimblesite +- nonclaiming +- OPENSOURCE +- Outliner +- paintable +- Postrender # Probably could be capitalized +- pubspec +- Rangeband +- RRGGBB # Color format +- Sankey +- squarification +- squarified +- Squarify +- Statick +- stylepack +- tappable +- tostring # Used in a lint name +- TRBL +- treemap +- Treemaps +- unitconverter # Probably could be capitalized +- Unlisten \ No newline at end of file diff --git a/test.sh b/test.sh old mode 100644 new mode 100755 index 7e59112c1..bf3253e23 --- a/test.sh +++ b/test.sh @@ -1,13 +1,13 @@ -cd charts_common +#!/bin/bash + +cd charts_common flutter test --update-goldens --coverage -cd ../charts_flutter +cd ../charts_flutter flutter test --update-goldens --coverage lcov ./coverage --output-file ./coverage/lcov.info --capture --directory -genhtml ./coverage/lcov.info --output-directory ./coverage/html - - \ No newline at end of file +genhtml ./coverage/lcov.info --output-directory ./coverage/html \ No newline at end of file