mucke/lib/presentation/widgets/queue_card.dart

82 lines
2.2 KiB
Dart
Raw Normal View History

2020-03-20 16:17:02 +01:00
import 'package:flutter/material.dart';
class QueueCard extends StatefulWidget {
QueueCard({Key key, this.boxConstraints}) : super(key: key);
final BoxConstraints boxConstraints;
@override
_QueueCardState createState() => _QueueCardState();
}
class _QueueCardState extends State<QueueCard> {
2020-03-28 09:39:59 +01:00
final title = 'Fire';
final artist = 'Beartooth';
2020-03-25 17:00:00 +01:00
final height = 64.0;
2020-03-20 16:17:02 +01:00
bool _first = true;
2020-03-25 17:00:00 +01:00
double _currentHeight;
2020-03-20 16:17:02 +01:00
@override
2020-03-25 17:00:00 +01:00
void initState() {
_currentHeight = height;
super.initState();
}
2020-03-20 16:17:02 +01:00
2020-03-25 17:00:00 +01:00
@override
Widget build(BuildContext context) {
2020-03-20 16:17:02 +01:00
return AnimatedPositioned(
bottom: 0,
left: 0,
right: 0,
2020-03-25 17:00:00 +01:00
height: _currentHeight,
2020-03-20 16:17:02 +01:00
child: Padding(
padding: const EdgeInsets.all(8.0),
child: GestureDetector(
onTap: () {
setState(() {
2020-03-25 17:00:00 +01:00
_currentHeight =
_first ? widget.boxConstraints.maxHeight : height;
2020-03-20 16:17:02 +01:00
_first = !_first;
});
},
child: Card(
elevation: 4.0,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: <Widget>[
Icon(Icons.expand_less),
Container(
width: 4.0,
),
2020-03-25 17:00:00 +01:00
RichText(
text: TextSpan(
2020-03-20 16:17:02 +01:00
style: TextStyle(
2020-03-25 17:00:00 +01:00
fontSize: 16,
),
children: [
TextSpan(text: "$title"),
TextSpan(text: "", style: TextStyle(color: Colors.white70)),
TextSpan(text: "$artist", style: TextStyle(fontWeight: FontWeight.w300, color: Colors.white70)),
],
),
),
2020-03-20 16:17:02 +01:00
],
),
],
crossAxisAlignment: CrossAxisAlignment.start,
),
),
),
),
),
duration: Duration(milliseconds: 250),
curve: Curves.fastOutSlowIn,
);
}
}