Skip to content

Commit

Permalink
Merge branch 'dev' into 'master'
Browse files Browse the repository at this point in the history
Merge

See merge request tech_client/scroll_kit!3
  • Loading branch information
endless7 committed Sep 6, 2022
2 parents aecbad9 + 7fb80df commit f9ac54a
Show file tree
Hide file tree
Showing 34 changed files with 6,388 additions and 729 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ migrate_working_dir/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
# /pubspec.lock
**/doc/api/
.dart_tool/
.packages
Expand Down
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.0.1
## 1.0.0

* TODO: Describe initial release.
- [] JumpTo(int index)
- [] ScrollTo(int index)
- [] Load list content from both leading and trailing direction.
- [] Reuse Element and RenderObject of list item.
- [] Provide life-cycle callbacks of list item.
- [] Load more list items without refreshing the whole list.
- [] Provides compatibility with refresh components(SmartRefresher).
73 changes: 73 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributing

Thank you for your interest in open source contributions.
Not only the code, but also contributions such as issues and rich documents are also welcome.

Please follow the guidelines in this article to make open source contributions to the UME project.

- [Contributing](#contributing)
- [How to contact author](#how-to-contact-author)
- [How to raise an Issue](#how-to-raise-an-issue)
- [How to raise a Pull Request](#how-to-raise-a-pull-request)
- [Commit Message specification](#commit-message-specification)

## How to contact author

**Maybe...**

- Found a bug in the code, or an error in the documentation
- Produces an exception when you use the UME
- UME is not compatible with the new version Flutter
- Have a good idea or suggestion

You can [submit an issue](#how-to-raise-an-issue) in any of the above situations。

**Maybe...**

- Communicate with the author
- Communicate with more community developers
- Cooperate with UME

Welcome to [Join the ByteDance Flutter Exchange Group](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=b07u55bb-68f0-4a4b-871d-687637766a68).

Or contact [author](mailto:[email protected]).

## How to raise an Issue

1. Go to Issues.
2. Search for similar situations, if there is a match, directly feedback in it.
3. If there is not, press New issue to raise a new one.
4. Select a template.
5. Describe your situation, and fill in the template.
6. It is better to attach a demo that can reproduce the problem.

## How to raise a Pull Request

1. Fork the repository.
2. Clone your fork repository.
3. Checkout to the correct develop branch, and then create a new brnach based on the develop branch.
4. Edit code.
5. Edit test code in example project, and test it manually.
6. Edit unit test in test directory.
7. Commit your changes and push it. Please follow the [Commit Message specification](#commit-message-specification) to write the commit message.
8. Create Pull Request in GitHub, and fill in the template.

## Commit Message specification

1. Please use english.
2. If you have references, please attach a link.
3. Format: `[tags] description`
1. `tags` is the type of PR, such as `fix`, `feat`, `improve`.
2. `description` is used to describe changes.

The following is a standard Commit message example:

``` plaintext
[fix] README.md document syntax error
```

``` plaintext
[feat] New feature description
[https://flutter.dev/dash](https://flutter.dev/dash)
```
66 changes: 65 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1 +1,65 @@
TODO: Add your license here.
MIT License

Copyright (c) 2022 ByteDance Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

MIT License

Copyright (c) 2019 Quire

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

MIT License

Copyright (c) 2018 Jpeng

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
77 changes: 52 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,66 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
scroll_kit
---

For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->

TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
ScrollKit provides additional features for list in Flutter Apps.

## Features

TODO: List what your package can do. Maybe include images, gifs, or videos.
- [] JumpTo(int index).
- [] ScrollTo(int index).
- [] Load list content from both leading and trailing direction.
- [] Reuse the Element and RenderObject of list item.
- [] Provide life-cycle callbacks of list item.
- [] Load more list items without refreshing the whole list.
- [] Provides JumpTo, ScrollTo with compatibility of refresh components(SmartRefresher).

## Getting started

TODO: List prerequisites and provide or point to information on how to
start using the package.
```yaml
scroll_kit: ^1.0.0
```
## Usage
TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.

```dart
const like = 'sample';
final scrollView = CustomScrollView(
slivers: [
SKSliverList(
delegate: SKSliverChildBuilderDelegate((c, i) {
if (i % 2 == 0) {
return Container(
height: 100,
child: Text(i.toString()),
color: Colors.grey,
margin: EdgeInsets.only(top: 3),
);
} else {
return Container(
height: 100,
child: Text(i.toString()),
color: Colors.red,
margin: EdgeInsets.only(top: 3),
);
}
}, onAppear: (i) {
print("Appear: " + i.toString());
}, onDisAppear: (i) {
print("Disappear: " + i.toString());
}, reuseIdentifier: (i) {
if (i % 2 == 0) {
return "type1";
} else {
return "type2";
}
}, childCount: 100))
],
);
```

## Additional information
## Reference
- [scroll_to_index](https://pub.dev/packages/scroll_to_index)
- [pull_to_refresh](https://pub.dev/packages/pull_to_refresh)

TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
## Contributing
- This project is licensed under the MIT License.
- Welcome to [Join the ByteDance Flutter Exchange Group](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=b07u55bb-68f0-4a4b-871d-687637766a68).
- Any questions or suggestions, please feel free to contact me at [email protected].
4 changes: 3 additions & 1 deletion example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -171,6 +171,7 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -185,6 +186,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down
12 changes: 11 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import 'package:example/position_page.dart';
// Copyright (2022) Bytedance Inc.

import 'package:example/pages/life_cycle_page.dart';
import 'package:example/pages/loadMore_page.dart';
import 'package:example/pages/position_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
Expand All @@ -8,6 +12,8 @@ void main() {
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
Expand All @@ -26,8 +32,12 @@ class HomePage extends StatelessWidget {

final Map<String, Widget> m = {
"Position": const PositionedListPage(),
"loadMore": const LoadMorePage(),
"LifeCycle": const LifeCyclePage()
};

HomePage({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down
51 changes: 51 additions & 0 deletions example/lib/pages/life_cycle_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (2022) Bytedance Inc.

import 'package:flutter/material.dart';
import 'package:scroll_kit/scroll_kit.dart';

class LifeCyclePage extends StatefulWidget {
const LifeCyclePage({super.key});
@override
State<StatefulWidget> createState() {
return LifeCyclePageState();
}
}

class LifeCyclePageState extends State<LifeCyclePage> {
@override
Widget build(BuildContext context) {
final scrollView = CustomScrollView(
slivers: [
SKSliverList(
delegate: SKSliverChildBuilderDelegate((c, i) {
if (i % 2 == 0) {
return Container(
height: 100,
child: Text(i.toString()),
color: Colors.grey,
margin: EdgeInsets.only(top: 3),
);
} else {
return Container(
height: 100,
child: Text(i.toString()),
color: Colors.red,
margin: EdgeInsets.only(top: 3),
);
}
}, onAppear: (i) {
print("Appear: $i");
}, onDisAppear: (i) {
print("Disappear: $i");
}, reuseIdentifier: (i) {
if (i % 2 == 0) {
return "type1";
} else {
return "type2";
}
}, childCount: 100))
],
);
return Scaffold(appBar: AppBar(title: Text("LifeCycle")), body: scrollView);
}
}
Loading

0 comments on commit f9ac54a

Please sign in to comment.