Skip to content

Commit 7517549

Browse files
committed
V0.0.7
1 parent 64e15d3 commit 7517549

11 files changed

+194
-130
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [0.0.7]
2+
3+
* Made state public
4+
* Added flutter_lints
5+
* Updated README
6+
17
## [0.0.6]
28

39
* Improved support for RTL

README.md

+54-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,59 @@
11
# material_speed_dial
22

3-
A new Flutter project.
3+
A simple Material speed dial.
44

5-
## Getting Started
5+
## Preview
66

7-
This project is a starting point for a Dart
8-
[package](https://flutter.dev/developing-packages/),
9-
a library module containing code that can be shared easily across
10-
multiple Flutter or Dart projects.
7+
![Preview](./arts/demo.gif)
118

12-
For help getting started with Flutter, view our
13-
[online documentation](https://flutter.dev/docs), which offers tutorials,
14-
samples, guidance on mobile development, and a full API reference.
9+
## Usage
10+
11+
1. Add to your dependencies
12+
13+
```yaml
14+
dependencies:
15+
material_speed_dial: 0.0.7
16+
```
17+
18+
2. Add to your widget tree
19+
20+
```dart
21+
class MyHomePage extends StatelessWidget {
22+
final _key = GlobalKey<SpeedDialState>();
23+
24+
@override
25+
Widget build(BuildContext context) {
26+
return Scaffold(
27+
floatingActionButton: SpeedDial(
28+
key: _key,
29+
invokeAfterClosing: true,
30+
child: Icon(Icons.add),
31+
expandedChild: Icon(Icons.share),
32+
backgroundColor: Colors.blue,
33+
expandedBackgroundColor: Colors.black,
34+
children: [
35+
SpeedDialChild(
36+
child: Icon(Icons.close),
37+
label: Text('Test'),
38+
onPressed: () {},
39+
),
40+
SpeedDialChild(
41+
child: Icon(Icons.pending),
42+
label: Text('Another Test'),
43+
onPressed: () {},
44+
),
45+
],
46+
),
47+
);
48+
}
49+
}
50+
```
51+
52+
3. Check for state or toggle
53+
54+
```dart
55+
final isOpen = _key.currentState.isOpen;
56+
```
57+
```dart
58+
_key.currentState.toggle();
59+
```

analysis_options.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include: package:flutter_lints/flutter.yaml

arts/demo.gif

608 KB
Loading

example/analysis_options.yaml

Whitespace-only changes.

example/pubspec.lock

+10-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.5.0"
10+
version: "2.8.2"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
@@ -21,14 +21,14 @@ packages:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.1.0"
24+
version: "1.2.0"
2525
charcode:
2626
dependency: transitive
2727
description:
2828
name: charcode
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.2.0"
31+
version: "1.3.1"
3232
clock:
3333
dependency: transitive
3434
description:
@@ -73,21 +73,21 @@ packages:
7373
name: matcher
7474
url: "https://pub.dartlang.org"
7575
source: hosted
76-
version: "0.12.10"
76+
version: "0.12.11"
7777
material_speed_dial:
7878
dependency: "direct main"
7979
description:
8080
path: ".."
8181
relative: true
8282
source: path
83-
version: "0.0.5"
83+
version: "0.0.7"
8484
meta:
8585
dependency: transitive
8686
description:
8787
name: meta
8888
url: "https://pub.dartlang.org"
8989
source: hosted
90-
version: "1.3.0"
90+
version: "1.7.0"
9191
path:
9292
dependency: transitive
9393
description:
@@ -106,7 +106,7 @@ packages:
106106
name: source_span
107107
url: "https://pub.dartlang.org"
108108
source: hosted
109-
version: "1.8.0"
109+
version: "1.8.1"
110110
stack_trace:
111111
dependency: transitive
112112
description:
@@ -141,7 +141,7 @@ packages:
141141
name: test_api
142142
url: "https://pub.dartlang.org"
143143
source: hosted
144-
version: "0.2.19"
144+
version: "0.4.3"
145145
typed_data:
146146
dependency: transitive
147147
description:
@@ -155,7 +155,7 @@ packages:
155155
name: vector_math
156156
url: "https://pub.dartlang.org"
157157
source: hosted
158-
version: "2.1.0"
158+
version: "2.1.1"
159159
sdks:
160-
dart: ">=2.12.0 <3.0.0"
160+
dart: ">=2.14.0 <3.0.0"
161161
flutter: ">=1.17.0"

lib/src/animated_children.dart

+46-47
Original file line numberDiff line numberDiff line change
@@ -16,56 +16,55 @@ class AnimatedChildren extends StatelessWidget {
1616
}) : super(key: key);
1717

1818
@override
19-
Widget build(BuildContext context) {
20-
return AnimatedBuilder(
21-
animation: animation,
22-
builder: (context, _) => Column(
23-
children: List.generate(children.length, (i) => i).map((i) {
24-
final speedDialChild = children[i];
25-
final curvedAnimation = CurvedAnimation(
26-
parent: animation,
27-
curve: Interval(((children.length - 1 - i) / children.length), 1,
28-
curve: Curves.easeInOutCubic));
19+
Widget build(BuildContext context) => AnimatedBuilder(
20+
animation: animation,
21+
builder: (context, _) => Column(
22+
children: List.generate(children.length, (i) => i).map((i) {
23+
final speedDialChild = children[i];
24+
final curvedAnimation = CurvedAnimation(
25+
parent: animation,
26+
curve: Interval(
27+
((children.length - 1 - i) / children.length), 1,
28+
curve: Curves.easeInOutCubic));
2929

30-
onPressed() async {
31-
invokeAfterClosing ? await close() : close();
32-
speedDialChild.onPressed?.call();
33-
}
30+
onPressed() async {
31+
invokeAfterClosing ? await close() : close();
32+
speedDialChild.onPressed?.call();
33+
}
3434

35-
return Padding(
36-
padding: const EdgeInsets.only(bottom: 8),
37-
child: GestureDetector(
38-
behavior: HitTestBehavior.translucent,
39-
onTap: onPressed,
40-
child: Row(
41-
children: [
42-
Opacity(
43-
opacity: curvedAnimation.value,
44-
child: Center(child: speedDialChild.label),
45-
),
46-
SizedBox(width: 16),
47-
ScaleTransition(
48-
scale: curvedAnimation,
49-
child: Container(
50-
width: 56,
51-
alignment: Alignment.center,
52-
child: FloatingActionButton(
53-
onPressed: onPressed,
54-
child: speedDialChild.child,
55-
foregroundColor: speedDialChild.foregroundColor,
56-
backgroundColor: speedDialChild.backgroundColor,
57-
mini: true,
35+
return Padding(
36+
padding: const EdgeInsets.only(bottom: 8),
37+
child: GestureDetector(
38+
behavior: HitTestBehavior.translucent,
39+
onTap: onPressed,
40+
child: Row(
41+
children: [
42+
Opacity(
43+
opacity: curvedAnimation.value,
44+
child: Center(child: speedDialChild.label),
45+
),
46+
const SizedBox(width: 16),
47+
ScaleTransition(
48+
scale: curvedAnimation,
49+
child: Container(
50+
width: 56,
51+
alignment: Alignment.center,
52+
child: FloatingActionButton(
53+
onPressed: onPressed,
54+
child: speedDialChild.child,
55+
foregroundColor: speedDialChild.foregroundColor,
56+
backgroundColor: speedDialChild.backgroundColor,
57+
mini: true,
58+
),
5859
),
5960
),
60-
),
61-
],
61+
],
62+
),
6263
),
63-
),
64-
);
65-
}).toList(),
66-
crossAxisAlignment: CrossAxisAlignment.end,
67-
mainAxisAlignment: MainAxisAlignment.end,
68-
),
69-
);
70-
}
64+
);
65+
}).toList(),
66+
crossAxisAlignment: CrossAxisAlignment.end,
67+
mainAxisAlignment: MainAxisAlignment.end,
68+
),
69+
);
7170
}

0 commit comments

Comments
 (0)