NFC Attendance implement
							parent
							
								
									681fe7fb38
								
							
						
					
					
						commit
						68729ddbb9
					
				
											
												Binary file not shown.
											
										
									
								| After Width: | Height: | Size: 18 KiB | 
											
												Binary file not shown.
											
										
									
								| After Width: | Height: | Size: 19 KiB | 
| @ -0,0 +1,30 @@ | ||||
| import 'package:permission_handler/permission_handler.dart'; | ||||
| 
 | ||||
| class AppPermissions{ | ||||
|   static location(Function(bool) completion) { | ||||
|     Permission.location.isGranted.then((isGranted){ | ||||
|       if(!isGranted){ | ||||
|         Permission.location.request().then((granted){ | ||||
|           completion(granted == PermissionStatus.granted); | ||||
|         }); | ||||
|       } | ||||
|       completion(isGranted); | ||||
|     }); | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   static checkAll(Function(bool) completion){ | ||||
|     [ | ||||
|       Permission.location | ||||
|     ].request().then((value){ | ||||
| 
 | ||||
|       bool allGranted = false; | ||||
|       value.values.forEach((element) { | ||||
|         allGranted = allGranted && element == PermissionStatus.granted; | ||||
|       }); | ||||
| 
 | ||||
|       completion(allGranted); | ||||
| 
 | ||||
|     }); | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,249 @@ | ||||
| import 'dart:async'; | ||||
| import 'dart:math'; | ||||
| import 'dart:ui'; | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter/rendering.dart'; | ||||
| import 'package:geolocator/geolocator.dart'; | ||||
| import 'package:google_directions_api/google_directions_api.dart'; | ||||
| import 'package:google_maps_flutter/google_maps_flutter.dart'; | ||||
| import 'package:mohem_flutter_app/classes/utils.dart'; | ||||
| // import 'package:geodesy/geodesy.dart' as geodesy; | ||||
| 
 | ||||
| import '../../classes/app_permissions.dart'; | ||||
| import '../../theme/colors.dart'; | ||||
| 
 | ||||
| 
 | ||||
| //Created By Mr.Zohaib | ||||
| class Location { | ||||
|   static _Map map = _Map(); | ||||
| 
 | ||||
|   static havePermission(Function(bool) callback) { | ||||
|     Geolocator.checkPermission().then((value) async { | ||||
|       if (value == LocationPermission.denied) { | ||||
|         value = await Geolocator.requestPermission(); | ||||
|         callback(![LocationPermission.denied, LocationPermission.deniedForever].contains(value)); | ||||
|       } else { | ||||
|         callback(true); | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   static isEnabled(Function(bool) callback) { | ||||
|     Geolocator.isLocationServiceEnabled().then((value) => callback(value)); | ||||
|   } | ||||
| 
 | ||||
|   static bool _listeningSettingChange = true; | ||||
| 
 | ||||
|   static listenGPS({bool change = true, Function(bool)? onChange}) async { | ||||
|     _listeningSettingChange = change; | ||||
|     if (change == false) return; | ||||
| 
 | ||||
|     Future.doWhile(() async { | ||||
|       await Utils.delay(1000); | ||||
|       var enable = await Geolocator.isLocationServiceEnabled(); | ||||
|       onChange!(enable); | ||||
|       return _listeningSettingChange; | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   static getCurrentLocation(Function(LatLng?) callback) { | ||||
|     done(Position position) { | ||||
|       //AppStorage.sp.saveLocation(position); | ||||
| 
 | ||||
|       LatLng? myCurrentLocation = LatLng(position.latitude, position.longitude); | ||||
|       callback(myCurrentLocation); | ||||
|     } | ||||
| 
 | ||||
|     AppPermissions.location((granted) { | ||||
| 
 | ||||
|       if (granted) | ||||
|         Geolocator.getLastKnownPosition(forceAndroidLocationManager: true).then((value) { | ||||
|           if (value == null) { | ||||
|             Geolocator.getCurrentPosition().then((value) { | ||||
|               done(value); | ||||
|             }); | ||||
|           } else { | ||||
|             done(value); | ||||
|           } | ||||
|         }); | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   // static LatLng locationAwayFrom( | ||||
|   //     {required LatLng loc1, num distanceMeters = 200.0, num bearing = 270.0}) { | ||||
|   //   geodesy.LatLng l1 = geodesy.LatLng(loc1.latitude, loc1.longitude); | ||||
|   //   geodesy.LatLng destinationPoint = geodesy.Geodesy() | ||||
|   //       .destinationPointByDistanceAndBearing(l1, distanceMeters, bearing); | ||||
|   //   return LatLng(destinationPoint.latitude, destinationPoint.longitude); | ||||
|   // } | ||||
| 
 | ||||
|   static Future<double> distanceTo(LatLng destination) async { | ||||
|     var myLoc = await Geolocator.getLastKnownPosition(); | ||||
|     var distance = 0.0; | ||||
|     if (myLoc != null) { | ||||
|       distance = Geolocator.distanceBetween(destination.latitude, destination.longitude, myLoc.latitude, myLoc.longitude); | ||||
|     } | ||||
|     return distance; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class _Map { | ||||
|   Marker createMarker( | ||||
|     String id, { | ||||
|     required LatLng coordinates, | ||||
|     BitmapDescriptor? icon, | ||||
|     VoidCallback? onTap, | ||||
|   }) { | ||||
|     final MarkerId markerId = MarkerId(id); | ||||
|     return Marker( | ||||
|       icon: icon ?? BitmapDescriptor.defaultMarker, | ||||
|       markerId: markerId, | ||||
|       position: coordinates, | ||||
|       flat: false, | ||||
|       // infoWindow: InfoWindow(title: id, snippet: '*'), | ||||
|       onTap: onTap, | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   CameraPosition initialCamera({required Completer<GoogleMapController> mapController, LatLng? position, double zoom = 12}) { | ||||
|     position = position ?? LatLng(24.7249303, 46.5416656); | ||||
|     CameraPosition riyadhEye = CameraPosition( | ||||
|       target: position, | ||||
|       zoom: zoom, | ||||
|     ); | ||||
|     mapController.future.then((controller) { | ||||
|       controller.animateCamera(CameraUpdate.newCameraPosition(riyadhEye)); | ||||
|     }); | ||||
|     return riyadhEye; | ||||
|   } | ||||
| 
 | ||||
|   CameraPosition moveTo(LatLng location, {double zoom = 12, double direction = 0.0, required Completer<GoogleMapController> mapController, bool? animation}) { | ||||
|     var camera = CameraPosition(target: location, zoom: zoom, bearing: direction); | ||||
|     mapController.future.then((controller) { | ||||
|       animation ?? false ? controller.animateCamera(CameraUpdate.newCameraPosition(camera)) : controller.moveCamera(CameraUpdate.newCameraPosition(camera)); | ||||
|     }); | ||||
|     return camera; | ||||
|   } | ||||
| 
 | ||||
|   moveCamera(CameraPosition camera, @required Completer<GoogleMapController> mapController, bool animation) { | ||||
|     mapController.future.then((controller) { | ||||
|       animation ? controller.animateCamera(CameraUpdate.newCameraPosition(camera)) : controller.moveCamera(CameraUpdate.newCameraPosition(camera)); | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   scrollBy({double x = 0, double y = 0, required Completer<GoogleMapController> mapController, bool animation = true}) { | ||||
|     var camera = CameraUpdate.scrollBy(x, y); | ||||
|     mapController.future.then((controller) { | ||||
|       animation ? controller.animateCamera(camera) : controller.moveCamera(camera); | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   goToCurrentLocation({Completer<GoogleMapController>? mapController, double? direction = 0.0, bool? animation}) { | ||||
|     Location.getCurrentLocation((location) { | ||||
|       moveTo(location!, zoom: 17, mapController: mapController!, animation: animation, direction: direction!); | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   var routes = Map<String, DirectionsRoute>(); | ||||
| 
 | ||||
|   setRoutePolylines(LatLng? source, LatLng? destination, Set<Polyline> polylines, Completer<GoogleMapController> mapController, Function(DirectionsRoute?) completion) { | ||||
|     if (source == null || destination == null) { | ||||
|       completion(null); | ||||
|       return; | ||||
|     } | ||||
| 
 | ||||
|     var origin = '${source.latitude},${source.longitude}'; | ||||
|     var destin = '${destination.latitude},${destination.longitude}'; | ||||
|     var routeId = '$origin->$destination'; | ||||
| 
 | ||||
|     createPolyline(DirectionsRoute results) { | ||||
|       List<LatLng> polylineCoordinates = results.overviewPath!.map((e) => LatLng(e.latitude, e.longitude)).toList(); | ||||
|       PolylineId id = PolylineId("route"); | ||||
|       Polyline polyline = Polyline( | ||||
|         polylineId: id, | ||||
|         color: accentColor, | ||||
|         width: 5, | ||||
|         jointType: JointType.round, | ||||
|         startCap: Cap.roundCap, | ||||
|         endCap: Cap.roundCap, | ||||
|         points: polylineCoordinates, | ||||
|       ); | ||||
| 
 | ||||
|       polylines.removeWhere((element) => true); | ||||
|       polylines.add(polyline); | ||||
| 
 | ||||
|       LatLngBounds bound = getBounds(coordinates: polylineCoordinates); | ||||
|       focusCameraToLatLngBounds(bound: bound, mapController: mapController, padding: 100); | ||||
|       completion(routes[routeId]); | ||||
|     } | ||||
| 
 | ||||
|     var availableRoute = routes[routeId]; | ||||
|     if (availableRoute == null) { | ||||
|       var request = DirectionsRequest(origin: origin, destination: destin); | ||||
|       DirectionsService().route(request, (response, status) { | ||||
|         if (status == DirectionsStatus.ok && response.routes!.isNotEmpty) { | ||||
|           routes[routeId] = response.routes!.first; | ||||
|           createPolyline(response.routes!.first); | ||||
|         } | ||||
|       }); | ||||
|     } else { | ||||
|       createPolyline(availableRoute); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   LatLngBounds getBounds({required List<LatLng> coordinates}) { | ||||
|     var lngs = coordinates.map<double>((c) => c.longitude).toList(); | ||||
|     var lats = coordinates.map<double>((c) => c.latitude).toList(); | ||||
| 
 | ||||
|     double bottomMost = lngs.reduce(min); | ||||
|     double topMost = lngs.reduce(max); | ||||
|     double leftMost = lats.reduce(min); | ||||
|     double rightMost = lats.reduce(max); | ||||
| 
 | ||||
|     LatLngBounds bounds = LatLngBounds( | ||||
|       northeast: LatLng(rightMost, topMost), | ||||
|       southwest: LatLng(leftMost, bottomMost), | ||||
|     ); | ||||
|     return bounds; | ||||
| 
 | ||||
|     double? x0, x1, y0, y1; | ||||
|     for (LatLng latLng in coordinates) { | ||||
|       if (x0 == null) { | ||||
|         x0 = x1 = latLng.latitude; | ||||
|         y0 = y1 = latLng.longitude; | ||||
|       } else { | ||||
|         if (latLng.latitude > x1!) x1 = latLng.latitude; | ||||
|         if (latLng.latitude < x0) x0 = latLng.latitude; | ||||
|         if (latLng.longitude > y1!) y1 = latLng.longitude; | ||||
|         if (latLng.longitude < y0!) y0 = latLng.longitude; | ||||
|       } | ||||
|     } | ||||
|     return LatLngBounds(northeast: LatLng(x1!, y1!), southwest: LatLng(x0!, y0!)); | ||||
|   } | ||||
| 
 | ||||
|   focusCameraToLatLngBounds({LatLngBounds? bound, Completer<GoogleMapController>? mapController, double? padding}) async { | ||||
|     if (bound == null) return; | ||||
| 
 | ||||
|     CameraUpdate camera = CameraUpdate.newLatLngBounds(bound, padding!); | ||||
|     final GoogleMapController controller = await mapController!.future; | ||||
|     controller.animateCamera(camera); | ||||
|   } | ||||
| 
 | ||||
|   focusCameraTo2Points({LatLng? point1, LatLng? point2, Completer<GoogleMapController>? mapController, double? padding}) async { | ||||
|     var source = point1; | ||||
|     var destination = point2; | ||||
|     if (source != null && destination != null) { | ||||
|       // 'package:google_maps_flutter_platform_interface/src/types/location.dart': Failed assertion: line 72 pos 16: 'southwest.latitude <= northeast.latitude': is not true. | ||||
|       LatLngBounds bound; | ||||
|       if (source.latitude <= destination.latitude) { | ||||
|         bound = LatLngBounds(southwest: source, northeast: destination); | ||||
|       } else { | ||||
|         bound = LatLngBounds(southwest: destination, northeast: source); | ||||
|       } | ||||
| 
 | ||||
|       if (bound == null) return; | ||||
| 
 | ||||
|       focusCameraToLatLngBounds(bound: bound, mapController: mapController, padding: padding); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,187 @@ | ||||
| import 'dart:async'; | ||||
| 
 | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:nfc_manager/nfc_manager.dart'; | ||||
| import 'package:nfc_manager/platform_tags.dart'; | ||||
| 
 | ||||
| void showNfcReader(BuildContext context, {required Function(String? nfcId) onNcfScan}) { | ||||
|   showModalBottomSheet( | ||||
|     context: context, | ||||
|     enableDrag: false, | ||||
|     isDismissible: false, | ||||
|     shape: RoundedRectangleBorder( | ||||
|       borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)), | ||||
|     ), | ||||
|     backgroundColor: Colors.white, | ||||
|     builder: (context) { | ||||
|       return NfcLayout( | ||||
|         onNcfScan: onNcfScan, | ||||
|       ); | ||||
|     }, | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| class NfcLayout extends StatefulWidget { | ||||
|   Function(String? nfcId) onNcfScan; | ||||
| 
 | ||||
|   NfcLayout({required this.onNcfScan}); | ||||
| 
 | ||||
|   @override | ||||
|   _NfcLayoutState createState() => _NfcLayoutState(); | ||||
| } | ||||
| 
 | ||||
| class _NfcLayoutState extends State<NfcLayout> { | ||||
|   bool _reading = false; | ||||
|   Widget? mainWidget; | ||||
|   String? nfcId; | ||||
| 
 | ||||
|   @override | ||||
|   void initState() { | ||||
|     super.initState(); | ||||
| 
 | ||||
|     NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async { | ||||
|       print(tag.data); | ||||
|       var f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22); | ||||
|       final String identifier = f.identifier.map((e) => e.toRadixString(16).padLeft(2, '0')).join(''); | ||||
|       // print(identifier); // => 0428fcf2255e81 | ||||
|       nfcId = identifier; | ||||
| 
 | ||||
|       setState(() { | ||||
|         _reading = true; | ||||
|         mainWidget = doneNfc(); | ||||
|       }); | ||||
| 
 | ||||
|       Future.delayed(const Duration(seconds: 1), () { | ||||
|         NfcManager.instance.stopSession(); | ||||
|         Navigator.pop(context); | ||||
|         widget.onNcfScan(nfcId); | ||||
|       }); | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     (mainWidget == null && !_reading) ? mainWidget = scanNfc() : mainWidget = doneNfc(); | ||||
|     return AnimatedSwitcher(duration: Duration(milliseconds: 500), child: mainWidget); | ||||
|   } | ||||
| 
 | ||||
|   Widget scanNfc() { | ||||
|     return Container( | ||||
|       key: ValueKey(1), | ||||
|       child: Column( | ||||
|         mainAxisSize: MainAxisSize.min, | ||||
|         children: <Widget>[ | ||||
|           SizedBox( | ||||
|             height: 30, | ||||
|           ), | ||||
|           Text( | ||||
|             "Ready To Scan", | ||||
|             style: TextStyle( | ||||
|               fontWeight: FontWeight.bold, | ||||
|               fontSize: 24, | ||||
|             ), | ||||
|           ), | ||||
|           SizedBox( | ||||
|             height: 30, | ||||
|           ), | ||||
|           Image.asset( | ||||
|             "assets/icons/nfc/ic_nfc.png", | ||||
|             height: MediaQuery.of(context).size.width / 3, | ||||
|           ), | ||||
|           SizedBox( | ||||
|             height: 30, | ||||
|           ), | ||||
|           Text( | ||||
|             "Approach an NFC Tag", | ||||
|             style: TextStyle( | ||||
|               fontSize: 18, | ||||
|             ), | ||||
|           ), | ||||
|           SizedBox( | ||||
|             height: 30, | ||||
|           ), | ||||
|           ButtonTheme( | ||||
|             minWidth: MediaQuery.of(context).size.width / 1.2, | ||||
|             height: 45.0, | ||||
|             buttonColor: Colors.grey[300], | ||||
|             shape: RoundedRectangleBorder( | ||||
|               borderRadius: BorderRadius.circular(6), | ||||
|             ), | ||||
|             child: RaisedButton( | ||||
|               onPressed: () { | ||||
|                 NfcManager.instance.stopSession(); | ||||
|                 Navigator.pop(context); | ||||
|               }, | ||||
|               elevation: 0, | ||||
|               child: Text("CANCEL"), | ||||
|             ), | ||||
|           ), | ||||
|           SizedBox( | ||||
|             height: 30, | ||||
|           ), | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Widget doneNfc() { | ||||
|     return Container( | ||||
|       key: ValueKey(2), | ||||
|       child: Column( | ||||
|         mainAxisSize: MainAxisSize.min, | ||||
|         children: <Widget>[ | ||||
|           SizedBox( | ||||
|             height: 30, | ||||
|           ), | ||||
|           Text( | ||||
|             "Successfully Scanned", | ||||
|             style: TextStyle( | ||||
|               fontWeight: FontWeight.bold, | ||||
|               fontSize: 24, | ||||
|             ), | ||||
|           ), | ||||
|           SizedBox( | ||||
|             height: 30, | ||||
|           ), | ||||
|           Image.asset( | ||||
|             "assets/icons/nfc/ic_done.png", | ||||
|             height: MediaQuery.of(context).size.width / 3, | ||||
|           ), | ||||
|           SizedBox( | ||||
|             height: 30, | ||||
|           ), | ||||
|           Text( | ||||
|             "Approach an NFC Tag", | ||||
|             style: TextStyle( | ||||
|               fontSize: 18, | ||||
|             ), | ||||
|           ), | ||||
|           SizedBox( | ||||
|             height: 30, | ||||
|           ), | ||||
|           ButtonTheme( | ||||
|             minWidth: MediaQuery.of(context).size.width / 1.2, | ||||
|             height: 45.0, | ||||
|             buttonColor: Colors.grey[300], | ||||
|             shape: RoundedRectangleBorder( | ||||
|               borderRadius: BorderRadius.circular(6), | ||||
|             ), | ||||
|             child: RaisedButton( | ||||
|               // onPressed: () { | ||||
|               //   _stream?.cancel(); | ||||
|               //   widget.onNcfScan(nfcId); | ||||
|               //   Navigator.pop(context); | ||||
|               // }, | ||||
|               onPressed: null, | ||||
|               elevation: 0, | ||||
|               child: Text("DONE"), | ||||
|             ), | ||||
|           ), | ||||
|           SizedBox( | ||||
|             height: 30, | ||||
|           ), | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,194 @@ | ||||
| // import 'dart:async'; | ||||
| // | ||||
| // import 'package:flutter/material.dart'; | ||||
| // | ||||
| // | ||||
| // void showNfcReader(BuildContext context, {Function onNcfScan}) { | ||||
| //   showModalBottomSheet( | ||||
| //       context: context, | ||||
| //       enableDrag: false, | ||||
| //       isDismissible: false, | ||||
| //       shape: RoundedRectangleBorder( | ||||
| //         borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)), | ||||
| //       ), | ||||
| //       backgroundColor: Colors.white, | ||||
| //       builder: (context) { | ||||
| //         return NfcLayout( | ||||
| //           onNcfScan: onNcfScan, | ||||
| //         ); | ||||
| //       }); | ||||
| // } | ||||
| // | ||||
| // class NfcLayout extends StatefulWidget { | ||||
| //   Function onNcfScan; | ||||
| // | ||||
| //   NfcLayout({this.onNcfScan}); | ||||
| // | ||||
| //   @override | ||||
| //   _NfcLayoutState createState() => _NfcLayoutState(); | ||||
| // } | ||||
| // | ||||
| // class _NfcLayoutState extends State<NfcLayout> { | ||||
| //   StreamSubscription<NDEFMessage> _stream; | ||||
| //   bool _reading = false; | ||||
| //   Widget mainWidget; | ||||
| //   String nfcId; | ||||
| // | ||||
| //   @override | ||||
| //   void initState() { | ||||
| //     super.initState(); | ||||
| // | ||||
| //     setState(() { | ||||
| //       // _reading = true; | ||||
| //       // Start reading using NFC.readNDEF() | ||||
| //       _stream = NFC.readNDEF(once: false, throwOnUserCancel: false, readerMode: NFCDispatchReaderMode()).listen((NDEFMessage message) { | ||||
| //         setState(() { | ||||
| //           _reading = true; | ||||
| //           mainWidget = doneNfc(); | ||||
| //         }); | ||||
| //         Future.delayed(const Duration(milliseconds: 500), () { | ||||
| //           _stream?.cancel(); | ||||
| //           widget.onNcfScan(nfcId); | ||||
| //           Navigator.pop(context); | ||||
| //         }); | ||||
| //         print("read NDEF id: ${message.id}"); | ||||
| //         print("NFC Record " + message.payload); | ||||
| //         print("NFC Record Lenght " + message.records.length.toString()); | ||||
| //         print("NFC Record " + message.records.first.id); | ||||
| //         print("NFC Record " + message.records.first.payload); | ||||
| //         print("NFC Record " + message.records.first.data); | ||||
| //         print("NFC Record " + message.records.first.type); | ||||
| //         //  widget.onNcfScan(message.id); | ||||
| //         nfcId = message.id; | ||||
| //       }, onError: (e) { | ||||
| //         // Check error handling guide below | ||||
| //       }); | ||||
| //     }); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   Widget build(BuildContext context) { | ||||
| //     (mainWidget == null && !_reading) ? mainWidget = scanNfc() : mainWidget = doneNfc(); | ||||
| //     return AnimatedSwitcher(duration: Duration(milliseconds: 500), child: mainWidget); | ||||
| //   } | ||||
| // | ||||
| //   Widget scanNfc() { | ||||
| //     return Container( | ||||
| //       key: ValueKey(1), | ||||
| //       child: Column( | ||||
| //         mainAxisSize: MainAxisSize.min, | ||||
| //         children: <Widget>[ | ||||
| //           SizedBox( | ||||
| //             height: 30, | ||||
| //           ), | ||||
| //           Text( | ||||
| //             "Ready To Scan", | ||||
| //             style: TextStyle( | ||||
| //               fontWeight: FontWeight.bold, | ||||
| //               fontSize: 24, | ||||
| //             ), | ||||
| //           ), | ||||
| //           SizedBox( | ||||
| //             height: 30, | ||||
| //           ), | ||||
| //           Image.asset( | ||||
| //             "assets/images/nfc/ic_nfc.png", | ||||
| //             height: MediaQuery.of(context).size.width / 3, | ||||
| //           ), | ||||
| //           SizedBox( | ||||
| //             height: 30, | ||||
| //           ), | ||||
| //           Text( | ||||
| //             "Approach an NFC Tag", | ||||
| //             style: TextStyle( | ||||
| //               fontSize: 18, | ||||
| //             ), | ||||
| //           ), | ||||
| //           SizedBox( | ||||
| //             height: 30, | ||||
| //           ), | ||||
| //           ButtonTheme( | ||||
| //             minWidth: MediaQuery.of(context).size.width / 1.2, | ||||
| //             height: 45.0, | ||||
| //             buttonColor: Colors.grey[300], | ||||
| //             shape: RoundedRectangleBorder( | ||||
| //               borderRadius: BorderRadius.circular(6), | ||||
| //             ), | ||||
| //             child: RaisedButton( | ||||
| //               onPressed: () { | ||||
| //                 _stream?.cancel(); | ||||
| //                 Navigator.pop(context); | ||||
| //               }, | ||||
| //               elevation: 0, | ||||
| //               child: Text("CANCEL"), | ||||
| //             ), | ||||
| //           ), | ||||
| //           SizedBox( | ||||
| //             height: 30, | ||||
| //           ), | ||||
| //         ], | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // | ||||
| //   Widget doneNfc() { | ||||
| //     return Container( | ||||
| //       key: ValueKey(2), | ||||
| //       child: Column( | ||||
| //         mainAxisSize: MainAxisSize.min, | ||||
| //         children: <Widget>[ | ||||
| //           SizedBox( | ||||
| //             height: 30, | ||||
| //           ), | ||||
| //           Text( | ||||
| //             "Successfully Scanned", | ||||
| //             style: TextStyle( | ||||
| //               fontWeight: FontWeight.bold, | ||||
| //               fontSize: 24, | ||||
| //             ), | ||||
| //           ), | ||||
| //           SizedBox( | ||||
| //             height: 30, | ||||
| //           ), | ||||
| //           Image.asset( | ||||
| //             "assets/images/nfc/ic_done.png", | ||||
| //             height: MediaQuery.of(context).size.width / 3, | ||||
| //           ), | ||||
| //           SizedBox( | ||||
| //             height: 30, | ||||
| //           ), | ||||
| //           Text( | ||||
| //             "Approach an NFC Tag", | ||||
| //             style: TextStyle( | ||||
| //               fontSize: 18, | ||||
| //             ), | ||||
| //           ), | ||||
| //           SizedBox( | ||||
| //             height: 30, | ||||
| //           ), | ||||
| //           ButtonTheme( | ||||
| //             minWidth: MediaQuery.of(context).size.width / 1.2, | ||||
| //             height: 45.0, | ||||
| //             buttonColor: Colors.grey[300], | ||||
| //             shape: RoundedRectangleBorder( | ||||
| //               borderRadius: BorderRadius.circular(6), | ||||
| //             ), | ||||
| //             child: RaisedButton( | ||||
| //               // onPressed: () { | ||||
| //               //   _stream?.cancel(); | ||||
| //               //   widget.onNcfScan(nfcId); | ||||
| //               //   Navigator.pop(context); | ||||
| //               // }, | ||||
| //               onPressed: null, | ||||
| //               elevation: 0, | ||||
| //               child: Text("DONE"), | ||||
| //             ), | ||||
| //           ), | ||||
| //           SizedBox( | ||||
| //             height: 30, | ||||
| //           ), | ||||
| //         ], | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // } | ||||
					Loading…
					
					
				
		Reference in New Issue