-
Notifications
You must be signed in to change notification settings - Fork 481
/
Copy pathbuttons_row.dart
78 lines (75 loc) · 2.4 KB
/
buttons_row.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import 'package:flutter/material.dart';
import 'package:flare_flutter/flare_actor.dart';
class ButtonsRow extends StatefulWidget {
@override
State<StatefulWidget> createState() => _ButtonsState();
}
class _ButtonsState extends State<ButtonsRow> {
static final double containerSize = 20.0;
// Wheather this element is a favorite or not.
bool _isFav = false;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 18.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(children: [
Container(
margin: EdgeInsets.only(right: 10),
child: Icon(Icons.rate_review, size: containerSize + 2)),
Text(
"Reviews",
style: TextStyle(
fontSize: 11,
fontFamily: "Montserrat",
color: Colors.black45),
),
]),
GestureDetector(
onTap: () {
// Toggle the state:
// This'll cause this widget to rebuild
// and the animation will be swapped.
setState(() {
_isFav = !_isFav;
});
},
child: Row(children: [
Container(
margin: EdgeInsets.only(right: 10),
width: containerSize,
height: containerSize,
child: FlareActor("assets/Favorite.flr",
shouldClip: false,
// Play the animation depending on the state.
animation:
_isFav ? "Favorite" : "Unfavorite" //_animationName
)),
Text(
"Like",
style: TextStyle(
fontSize: 11,
fontFamily: "Montserrat",
color: Colors.black45),
),
]),
),
Row(children: [
Container(
margin: EdgeInsets.only(right: 10),
child: Icon(Icons.share, size: containerSize + 2)),
Text(
"Share",
style: TextStyle(
fontSize: 11,
fontFamily: "Montserrat",
color: Colors.black45),
),
]),
],
),
);
}
}