Skip to content

chore: clear ruflet_color_pickers analyzer issues - #75

Merged
AdamMusa merged 1 commit into
codex/engine-initializationfrom
chore/color-pickers-analyzer
Nov 2, 2026
Merged

AdamMusa merged 1 commit into
codex/engine-initializationfrom
chore/color-pickers-analyzer

Conversation

@AdamMusa

@AdamMusa AdamMusa commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

What

ruflet_color_pickers had 126 flutter analyze issues on the base. This PR fixes them without behavior changes; the package's tests still pass.

Classification (base)

Kind Count Where
Real errors / warnings 0 none
Deprecations (deprecated_member_use) 98 Color.value ×32, withOpacity ×17, red / green / blue ×13 each, opacity ×3, alpha ×3; flutter_colorpicker labelTextStyle ×2, sliderTextStyle ×1, showLabel ×1
Lints 28 use_super_parameters ×12, curly_braces_in_flow_control_structures ×8, no_leading_underscores_for_local_identifiers ×7, prefer_const_literals_to_create_immutables ×1 (test)

Most issues (97) are in lib/src/cupertino_picker/, the local MIT fork of flutter_colorpicker 1.1.0. The rest are in the Ruflet wrapper renderers.

Fixes

  • Color.value → toARGB32(). This is literally what the deprecated getter returns.
  • alpha / red / green / blue / opacity / withOpacity move to a small package extension, lib/src/utils/color_channels.dart. It provides alpha8, red8, green8, blue8, opacity8 and withOpacity8, computed exactly like the deprecated dart:ui getters: from toARGB32(), with 8-bit quantized alpha. I did not use the suggested withValues(alpha:), because it keeps the exact double and would subtly change the colors and Color equality that the pickers and their history depend on. The new test/color_channels_test.dart compares every helper against the deprecated getter, including non-8-bit float colors from HSV/HSL conversion and edge opacities.
  • SlidePicker showLabel → labelTypes: show_label ? labelTypes : []. Upstream draws the label only when showLabel && labelTypes.isNotEmpty, so this is the same condition.
  • Kept on the deprecated API (minimal, explained): labelTextStyle (ColorPicker, SlidePicker) and sliderTextStyle (SlidePicker). Upstream's replacement is to alter Theme.of(context).textTheme roles. That cannot reproduce Ruby's per-control label_text_style / slider_text_style without changing rendering: the label font-size override, the slider text fallback to bodyLarge/bodyMedium, and the theme seen by surrounding widgets. The three call sites carry a scoped // ignore: deprecated_member_use with that reason. A real migration would be a rendering change and deserves its own PR.
  • Lints:
    • dart fix for super parameters and braces.
    • Hand renames of local _x identifiers in cupertino_picker/material_picker.dart. The automated rename collided with an existing color variable, so I picked non-colliding names.
    • In the test, the lint wanted pickerColors: const [red]. The multiple-choice picker edits that list in place (the test failed with a const list), so the test now passes List.of([red]) with a comment instead.

Tests

  • flutter analyze: 126 → No issues found.
  • flutter test in the package: 8 passed (7 existing + 1 new equivalence test).

team/verify_pr.sh <engine> "" with EXT_PKGS=ruflet_color_pickers at head 50ae312 (rebased on b4d3f8e): PASS

  • core flutter test: +734, all passed; flutter analyze lib test: No issues found
  • ruflet_color_pickers flutter test: +8, all passed; flutter analyze lib test: No issues found

Engine-only change; rebased on the latest codex/engine-initialization (b4d3f8e).

The package had 126 analyzer infos on the base and no errors or
warnings: 98 deprecated_member_use and 28 lints.

- Color.value becomes toARGB32(), which is what the getter returns.
- Color.alpha/red/green/blue/opacity and withOpacity become the
  ColorChannels8 helpers, which compute the same 8-bit values from
  toARGB32() and keep withOpacity's 8-bit alpha (withValues would not).
  A test compares them with the deprecated getters.
- SlidePicker showLabel becomes an empty labelTypes list, which the
  picker treats the same way.
- labelTextStyle and sliderTextStyle stay on the deprecated API with a
  scoped ignore: their replacement is a Theme text-role override that
  cannot express a per-control style without changing rendering.
- Lints: super parameters, braces, local names without underscores,
  and a growable list in the multiple-choice test where const would
  break the picker's in-place edits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant