ml-opensource / ml-opensource/flutter-template

Introduce shimmering loader placeholders

Open
#71 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
37
Forks
23
PR merge metrics
No merged PRs in 30d

Description

  1. A widget that adds a preconfigured shimmering parent.

  2. A widget for building the actual shapes, e.g.

     /// Pre-configured widget for adding loading shapes to the screen.
     class PlaceholderShape extends StatelessWidget {
       const PlaceholderShape({
         super.key,
         this.width,
         this.height,
         this.borderRadius,
         this.color,
       });
     
       const PlaceholderShape.square({
         super.key,
         double? size,
         this.borderRadius,
         this.color,
       })  : width = size,
             height = size;
     
       /// A rectangular shape that has the size of the text with the given style.
       PlaceholderShape.fromText({
         super.key,
         required String text,
         required TextStyle textStyle,
         this.borderRadius,
         this.color,
       })  : width = text.getSize(textStyle).width,
             height = text.getSize(textStyle).height;  
     
       final double? width;
       final double? height;
       final double? borderRadius;
       final Color? color;  
     
       @override
       Widget build(BuildContext context) {
         // TODO: Setup the default colour.
         final defaultColor = Colors.white54;
         
         return ClipRRect(
           borderRadius: BorderRadius.all(Radius.circular(borderRadius ?? .0)),
           child: SizedBox(
             width: width,
             height: height,
             child: ColoredBox(color: color ?? defaultColor),
           ),
         );
       }
     }
    
  3. So it can be used like this:

    AppShimmer(
      child: Column(
        children: [
            LoadingPlaceholderShape(...),
            LoadingPlaceholderShape(...),
        ],
      ),
    // or
    AppShimmer.column(
      children: [
        LoadingPlaceholderShape(...),
        LoadingPlaceholderShape(...),
      ],
    ),
    // or
    AppShimmer.row(
      children: [
        LoadingPlaceholderShape(...),
        LoadingPlaceholderShape(...),
      ],
    ),
    

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; begin by locating the Flutter widget entry points and dependency configuration, then read the linked shimmer package. Done means the requested shimmering parent and placeholder-shape widgets support the shown constructors and row/column usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.