Skip to content

Commit

Permalink
Fix #11 #15
Browse files Browse the repository at this point in the history
  • Loading branch information
jzoom committed Sep 20, 2018
1 parent 678a421 commit d287b9c
Show file tree
Hide file tree
Showing 24 changed files with 563 additions and 1,155 deletions.
8 changes: 8 additions & 0 deletions .idea/libraries/Dart_Packages.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

619 changes: 328 additions & 291 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README-ZH.md
Expand Up @@ -234,7 +234,7 @@ new Swiper(
| 参数 | 默认值 | 描述 |
| :------------ |:---------------:| :-----|
| autoplayDely | 3000 | 自动播放延迟毫秒数. |
| autoplayDiableOnInteraction | true | 当用户拖拽的时候,是否停止自动播放. |
| autoplayDisableOnInteraction | true | 当用户拖拽的时候,是否停止自动播放. |



Expand Down
8 changes: 2 additions & 6 deletions README.md
Expand Up @@ -33,10 +33,7 @@ Finally, we have `PageTransformer` like android, just set `transformItemBuilder`
it returns a widget that has been transformed. For now, only support for layout `DEFAULT`.
Thanks to @FlutterRocks ,you've done great job 👏.

![](https://github.com/jzoom/images/raw/master/transform1.gif)

>See the code [here](https://github.com/best-flutter/flutter_swiper/blob/master/example/lib/swiper_tranform_depeth.dart).
We are now using this project [transformer_page_view](https://github.com/best-flutter/transformer_page_view).


# :sparkles::sparkles: New Features:Layout
Expand Down Expand Up @@ -247,8 +244,7 @@ The `Controller` is used to control the `index` of the Swiper, start or stop aut
| Parameter | Default | Description |
| :------------ |:---------------:| :-----|
| autoplayDelay | 3000 | Autoplay delay milliseconds. |
| autoplayDiableOnInteraction | true | Disable autoplay when user drag. |

| autoplayDisableOnInteraction | true | If set true, `autoplay` is disabled when use swipes. |

## Build in layouts
![](https://github.com/jzoom/images/raw/master/layout1.gif)
Expand Down
Binary file added example/ios/MyLaunch.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion example/ios/Runner.xcodeproj/project.pbxproj
Expand Up @@ -21,6 +21,7 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
D57DA1A0215230B4005D4B7F /* MyLaunch.jpg in Resources */ = {isa = PBXBuildFile; fileRef = D57DA19F215230B4005D4B7F /* MyLaunch.jpg */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -56,6 +57,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D57DA19F215230B4005D4B7F /* MyLaunch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = MyLaunch.jpg; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -88,10 +90,10 @@
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
D57DA19F215230B4005D4B7F /* MyLaunch.jpg */,
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -161,6 +163,7 @@
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = 23T2HFANR5;
};
};
};
Expand Down Expand Up @@ -191,6 +194,7 @@
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
D57DA1A0215230B4005D4B7F /* MyLaunch.jpg in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
Expand Down Expand Up @@ -372,6 +376,7 @@
ARCHS = arm64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 23T2HFANR5;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -396,6 +401,7 @@
ARCHS = arm64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 23T2HFANR5;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand Down
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
22 changes: 15 additions & 7 deletions example/ios/Runner/Base.lproj/LaunchScreen.storyboard
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -14,15 +18,19 @@
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="MyLaunch.jpg" translatesAutoresizingMaskIntoConstraints="NO" id="uio-Um-rja">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
<constraint firstItem="uio-Um-rja" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="2KC-gl-GLX"/>
<constraint firstAttribute="trailing" secondItem="uio-Um-rja" secondAttribute="trailing" id="3pb-lM-hI4"/>
<constraint firstItem="uio-Um-rja" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="XiB-5L-JlS"/>
<constraint firstAttribute="bottom" secondItem="uio-Um-rja" secondAttribute="bottom" id="iEo-Jc-AcY"/>
</constraints>
</view>
</viewController>
Expand All @@ -32,6 +40,6 @@
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
<image name="MyLaunch.jpg" width="720" height="1280"/>
</resources>
</document>
14 changes: 9 additions & 5 deletions example/ios/Runner/Base.lproj/Main.storyboard
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
Expand All @@ -14,9 +18,9 @@
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
Expand Down
45 changes: 23 additions & 22 deletions example/lib/InnerSwiper.dart
Expand Up @@ -29,8 +29,12 @@ class _InnerSwiperState extends State<InnerSwiper> {
@override
void initState() {
controller = new SwiperController();
autoplayes = new List()..length=10..fillRange(0, 10,false);
controllers = new List()..length=10..fillRange(0, 10,new SwiperController());
autoplayes = new List()
..length = 10
..fillRange(0, 10, false);
controllers = new List()
..length = 10
..fillRange(0, 10, new SwiperController());
super.initState();
}

Expand All @@ -47,7 +51,7 @@ class _InnerSwiperState extends State<InnerSwiper> {
children: <Widget>[
new SizedBox(
child: new Swiper(
controller:controllers[index],
controller: controllers[index],
pagination: new SwiperPagination(),
itemCount: 4,
itemBuilder: (BuildContext context, int index) {
Expand All @@ -56,30 +60,27 @@ class _InnerSwiperState extends State<InnerSwiper> {
child: new Text("jkfjkldsfjd"),
);
},

autoplay: autoplayes[index],

),
height: 300.0,
),
new RaisedButton(onPressed: (){

setState(() {
autoplayes[index] = true;
});

},child: new Text("Start autoplay"),),

new RaisedButton(onPressed: (){


setState(() {
autoplayes[index] = false;
});
},child: new Text("End autoplay"),),

new RaisedButton(
onPressed: () {
setState(() {
autoplayes[index] = true;
});
},
child: new Text("Start autoplay"),
),
new RaisedButton(
onPressed: () {
setState(() {
autoplayes[index] = false;
});
},
child: new Text("End autoplay"),
),
new Text("is autoplay: ${autoplayes[index]}")

],
);
},
Expand Down
2 changes: 2 additions & 0 deletions example/lib/main.dart
Expand Up @@ -73,6 +73,8 @@ class _MyHomePageState extends State<MyHomePage> {

@override
Widget build(BuildContext context) {
// DateTime moonLanding = DateTime.parse("1969-07-20");

return new Scaffold(
appBar: new AppBar(
title: Text(widget.title),
Expand Down
32 changes: 27 additions & 5 deletions example/lib/src/ExampleCustom.dart
Expand Up @@ -11,8 +11,7 @@ class ExampleCustom extends StatefulWidget {
}

class _ExampleCustomState extends State<ExampleCustom> {
//properties whant to custom

//properties want to custom
int _itemCount;

bool _loop;
Expand Down Expand Up @@ -41,6 +40,8 @@ class _ExampleCustomState extends State<ExampleCustom> {

double _fade;

bool _autoplayDisableOnInteraction;

CustomLayoutOption customLayoutOption;

Widget _buildItem(BuildContext context, int index) {
Expand Down Expand Up @@ -87,13 +88,13 @@ class _ExampleCustomState extends State<ExampleCustom> {
_viewportFraction = 0.8;
_outer = false;
_scrollDirection = Axis.horizontal;
_autoplayDisableOnInteraction = false;
super.initState();
}

// maintain the index

Widget buildSwiper() {
Navigator;
return new Swiper(
onTap: (int index) {
// Navigator
Expand Down Expand Up @@ -129,12 +130,13 @@ class _ExampleCustomState extends State<ExampleCustom> {
itemBuilder: _buildItem,
itemCount: _itemCount,
scrollDirection: _scrollDirection,
autoplayDisableOnInteraction: _autoplayDisableOnInteraction,
pagination: new SwiperPagination(),
);
}

SwiperController _controller;

TextEditingController numberController = new TextEditingController();
@override
Widget build(BuildContext context) {
return new Column(children: <Widget>[
Expand All @@ -146,6 +148,7 @@ class _ExampleCustomState extends State<ExampleCustom> {
new Expanded(
child: new ListView(
children: <Widget>[
new Text("Index:$_currentIndex"),
new Row(
children: <Widget>[
new RaisedButton(
Expand All @@ -160,7 +163,19 @@ class _ExampleCustomState extends State<ExampleCustom> {
},
child: new Text("Next"),
),
new Text("Index:$_currentIndex")
new Expanded(
child: new TextField(
controller: numberController,
)),
new RaisedButton(
onPressed: () {
var text = numberController.text;
setState(() {
_currentIndex = int.parse(text);
});
},
child: new Text("Update"),
),
],
),
new FormWidget(
Expand All @@ -185,6 +200,13 @@ class _ExampleCustomState extends State<ExampleCustom> {
onChanged: (bool value) => setState(() => _scrollDirection =
value ? Axis.horizontal : Axis.vertical)),
),
new FormWidget(
label: "autoplayDisableOnInteractio",
child: new Switch(
value: _autoplayDisableOnInteraction,
onChanged: (bool value) =>
setState(() => _autoplayDisableOnInteraction = value)),
),
//Pannel Begin
new FormWidget(
label: "loop",
Expand Down

0 comments on commit d287b9c

Please sign in to comment.