ppm parameter added for FMS. & huawei token improvement.

main_design2.1
Sikander Saleem 2 years ago
parent a6762ad424
commit 8d8984cc4f

@ -1,8 +1,8 @@
class URLs { class URLs {
URLs._(); URLs._();
static const host1 = "https://atomsm.hmg.com"; // production url // static const host1 = "https://atomsm.hmg.com"; // production url
// static const host1 = "https://atomsmdev.hmg.com"; // local UAT url static const host1 = "https://atomsmdev.hmg.com"; // local UAT url
// static String _baseUrl = "$_host/mobile"; // static String _baseUrl = "$_host/mobile";
static String _baseUrl = "$_host/v2/mobile"; // new V2 apis 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:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_api_availability/google_api_availability.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/controllers/notification/notification_manger.dart';
import 'package:test_sa/models/all_requests_and_count_model.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/device/asset_transfer.dart';
import 'package:test_sa/models/new_models/gas_refill_model.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/ppm/ppm_details_page.dart';
import 'package:test_sa/views/pages/user/requests/service_request_details.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') @pragma('vm:entry-point')
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {} Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {}
@ -49,16 +49,14 @@ class FirebaseNotificationManger {
// newMessage(toFirebaseRemoteMessage(message)); // newMessage(toFirebaseRemoteMessage(message));
}, onError: (e) => print(e.toString())); }, onError: (e) => print(e.toString()));
h_push.Push.getTokenStream.listen((token) { h_push.Push.getTokenStream.listen((hToken) {
// onToken(token); // onToken(token);
print("Huawei Token: ${token}"); print("Huawei Token: ${token}");
FirebaseNotificationManger.token = token; token = hToken;
}, onError: (e) { }, onError: (e) {
print(e.toString()); print(e.toString());
} });
);
h_push.Push.getToken(''); h_push.Push.getToken('');
} else { } else {
if (settings.authorizationStatus == AuthorizationStatus.authorized) { if (settings.authorizationStatus == AuthorizationStatus.authorized) {
try { try {

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

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

Loading…
Cancel
Save