Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/shrink wrap #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -91,6 +91,7 @@ CardListSkeleton(
| colors | List<Color> | 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

Expand All @@ -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
29 changes: 15 additions & 14 deletions README_zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<Color> | 横条的渐变 | 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<Color> | 横条的渐变 | null, 根据 Theme 获取默认值 |
| backgroundColor | Color | 背景色 | null, 根据 Theme 获取默认值 |
| theme | SkeletonTheme | 预置的 Theme | SkeletonTheme.Light |
| shrinkWrap | bool | 控制列表的 shrinkWrap | false |

## Example

Expand All @@ -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
1 change: 1 addition & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
15 changes: 15 additions & 0 deletions example/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -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"
7 changes: 3 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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.
Expand All @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion lib/src/skeleton_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class SkeletonStyle {
final List<Color> colors;
final Color backgroundColor;
final SkeletonTheme theme;
final bool shrinkWrap;

SkeletonStyle({
this.isAnimation: true,
Expand All @@ -23,6 +24,7 @@ class SkeletonStyle {
this.colors,
this.backgroundColor,
this.theme: SkeletonTheme.Light,
this.shrinkWrap,
});

const SkeletonStyle.origin()
Expand All @@ -34,5 +36,6 @@ class SkeletonStyle {
padding = const EdgeInsets.all(16.0),
colors = null,
backgroundColor = null,
theme = SkeletonTheme.Light;
theme = SkeletonTheme.Light,
shrinkWrap = false;
}
1 change: 1 addition & 0 deletions lib/src/widget/card_list_skeleton.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions lib/src/widget/list_skeleton.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down