mirror of
https://github.com/hackku21/loc-chain-app.git
synced 2024-10-27 20:34:05 +00:00
working on
This commit is contained in:
parent
d41d026448
commit
5b8922e68a
@ -16,7 +16,9 @@ class BluetoothPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _BluetoothPageState extends State<BluetoothPage> {
|
class _BluetoothPageState extends State<BluetoothPage> {
|
||||||
final id = SharedPreferences.getInstance().then((s) => s.getString('id'));
|
// final String id = getId();
|
||||||
|
// String getId() =>
|
||||||
|
// SharedPreferences.getInstance().then((s) => s.getString('id') ?? '0');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -25,8 +27,23 @@ class _BluetoothPageState extends State<BluetoothPage> {
|
|||||||
title: Text(widget.title),
|
title: Text(widget.title),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Text('$id'),
|
child: ElevatedButton(
|
||||||
|
child: Text("GetID"),
|
||||||
|
onPressed: () async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
final id = prefs.getString('id');
|
||||||
|
|
||||||
|
ScaffoldMessenger.of(context)
|
||||||
|
.showSnackBar(SnackBar(content: Text("Id is $id")));
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showSnackbar(dynamic a) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||||
|
content: Text(a.toString()),
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
10
loc_chain_app/lib/util/bluetooth.dart
Normal file
10
loc_chain_app/lib/util/bluetooth.dart
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
import 'dart:math';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:nearby_connections/nearby_connections.dart';
|
||||||
|
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
class Connect {}
|
Loading…
Reference in New Issue
Block a user