Skip to content

Commit a4cf81a

Browse files
authored
Release/2.3.0 (#54)
* Release 2.3.0
1 parent 5e83aea commit a4cf81a

10 files changed

Lines changed: 238 additions & 60 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.3.0
2+
* Update
3+
- `ExpansionTileGroup` with new parameters `keepState`.
4+
- Avoid column main axis use all available space. Thanks for [#53](https://github.com/congthanhng/Expansion-Tile-Group/pull/53)
5+
16
## 2.2.0
27
* New Feature:
38
- Only trailing can toggle the state: `isOnlyTrailingDoToggle` [#42](https://github.com/congthanhng/Expansion-Tile-Group/pull/42)

doc/group-features.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,14 @@ class ExpansionGroupExample extends StatelessWidget {
7777
That's it!
7878

7979
### ExpansionTileGroup parameters
80-
| Parameter | Description |
81-
|--------------------------|--------------------------------------------------------------|
82-
| `key` | Controls how one widget replaces another widget in the tree. |
83-
| `children`* | The children in this group, `ExpansionTileItem` |
84-
| `toggleType` | Provide the behaviors of items in this group, it's `enum` |
85-
| `spaceBetweenItem` | The gap space between item in the group |
86-
| `onExpansionItemChanged` | Listen the changed behavior of any item in the group |
80+
| Parameter | Description |
81+
|--------------------------|----------------------------------------------------------------------------------------|
82+
| `key` | Controls how one widget replaces another widget in the tree. |
83+
| `children`* | The children in this group, `ExpansionTileItem` |
84+
| `toggleType` | Provide the behaviors of items in this group, it's `enum` |
85+
| `spaceBetweenItem` | The gap space between item in the group |
86+
| `keepState` | Will keep the state of the expansion tile whenever the parent's node widget is rebuilt |
87+
| `onExpansionItemChanged` | Listen the changed behavior of any item in the group |
8788

8889
## Let implement with Option 2: Using `ExansionGroupController`
8990
Why do we have option 2 while option 1 work well?

doc/item-features.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ Now you can change default trailing icon by calling `trailingIcon`, it is retrie
169169
| `isEnableExpanded` | Force item expand or NOT |
170170
| `isDefaultVerticalPadding` | Remove completely default vertical title padding |
171171
| `isHideSubtitleOnExpanded` | Hide Subtitle when view is expanded |
172+
| `isOnlyTrailingDoToggle` | Only trailing can toggle the state [#42](https://github.com/congthanhng/Expansion-Tile-Group/pull/42) |
172173
| `trailingIcon` | Change default trailing icon with keeping rotate animation |
173174

174175
## Additional ExpansionTileLeaf parameters

example/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# example
22

3-
A new Flutter project.
3+
An example Flutter project to demonstrate the `expansion_tile_group` package.
44

55
## Getting Started
66

@@ -25,3 +25,7 @@ dart pub global activate dhttpd
2525
dart pub global run dhttpd --path doc/api
2626
```
2727
## Build demo web
28+
flutter build web --release
29+
30+
## Public package
31+
dart pub publish --dry-run

example/lib/main.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:expansion_tile_group_example/route_named.dart';
22
import 'package:expansion_tile_group_example/use_cases/fantasy/fantasy_page.dart';
33
import 'package:expansion_tile_group_example/use_cases/group/custom_group_with_controller.dart';
4+
import 'package:expansion_tile_group_example/use_cases/group/keep_state_page.dart';
45
import 'package:flutter/material.dart';
56

67
import 'use_cases/use_cases.dart';
@@ -55,6 +56,9 @@ class _MyAppState extends State<MyApp> {
5556
builder: (context) => const CustomGroupWithController());
5657
case RouteNamed.fantasyPage:
5758
return MaterialPageRoute(builder: (context) => const FantasyPage());
59+
case RouteNamed.keepStatePage:
60+
return MaterialPageRoute(
61+
builder: (context) => const KeepStatePage());
5862
default:
5963
return MaterialPageRoute(builder: (context) => const HomePage());
6064
}
@@ -166,6 +170,12 @@ class HomePage extends StatelessWidget {
166170
routeName: RouteNamed.listenGroupItemChanged,
167171
),
168172
const Divider(),
173+
_buildRow(
174+
context,
175+
title: 'Keep state Example',
176+
routeName: RouteNamed.keepStatePage,
177+
),
178+
const Divider(),
169179
const Text(
170180
'CUSTOM GROUP',
171181
style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold),

example/lib/route_named.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ class RouteNamed {
1212
static const String ignoreBehavior = '/ignore_behavior';
1313
static const String hideSubtitle = '/hide_subtitle';
1414
static const String fantasyPage = '/fantasy_page';
15+
static const String keepStatePage = '/keep_state_page';
1516
}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
import 'package:expansion_tile_group/expansion_tile_group.dart';
2+
import 'package:flutter/material.dart';
3+
4+
class KeepStatePage extends StatefulWidget {
5+
const KeepStatePage({super.key});
6+
7+
@override
8+
State<KeepStatePage> createState() => _KeepStatePageState();
9+
}
10+
11+
class _KeepStatePageState extends State<KeepStatePage> {
12+
@override
13+
Widget build(BuildContext context) {
14+
return Scaffold(
15+
appBar: AppBar(
16+
title: const Text('Keep State Example'),
17+
),
18+
body: SingleChildScrollView(
19+
child: Padding(
20+
padding: const EdgeInsets.all(16.0),
21+
child: Column(
22+
children: [
23+
Row(
24+
children: [
25+
_buildGroupLayout(
26+
context,
27+
title: 'Group 1: keepState: true',
28+
child: ExpansionTileGroup(
29+
spaceBetweenItem: 16,
30+
keepState: true,
31+
children: [
32+
_buildExpansionItem(context),
33+
_buildExpansionItem(context),
34+
_buildExpansionItem(context),
35+
],
36+
),
37+
),
38+
const SizedBox(
39+
width: 16,
40+
),
41+
_buildGroupLayout(
42+
context,
43+
title: 'Group 2: keepState: false',
44+
child: ExpansionTileGroup(
45+
spaceBetweenItem: 16,
46+
keepState: false,
47+
children: [
48+
_buildExpansionItem(context),
49+
_buildExpansionItem(context),
50+
_buildExpansionItem(context),
51+
],
52+
),
53+
),
54+
],
55+
),
56+
const SizedBox(
57+
height: 16,
58+
),
59+
const Text(
60+
'Try to expand some items of each group and then tap to below button, you can see the different',
61+
textAlign: TextAlign.center,
62+
),
63+
const SizedBox(
64+
height: 16,
65+
),
66+
ElevatedButton(
67+
onPressed: () {
68+
setState(() {});
69+
},
70+
child: const Text('Rebuild this Page')),
71+
],
72+
),
73+
),
74+
),
75+
);
76+
}
77+
78+
ExpansionTileItem _buildExpansionItem(BuildContext context,
79+
{bool isExpanded = false}) {
80+
return ExpansionTileItem.outlined(
81+
initiallyExpanded: isExpanded,
82+
title: const Text('ExpansionTile Item'),
83+
children: [
84+
Material(
85+
child: InkWell(
86+
onTap: () {},
87+
child: const Text(
88+
''' Nullam eleifend ultrices tortor, sit amet gravida sapien cursus vitae. Duis rutrum convallis erat et ultrices. Morbi a luctus ligula, at varius ligula. Nam mollis sapien ac nunc hendrerit consequat. Cras posuere metus felis, at pellentesque sem ornare id. Praesent ut nunc aliquam, dictum felis eu, congue metus. Nunc vitae elit eros. In eu dui pharetra, varius metus a, efficitur eros.'''),
89+
),
90+
),
91+
],
92+
);
93+
}
94+
95+
Widget _buildGroupLayout(BuildContext context,
96+
{required String title, required Widget child}) {
97+
return Expanded(
98+
child: Column(
99+
mainAxisAlignment: MainAxisAlignment.start,
100+
children: [
101+
Text(
102+
title,
103+
style: const TextStyle(fontSize: 20),
104+
),
105+
const SizedBox(
106+
height: 16,
107+
),
108+
Card(
109+
child: Padding(
110+
padding: const EdgeInsets.all(8.0),
111+
child: child,
112+
),
113+
),
114+
],
115+
),
116+
);
117+
}
118+
}

0 commit comments

Comments
 (0)