From a1f13b866fca13d4fa908fa40d79868d3c2dc139 Mon Sep 17 00:00:00 2001 From: Maruti54 Date: Fri, 22 Jul 2022 23:59:26 +0530 Subject: [PATCH 1/3] updated --- .../screens/users/ev_charging_stations.dart | 76 +++++++++++++++++++ projects/ev_stations/pubspec.lock | 23 ++---- .../windows/flutter/generated_plugins.cmake | 8 ++ 3 files changed, 92 insertions(+), 15 deletions(-) diff --git a/projects/ev_stations/lib/screens/users/ev_charging_stations.dart b/projects/ev_stations/lib/screens/users/ev_charging_stations.dart index bbc2789..6fcc3f5 100644 --- a/projects/ev_stations/lib/screens/users/ev_charging_stations.dart +++ b/projects/ev_stations/lib/screens/users/ev_charging_stations.dart @@ -1 +1,77 @@ // ev_charging_stations +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:qr_code_scanner/qr_code_scanner.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class Scanner extends StatefulWidget { + const Scanner({Key? key}) : super(key: key); + + @override + _ScannerState createState() => _ScannerState(); +} + +class _ScannerState extends State { + final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); + late QRViewController controller; + + @override + void dispose() { + controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return QRView( + key: qrKey, + onQRViewCreated: _onQRViewCreated, + ); + } + + void _onQRViewCreated(QRViewController controller) { + this.controller = controller; + controller.scannedDataStream.listen((scanData) async { + controller.pauseCamera(); + if (await canLaunchUrl(Uri.parse((scanData.code)!))) { + await launchUrl(Uri.parse((scanData.code)!)); + controller.resumeCamera(); + } else { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Url'), + content: SingleChildScrollView( + child: ListBody( + children: [ + Text('Barcode Type: ${describeEnum(scanData.format)}'), + Text('Data: ${scanData.code}'), + ], + ), + ), + actions: [ + TextButton( + child: const Text('Ok'), + onPressed: () { + Navigator.of(context).pop(); + _launchInBrowser(Uri.parse((scanData.code)!)); + }, + ), + ], + ); + }, + ).then((value) => controller.resumeCamera()); + } + }); + } +} + +Future _launchInBrowser(Uri url) async { + if (!await launchUrl( + url, + mode: LaunchMode.externalApplication, + )) { + throw 'Could not launch $url'; + } +} \ No newline at end of file diff --git a/projects/ev_stations/pubspec.lock b/projects/ev_stations/pubspec.lock index 5090ad0..779e035 100644 --- a/projects/ev_stations/pubspec.lock +++ b/projects/ev_stations/pubspec.lock @@ -42,7 +42,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" cupertino_icons: dependency: "direct main" description: @@ -56,7 +56,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" flutter: dependency: "direct main" description: flutter @@ -94,7 +94,7 @@ packages: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "0.1.4" meta: dependency: transitive description: @@ -108,7 +108,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" sky_engine: dependency: transitive description: flutter @@ -120,7 +120,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" stack_trace: dependency: transitive description: @@ -155,20 +155,13 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.8" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.4.9" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" sdks: - dart: ">=2.16.2 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" diff --git a/projects/ev_stations/windows/flutter/generated_plugins.cmake b/projects/ev_stations/windows/flutter/generated_plugins.cmake index 4d10c25..b93c4c3 100644 --- a/projects/ev_stations/windows/flutter/generated_plugins.cmake +++ b/projects/ev_stations/windows/flutter/generated_plugins.cmake @@ -5,6 +5,9 @@ list(APPEND FLUTTER_PLUGIN_LIST ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) From 6a667e1311963c50213f54d7d5844063770daf48 Mon Sep 17 00:00:00 2001 From: Maruti54 Date: Sat, 23 Jul 2022 10:28:38 +0530 Subject: [PATCH 2/3] #44 Fixed QR Code Scanner --- projects/ev_stations/android/app/build.gradle | 4 +- projects/ev_stations/assets/lottie/torch.json | 1 + projects/ev_stations/lib/main.dart | 5 +- .../screens/users/ev_charging_stations.dart | 62 ++++++++- projects/ev_stations/pubspec.lock | 120 +++++++++++++++++- projects/ev_stations/pubspec.yaml | 10 +- .../flutter/generated_plugin_registrant.cc | 3 + .../windows/flutter/generated_plugins.cmake | 1 + 8 files changed, 194 insertions(+), 12 deletions(-) create mode 100644 projects/ev_stations/assets/lottie/torch.json diff --git a/projects/ev_stations/android/app/build.gradle b/projects/ev_stations/android/app/build.gradle index 2ca9445..f23a9ff 100644 --- a/projects/ev_stations/android/app/build.gradle +++ b/projects/ev_stations/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion flutter.compileSdkVersion + compileSdkVersion 32 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -44,7 +44,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.ev_stations" - minSdkVersion flutter.minSdkVersion + minSdkVersion 21 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/projects/ev_stations/assets/lottie/torch.json b/projects/ev_stations/assets/lottie/torch.json new file mode 100644 index 0000000..0b74e1d --- /dev/null +++ b/projects/ev_stations/assets/lottie/torch.json @@ -0,0 +1 @@ +{"v":"5.6.6","ip":0,"op":80,"fr":60,"w":28,"h":28,"layers":[{"ind":17588,"nm":"surface73409","ao":0,"ip":0,"op":80,"st":0,"ty":4,"ks":{"ty":"tr","o":{"k":100},"r":{"k":0},"p":{"a":0,"k":[0,0,0],"ix":2},"a":{"k":[0,0]},"s":{"k":[133.33,133.33]},"sk":{"k":0},"sa":{"k":0}},"shapes":[{"ty":"gr","hd":false,"nm":"surface73409","it":[{"ty":"gr","hd":false,"it":[{"ty":"sh","ks":{"k":{"i":[[0,0],[0,0],[0.11,0.06],[0.12,-0.03],[-0.05,-0.25],[0,0],[0,0],[-0.21,0],[0,0.25],[0.01,0.04]],"o":[[0,0],[-0.03,-0.12],[-0.1,-0.06],[-0.25,0.06],[0,0],[0,0],[0.04,0.21],[0.25,0],[0,-0.04],[0,0]],"v":[[7.57,3.38],[6.95,0.75],[6.74,0.47],[6.4,0.42],[6.06,0.97],[6.68,3.59],[6.68,3.59],[7.12,3.95],[7.58,3.49],[7.57,3.38]],"c":true}}},{"ty":"fl","o":{"k":100},"c":{"k":[0,0,0,1]}},{"ty":"tr","o":{"k":100},"r":{"k":0},"p":{"k":[0,0]},"a":{"k":[0,0]},"s":{"k":[100,100]},"sk":{"k":0},"sa":{"k":0},"hd":false}]},{"ty":"gr","hd":false,"it":[{"ty":"sh","ks":{"k":{"i":[[0,0],[0.1,-0.06],[0.03,-0.12],[0,0],[-0.25,-0.06],[-0.06,0.25],[0,0],[0,0],[0.25,0.06]],"o":[[-0.12,-0.03],[-0.1,0.07],[0,0],[-0.06,0.25],[0.25,0.06],[0,0],[0,0],[0.05,-0.25],[0,0]],"v":[[14.6,0.42],[14.26,0.47],[14.05,0.76],[13.43,3.38],[13.77,3.93],[14.32,3.59],[14.94,0.97],[14.94,0.97],[14.6,0.42]],"c":true}}},{"ty":"fl","o":{"k":100},"c":{"k":[0,0,0,1]}},{"ty":"tr","o":{"k":100},"r":{"k":0},"p":{"k":[0,0]},"a":{"k":[0,0]},"s":{"k":[100,100]},"sk":{"k":0},"sa":{"k":0},"hd":false}]},{"ty":"gr","hd":false,"it":[{"ty":"sh","ks":{"k":{"i":[[0,0],[0,-0.25],[0,0],[-0.25,0],[0,0.25],[0,0],[0.09,0.09],[0.12,0]],"o":[[-0.25,0],[0,0],[0,0.25],[0.25,0],[0,0],[0,-0.12],[-0.09,-0.09],[0,0]],"v":[[10.5,0],[10.04,0.46],[10.04,3.46],[10.5,3.91],[10.96,3.46],[10.96,0.46],[10.82,0.13],[10.5,0]],"c":true}}},{"ty":"fl","o":{"k":100},"c":{"k":[0,0,0,1]}},{"ty":"tr","o":{"k":100},"r":{"k":0},"p":{"k":[0,0]},"a":{"k":[0,0]},"s":{"k":[100,100]},"sk":{"k":0},"sa":{"k":0},"hd":false}]},{"ty":"gr","hd":false,"it":[{"ty":"sh","ks":{"k":{"i":[[0,0],[0.01,0.06],[0,0],[0.08,0.09],[0.12,0],[0,0],[0.01,-0.25],[0,0],[-0.06,-0.08],[0,0],[0,0],[-0.86,0],[0,0],[-0.01,0.86],[0,0],[0,0],[-0.08,0.09],[0,0.12],[0,0],[0.24,0.01],[0,0],[0,0]],"o":[[0.01,-0.06],[0,0],[0.01,-0.12],[-0.08,-0.09],[0,0],[-0.25,0],[0,0],[0,0.11],[0,0],[0,0],[0.01,0.86],[0,0],[0.86,0],[0,0],[0,0],[0.12,0],[0.08,-0.09],[0,0],[0.01,-0.24],[0,0],[0,0],[0,0]],"v":[[14.8,8.4],[14.8,8.21],[14.8,5.73],[14.69,5.4],[14.37,5.25],[6.61,5.25],[6.14,5.71],[6.14,8.25],[6.24,8.54],[7.79,11.86],[7.79,19.45],[9.37,21],[11.62,21],[13.19,19.45],[13.19,16.09],[13.76,16.09],[14.08,15.95],[14.2,15.63],[14.2,13.88],[13.79,13.43],[13.19,13.43],[13.19,11.82]],"c":true}}},{"ty":"sh","ks":{"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[7.07,6.19],[13.89,6.19],[13.89,7.75],[7.07,7.75]],"c":true}}},{"ty":"sh","ks":{"k":{"i":[[0,0],[0.35,0],[0,0],[0.01,0.35],[0,0],[0,0]],"o":[[-0.01,0.35],[0,0],[-0.36,0],[0,0],[0,0],[0,0]],"v":[[12.32,19.45],[11.66,20.09],[9.41,20.09],[8.76,19.45],[8.76,18.8],[12.33,18.8]],"c":true}}},{"ty":"sh","ks":{"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[13.33,14.36],[13.33,15.18],[13.24,15.18],[13.24,14.36]],"c":true}}},{"ty":"sh","ks":{"k":{"i":[[0,0],[0,-0.07],[0,0],[0,0],[0,0],[0.02,0.07],[0,0],[0,0]],"o":[[-0.03,0.07],[0,0],[0,0],[0,0],[0.02,-0.07],[0,0],[0,0],[0,0]],"v":[[12.35,11.52],[12.32,11.72],[12.32,17.88],[8.71,17.88],[8.71,11.72],[8.71,11.52],[7.38,8.67],[13.7,8.67]],"c":true}}},{"ty":"fl","o":{"k":100},"c":{"k":[0,0,0,1]}},{"ty":"tr","o":{"k":100},"r":{"k":0},"p":{"k":[0,0]},"a":{"k":[0,0]},"s":{"k":[100,100]},"sk":{"k":0},"sa":{"k":0},"hd":false}]},{"ty":"tr","o":{"k":100},"r":{"k":0},"p":{"k":[0,0]},"a":{"k":[0,0]},"s":{"k":[100,100]},"sk":{"k":0},"sa":{"k":0},"hd":false}]},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.35],"y":[1]},"o":{"x":[0.17],"y":[0.17]},"t":0,"s":[25]},{"t":55,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}]}],"meta":{"g":"LF SVG to Lottie"}} \ No newline at end of file diff --git a/projects/ev_stations/lib/main.dart b/projects/ev_stations/lib/main.dart index 2c27c51..f391e42 100644 --- a/projects/ev_stations/lib/main.dart +++ b/projects/ev_stations/lib/main.dart @@ -1,4 +1,4 @@ -import 'package:ev_stations/screens/users/dashboard.dart'; +import 'package:ev_stations/screens/users/ev_charging_stations.dart'; import 'package:flutter/material.dart'; void main() { @@ -12,11 +12,12 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( + debugShowCheckedModeBanner: false, title: 'EV Stations', theme: ThemeData( primarySwatch: Colors.blue, ), - home: const MyHomePage(title: 'EV Stations'), + home: const Scanner(), ); } } diff --git a/projects/ev_stations/lib/screens/users/ev_charging_stations.dart b/projects/ev_stations/lib/screens/users/ev_charging_stations.dart index 6fcc3f5..34a8b83 100644 --- a/projects/ev_stations/lib/screens/users/ev_charging_stations.dart +++ b/projects/ev_stations/lib/screens/users/ev_charging_stations.dart @@ -3,6 +3,8 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:qr_code_scanner/qr_code_scanner.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:lottie/lottie.dart'; +import 'package:torch_light/torch_light.dart'; class Scanner extends StatefulWidget { const Scanner({Key? key}) : super(key: key); @@ -23,9 +25,41 @@ class _ScannerState extends State { @override Widget build(BuildContext context) { - return QRView( - key: qrKey, - onQRViewCreated: _onQRViewCreated, + return Stack( + children: [ + QRView( + key: qrKey, + onQRViewCreated: _onQRViewCreated, + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Center( + child: Container( + width: 300, + height: 300, + decoration: BoxDecoration( + border: Border.all( + color: Colors.red, + width: 4, + ), + borderRadius: BorderRadius.circular(12), + ), + ), + ), + const SizedBox(height: 100,), + ElevatedButton( + child: CircleAvatar( + backgroundColor: Colors.transparent, + child: LottieBuilder.asset('assets/lottie/torch.json'), + ), + onPressed: (){ + _turnOnFlash(context); + } + ) + ], + ), + ], ); } @@ -74,4 +108,24 @@ Future _launchInBrowser(Uri url) async { )) { throw 'Could not launch $url'; } -} \ No newline at end of file +} + +Future _turnOnFlash(BuildContext context) async { + try { + await TorchLight.enableTorch(); + } on Exception catch (_) { + _showErrorMes('Could not enable Flashlight', context); + } +} + +Future _turnOffFlash(BuildContext context) async { + try { + await TorchLight.disableTorch(); + } on Exception catch (_) { + _showErrorMes('Could not enable Flashlight', context); + } +} +void _showErrorMes(String mes, BuildContext context) { + ScaffoldMessenger.of(context) + .showSnackBar(SnackBar(content: Text(mes))); +} diff --git a/projects/ev_stations/pubspec.lock b/projects/ev_stations/pubspec.lock index 779e035..4fbefbd 100644 --- a/projects/ev_stations/pubspec.lock +++ b/projects/ev_stations/pubspec.lock @@ -1,6 +1,13 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "3.3.1" async: dependency: transitive description: @@ -43,6 +50,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.16.0" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.2" cupertino_icons: dependency: "direct main" description: @@ -74,6 +88,18 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.4" lints: dependency: transitive description: @@ -81,6 +107,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.1" + lottie: + dependency: "direct main" + description: + name: lottie + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" matcher: dependency: transitive description: @@ -109,6 +142,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" + qr_code_scanner: + dependency: "direct main" + description: + name: qr_code_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" sky_engine: dependency: transitive description: flutter @@ -156,6 +203,76 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.4.9" + torch_light: + dependency: "direct main" + description: + name: torch_light + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.0" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.1" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.5" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.17" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.17" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.12" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" vector_math: dependency: transitive description: @@ -164,4 +281,5 @@ packages: source: hosted version: "2.1.2" sdks: - dart: ">=2.17.0-0 <3.0.0" + dart: ">=2.17.0 <3.0.0" + flutter: ">=2.10.0" diff --git a/projects/ev_stations/pubspec.yaml b/projects/ev_stations/pubspec.yaml index 1ecfe31..a598f12 100644 --- a/projects/ev_stations/pubspec.yaml +++ b/projects/ev_stations/pubspec.yaml @@ -34,6 +34,10 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 + qr_code_scanner: ^1.0.0 + url_launcher: ^6.1.5 + lottie: ^1.3.0 + torch_light: ^0.4.0 dev_dependencies: flutter_test: @@ -58,9 +62,9 @@ flutter: uses-material-design: true # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg + assets: + - assets/ + - assets/lottie/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. diff --git a/projects/ev_stations/windows/flutter/generated_plugin_registrant.cc b/projects/ev_stations/windows/flutter/generated_plugin_registrant.cc index 8b6d468..4f78848 100644 --- a/projects/ev_stations/windows/flutter/generated_plugin_registrant.cc +++ b/projects/ev_stations/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/projects/ev_stations/windows/flutter/generated_plugins.cmake b/projects/ev_stations/windows/flutter/generated_plugins.cmake index b93c4c3..88b22e5 100644 --- a/projects/ev_stations/windows/flutter/generated_plugins.cmake +++ b/projects/ev_stations/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + url_launcher_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST From 3125abe232d2a4b24f9c28add0027bb220e765f5 Mon Sep 17 00:00:00 2001 From: Maruti54 Date: Sat, 23 Jul 2022 10:29:17 +0530 Subject: [PATCH 3/3] #44 Fixed QR Code Scanner --- .../screens/users/ev_charging_stations.dart | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/projects/ev_stations/lib/screens/users/ev_charging_stations.dart b/projects/ev_stations/lib/screens/users/ev_charging_stations.dart index 34a8b83..d83eb47 100644 --- a/projects/ev_stations/lib/screens/users/ev_charging_stations.dart +++ b/projects/ev_stations/lib/screens/users/ev_charging_stations.dart @@ -47,16 +47,17 @@ class _ScannerState extends State { ), ), ), - const SizedBox(height: 100,), + const SizedBox( + height: 100, + ), ElevatedButton( - child: CircleAvatar( - backgroundColor: Colors.transparent, - child: LottieBuilder.asset('assets/lottie/torch.json'), - ), - onPressed: (){ - _turnOnFlash(context); - } - ) + child: CircleAvatar( + backgroundColor: Colors.transparent, + child: LottieBuilder.asset('assets/lottie/torch.json'), + ), + onPressed: () { + _turnOnFlash(context); + }) ], ), ], @@ -125,7 +126,7 @@ Future _turnOffFlash(BuildContext context) async { _showErrorMes('Could not enable Flashlight', context); } } + void _showErrorMes(String mes, BuildContext context) { - ScaffoldMessenger.of(context) - .showSnackBar(SnackBar(content: Text(mes))); + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(mes))); }