-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dart
128 lines (96 loc) · 3.65 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import 'package:flutter/material.dart';
import 'package:flexi_productimage_slider/flexi_productimage_slider.dart';
import 'package:gallery_zoom_slides/gallery_zoom_slides.dart';
void main() async {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'flexi_productimage_slider',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'flexi_productimage_slider'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
List<String> arrayImages = const [
"https://i.ibb.co/ZLFHX3F/1.png",
"https://i.ibb.co/JKJvs5S/2.png",
"https://i.ibb.co/LCzV7b3/3.png",
"https://i.ibb.co/L8JHn1L/4.png",
"https://i.ibb.co/7RWNCXH/5.png",
"https://i.ibb.co/bBsh5Pm/6.png",
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
const SizedBox(height: 10,),
flexiProductimageSlider(
//required fields
arrayImages: arrayImages,
// optional fields
//set where you want to set your thumbnail
sliderStyle: SliderStyle.overSlider,//.nextToSlider
// set you slider height like 1.0,1.5,2.0 etc...
aspectRatio: 0.8,
//set content mode of image
boxFit: BoxFit.cover,
//set this if you want to set any default image index when it loads
selectedImagePosition: 0,
//set your thumbnail alignment in slider
thumbnailAlignment: ThumbnailAlignment.left,//.right , .bottom
thumbnailBorderType: ThumbnailBorderType.all,//.bottom, .all
thumbnailBorderWidth: 1.5,//double value
//set corner radius of your thumbnail
thumbnailBorderRadius: 2,
//set your thumbnail height & width
//NOTE : if you set ThumbnailShape.circle then set thumbnail width height same
thumbnailWidth: 55,
thumbnailHeight: 55,
//set color of current image thumbnail border
thumbnailBorderColor: Colors.blue,
//make you action when user click on image
onTap: (index){
print("selected index : $index");
//for zooming effect on click
Navigator.push(context, MaterialPageRoute(builder: (context)=>
galleryZoomSlides(
//required fields
arrayImages: arrayImages,
//Optional fields
zoomTheme: ZoomTheme.theme3,//.theme1, .theme2, .theme3
selectedImagePosition: index,
selectedThumbnailColor: Colors.blue,
)
)
);
},
),
],
),
),
// This trailing comma makes auto-formatting nicer for build methods.
);
}
}