You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
Dart
44 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../models/visits/visit.dart';
|
|
import '../../app_style/colors.dart';
|
|
import '../../app_style/sizing.dart';
|
|
|
|
class VisitStatusLabel extends StatelessWidget {
|
|
final Visit visit;
|
|
|
|
const VisitStatusLabel({Key? key, required this.visit}) : super(key: key);
|
|
|
|
Color getStatusColor() {
|
|
switch (visit.taskStatusId) {
|
|
case 0:
|
|
return AColors.green;
|
|
case 1:
|
|
return AColors.grey;
|
|
case 2:
|
|
return AColors.grey;
|
|
default:
|
|
return AColors.grey;
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 8),
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
color: getStatusColor(),
|
|
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
|
|
boxShadow: const [AppStyle.boxShadow],
|
|
),
|
|
child: Text(
|
|
visit.taskStatusName == null || (visit.taskStatusName?.isEmpty ?? false) ? "no status" : visit.taskStatusName ?? "",
|
|
style: Theme.of(context).textTheme.titleSmall?.copyWith(
|
|
color: getStatusColor().computeLuminance() > 0.5 ? AColors.black : Colors.white,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|