|
|
|
|
@ -1,9 +1,7 @@
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/gas_refill_provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/string_extensions.dart';
|
|
|
|
|
@ -31,7 +29,6 @@ class GasRefillDetailsPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
GasRefillModel _model = GasRefillModel(gazRefillDetails: []);
|
|
|
|
|
bool _enableEdit = false;
|
|
|
|
|
UserProvider _userProvider;
|
|
|
|
|
bool _isLoading = false;
|
|
|
|
|
|
|
|
|
|
@ -46,7 +43,6 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
|
|
_userProvider = Provider.of<UserProvider>(context);
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
@ -61,9 +57,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
stateCode: 200,
|
|
|
|
|
onRefresh: () async {},
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
informationCard()
|
|
|
|
|
],
|
|
|
|
|
children: [informationCard()],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -99,17 +93,35 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
//textColor: AColors.getPriorityStatusTextColor(serviceRequest.priority.id),
|
|
|
|
|
//backgroundColor: AColors.getPriorityStatusColor(serviceRequest.priority.id)
|
|
|
|
|
//),
|
|
|
|
|
8.width,
|
|
|
|
|
// 8.width,
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: widget.model.status?.name ?? "",
|
|
|
|
|
textColor: AColors.getRequestStatusTextColor(widget.model.status?.value ?? 0),
|
|
|
|
|
backgroundColor: AColors.getRequestStatusColor(widget.model.status?.value ?? 0)),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(context.translation.gasRefillRequest, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
|
|
///TBD
|
|
|
|
|
Text(
|
|
|
|
|
context.translation.gasRequest,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.cylinderSize}: ${widget.model.gazRefillDetails[0].cylinderSize.value}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.site}: ${widget.model.site.name}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
1.width.expanded,
|
|
|
|
|
if (_userProvider.user.type == UsersTypes.engineer)
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
if (_userProvider.user.type == UsersTypes.engineer && (widget.model.status?.value ?? 0) != 2)
|
|
|
|
|
CircleAvatar(
|
|
|
|
|
radius: 25,
|
|
|
|
|
backgroundColor: AppColor.neutral30,
|
|
|
|
|
@ -122,11 +134,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
).onPress(
|
|
|
|
|
(widget.model.status?.value ?? 0) == 2
|
|
|
|
|
? null
|
|
|
|
|
:
|
|
|
|
|
() async {
|
|
|
|
|
_enableEdit = !_enableEdit;
|
|
|
|
|
_model?.fromGasRefillModel(widget.model);
|
|
|
|
|
// setState(() {});
|
|
|
|
|
Navigator.push(
|
|
|
|
|
@ -142,34 +150,12 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
setState(() {});
|
|
|
|
|
},),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
///TBD
|
|
|
|
|
Text(
|
|
|
|
|
context.translation.gasRequest,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.cylinderSize}: ${widget.model.gazRefillDetails[0].cylinderSize.value}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.site}: ${widget.model.site.name}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Text(widget.model.startDate?.toServiceRequestCardFormat ?? "", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
@ -185,6 +171,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
).paddingAll(16),
|
|
|
|
|
|
|
|
|
|
/// TBD
|
|
|
|
|
(_userProvider.user.type == UsersTypes.normal_user
|
|
|
|
|
? Container(
|
|
|
|
|
@ -236,8 +223,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(bottom: 16, start: 16, end: 16))
|
|
|
|
|
.onPress(() {
|
|
|
|
|
}),
|
|
|
|
|
.onPress(() {}),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).paddingAll(16);
|
|
|
|
|
|