Skip to content

Skeleton widget update#480

Merged
dewabisma merged 4 commits into
mainfrom
feat/skeleton-widget-update
May 11, 2026
Merged

Skeleton widget update#480
dewabisma merged 4 commits into
mainfrom
feat/skeleton-widget-update

Conversation

@dewabisma

@dewabisma dewabisma commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Moved skeleton update in miner reward branch to this branch.

  • updated skeleton styling
  • updated tx item skeleton

Note

Low Risk
Low risk UI-only changes that adjust theme color fields and loading placeholders; main risk is minor visual regressions in skeleton rendering.

Overview
Updates the loading Skeleton to use the V2 theme (context.colors) with a new base + two-tone highlight shimmer, and standardizes the animation duration.

Replaces the old Skeleton.txItem constructor with a dedicated TxItemSkeleton widget and switches activity loading states to render it.

Removes legacy skeleton colors from AppColorsTheme and updates AppColorsV2 to replace skeletonHighlight with skeletonHighlightA/skeletonHighlightB (including new default values).

Reviewed by Cursor Bugbot for commit 005bcff. Bugbot is set up for automated code reviews on this repo. Configure here.

dewabisma and others added 3 commits May 8, 2026 15:57
Rewrites Skeleton to use theme-aware skeletonHighlightA/B colors,
extracts TxItemSkeleton as a standalone widget, and converts
skeletonHighlight to two-stop skeletonHighlightA/B in AppColorsV2.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dewabisma dewabisma requested a review from n13 May 8, 2026 08:20
@n13

n13 commented May 9, 2026

Copy link
Copy Markdown
Collaborator

I've reviewed PR #480 thoroughly. Here's my review.

Overall

This is a well-scoped, low-risk UI cleanup. CI is green (Analyze, Bugbot, Security Reviewer all passing). The widget becomes simpler, more theme-driven, and removes a pre-existing footgun in Skeleton.circular/Skeleton's border-radius logic. Approving in spirit, with a few small suggestions below.

What's good

  • Drops the hardcoded _defaultSkeletonBaseColor / _defaultSkeletonHighlightColor fallbacks → fully theme-driven via context.colors (also matches the "fail early, no silent fallback" rule).
  • Splitting Skeleton.txItem into a dedicated TxItemSkeleton widget is cleaner — each shimmering rectangle gets its own animation and proper layout, instead of one fixed 40px-tall bar pretending to be a row.
  • All Skeleton.txItem callers (activity_screen.dart, activity_section.dart) are updated; no orphans left in the tree.
  • Skeleton.circular now actually applies BorderRadius.circular(size). Previously it set borderRadius = null and relied on the build-time heuristic width == height ? circular(width) : circular(4), which silently turned every square Skeleton into a circle. The new constructor makes the intent explicit.
  • Import switched to the canonical package:resonance_network_wallet/... path, consistent with the rest of v2.
  • The single MaterialApp in mobile-app/lib/app.dart uses v2/theme/app_theme.dart which registers both V1 and V2 extensions, so context.colors is always available — no risk of null! crash from this widget.

Concerns / suggestions

  1. Dead V1 fields left behind. After this PR, AppColorsTheme.skeletonBase and AppColorsTheme.skeletonHighlight in mobile-app/lib/features/styles/app_colors_theme.dart (lines 41–42, 81–82, 123–124, 165–166, 207–208, 246–247, 290–291) have no remaining consumers. Worth deleting them in this PR — DRY-wise we now have two parallel skeleton color definitions (V1+V2), only one of which is used.

  2. Subtle visual regression for square Skeletons. Previously Skeleton(width: 32, height: 32) rendered as a 16px-radius circle (because of the width == height shortcut). Now it renders as a 4px-radius rounded square. I checked all callers and none rely on this — the only square use was the old Skeleton.txItem icon block, which is rewritten. Still worth calling out in the PR description so reviewers know the icon block intentionally went from circular to rounded-square.

  3. Opacity widget triggers a saveLayer() for every skeleton on screen (3 in activity preview × multiple Skeletons inside TxItemSkeleton = ~15 save layers per loading state). Visually equivalent and cheaper:

decoration: BoxDecoration(
  borderRadius: borderRadius,
  color: context.colors.skeletonBase,
  gradient: LinearGradient(
    begin: Alignment.centerLeft,
    end: Alignment.centerRight,
    colors: [
      context.colors.skeletonHighlightA.withValues(alpha: 0.2),
      context.colors.skeletonHighlightB.withValues(alpha: 0.2),
      context.colors.skeletonHighlightA.withValues(alpha: 0.2),
    ],
    stops: const [0.0, 0.5, 1.0],
    transform: _SlideGradientTransform(_animation.value),
  ),
),

Single Container, no inner widget, no Opacity, no save layer. (You could also bake the 0.2 alpha directly into the V2 palette so this stays a one-line gradient.)

  1. Skeleton.circular lost its const-ness. Because BorderRadius.circular(size) isn't const-evaluable for a runtime size. No current callers, so no compile errors, but it does mean any future const Skeleton.circular(size: 16) won't compile. If you want to keep it const-friendly, leave borderRadius = null and resolve in build() like:
final br = widget.borderRadius ??
    (widget.width != null && widget.width == widget.height
        ? BorderRadius.circular(widget.width!)
        : BorderRadius.circular(4));

— but that re-introduces the heuristic from #2, so the simpler thing is to keep the current non-const constructor and accept it.

  1. Tiny nit in TxItemSkeleton:
  Widget build(BuildContext context) {
    final double txItemHeight = 32.0;
    final double txItemDetailHeight = 12.0;

    return Row(

Make these const double (or hoist to file-level constants) — then the Skeleton(...) calls below can also become const Skeleton(...), which lets Flutter elide rebuilds.

  1. AppColorsV2 has no .light() constructor (pre-existing, not introduced here), but adding two new required fields makes a future light theme slightly more painful. Worth noting.

  2. No tests / goldens for the visual change. Not blocking — the codebase doesn't have skeleton tests today — but the new look (solid base + 20% gradient overlay) is materially different from the old (full-strength 3-stop shimmer). A screenshot in the PR description would help the visual reviewer (@n13).

Verdict

LGTM with the dead V1 skeletonBase/skeletonHighlight cleanup as the only thing I'd ask for in this PR. The other items are nice-to-haves and fine as follow-ups.

Want me to push the V1 dead-field cleanup and/or the Opacity-removal optimization to the branch?

- Dead V1 fields left behind.
- Opacity widget triggers a saveLayer()
- Tiny nit in TxItemSkeleton
@dewabisma dewabisma merged commit aa78be6 into main May 11, 2026
3 checks passed
dewabisma added a commit that referenced this pull request May 11, 2026
* wip: pos flow

- finish input charge screen
- finish scan to pay screen

* feat: finish pos screens, and formatting

* feat: make charge button big in bottom of screen

* chore: formatting

* refresh miner balance periodically and on mining new block (#482)

* refresh miner balance periodically and on mining new block

* miner run script

miner needs to be run in release mode, otherwise very slow

* add logging with rotating logs

* Miner Version 0.4.3

* Skeleton widget update (#480)

* feat: update skeleton widget with improved shimmer and colors

Rewrites Skeleton to use theme-aware skeletonHighlightA/B colors,
extracts TxItemSkeleton as a standalone widget, and converts
skeletonHighlight to two-stop skeletonHighlightA/B in AppColorsV2.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: change skeleton to new one

* fix: PR review issues

- Dead V1 fields left behind.
- Opacity widget triggers a saveLayer()
- Tiny nit in TxItemSkeleton

---------

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: big clean up (#478)

* feat: update to new graphql

- comply with hasura syntax
- change to new graphql url in constants
- update data model construction from json to comply new hasura return value

* fix: revert to parse string

We have made hasura return string for number value.

* chore: formatting

* feat: finish mining reward screen

* feat: finish proper loading state

* feat: update empty state in home

* feat: big clean up

- Delete unused assets
- Delete unused widgets

* feat: update graphql wormhole to comply hasura

* feat: make planck as the highlighted mined stats and earned

* fix: query for transfer

change toHash to to_hash

* fix: import path

* feat: show current testnet details and redeem button

* feat: update skeleton widget with improved shimmer and colors

Rewrites Skeleton to use theme-aware skeletonHighlightA/B colors,
extracts TxItemSkeleton as a standalone widget, and converts
skeletonHighlight to two-stop skeletonHighlightA/B in AppColorsV2.

Co-authored-by: Cursor <cursoragent@cursor.com>

* revert: remove skeleton widget changes (moved to feat/skeleton-widget-update)

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: change skeleton to new one

* chore: formatting

---------

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Nikolaus Heger <nheger@gmail.com>
@dewabisma dewabisma deleted the feat/skeleton-widget-update branch June 22, 2026 03:42
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.

2 participants