This repository has been archived on 2022-04-20. You can view files and clone it, but cannot push or open issues or pull requests.
app/lib/components/label.dart
konrad 456b8ca15f
Some checks failed
continuous-integration/drone/push Build is failing
Styling
2019-03-18 11:30:14 +01:00

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,
),
],
),
),
);
}
}