Skip to content

Commit

Permalink
Pagina di aggiunta chiavi tramite stringa
Browse files Browse the repository at this point in the history
  • Loading branch information
Lange99 committed Nov 8, 2020
1 parent bb8c173 commit a2e24e0
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 45 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.nfc_app"
minSdkVersion 16
minSdkVersion 19
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
4 changes: 4 additions & 0 deletions lib/NfcKeyManager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class NfcManager {
availableKey.add(message.id);
}

void addReadableId(String s) async {
availableKey.add(s);
}

/*
Metodo che ritorna:
-> 1 se posso leggere il tag
Expand Down
51 changes: 51 additions & 0 deletions lib/Pages/AddKeyPage.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import 'package:flutter/material.dart';
import 'package:nfc_app/NfcKeyManager.dart';

class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {

NfcManager manager;
TextEditingController controller;

@override
void initState() {
super.initState();
manager = new NfcManager();
controller = new TextEditingController();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Add Key')),
body: Container(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
child: Text('Add new readable key:'),
),
Flexible(
child: TextField(controller: controller,)
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[RaisedButton(
child: Text('Login'),
onPressed: () {manager.addReadableId(controller.value.text); print(controller.value.text);},
)
],
)
],
)

),

);
}
}
44 changes: 0 additions & 44 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,13 @@ class MyApp extends StatelessWidget {
title: "Nfc",
theme: ThemeData(primarySwatch: Colors.blue),


);
}

}

class MainPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Scaffold(

);
}

}


class AddKey extends StatelessWidget {

AddKey(NfcManager manager);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Add Key')),
body: Container(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
child: Text('Add new readable key:'),
),
Flexible(
child: TextField()
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[RaisedButton(
child: Text('Login'),
onPressed: () => {}, //manager.addReadable(),
)
],
)
],
)

),

);
}

}

0 comments on commit a2e24e0

Please sign in to comment.