ppm parameter added for FMS. & huawei token improvement.

main_design2.1
Sikander Saleem 1 year ago
parent a6762ad424
commit 8d8984cc4f

@ -1,8 +1,8 @@
class URLs {
URLs._();
static const host1 = "https://atomsm.hmg.com"; // production url
// static const host1 = "https://atomsmdev.hmg.com"; // local UAT url
// static const host1 = "https://atomsm.hmg.com"; // production url
static const host1 = "https://atomsmdev.hmg.com"; // local UAT url
// static String _baseUrl = "$_host/mobile";
static String _baseUrl = "$_host/v2/mobile"; // new V2 apis

@ -4,7 +4,10 @@ import 'dart:io';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:google_api_availability/google_api_availability.dart';
// import 'package:huawei_hmsavailability/huawei_hmsavailability.dart';
import 'package:huawei_push/huawei_push.dart' as h_push;
import 'package:test_sa/controllers/notification/notification_manger.dart';
import 'package:test_sa/models/all_requests_and_count_model.dart';
import 'package:test_sa/models/device/asset_transfer.dart';
import 'package:test_sa/models/new_models/gas_refill_model.dart';
@ -14,9 +17,6 @@ import 'package:test_sa/views/pages/user/gas_refill/gas_refill_details.dart';
import 'package:test_sa/views/pages/user/ppm/ppm_details_page.dart';
import 'package:test_sa/views/pages/user/requests/service_request_details.dart';
// import 'package:huawei_hmsavailability/huawei_hmsavailability.dart';
import 'package:huawei_push/huawei_push.dart' as h_push;
@pragma('vm:entry-point')
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {}
@ -49,16 +49,14 @@ class FirebaseNotificationManger {
// newMessage(toFirebaseRemoteMessage(message));
}, onError: (e) => print(e.toString()));
h_push.Push.getTokenStream.listen((token) {
h_push.Push.getTokenStream.listen((hToken) {
// onToken(token);
print("Huawei Token: ${token}");
FirebaseNotificationManger.token = token;
token = hToken;
}, onError: (e) {
print(e.toString());
}
);
});
h_push.Push.getToken('');
} else {
if (settings.authorizationStatus == AuthorizationStatus.authorized) {
try {

@ -7,6 +7,8 @@ class PpmChecklists {
this.taskComment,
this.measuredValue,
this.taskStatusName,
this.instructionTextId,
this.text,
});
PpmChecklists.fromJson(dynamic json) {
@ -17,6 +19,8 @@ class PpmChecklists {
taskStatusName = json['taskStatusName'];
taskComment = json['taskComment'];
measuredValue = json['measuredValue'];
instructionTextId = json['instructionTextId'];
text = json['text'];
}
num id;
@ -26,6 +30,8 @@ class PpmChecklists {
String taskComment;
String measuredValue;
String taskStatusName;
num instructionTextId;
String text;
PpmChecklists copyWith({
num id,
@ -35,6 +41,8 @@ class PpmChecklists {
String taskComment,
String measuredValue,
String taskStatusName,
num instructionTextId,
String text,
}) =>
PpmChecklists(
id: id ?? this.id,
@ -44,6 +52,8 @@ class PpmChecklists {
taskComment: taskComment ?? this.taskComment,
measuredValue: measuredValue ?? this.measuredValue,
taskStatusName: taskStatusName ?? this.taskStatusName,
instructionTextId: instructionTextId ?? this.instructionTextId,
text: text ?? this.text,
);
Map<String, dynamic> toJson() {
@ -55,6 +65,8 @@ class PpmChecklists {
map['taskComment'] = taskComment;
map['measuredValue'] = measuredValue;
map['taskStatusName'] = taskStatusName;
map['instructionTextId'] = instructionTextId;
map['text'] = text;
return map;
}
}

@ -25,8 +25,7 @@ class _PentryPMChecklistFormState extends State<PentryPMChecklistForm> {
@override
Widget build(BuildContext context) {
final list =
widget.models?.where((element) => element.task != null)?.toList();
final list = widget.models?.where((element) => element.task != null)?.toList();
return (list?.isEmpty ?? true)
? context.translation.noDataFound.heading5(context).center
: ListView.builder(
@ -37,7 +36,7 @@ class _PentryPMChecklistFormState extends State<PentryPMChecklistForm> {
return Card(
child: ExpansionTile(
shape: const Border(),
title: (list[index].task ?? "").heading5(context),
title: (list[index].instructionTextId == null ? (list[index].task ?? "") : (list[index].text ?? "")).heading5(context),
onExpansionChanged: (value) {
if (!value) {
showLabel.remove(index);
@ -46,28 +45,16 @@ class _PentryPMChecklistFormState extends State<PentryPMChecklistForm> {
}
setState(() {});
},
subtitle: showLabel.isNotEmpty && showLabel.contains(index)
? null
: "${context.translation.status} ${list[index].taskStatusName}"
.bodyText(context),
iconColor:
context.isDark ? AppColor.neutral30 : AppColor.neutral50,
collapsedIconColor:
context.isDark ? AppColor.neutral30 : AppColor.neutral50,
childrenPadding: EdgeInsets.symmetric(
horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
subtitle: showLabel.isNotEmpty && showLabel.contains(index) ? null : "${context.translation.status} ${list[index].taskStatusName}".bodyText(context),
iconColor: context.isDark ? AppColor.neutral30 : AppColor.neutral50,
collapsedIconColor: context.isDark ? AppColor.neutral30 : AppColor.neutral50,
childrenPadding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
children: [
if (showLabel.isNotEmpty && showLabel.contains(index))
SingleItemDropDownMenu<Lookup,
PpmChecklistStatusProvider>(
SingleItemDropDownMenu<Lookup, PpmChecklistStatusProvider>(
context: context,
backgroundColor:
context.isDark ? AppColor.neutral50 : null,
initialValue: list[index].taskStatusId == null
? null
: Lookup(
id: list[index].taskStatusId,
name: list[index].taskStatusName),
backgroundColor: context.isDark ? AppColor.neutral50 : null,
initialValue: list[index].taskStatusId == null ? null : Lookup(id: list[index].taskStatusId, name: list[index].taskStatusName),
title: context.translation.status,
onSelect: (value) {
if (value != null) {
@ -76,14 +63,12 @@ class _PentryPMChecklistFormState extends State<PentryPMChecklistForm> {
}
},
),
if (showLabel.isNotEmpty && showLabel.contains(index))
8.height,
if (showLabel.isNotEmpty && showLabel.contains(index)) 8.height,
AppTextFormField(
labelText: context.translation.measuredValue,
initialValue: list[index].measuredValue,
// enable: false,
backgroundColor:
context.isDark ? AppColor.neutral20 : null,
backgroundColor: context.isDark ? AppColor.neutral20 : null,
// backgroundColor: context.isDark ? AppColor.neutral50 : null,
onChange: (text) {
list[index].measuredValue = text;
@ -94,8 +79,7 @@ class _PentryPMChecklistFormState extends State<PentryPMChecklistForm> {
labelText: context.translation.comment,
initialValue: list[index].taskComment,
// enable: false,
backgroundColor:
context.isDark ? AppColor.neutral20 : null,
backgroundColor: context.isDark ? AppColor.neutral20 : null,
// backgroundColor: context.isDark ? AppColor.neutral50 : null,
onChange: (text) {
list[index].taskComment = text;

Loading…
Cancel
Save