Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ImageSliderScreen extends StatefulWidget {
- final List<RecipeStepsModel>? recipeStepsList;
- ImageSliderScreen({required this.recipeStepsList});
- @override
- _ImageSliderScreenState createState() => _ImageSliderScreenState();
- }
- class _ImageSliderScreenState extends State<ImageSliderScreen> {
- //int _current = 0;
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: _buildItems(context),
- );
- }
- Widget appBar(BuildContext context) {
- return Container(
- padding: EdgeInsets.only(top: 50),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- decoration: BoxDecoration(
- color: Color(0xffff8f8f8),
- borderRadius: BorderRadius.circular(15),
- ),
- child: IconButton(
- onPressed: () {
- Navigator.pop(context);
- },
- icon: Icon(Icons.arrow_back_ios),
- ),
- ),
- ],
- ),
- );
- }
- Widget _buildItems(BuildContext context) {
- return Column(
- children: <Widget>[
- appBar(context),
- Expanded(
- child: Center(
- child: CarouselSlider(
- options: CarouselOptions(
- enlargeCenterPage: true,
- enableInfiniteScroll: false,
- autoPlay: false,
- ),
- items: widget.recipeStepsList!
- .map(
- (e) => Column(
- children: [
- ClipRRect(
- borderRadius: BorderRadius.circular(8),
- child: Image.network(
- e.stepThumbnailLink!,
- width: 1000,
- height: 200,
- fit: BoxFit.cover,
- ),
- ),
- Text(
- e.name!,
- style: TextStyle(color: Colors.red),
- ),
- ],
- ),
- )
- .toList(),
- )),
- ),
- ],
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement