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.
180 lines
6.9 KiB
Dart
180 lines
6.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:test_sa/controllers/localization/localization.dart';
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
import 'package:test_sa/models/subtitle.dart';
|
|
import 'package:test_sa/models/visits/visit.dart';
|
|
import 'package:test_sa/views/app_style/colors.dart';
|
|
import 'package:test_sa/views/app_style/sizing.dart';
|
|
import 'package:test_sa/views/pages/user/visits/pantry/edit_pentry.dart';
|
|
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
|
|
import 'package:test_sa/views/widgets/buttons/app_icon_button.dart';
|
|
import 'package:test_sa/views/widgets/images/files_list.dart';
|
|
import 'package:test_sa/views/widgets/images/images_list.dart';
|
|
import 'package:test_sa/views/widgets/requests/info_row.dart';
|
|
import 'package:test_sa/views/widgets/visits/visit_status.dart';
|
|
|
|
import '../../../../controllers/providers/api/user_provider.dart';
|
|
import '../../../../models/enums/user_types.dart';
|
|
import '../../../widgets/loaders/image_loader.dart';
|
|
|
|
class VisitDetailsPage extends StatelessWidget {
|
|
static const String id = "/visit-details";
|
|
final Visit visit;
|
|
|
|
const VisitDetailsPage({Key key, this.visit}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Subtitle subtitle = AppLocalization.of(context).subtitle;
|
|
UserProvider userProvider = Provider.of<UserProvider>(context);
|
|
|
|
return Scaffold(
|
|
body: SafeArea(
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
color: AColors.primaryColor,
|
|
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),
|
|
child: Row(
|
|
children: [
|
|
const ABackButton(),
|
|
Expanded(
|
|
child: Center(
|
|
child: Text(
|
|
subtitle.visitInformation,
|
|
style: Theme.of(context).textTheme.titleLarge.copyWith(color: AColors.white, fontStyle: FontStyle.italic),
|
|
),
|
|
),
|
|
),
|
|
if (userProvider?.user?.type == UsersTypes.engineer)
|
|
AIconButton(
|
|
iconData: Icons.edit,
|
|
color: AColors.white,
|
|
buttonSize: 42,
|
|
backgroundColor: AColors.green,
|
|
onPressed: () async {
|
|
Navigator.of(context).push(
|
|
MaterialPageRoute(
|
|
builder: (_) => EditPentry(
|
|
visit: visit,
|
|
pentry: visit.pentry,
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
const SizedBox(width: 42)
|
|
],
|
|
),
|
|
),
|
|
Expanded(
|
|
child: ListView(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
children: [
|
|
const SizedBox(height: 8),
|
|
// MaterialButton(
|
|
// padding: EdgeInsets.zero,
|
|
// onPressed: () {
|
|
// if ((visit.images?.isNotEmpty ?? false) && (visit.images?.first?.isNotEmpty ?? false)) {
|
|
// Navigator.of(context).push(
|
|
// MaterialPageRoute(
|
|
// builder: (_) => Scaffold(
|
|
// body: InteractiveViewer(
|
|
// child: Center(
|
|
// child: ImageLoader(
|
|
// url: visit.images.first,
|
|
// boxFit: BoxFit.contain,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// );
|
|
// }
|
|
// },
|
|
// child: SizedBox(
|
|
// height: 140 * AppStyle.getScaleFactor(context),
|
|
// width: MediaQuery.of(context).size.width,
|
|
// child: ImageLoader(
|
|
// url: visit.images.isEmpty ? " " : visit.images.first,
|
|
// boxFit: BoxFit.cover,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// const SizedBox(
|
|
// height: 8,
|
|
// ),
|
|
if (visit?.images?.isNotEmpty ?? false)
|
|
SizedBox(
|
|
height: 60 * AppStyle.getScaleFactor(context),
|
|
child: FilesList(
|
|
images: visit.images,
|
|
),
|
|
).paddingOnly(top: 4, bottom: 4),
|
|
const SizedBox(
|
|
height: 8,
|
|
),
|
|
RequestInfoRow(
|
|
title: subtitle.code,
|
|
info: visit.serialNumber,
|
|
),
|
|
RequestInfoRow(
|
|
title: "Asset Number",
|
|
info: visit.deviceNumber,
|
|
),
|
|
RequestInfoRow(
|
|
title: subtitle.deviceName,
|
|
content: visit.deviceEnglishName,
|
|
),
|
|
RequestInfoRow(
|
|
title: subtitle.deviceSN,
|
|
info: visit.deviceSerialNumber,
|
|
),
|
|
RequestInfoRow(
|
|
title: subtitle.expectDate,
|
|
info: visit.expectDate,
|
|
),
|
|
RequestInfoRow(
|
|
title: subtitle.actualDate,
|
|
info: visit.actualDate,
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
"${subtitle.status} : ",
|
|
style: Theme.of(context).textTheme.titleMedium.copyWith(fontWeight: FontWeight.bold),
|
|
textScaleFactor: AppStyle.getScaleFactor(context),
|
|
),
|
|
),
|
|
VisitStatusLabel(
|
|
visit: visit,
|
|
),
|
|
],
|
|
),
|
|
Divider(
|
|
color: Theme.of(context).primaryColor,
|
|
),
|
|
RequestInfoRow(
|
|
title: subtitle.contactStatus,
|
|
info: visit.assignTo,
|
|
),
|
|
RequestInfoRow(
|
|
title: subtitle.engineerName,
|
|
info: visit.employName,
|
|
),
|
|
RequestInfoRow(
|
|
title: subtitle.hospital,
|
|
content: visit.hospitalName,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|