Skip to content

Commit

Permalink
Merge e0c06c4 into 71eb236
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensdemelo committed Jul 15, 2019
2 parents 71eb236 + e0c06c4 commit 45a72e6
Showing 1 changed file with 51 additions and 51 deletions.
102 changes: 51 additions & 51 deletions README.md
Expand Up @@ -32,7 +32,7 @@ The best swiper for flutter , with multiple layouts, infinite loop. Compatible w

We are using this project [flutter_page_indicator](https://github.com/best-flutter/flutter_page_indicator) now .

# :sparkles::sparkles: New Features:PageTransformer
# :sparkles::sparkles: flutter_swiper: ^1.1.6 Features:PageTransformer

Finally, we have `PageTransformer` like android, just set a `transformer` to `Swiper`,
it returns a widget that has been transformed. For now, only support for layout `DEFAULT`.
Expand Down Expand Up @@ -122,17 +122,17 @@ import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
void main() => runApp(new MyApp());
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
return MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(title: 'Flutter Demo Home Page'),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
Expand All @@ -143,24 +143,24 @@ class MyHomePage extends StatefulWidget {
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: new Swiper(
body: Swiper(
itemBuilder: (BuildContext context,int index){
return new Image.network("http://via.placeholder.com/350x150",fit: BoxFit.fill,);
return Image.network("http://via.placeholder.com/350x150",fit: BoxFit.fill,);
},
itemCount: 3,
pagination: new SwiperPagination(),
control: new SwiperControl(),
pagination: SwiperPagination(),
control: SwiperControl(),
),
);
}
Expand All @@ -184,13 +184,13 @@ class _MyHomePageState extends State<MyHomePage> {
| onIndexChanged | void onIndexChanged(int index) | Called with the new index when the user swiped or autoplay |
| onTap | void onTap(int index) | Called when user tap ui. |
| duration | 300.0 | The milliscends of every transaction animation costs |
| pagination | null | set `new SwiperPagination()` to show default pagination
| control | null | set `new SwiperControl()` to show default control buttons
| pagination | null | set `SwiperPagination()` to show default pagination
| control | null | set `SwiperControl()` to show default control buttons


#### Pagination

The pagination extends from `SwiperPlugin`,the `SwiperPlugin` provides extra ui for `Swiper`.Set `new SwiperPagination()` to show default pagination.
The pagination extends from `SwiperPlugin`,the `SwiperPlugin` provides extra ui for `Swiper`.Set `SwiperPagination()` to show default pagination.


| Parameter | Default | Description |
Expand All @@ -202,11 +202,11 @@ The pagination extends from `SwiperPlugin`,the `SwiperPlugin` provides extra ui
If you'd like to customize your own pagination, you can do like this:

```
new Swiper(
Swiper(
...,
pagination:new SwiperCustomPagination(
pagination: SwiperCustomPagination(
builder:(BuildContext context, SwiperPluginConfig config){
return new YourOwnPaginatipon();
return YourOwnPaginatipon();
}
)
);
Expand All @@ -217,7 +217,7 @@ new Swiper(

#### Control buttons

The control also extends from `SwiperPlugin`,set `new SwiperControl()` to show default control buttons.
The control also extends from `SwiperPlugin`,set `SwiperControl()` to show default control buttons.


| Parameter | Default | Description |
Expand All @@ -231,7 +231,7 @@ The control also extends from `SwiperPlugin`,set `new SwiperControl()` to show d

#### Controller

The `Controller` is used to control the `index` of the Swiper, start or stop autoplay.You can create a controller by `new SwiperController()` and save the instance by futher usage.
The `Controller` is used to control the `index` of the Swiper, start or stop autoplay.You can create a controller by `SwiperController()` and save the instance by futher usage.


| Method | Description |
Expand All @@ -255,9 +255,9 @@ The `Controller` is used to control the `index` of the Swiper, start or stop aut
![](https://github.com/jzoom/images/raw/master/layout1.gif)

```
new Swiper(
Swiper(
itemBuilder: (BuildContext context, int index) {
return new Image.network(
return Image.network(
"http://via.placeholder.com/288x188",
fit: BoxFit.fill,
);
Expand All @@ -274,9 +274,9 @@ new Swiper(
![](https://github.com/jzoom/images/raw/master/layout2.gif)

```
new Swiper(
Swiper(
itemBuilder: (BuildContext context, int index) {
return new Image.network(
return Image.network(
"http://via.placeholder.com/288x188",
fit: BoxFit.fill,
);
Expand All @@ -290,9 +290,9 @@ new Swiper(
![](https://github.com/jzoom/images/raw/master/layout3.gif)

```
new Swiper(
Swiper(
itemBuilder: (BuildContext context, int index) {
return new Image.network(
return Image.network(
"http://via.placeholder.com/288x188",
fit: BoxFit.fill,
);
Expand All @@ -310,27 +310,27 @@ new Swiper(
Very easy to create you own custom animation:
```
new Swiper(
Swiper(
layout: SwiperLayout.CUSTOM,
customLayoutOption: new CustomLayoutOption(
customLayoutOption: CustomLayoutOption(
startIndex: -1,
stateCount: 3
).addRotate([
-45.0/180,
0.0,
45.0/180
]).addTranslate([
new Offset(-370.0, -40.0),
new Offset(0.0, 0.0),
new Offset(370.0, -40.0)
Offset(-370.0, -40.0),
Offset(0.0, 0.0),
Offset(370.0, -40.0)
]),
itemWidth: 300.0,
itemHeight: 200.0,
itemBuilder: (context, index) {
return new Container(
return Container(
color: Colors.grey,
child: new Center(
child: new Text("$index"),
child: Center(
child: Text("$index"),
),
);
},
Expand All @@ -342,17 +342,17 @@ The `CustomLayoutOption` is designed to describe animations.
It is very easy to specify every state of items in Swiper.

```
new CustomLayoutOption(
CustomLayoutOption(
startIndex: -1, /// Which index is the first item of array below
stateCount: 3 /// array length
).addRotate([ // rotation of every item
-45.0/180,
0.0,
45.0/180
]).addTranslate([ /// offset of every item
new Offset(-370.0, -40.0),
new Offset(0.0, 0.0),
new Offset(370.0, -40.0)
Offset(-370.0, -40.0),
Offset(0.0, 0.0),
Offset(370.0, -40.0)
])
```
Expand All @@ -362,38 +362,38 @@ new CustomLayoutOption(
![Example](https://github.com/jzoom/images/raw/master/swiper-example.gif)

```
new ConstrainedBox(
child: new Swiper(
ConstrainedBox(
child: Swiper(
outer:false,
itemBuilder: (c, i) {
return new Wrap(
return Wrap(
runSpacing: 6.0,
children: [0,1,2,3,4,5,6,7,8,9].map((i){
return new SizedBox(
return SizedBox(
width: MediaQuery.of(context).size.width/5,
child: new Column(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new SizedBox(
child: new Container(
child: new Image.network("https://fuss10.elemecdn.com/c/db/d20d49e5029281b9b73db1c5ec6f9jpeg.jpeg%3FimageMogr/format/webp/thumbnail/!90x90r/gravity/Center/crop/90x90"),
SizedBox(
child: Container(
child: Image.network("https://fuss10.elemecdn.com/c/db/d20d49e5029281b9b73db1c5ec6f9jpeg.jpeg%3FimageMogr/format/webp/thumbnail/!90x90r/gravity/Center/crop/90x90"),
),
height: MediaQuery.of(context).size.width * 0.12,
width: MediaQuery.of(context).size.width * 0.12,
),
new Padding(padding: new EdgeInsets.only(top:6.0),child: new Text("$i"),)
Padding(padding: EdgeInsets.only(top:6.0),child: Text("$i"),)
],
),
);
}).toList(),
);
},
pagination: new SwiperPagination(
margin: new EdgeInsets.all(5.0)
pagination: SwiperPagination(
margin: EdgeInsets.all(5.0)
),
itemCount: 10,
),
constraints:new BoxConstraints.loose(new Size(screenWidth, 170.0))
constraints: BoxConstraints.loose(Size(screenWidth, 170.0))
),
```
Expand Down

0 comments on commit 45a72e6

Please sign in to comment.