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

Animation is taking whole element not individual widgets #55

Open
troncomputers opened this issue Jan 4, 2022 · 1 comment
Open

Animation is taking whole element not individual widgets #55

troncomputers opened this issue Jan 4, 2022 · 1 comment

Comments

@troncomputers
Copy link

troncomputers commented Jan 4, 2022

Shimmer not applied:

  1. Container -> BorderRadius
  2. Animation to elements inside

shimmer_animation

  Widget productsLoading() {
    return Padding(
      padding: const EdgeInsets.all(10),
      child: Shimmer.fromColors(
        baseColor: Colors.grey[300]!,
        highlightColor: Colors.grey[100]!,
        child: ListView.separated(
          itemBuilder: (_, __) => Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.all(
                Radius.circular(10),
              ),
            ),
            child: Card(
              color: Colors.white,
              elevation: 0,
              child: Container(
                height: 90,
                color: Colors.white,
                padding: EdgeInsets.all(5),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    SizedBox(
                      width: 70,
                      height: 70,
                      child: SizedBox(
                        height: 65,
                        width: 65,
                      ),
                    ),
                    SizedBox(
                      width: 10,
                    ),
                    Expanded(
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.start,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        mainAxisSize: MainAxisSize.min,
                        children: [
                          SizedBox(
                            width: double.infinity,
                            height: 20,
                          ),
                          SizedBox(
                            height: 5,
                          ),
                          SizedBox(
                            width: double.infinity,
                            height: 20,
                          ),
                          SizedBox(
                            height: 5,
                          ),
                          Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              SizedBox(
                                width: 50,
                                height: 20,
                              ),
                              SizedBox(
                                width: 50,
                                height: 20,
                              )
                            ],
                          )
                        ],
                      ),
                    )
                  ],
                ),
              ),
            ),
          ),
          separatorBuilder: (_, __) => SizedBox(
            height: 7,
          ),
          itemCount: 7,
        ),
      ),
    );
  }

What am I doing wrong?

@i2gor87
Copy link

i2gor87 commented Mar 17, 2022

Just had similar problem. Try to wrap each widget with shimmer like

List<Widget> shimmerList = List.filled(10, Shimmer.fromColors(...));

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

No branches or pull requests

2 participants