Skip to content

Commit

Permalink
Added new constructor to pass frontWidget and innerWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-faob committed Jun 23, 2020
1 parent f398262 commit 6878c01
Show file tree
Hide file tree
Showing 10 changed files with 867 additions and 300 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
@@ -1,5 +1,8 @@
## 1.0.0
* Added `SimpleFoldingCell.create()` to pass `frontWidget` and `innerWidget`

## 0.1.2
* Added `onOpen` and `onClose` callbacks <br/>
* Added `onOpen` and `onClose` callbacks
* Can now programmatically open and close cell
* Added `AnimatedBuilder` instead of `setState()` and simplified code
* Updated examples
Expand Down
119 changes: 118 additions & 1 deletion README.md
Expand Up @@ -9,16 +9,133 @@ Simple folding cell widget implemented in Flutter. Its a widget so add it to any
Add dependency in `pubspec.yaml`:
```yaml
dependencies:
folding_cell: "^0.1.2"
folding_cell: "^1.0.0"
```

Import in your project:
```dart
import 'package:folding_cell/folding_cell.dart';
```
## v 1.0.0

* Added new constructor to pass `frontWidget` and `innerWidget`
```
SimpleFoldingCell.create(
frontWidget: _buildFrontWidget(),
innerWidget: _buildInnerWidget(),
...
)
```

## Basic usage

#### v 1.0.0
```dart
class FoldingCellSimpleDemo extends StatelessWidget {
final _foldingCellKey = GlobalKey<SimpleFoldingCellState>();
@override
Widget build(BuildContext context) {
return Container(
color: Color(0xFF2e282a),
alignment: Alignment.topCenter,
child: SimpleFoldingCell.create(
key: _foldingCellKey,
frontWidget: _buildFrontWidget(),
innerWidget: _buildInnerWidget(),
cellSize: Size(MediaQuery.of(context).size.width, 140),
padding: EdgeInsets.all(15),
animationDuration: Duration(milliseconds: 300),
borderRadius: 10,
onOpen: () => print('cell opened'),
onClose: () => print('cell closed'),
),
);
}
Widget _buildFrontWidget() {
return Container(
color: Color(0xFFffcd3c),
alignment: Alignment.center,
child: Stack(
children: <Widget>[
Align(
alignment: Alignment.center,
child: Text(
"CARD TITLE",
style: GoogleFonts.aldrich(
color: Color(0xFF2e282a),
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
),
Positioned(
right: 5,
bottom: 0,
child: FlatButton(
onPressed: () => _foldingCellKey?.currentState?.toggleFold(),
child: Text(
"OPEN",
),
textColor: Colors.white,
color: Colors.indigoAccent,
splashColor: Colors.white.withOpacity(0.5),
),
)
],
),
);
}
Widget _buildInnerWidget() {
return Container(
color: Color(0xFFecf2f9),
padding: EdgeInsets.only(top: 10),
child: Stack(
children: [
Align(
alignment: Alignment.topCenter,
child: Text(
"CARD TITLE",
style: GoogleFonts.aldrich(
color: Color(0xFF2e282a),
fontSize: 22.0,
fontWeight: FontWeight.bold,
),
),
),
Align(
alignment: Alignment.center,
child: Text(
"CARD DETAIL",
style: GoogleFonts.aldrich(
color: Color(0xFF2e282a),
fontSize: 40.0,
),
),
),
Positioned(
right: 5,
bottom: 0,
child: FlatButton(
onPressed: () => _foldingCellKey?.currentState?.toggleFold(),
child: Text(
"Close",
),
textColor: Colors.white,
color: Colors.indigoAccent,
splashColor: Colors.white.withOpacity(0.5),
),
),
],
),
);
}
}
```

#### v 0.1.2
```dart
class FoldingCellSimpleDemo extends StatelessWidget {
final _foldingCellKey = GlobalKey<SimpleFoldingCellState>();
Expand Down
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Expand Up @@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 27
compileSdkVersion 28

lintOptions {
disable 'InvalidPackage'
Expand All @@ -35,7 +35,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
minSdkVersion 16
targetSdkVersion 27
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
1 change: 1 addition & 0 deletions example/android/gradle.properties
@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true

0 comments on commit 6878c01

Please sign in to comment.