1
0
mirror of https://github.com/go-vikunja/app synced 2024-06-02 18:49:47 +00:00
app-mirror-github/lib/components/label.dart

41 lines
1014 B
Dart
Raw Normal View History

2021-06-04 09:34:25 +00:00
import 'package:flutter/material.dart';
import 'package:vikunja_app/models/label.dart';
2022-09-03 15:43:16 +00:00
class LabelComponent extends StatelessWidget {
2021-06-04 09:34:25 +00:00
final Label label;
final VoidCallback onDelete;
2022-08-27 21:04:43 +00:00
const LabelComponent({Key? key, required this.label, required this.onDelete})
2021-06-04 09:34:25 +00:00
: super(key: key);
@override
Widget build(BuildContext context) {
return Chip(
label: Text(
2022-09-03 15:43:16 +00:00
label.title,
2021-06-04 09:34:25 +00:00
style: TextStyle(
2022-09-03 15:43:16 +00:00
color: label.textColor,
2021-06-04 09:34:25 +00:00
),
),
2022-09-03 15:43:16 +00:00
backgroundColor: label.color,
2021-06-04 09:34:25 +00:00
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(3)),
),
2022-09-03 15:43:16 +00:00
onDeleted: onDelete,
deleteIconColor: label.textColor,
2021-06-04 09:34:25 +00:00
deleteIcon: Container(
padding: EdgeInsets.all(3),
decoration: BoxDecoration(
color: Color.fromARGB(50, 0, 0, 0),
shape: BoxShape.circle,
),
child: Icon(
Icons.close,
2022-09-03 15:43:16 +00:00
color: label.textColor,
2021-06-04 09:34:25 +00:00
size: 15,
),
),
);
}
}