|
|
|
@ -1,9 +1,7 @@
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
import 'package:provider/provider.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/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/context_extension.dart';
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
import 'package:test_sa/extensions/string_extensions.dart';
|
|
|
|
import 'package:test_sa/extensions/string_extensions.dart';
|
|
|
|
@ -31,7 +29,6 @@ class GasRefillDetailsPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
|
|
class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
GasRefillModel _model = GasRefillModel(gazRefillDetails: []);
|
|
|
|
GasRefillModel _model = GasRefillModel(gazRefillDetails: []);
|
|
|
|
bool _enableEdit = false;
|
|
|
|
|
|
|
|
UserProvider _userProvider;
|
|
|
|
UserProvider _userProvider;
|
|
|
|
bool _isLoading = false;
|
|
|
|
bool _isLoading = false;
|
|
|
|
|
|
|
|
|
|
|
|
@ -46,7 +43,6 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
|
|
|
|
_userProvider = Provider.of<UserProvider>(context);
|
|
|
|
_userProvider = Provider.of<UserProvider>(context);
|
|
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
return Scaffold(
|
|
|
|
@ -61,9 +57,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
stateCode: 200,
|
|
|
|
stateCode: 200,
|
|
|
|
onRefresh: () async {},
|
|
|
|
onRefresh: () async {},
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
children: [informationCard()],
|
|
|
|
informationCard()
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -99,60 +93,15 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
//textColor: AColors.getPriorityStatusTextColor(serviceRequest.priority.id),
|
|
|
|
//textColor: AColors.getPriorityStatusTextColor(serviceRequest.priority.id),
|
|
|
|
//backgroundColor: AColors.getPriorityStatusColor(serviceRequest.priority.id)
|
|
|
|
//backgroundColor: AColors.getPriorityStatusColor(serviceRequest.priority.id)
|
|
|
|
//),
|
|
|
|
//),
|
|
|
|
8.width,
|
|
|
|
// 8.width,
|
|
|
|
StatusLabel(
|
|
|
|
StatusLabel(
|
|
|
|
label: widget.model.status?.name??"",
|
|
|
|
label: widget.model.status?.name ?? "",
|
|
|
|
textColor: AColors.getRequestStatusTextColor(widget.model.status?.value??0),
|
|
|
|
textColor: AColors.getRequestStatusTextColor(widget.model.status?.value ?? 0),
|
|
|
|
backgroundColor: AColors.getRequestStatusColor(widget.model.status?.value??0)),
|
|
|
|
backgroundColor: AColors.getRequestStatusColor(widget.model.status?.value ?? 0)),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
Text(context.translation.gasRefillRequest, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
Text(context.translation.gasRefillRequest, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
],
|
|
|
|
8.height,
|
|
|
|
),
|
|
|
|
|
|
|
|
1.width.expanded,
|
|
|
|
|
|
|
|
if (_userProvider.user.type == UsersTypes.engineer)
|
|
|
|
|
|
|
|
CircleAvatar(
|
|
|
|
|
|
|
|
radius: 25,
|
|
|
|
|
|
|
|
backgroundColor: AppColor.neutral30,
|
|
|
|
|
|
|
|
child: CircleAvatar(
|
|
|
|
|
|
|
|
radius: 24,
|
|
|
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
|
|
|
child: Padding(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.only(left: 3.0),
|
|
|
|
|
|
|
|
child: SvgPicture.asset('assets/images/update.svg'),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
).onPress(
|
|
|
|
|
|
|
|
(widget.model.status?.value ?? 0) == 2
|
|
|
|
|
|
|
|
? null
|
|
|
|
|
|
|
|
:
|
|
|
|
|
|
|
|
() async {
|
|
|
|
|
|
|
|
_enableEdit = !_enableEdit;
|
|
|
|
|
|
|
|
_model?.fromGasRefillModel(widget.model);
|
|
|
|
|
|
|
|
// setState(() {});
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
|
|
|
builder: (context) => RequestGasRefill(
|
|
|
|
|
|
|
|
gasRefillModel: widget.model,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
).then((value) {
|
|
|
|
|
|
|
|
if (value != null) {
|
|
|
|
|
|
|
|
_model = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
///TBD
|
|
|
|
///TBD
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
context.translation.gasRequest,
|
|
|
|
context.translation.gasRequest,
|
|
|
|
@ -168,7 +117,44 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(widget.model.startDate?.toServiceRequestCardFormat??"", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
1.width.expanded,
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
if (_userProvider.user.type == UsersTypes.engineer && (widget.model.status?.value ?? 0) != 2)
|
|
|
|
|
|
|
|
CircleAvatar(
|
|
|
|
|
|
|
|
radius: 25,
|
|
|
|
|
|
|
|
backgroundColor: AppColor.neutral30,
|
|
|
|
|
|
|
|
child: CircleAvatar(
|
|
|
|
|
|
|
|
radius: 24,
|
|
|
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
|
|
|
child: Padding(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.only(left: 3.0),
|
|
|
|
|
|
|
|
child: SvgPicture.asset('assets/images/update.svg'),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
).onPress(
|
|
|
|
|
|
|
|
() async {
|
|
|
|
|
|
|
|
_model?.fromGasRefillModel(widget.model);
|
|
|
|
|
|
|
|
// setState(() {});
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
|
|
|
builder: (context) => RequestGasRefill(
|
|
|
|
|
|
|
|
gasRefillModel: widget.model,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
).then((value) {
|
|
|
|
|
|
|
|
if (value != null) {
|
|
|
|
|
|
|
|
_model = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Text(widget.model.startDate?.toServiceRequestCardFormat ?? "", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
@ -185,59 +171,59 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).paddingAll(16),
|
|
|
|
).paddingAll(16),
|
|
|
|
|
|
|
|
|
|
|
|
/// TBD
|
|
|
|
/// TBD
|
|
|
|
(_userProvider.user.type == UsersTypes.normal_user
|
|
|
|
(_userProvider.user.type == UsersTypes.normal_user
|
|
|
|
? Container(
|
|
|
|
? Container(
|
|
|
|
height: 50,
|
|
|
|
height: 50,
|
|
|
|
padding: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
padding: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
decoration: const ShapeDecoration(
|
|
|
|
decoration: const ShapeDecoration(
|
|
|
|
color: Color(0xFFEAF1F4),
|
|
|
|
color: Color(0xFFEAF1F4),
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
bottomLeft: Radius.circular(20),
|
|
|
|
bottomLeft: Radius.circular(20),
|
|
|
|
bottomRight: Radius.circular(20),
|
|
|
|
bottomRight: Radius.circular(20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
'${context.translation.commentHere}...',
|
|
|
|
'${context.translation.commentHere}...',
|
|
|
|
style: AppTextStyles.heading6.copyWith(
|
|
|
|
style: AppTextStyles.heading6.copyWith(
|
|
|
|
color: AppColor.neutral50.withOpacity(.6),
|
|
|
|
color: AppColor.neutral50.withOpacity(.6),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
).expanded,
|
|
|
|
).expanded,
|
|
|
|
SvgPicture.asset("assets/images/comment_send.svg", width: 24 * AppStyle.getScaleFactor(context), height: 24 * AppStyle.getScaleFactor(context), color: AppColor.primary70),
|
|
|
|
SvgPicture.asset("assets/images/comment_send.svg", width: 24 * AppStyle.getScaleFactor(context), height: 24 * AppStyle.getScaleFactor(context), color: AppColor.primary70),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: Column(
|
|
|
|
: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
16.height,
|
|
|
|
16.height,
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
'${context.translation.viewComments}',
|
|
|
|
'${context.translation.viewComments}',
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
4.width,
|
|
|
|
4.width,
|
|
|
|
const Icon(
|
|
|
|
const Icon(
|
|
|
|
Icons.arrow_forward,
|
|
|
|
Icons.arrow_forward,
|
|
|
|
color: Color(0xFF4A8DB7),
|
|
|
|
color: Color(0xFF4A8DB7),
|
|
|
|
size: 14,
|
|
|
|
size: 14,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).paddingOnly(bottom: 16, start: 16, end: 16))
|
|
|
|
).paddingOnly(bottom: 16, start: 16, end: 16))
|
|
|
|
.onPress(() {
|
|
|
|
.onPress(() {}),
|
|
|
|
}),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
).paddingAll(16);
|
|
|
|
).paddingAll(16);
|
|
|
|
|