Skip to content

Commit 87eab57

Browse files
committed
add animation
1 parent 54ef57e commit 87eab57

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

‎lib/page/repository_detail_page.dart‎

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class RepositoryDetailPage extends StatefulWidget {
3434
_RepositoryDetailPageState createState() => _RepositoryDetailPageState();
3535
}
3636

37-
class _RepositoryDetailPageState extends State<RepositoryDetailPage> {
37+
class _RepositoryDetailPageState extends State<RepositoryDetailPage>
38+
with SingleTickerProviderStateMixin {
3839
ReposHeaderViewModel reposHeaderViewModel = new ReposHeaderViewModel();
3940

4041
BottomStatusModel bottomStatusModel;
@@ -57,6 +58,8 @@ class _RepositoryDetailPageState extends State<RepositoryDetailPage> {
5758
GlobalKey<RepositoryDetailIssuePageState> issueListKey =
5859
new GlobalKey<RepositoryDetailIssuePageState>();
5960

61+
AnimationController animationController;
62+
6063
List<String> branchList = new List();
6164

6265
_getReposStatus() async {
@@ -261,6 +264,9 @@ class _RepositoryDetailPageState extends State<RepositoryDetailPage> {
261264
super.initState();
262265
_getBranchList();
263266
_refresh();
267+
animationController =
268+
new AnimationController(vsync: this, duration: Duration(seconds: 2));
269+
animationController.forward();
264270
}
265271

266272
@override
@@ -299,12 +305,15 @@ class _RepositoryDetailPageState extends State<RepositoryDetailPage> {
299305
onPageChanged: (index) {
300306
reposDetailModel.setCurrentIndex(index);
301307
},
302-
floatingActionButton: FloatingActionButton(
303-
onPressed: () {
304-
_createIssue();
305-
},
306-
child: Icon(Icons.add),
307-
backgroundColor: Theme.of(context).primaryColor,
308+
floatingActionButton: ScaleTransition(
309+
scale: CurvedAnimation(parent: animationController, curve: Curves.bounceIn),
310+
child: FloatingActionButton(
311+
onPressed: () {
312+
_createIssue();
313+
},
314+
child: Icon(Icons.add),
315+
backgroundColor: Theme.of(context).primaryColor,
316+
),
308317
),
309318
floatingActionButtonLocation:
310319
FloatingActionButtonLocation.endDocked,
@@ -315,7 +324,11 @@ class _RepositoryDetailPageState extends State<RepositoryDetailPage> {
315324
rowContents: (tarBarControl.footerButton == null)
316325
? [Container()]
317326
: tarBarControl.footerButton.length == 0
318-
? [SizedBox.fromSize(size: Size(100, 50),)]
327+
? [
328+
SizedBox.fromSize(
329+
size: Size(100, 50),
330+
)
331+
]
319332
: tarBarControl.footerButton),
320333
);
321334
},

0 commit comments

Comments
 (0)