|
|
|
|
@ -21,27 +21,28 @@ class VisitItem extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
UserProvider _userProvider = Provider.of<UserProvider>(context);
|
|
|
|
|
UserProvider userProvider = Provider.of<UserProvider>(context);
|
|
|
|
|
Color itemColor = index % 2 == 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onPrimary;
|
|
|
|
|
Color onItemColor = index % 2 != 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onPrimary;
|
|
|
|
|
Subtitle _subtitle = AppLocalization.of(context).subtitle;
|
|
|
|
|
Subtitle subtitle = AppLocalization.of(context).subtitle;
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 4),
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
|
|
|
|
primary: itemColor,
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
|
|
|
|
backgroundColor: itemColor,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (activeSelectMod && _userProvider.user.type == UsersTypes.engineer)
|
|
|
|
|
if (activeSelectMod && userProvider.user.type == UsersTypes.engineer) {
|
|
|
|
|
onSelect(visit);
|
|
|
|
|
else
|
|
|
|
|
} else {
|
|
|
|
|
onPressed(visit);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLongPress: _userProvider.user.type == UsersTypes.engineer
|
|
|
|
|
onLongPress: userProvider.user.type == UsersTypes.engineer
|
|
|
|
|
? () {
|
|
|
|
|
onLongPress(visit);
|
|
|
|
|
}
|
|
|
|
|
@ -53,12 +54,12 @@ class VisitItem extends StatelessWidget {
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
"S.N: " + visit.deviceSerialNumber ?? "No serial number",
|
|
|
|
|
style: Theme.of(context).textTheme.headline6.copyWith(color: onItemColor, fontSize: 16, fontWeight: FontWeight.bold),
|
|
|
|
|
"S.N: ${visit.deviceSerialNumber}" ?? "No serial number",
|
|
|
|
|
style: Theme.of(context).textTheme.titleLarge.copyWith(color: onItemColor, fontSize: 16, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
AnimatedSwitcher(
|
|
|
|
|
duration: Duration(milliseconds: 400),
|
|
|
|
|
duration: const Duration(milliseconds: 400),
|
|
|
|
|
child: Visibility(
|
|
|
|
|
key: ValueKey(activeSelectMod),
|
|
|
|
|
visible: activeSelectMod,
|
|
|
|
|
@ -83,10 +84,7 @@ class VisitItem extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
visit.deviceNumber ?? "",
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1.copyWith(
|
|
|
|
|
color: onItemColor,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium.copyWith(color: onItemColor, fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
Divider(
|
|
|
|
|
color: onItemColor,
|
|
|
|
|
@ -96,7 +94,7 @@ class VisitItem extends StatelessWidget {
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
visit.hospitalName ?? "No client found",
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1.copyWith(
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium.copyWith(
|
|
|
|
|
color: onItemColor,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
@ -106,29 +104,30 @@ class VisitItem extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
visit.modelAndBrand ?? "",
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1.copyWith(
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium.copyWith(
|
|
|
|
|
color: onItemColor,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(color: onItemColor),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
visit.employName ?? "No employ found",
|
|
|
|
|
style: Theme.of(context).textTheme.headline6.copyWith(color: onItemColor, fontSize: 14, fontWeight: FontWeight.bold),
|
|
|
|
|
if (visit.employName != null && visit.employName.isNotEmpty) Divider(color: onItemColor),
|
|
|
|
|
if (visit.employName != null && visit.employName.isNotEmpty)
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
visit.employName ?? "No employ found",
|
|
|
|
|
style: Theme.of(context).textTheme.titleLarge.copyWith(color: onItemColor, fontSize: 14, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// Text(
|
|
|
|
|
// visit.contactStatus ?? "",
|
|
|
|
|
// style: Theme.of(context).textTheme.subtitle1.copyWith(
|
|
|
|
|
// color: onItemColor,
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
// Text(
|
|
|
|
|
// visit.contactStatus ?? "",
|
|
|
|
|
// style: Theme.of(context).textTheme.subtitle1.copyWith(
|
|
|
|
|
// color: onItemColor,
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Divider(
|
|
|
|
|
color: onItemColor,
|
|
|
|
|
),
|
|
|
|
|
@ -139,18 +138,12 @@ class VisitItem extends StatelessWidget {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
_subtitle.expectDate,
|
|
|
|
|
style: Theme.of(context).textTheme.headline6.copyWith(
|
|
|
|
|
color: onItemColor,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
subtitle.expectDate,
|
|
|
|
|
style: Theme.of(context).textTheme.titleLarge.copyWith(color: onItemColor, fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
visit.expectDate ?? _subtitle.noDateFound,
|
|
|
|
|
style: Theme.of(context).textTheme.headline6.copyWith(
|
|
|
|
|
color: onItemColor,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
visit.expectDate ?? subtitle.noDateFound,
|
|
|
|
|
style: Theme.of(context).textTheme.titleLarge.copyWith(color: onItemColor, fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -159,25 +152,12 @@ class VisitItem extends StatelessWidget {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
_subtitle.actualDate,
|
|
|
|
|
style: Theme.of(context).textTheme.headline6.copyWith(
|
|
|
|
|
color: onItemColor,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
subtitle.actualDate,
|
|
|
|
|
style: Theme.of(context).textTheme.titleLarge.copyWith(color: onItemColor, fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
visit.actualDate ?? _subtitle.noDateFound,
|
|
|
|
|
style: Theme.of(context).textTheme.headline6.copyWith(
|
|
|
|
|
color: onItemColor,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
// Text(
|
|
|
|
|
// visit.contactStatus ?? "",
|
|
|
|
|
// style: Theme.of(context).textTheme.subtitle1.copyWith(
|
|
|
|
|
// color: onItemColor,
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
visit.actualDate ?? subtitle.noDateFound,
|
|
|
|
|
style: Theme.of(context).textTheme.titleLarge.copyWith(color: onItemColor, fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
|