approval bottom sheet added. & improvements.
parent
388761a8aa
commit
dc9266a0da
@ -0,0 +1 @@
|
||||
{"nm":"Timer","ddd":0,"h":48,"w":48,"meta":{"g":"@lottiefiles/toolkit-js 0.33.2"},"layers":[{"ty":4,"nm":"seconds","sr":1,"st":0,"op":480,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[-21.625,0.32,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6},"sk":{"a":0,"k":0},"p":{"a":0,"k":[24.375,23.781,0],"ix":2},"r":{"a":1,"k":[{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[235],"t":0},{"s":[595],"t":479}],"ix":10},"sa":{"a":0,"k":0},"o":{"a":0,"k":100,"ix":11}},"ef":[],"shapes":[{"ty":"gr","bm":0,"hd":false,"mn":"ADBE Vector Group","nm":"Rectangle 1","ix":1,"cix":2,"np":3,"it":[{"ty":"rc","bm":0,"hd":false,"mn":"ADBE Vector Shape - Rect","nm":"Rectangle Path 1","d":1,"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":100,"ix":4},"s":{"a":0,"k":[4,16],"ix":2}},{"ty":"st","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Stroke","nm":"Stroke 1","lc":1,"lj":1,"ml":4,"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"c":{"a":0,"k":[0.2392,0.6471,0.898],"ix":3}},{"ty":"fl","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","c":{"a":0,"k":[0.2392,0.6471,0.898],"ix":4},"r":1,"o":{"a":0,"k":100,"ix":5}},{"ty":"tr","a":{"a":0,"k":[0,6.25],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[-21.625,0.5],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]}],"ind":1},{"ty":4,"nm":"minutes","sr":1,"st":0,"op":480,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[-21.625,2.422,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6},"sk":{"a":0,"k":0},"p":{"a":0,"k":[24.375,23.781,0],"ix":2},"r":{"a":0,"k":0,"ix":10},"sa":{"a":0,"k":0},"o":{"a":0,"k":100,"ix":11}},"ef":[],"shapes":[{"ty":"gr","bm":0,"hd":false,"mn":"ADBE Vector Group","nm":"Rectangle 1","ix":1,"cix":2,"np":3,"it":[{"ty":"rc","bm":0,"hd":false,"mn":"ADBE Vector Shape - Rect","nm":"Rectangle Path 1","d":1,"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":112,"ix":4},"s":{"a":0,"k":[4,20],"ix":2}},{"ty":"st","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Stroke","nm":"Stroke 1","lc":1,"lj":1,"ml":4,"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"c":{"a":0,"k":[0.2392,0.6471,0.898],"ix":3}},{"ty":"fl","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","c":{"a":0,"k":[0.2392,0.6471,0.898],"ix":4},"r":1,"o":{"a":0,"k":100,"ix":5}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[-21.625,-5.75],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]}],"ind":2},{"ty":4,"nm":"background","sr":1,"st":0,"op":480,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[0.504,2.008,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6},"sk":{"a":0,"k":0},"p":{"a":0,"k":[24.379,23.758,0],"ix":2},"r":{"a":0,"k":0,"ix":10},"sa":{"a":0,"k":0},"o":{"a":0,"k":100,"ix":11}},"ef":[],"shapes":[{"ty":"gr","bm":0,"hd":false,"mn":"ADBE Vector Group","nm":"Ellipse 1","ix":1,"cix":2,"np":3,"it":[{"ty":"el","bm":0,"hd":false,"mn":"ADBE Vector Shape - Ellipse","nm":"Ellipse Path 1","d":1,"p":{"a":0,"k":[0,0],"ix":3},"s":{"a":0,"k":[24.5,24.5],"ix":2}},{"ty":"st","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Stroke","nm":"Stroke 1","lc":1,"lj":1,"ml":4,"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"c":{"a":0,"k":[0.2392,0.6471,0.898],"ix":3}},{"ty":"fl","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","c":{"a":0,"k":[0.7451,0.902,1],"ix":4},"r":1,"o":{"a":0,"k":100,"ix":5}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[186.718,186.718],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[0.5,2],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]}],"ind":3}],"v":"5.5.4","fr":60,"op":480,"ip":0,"assets":[]}
|
||||
@ -0,0 +1,99 @@
|
||||
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_push/huawei_push.dart' as h_push;
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
|
||||
class RequestApprovalBottomSheet extends StatefulWidget {
|
||||
RequestApprovalBottomSheet({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_RequestApprovalBottomState createState() {
|
||||
return _RequestApprovalBottomState();
|
||||
}
|
||||
}
|
||||
|
||||
class _RequestApprovalBottomState extends State<RequestApprovalBottomSheet> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
listenForApproval();
|
||||
}
|
||||
|
||||
void listenForApproval() async {
|
||||
if (Platform.isAndroid && !(await isGoogleServicesAvailable())) {
|
||||
h_push.Push.onMessageReceivedStream.listen((h_push.RemoteMessage remoteMessage) {
|
||||
print("onMessageReceivedStream:${remoteMessage.toMap()}");
|
||||
}, onError: (Object error) {
|
||||
print("onMessageReceivedStream:${error?.toString()}");
|
||||
});
|
||||
} else {
|
||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||
Map<String, dynamic> messageData = message.data;
|
||||
if (messageData["notificaitonType"] != null && messageData["arrived"] != null) {
|
||||
if (messageData["notificaitonType"] == "arrivalConfirmation") {
|
||||
if ((messageData["arrived"].toString()) == "true") {
|
||||
Navigator.pop(context, true);
|
||||
} else {
|
||||
Navigator.pop(context, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> isGoogleServicesAvailable() async {
|
||||
GooglePlayServicesAvailability availability = await GoogleApiAvailability.instance.checkGooglePlayServicesAvailability();
|
||||
String status = availability.toString().split('.').last;
|
||||
if (status == "success") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
width: double.infinity,
|
||||
margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.background(context),
|
||||
borderRadius: const BorderRadius.only(topRight: Radius.circular(20), topLeft: Radius.circular(20)),
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 24.toScreenHeight),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
"Waiting...".heading4(context),
|
||||
12.height,
|
||||
Text(
|
||||
"Request Sent, Waiting for requester to confirm arrival",
|
||||
style: TextStyle(
|
||||
fontSize: 16.toScreenWidth,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontStyle: FontStyle.normal,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
12.height,
|
||||
"waiting".toLottieAsset(height: 100).center,
|
||||
12.height,
|
||||
],
|
||||
),
|
||||
);
|
||||
;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue