You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
loc-chain-app/loc_chain_app/lib/pages/bluetooth.dart

54 lines
1.5 KiB

3 years ago
import 'dart:io';
import 'dart:math';
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:nearby_connections/nearby_connections.dart';
3 years ago
import 'package:flutter_udid/flutter_udid.dart';
3 years ago
3 years ago
import 'package:shared_preferences/shared_preferences.dart';
3 years ago
class BluetoothPage extends StatefulWidget {
3 years ago
BluetoothPage({Key? key, required this.title}) : super(key: key);
3 years ago
final String title;
@override
_BluetoothPageState createState() => _BluetoothPageState();
}
class _BluetoothPageState extends State<BluetoothPage> {
3 years ago
final Future<String> _id = FlutterUdid.consistentUdid;
3 years ago
// String getId() =>
// SharedPreferences.getInstance().then((s) => s.getString('id') ?? '0');
3 years ago
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
3 years ago
body: FutureBuilder<String>(
future: _id, // a previously-obtained Future<String> or null
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
String content = "Loading id...";
if (snapshot.hasData) {
content = "ID: ${snapshot.data!}";
}
return ListView(
children: <Widget>[
Container(
child: Text(content),
),
],
);
}),
3 years ago
);
}
3 years ago
void showSnackbar(dynamic a) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(a.toString()),
));
}
3 years ago
}