diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 8db0d5aaf59e60ba249d80063f0ccfa92d5e1777..6c4a86ba8c9abf9634fbece7e452d588efc50e81 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,6 @@ + + ("clean") { delete(rootProject.layout.buildDirectory) -} +} \ No newline at end of file diff --git a/assets/homePageBackground.png b/assets/homePageBackground.png new file mode 100644 index 0000000000000000000000000000000000000000..84d332366acbfb3f4a3074022a2548ed08c6f53c Binary files /dev/null and b/assets/homePageBackground.png differ diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index ebc4ae68ff3f691c64b23b0b3c5405ce69c6b511..57a7e5f1e98253fe2d7553d31e14cd228be3ba8c 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -2,6 +2,8 @@ + NFCReaderUsageDescription + We need NFC access to read and write tags. CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName diff --git a/lib/components/title.dart b/lib/components/title.dart new file mode 100644 index 0000000000000000000000000000000000000000..f009432bb1b54abf025bd92a0d3fa2d925d55c53 --- /dev/null +++ b/lib/components/title.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; + +import 'package:nfc_google_sheet/context/colories.dart'; + +class TitleCustom extends StatelessWidget{ + final String content; + const TitleCustom({super.key, required this.content}); + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsetsGeometry.directional(top: 20), + padding: EdgeInsetsGeometry.symmetric(horizontal: 16), + alignment: Alignment.center, + color: Colories.background, + child: + Text( + content, + style: TextStyle( + fontSize: 35, + color: Colories.selected + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/context/colories.dart b/lib/context/colories.dart index cb08ed0944a07254e4aee248b45f4ef4a538bd58..ee965be0c6d2dabb6eb4d86b8daed0cd0c1a95e5 100644 --- a/lib/context/colories.dart +++ b/lib/context/colories.dart @@ -1,11 +1,11 @@ import 'dart:ui'; class Colories { - static Color title = Color(0xff242423); + static Color title = Color(0xffddb252); static Color subtitle = Color(0xff3C3B39); static Color paragraphe = Color(0xff0D0D0C); static Color background = Color(0xff3a3835); static Color bordure = Color(0xff171601); static Color selected = Color(0xffe8bb5a); - static Color unselected = Color(0xffece0bf); + static Color unselected = Color(0xfffffae8); } \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 13db995f67424d41606d24b362b1da165952aafe..91a3eb6696717c09b8e251fdb9fc255c170da295 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:nfc_gogole_sheet/context/colories.dart'; -import 'package:nfc_gogole_sheet/pages/home_page.dart'; -import 'package:nfc_gogole_sheet/pages/sheet_page.dart'; -import 'package:nfc_gogole_sheet/pages/stats_page.dart'; +import 'package:nfc_google_sheet/context/colories.dart'; +import 'package:nfc_google_sheet/pages/home_page.dart'; +import 'package:nfc_google_sheet/pages/sheet_page.dart'; +import 'package:nfc_google_sheet/pages/stats_page.dart'; void main(){ runApp(MyApp()); diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index 81cc0a9b7a173e04ec29f4f1639d4e0513c2bf8a..8f4b526412b100a9755f1bfd328489bf1ba91327 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -1,5 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:nfc_gogole_sheet/context/colories.dart'; +import 'package:nfc_google_sheet/context/colories.dart'; +import 'package:nfc_google_sheet/components/title.dart'; +import 'package:nfc_manager/nfc_manager.dart'; +import 'package:nfc_manager_ndef/nfc_manager_ndef.dart'; +import 'package:nfc_manager_felica/nfc_manager_felica.dart'; +import 'package:flutter_nfc_kit/flutter_nfc_kit.dart'; class HomePage extends StatelessWidget { const HomePage({super.key}); @@ -12,27 +17,63 @@ class HomePage extends StatelessWidget { } } - class MyHomePage extends StatefulWidget{ const MyHomePage({super.key}); @override State createState() => _MyHomePageState(); + } class _MyHomePageState extends State{ + String nfcData = "Tap an NFC tag"; + Future startNFC() async { + NfcAvailability isAvailable = await NfcManager.instance.checkAvailability(); + if (isAvailable != NfcAvailability.enabled) { + setState(() { + nfcData = "NFC is not available on this device"; + }); + return; + } + + NfcManager.instance.startSession( + pollingOptions: {NfcPollingOption.iso14443}, + onDiscovered: (NfcTag tag) async { + print("data: ${tag.data.toString()}"); + await NfcManager.instance.stopSession(); + } + ); + } + + Future readNFCTag() async { + try { + NFCTag tag = await FlutterNfcKit.poll(); + print('NFC Tag Found: ${tag.id}'); + } catch (e) { + print('Error reading NFC tag: $e'); + } + } + @override Widget build(BuildContext context) { return Scaffold( - body: Column( - children: [ - SizedBox(height: 50), - Center( - child: Text( - 'Enregistrer les étudiants dans un google Sheet', - style: TextStyle(fontWeight: FontWeight.bold, color:Colories.title), - ) - ) - ] + body: Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/homePageBackground.png'), + fit: BoxFit.cover, + ), + ), + child: Column( + children: [ + SizedBox(height: 50), + Center( + child: TitleCustom(content: 'ENREGISTREZ - VOUS') + ), + SizedBox(height: 50), + ElevatedButton(onPressed: readNFCTag, child: Text("Enregistrer sa carte")), + Center(child: Text(nfcData)), + ] + ), ), ); } diff --git a/lib/pages/sheet_page.dart b/lib/pages/sheet_page.dart index 89c59b49c43ba310d91ee0fa396b70e6b06c5a00..08ed521c610a63b3f0f4f4d3be0d9d5b7ed59d35 100644 --- a/lib/pages/sheet_page.dart +++ b/lib/pages/sheet_page.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:nfc_gogole_sheet/context/colories.dart'; +import 'package:nfc_google_sheet/context/colories.dart'; class SheetPage extends StatelessWidget { const SheetPage({super.key}); diff --git a/lib/pages/stats_page.dart b/lib/pages/stats_page.dart index 1fb3165e4e2a6c70f89b8eb89131ca27e4573841..49fc9d490743f8a267b66bea09148721309a4977 100644 --- a/lib/pages/stats_page.dart +++ b/lib/pages/stats_page.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:nfc_gogole_sheet/context/colories.dart'; +import 'package:nfc_google_sheet/context/colories.dart'; class StatsPage extends StatelessWidget { const StatsPage({super.key}); diff --git a/pubspec.lock b/pubspec.lock index fc022427349d5f7df2be043c3543f92f4edf5d1b..a4213a9f3cfdb91cd0f66967618035868845642e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -41,6 +41,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" cupertino_icons: dependency: "direct main" description: @@ -57,6 +73,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.3" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" flutter: dependency: "direct main" description: flutter @@ -70,11 +94,32 @@ packages: url: "https://pub.dev" source: hosted version: "5.0.0" + flutter_nfc_kit: + dependency: "direct main" + description: + name: flutter_nfc_kit + sha256: "3cc4059626fa672031261512299458dd274de4ccb57a7f0ee0951ddd70a048e5" + url: "https://pub.dev" + source: hosted + version: "3.6.0" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" leak_tracker: dependency: transitive description: @@ -107,6 +152,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" matcher: dependency: transitive description: @@ -131,6 +184,46 @@ packages: url: "https://pub.dev" source: hosted version: "1.16.0" + ndef: + dependency: transitive + description: + name: ndef + sha256: "5083507cff4bb823b2a198a27ea2c70c4d6bc27a97b66097d966a250e1615d54" + url: "https://pub.dev" + source: hosted + version: "0.3.4" + ndef_record: + dependency: transitive + description: + name: ndef_record + sha256: "876e2774f18573e8afba1aa9db3998aaf4e3384c825c843c3f86d001bec8510d" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + nfc_manager: + dependency: "direct main" + description: + name: nfc_manager + sha256: "24c78b0e5702da53e7f8794d073624c0bee7cd99924f257cbd11f5d1c5866879" + url: "https://pub.dev" + source: hosted + version: "4.1.1" + nfc_manager_felica: + dependency: "direct main" + description: + name: nfc_manager_felica + sha256: "9f5506efd6bf828605e2cb4fc948c07cc3bfe51d9cf8d9b01860528c735cd8d1" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + nfc_manager_ndef: + dependency: "direct main" + description: + name: nfc_manager_ndef + sha256: "8aacee776120b4d09e3049b26cf4a7397fee3abafc207c0640342ada05c5df7d" + url: "https://pub.dev" + source: hosted + version: "1.1.0" path: dependency: "direct main" description: @@ -168,6 +261,7 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.1" +<<<<<<< HEAD sqflite: dependency: "direct main" description: @@ -208,6 +302,16 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.0" +======= + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" +>>>>>>> c12632c (feature: Nfc) stack_trace: dependency: transitive description: @@ -256,6 +360,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.6" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + uuid: + dependency: transitive + description: + name: uuid + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff + url: "https://pub.dev" + source: hosted + version: "4.5.1" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 4c87c2ad206389c1bd16d28433df7be73cf55741..c6b8673d4af663b0ee2e2fb58cbb31cce167365f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,4 @@ -name: nfc_gogole_sheet +name: nfc_google_sheet description: "A new Flutter project." # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. @@ -30,12 +30,19 @@ environment: dependencies: flutter: sdk: flutter +<<<<<<< HEAD sqflite: ^2.4.2 path: ^1.9.0 +======= + nfc_manager: ^4.1.1 + nfc_manager_felica: ^1.0.0 + nfc_manager_ndef: ^1.1.0 +>>>>>>> c12632c (feature: Nfc) # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.8 + flutter_nfc_kit: ^3.6.0 dev_dependencies: flutter_test: @@ -60,9 +67,8 @@ 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/homePageBackground.png # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/to/resolution-aware-images