Advertisement
Nisanth-Reddy

Untitled

May 20th, 2021
825
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. class ImageSliderScreen extends StatefulWidget {
  2. final List<RecipeStepsModel>? recipeStepsList;
  3. ImageSliderScreen({required this.recipeStepsList});
  4. @override
  5. _ImageSliderScreenState createState() => _ImageSliderScreenState();
  6. }
  7.  
  8. class _ImageSliderScreenState extends State<ImageSliderScreen> {
  9. //int _current = 0;
  10. @override
  11. Widget build(BuildContext context) {
  12. return Scaffold(
  13. body: _buildItems(context),
  14. );
  15. }
  16.  
  17. Widget appBar(BuildContext context) {
  18. return Container(
  19. padding: EdgeInsets.only(top: 50),
  20. child: Row(
  21. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  22. children: [
  23. Container(
  24. decoration: BoxDecoration(
  25. color: Color(0xffff8f8f8),
  26. borderRadius: BorderRadius.circular(15),
  27. ),
  28. child: IconButton(
  29. onPressed: () {
  30. Navigator.pop(context);
  31. },
  32. icon: Icon(Icons.arrow_back_ios),
  33. ),
  34. ),
  35. ],
  36. ),
  37. );
  38. }
  39.  
  40. Widget _buildItems(BuildContext context) {
  41. return Column(
  42. children: <Widget>[
  43. appBar(context),
  44. Expanded(
  45. child: Center(
  46. child: CarouselSlider(
  47. options: CarouselOptions(
  48. enlargeCenterPage: true,
  49. enableInfiniteScroll: false,
  50. autoPlay: false,
  51. ),
  52. items: widget.recipeStepsList!
  53. .map(
  54. (e) => Column(
  55. children: [
  56. ClipRRect(
  57. borderRadius: BorderRadius.circular(8),
  58. child: Image.network(
  59. e.stepThumbnailLink!,
  60. width: 1000,
  61. height: 200,
  62. fit: BoxFit.cover,
  63. ),
  64. ),
  65. Text(
  66. e.name!,
  67. style: TextStyle(color: Colors.red),
  68. ),
  69. ],
  70. ),
  71. )
  72. .toList(),
  73. )),
  74. ),
  75. ],
  76. );
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement