1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Flutter] Flutter Carousel Item Overflowed From Container

Discussão em 'Mobile' iniciado por Stack, Setembro 18, 2025.

  1. Stack

    Stack Membro Participativo

    my carousel image inside of the container is overflow little bit. Can you give me how to fix

    I already tried to wrap inside the cliprreact, but still overflow or in some case the image wont fill the container, like there is little bit gap.


    class CarouselBanner extends StatelessWidget {
    const CarouselBanner({super.key});

    @override
    Widget build(BuildContext context) {
    return CarouselSlider(
    options: CarouselOptions(
    height: 180,
    autoPlay: true,
    autoPlayAnimationDuration: Duration(seconds: 2),
    autoPlayCurve: Curves.fastOutSlowIn,
    enlargeCenterPage: true,
    ),
    items: ['assets/foto.jpg', 'assets/foto.jpg', 'assets/foto.jpg'].map((
    path,
    ) {
    return Builder(
    builder: (BuildContext context) {
    return Container(
    clipBehavior: Clip.hardEdge,
    decoration: BoxDecoration(
    border: Border.all(width: 2),
    borderRadius: BorderRadius.circular(20),
    ),
    child: Image.asset(
    path,
    fit: BoxFit.cover,
    width: double.infinity,
    height: double.infinity,
    ),
    );
    },
    );
    }).toList(),
    );
    }
    }

    Continue reading...

Compartilhe esta Página