67 lines
1.7 KiB
Dart
67 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:vikunja_app/models/label.dart';
|
|
import 'package:vikunja_app/theme/constants.dart';
|
|
|
|
class LabelComponent extends StatefulWidget {
|
|
final Label label;
|
|
final VoidCallback onTap;
|
|
final VoidCallback onDelete;
|
|
final Color backgroundColor;
|
|
|
|
const LabelComponent(
|
|
{Key key,
|
|
@required this.label,
|
|
this.onTap,
|
|
this.onDelete,
|
|
this.backgroundColor = vGreen})
|
|
: super(key: key);
|
|
|
|
@override
|
|
State<StatefulWidget> createState() {
|
|
return new LabelComponentState();
|
|
}
|
|
}
|
|
|
|
class LabelComponentState extends State<LabelComponent> {
|
|
LabelComponentState() {}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: widget.onTap,
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 8),
|
|
decoration: BoxDecoration(
|
|
color: widget.backgroundColor,
|
|
borderRadius: BorderRadius.all(Radius.circular(3))),
|
|
child: Row(
|
|
children: [
|
|
Text(
|
|
widget.label.title,
|
|
style: TextStyle(
|
|
color: vWhite,
|
|
),
|
|
),
|
|
GestureDetector(
|
|
child: Container(
|
|
padding: EdgeInsets.all(3),
|
|
margin: EdgeInsets.symmetric(horizontal: 3),
|
|
decoration: BoxDecoration(
|
|
color: Color.fromARGB(50, 0, 0, 0),
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: Icon(
|
|
Icons.close,
|
|
color: vWhite,
|
|
size: 15,
|
|
),
|
|
),
|
|
onTap: widget.onDelete,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|