-
Notifications
You must be signed in to change notification settings - Fork 179
Expand file tree
/
Copy pathpriority_widget.dart
More file actions
79 lines (75 loc) · 2.27 KB
/
priority_widget.dart
File metadata and controls
79 lines (75 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:taskwarrior/app/utils/constants/constants.dart';
import 'package:taskwarrior/app/utils/themes/theme_extension.dart';
class PriorityWidget extends StatelessWidget {
const PriorityWidget({
required this.name,
required this.value,
required this.callback,
required this.globalKey,
this.isEditable = true,
super.key,
});
final String name;
final dynamic value;
final void Function(dynamic) callback;
final GlobalKey globalKey;
final bool isEditable;
@override
Widget build(BuildContext context) {
TaskwarriorColorTheme tColors =
Theme.of(context).extension<TaskwarriorColorTheme>()!;
final Color? textColor = isEditable
? tColors.primaryTextColor
: tColors.primaryDisabledTextColor;
return Card(
key: globalKey,
color: tColors.secondaryBackgroundColor,
child: ListTile(
enabled: isEditable,
textColor: tColors.primaryTextColor,
title: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
RichText(
text: TextSpan(
children: <TextSpan>[
TextSpan(
text: '$name:'.padRight(13),
style: GoogleFonts.poppins(
fontWeight: TaskWarriorFonts.bold,
fontSize: TaskWarriorFonts.fontSizeMedium,
color: textColor,
),
),
TextSpan(
text: value ?? "not selected",
style: GoogleFonts.poppins(
fontSize: TaskWarriorFonts.fontSizeMedium,
color: textColor,
),
),
],
),
),
],
),
),
onTap: () {
switch (value) {
case 'H':
return callback('M');
case 'M':
return callback('L');
case 'L':
return callback(null);
default:
return callback('H');
}
},
),
);
}
}