when using the stack with carousel it work for a which but when navigating or scrolling the app suddenly freeze and crashes by showing the carousel package code. and i have also used listview biulder.
this code is just of carousel and stack
class Carousels extends StatelessWidget {
const Carousels({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Stack(
children: [
ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
child: Carousel(
autoplay: false,
dotSize: 4.0,
dotSpacing: 15.0,
dotColor: Colors.lightBlueAccent,
indicatorBgPadding: 5.0,
dotBgColor: Color.fromARGB(255, 100, 99, 100).withOpacity(0.5),
images: const [
AssetImage('assets/finallogo.png'),
AssetImage('assets/rr.png'),
],
),
),
Positioned(
top: 0,
right: 5,
child: Icon(
Icons.favorite,
color: Colors.red,
),
),
Positioned(
child: Icon(
Icons.star_rate_sharp,
color: Colors.white,
),
)
],
);
}
}
2
Answers
add Sizedbox like below
You can use carousel_slider package:
carousel_slider: ^4.2.1