forked from vikunja/app
Fixed label display
This commit is contained in:
parent
8a091c9828
commit
45eb087228
|
@ -4,16 +4,9 @@ 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})
|
||||
const LabelComponent({Key key, @required this.label, this.onDelete})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
|
@ -23,43 +16,31 @@ class LabelComponent extends StatefulWidget {
|
|||
}
|
||||
|
||||
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),
|
||||
margin: EdgeInsets.only(top: 5, bottom: 5, right: 10),
|
||||
return Chip(
|
||||
label: Text(
|
||||
widget.label.title,
|
||||
style: TextStyle(
|
||||
color: vWhite,
|
||||
),
|
||||
),
|
||||
backgroundColor: vGreen,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
onDeleted: widget.onDelete,
|
||||
deleteIconColor: vWhite,
|
||||
deleteIcon: Container(
|
||||
padding: EdgeInsets.all(3),
|
||||
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,
|
||||
),
|
||||
],
|
||||
color: Color.fromARGB(50, 0, 0, 0),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color: vWhite,
|
||||
size: 15,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -229,13 +229,11 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
|||
}).toList(),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
Wrap(
|
||||
spacing: 10,
|
||||
children: <Widget>[
|
||||
LabelComponent(
|
||||
label: Label(id: 12134, title: 'Lorem Ipsum'),
|
||||
onTap: () {
|
||||
print('tapped');
|
||||
},
|
||||
onDelete: () {
|
||||
print('deleted');
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue