From ca9823ef3955090246edc710e5fb447430b93c19 Mon Sep 17 00:00:00 2001 From: Ewaoluwa Ogunneye Date: Thu, 3 Sep 2020 13:06:07 +0400 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9E=95=20Add=20shrinkWrap=20property=20t?= =?UTF-8?q?o=20SkeletonStyle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +++--- README_zh-cn.md | 29 ++++++++++--------- example/android/gradle.properties | 1 + .../ios/Flutter/flutter_export_environment.sh | 15 ++++++++++ example/pubspec.yaml | 7 ++--- lib/src/skeleton_style.dart | 5 +++- lib/src/widget/list_skeleton.dart | 1 + 7 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 example/ios/Flutter/flutter_export_environment.sh diff --git a/README.md b/README.md index bb478d7..ff755d1 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ CardListSkeleton( ## SkeletonStyle Properties | Name | Type | Meaning | Default | -|:----------------|:--------------|:-------------------------------|:-------------------------| +| :-------------- | :------------ | :----------------------------- | :----------------------- | | isAnimation | bool | if show animation or not | true | | isShowAvatar | bool | if show avatar or not | true | | isCircleAvatar | bool | if the avatar is circle or not | true | @@ -91,6 +91,7 @@ CardListSkeleton( | colors | List | gradient color of bar | null, specified by theme | | backgroundColor | Color | background color of container | null, specified by theme | | theme | SkeletonTheme | pre-install theme | SkeletonTheme.Light | +| shrinkWrap | bool | control shrinkWrap of the list | false | ## Example @@ -100,6 +101,6 @@ CardListSkeleton( ![Example APK Download](https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_v0.1.0.jpg?raw=true) -[1]:https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_4.jpg?raw=true -[2]:https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_5.jpg?raw=true -[3]:https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_6.jpg?raw=true +[1]: https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_4.jpg?raw=true +[2]: https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_5.jpg?raw=true +[3]: https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_6.jpg?raw=true diff --git a/README_zh-cn.md b/README_zh-cn.md index 1a2757f..71c59f7 100644 --- a/README_zh-cn.md +++ b/README_zh-cn.md @@ -79,17 +79,18 @@ CardListSkeleton( ## SkeletonStyle 参数 -| 名称 | 类型 | 描述 | 默认值 | -|:----------------|:--------------|:----------------|:-----------------------| -| isAnimation | bool | 是否显示动画 | true | -| isShowAvatar | bool | 是否显示头像 | true | -| isCircleAvatar | bool | 头像是否显示成圆形 | true | -| barCount | int | 横条的数量 | 2 | -| borderRadius | BorderRadius | 圆角值 | 0 | -| padding | EdgeInsets | padding | 16 | -| colors | List | 横条的渐变 | null, 根据Theme获取默认值 | -| backgroundColor | Color | 背景色 | null, 根据Theme获取默认值 | -| theme | SkeletonTheme | 预置的Theme | SkeletonTheme.Light | +| 名称 | 类型 | 描述 | 默认值 | +| :-------------- | :------------ | :-------------------- | :-------------------------- | +| isAnimation | bool | 是否显示动画 | true | +| isShowAvatar | bool | 是否显示头像 | true | +| isCircleAvatar | bool | 头像是否显示成圆形 | true | +| barCount | int | 横条的数量 | 2 | +| borderRadius | BorderRadius | 圆角值 | 0 | +| padding | EdgeInsets | padding | 16 | +| colors | List | 横条的渐变 | null, 根据 Theme 获取默认值 | +| backgroundColor | Color | 背景色 | null, 根据 Theme 获取默认值 | +| theme | SkeletonTheme | 预置的 Theme | SkeletonTheme.Light | +| shrinkWrap | bool | 控制列表的 shrinkWrap | false | ## Example @@ -99,6 +100,6 @@ CardListSkeleton( ![Example APK Download](https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_v0.1.0.jpg?raw=true) -[1]:https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_4.jpg?raw=true -[2]:https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_5.jpg?raw=true -[3]:https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_6.jpg?raw=true +[1]: https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_4.jpg?raw=true +[2]: https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_5.jpg?raw=true +[3]: https://github.com/wuzhendev/assets/blob/master/flutter_skeleton/flutter_skeleton_6.jpg?raw=true diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 8bd86f6..7be3d8b 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1 +1,2 @@ org.gradle.jvmargs=-Xmx1536M +android.enableR8=true diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh new file mode 100644 index 0000000..ee3d5bf --- /dev/null +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=D:\flutter" +export "FLUTTER_APPLICATION_PATH=C:\Users\Flutter\Source Code\Flutter\Projects\flutter_skeleton\example" +export "FLUTTER_TARGET=lib\main.dart" +export "FLUTTER_BUILD_DIR=build" +export "SYMROOT=${SOURCE_ROOT}/../build\ios" +export "OTHER_LDFLAGS=$(inherited) -framework Flutter" +export "FLUTTER_FRAMEWORK_DIR=D:\flutter\bin\cache\artifacts\engine\ios" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 632c3e1..e403f84 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_skeleton_example description: Demonstrates how to use the flutter_skeleton plugin. -publish_to: 'none' +publish_to: "none" environment: sdk: ">=2.1.0 <3.0.0" @@ -9,8 +9,8 @@ dependencies: flutter: sdk: flutter - flutter_skeleton: - path: ../ + # flutter_skeleton: + # path: ../ # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. @@ -28,7 +28,6 @@ dev_dependencies: # The following section is specific to Flutter. flutter: - # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. diff --git a/lib/src/skeleton_style.dart b/lib/src/skeleton_style.dart index 723a881..89fc2ca 100644 --- a/lib/src/skeleton_style.dart +++ b/lib/src/skeleton_style.dart @@ -12,6 +12,7 @@ class SkeletonStyle { final List colors; final Color backgroundColor; final SkeletonTheme theme; + final bool shrinkWrap; SkeletonStyle({ this.isAnimation: true, @@ -23,6 +24,7 @@ class SkeletonStyle { this.colors, this.backgroundColor, this.theme: SkeletonTheme.Light, + this.shrinkWrap, }); const SkeletonStyle.origin() @@ -34,5 +36,6 @@ class SkeletonStyle { padding = const EdgeInsets.all(16.0), colors = null, backgroundColor = null, - theme = SkeletonTheme.Light; + theme = SkeletonTheme.Light, + shrinkWrap = false; } diff --git a/lib/src/widget/list_skeleton.dart b/lib/src/widget/list_skeleton.dart index 3647133..1703073 100644 --- a/lib/src/widget/list_skeleton.dart +++ b/lib/src/widget/list_skeleton.dart @@ -16,6 +16,7 @@ class ListSkeleton extends StatelessWidget { @override Widget build(BuildContext context) { return ListView.separated( + shrinkWrap: style.shrinkWrap, physics: const NeverScrollableScrollPhysics(), itemCount: length, separatorBuilder: (BuildContext context, int index) { From 43dec1bcb833c868b230439436deb6ee33cb360e Mon Sep 17 00:00:00 2001 From: Ewaoluwa Ogunneye Date: Thu, 3 Sep 2020 13:08:07 +0400 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A7=99=F0=9F=8F=BD=E2=80=8D=E2=99=82?= =?UTF-8?q?=EF=B8=8F=20Effect=20the=20shrinkWrap=20property=20in=20the=20C?= =?UTF-8?q?ardListSkeleton=20also?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/widget/card_list_skeleton.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/src/widget/card_list_skeleton.dart b/lib/src/widget/card_list_skeleton.dart index 8fb8d77..d67a362 100644 --- a/lib/src/widget/card_list_skeleton.dart +++ b/lib/src/widget/card_list_skeleton.dart @@ -16,6 +16,7 @@ class CardListSkeleton extends StatelessWidget { @override Widget build(BuildContext context) { return ListView.builder( + shrinkWrap: style.shrinkWrap, physics: const NeverScrollableScrollPhysics(), padding: EdgeInsets.only(top: 16.0), itemCount: length,