All dem changes
This commit is contained in:
@@ -17,6 +17,19 @@ class ArcDashboard extends StatefulWidget {
|
||||
State<ArcDashboard> createState() => _ArcDashboardState();
|
||||
}
|
||||
|
||||
String _rmconString(RoomConnectionMethod method) {
|
||||
switch (method) {
|
||||
case RoomConnectionMethod.Cloud:
|
||||
return "Cloud";
|
||||
case RoomConnectionMethod.Local:
|
||||
return "Local";
|
||||
case RoomConnectionMethod.P2P:
|
||||
return "P2P";
|
||||
case RoomConnectionMethod.None:
|
||||
return "None";
|
||||
}
|
||||
}
|
||||
|
||||
class _ArcDashboardState extends State<ArcDashboard> {
|
||||
_closeDialogueChecker closeDialogWidget = _closeDialogueChecker();
|
||||
|
||||
@@ -91,6 +104,8 @@ class _ArcDashboardState extends State<ArcDashboard> {
|
||||
onPressed: () {
|
||||
bool multiMode = ModalRoute.of(context)!.settings.name!.contains("multi");
|
||||
|
||||
LiveInformation().p2pModule.startDiscovery();
|
||||
|
||||
showShadSheet(
|
||||
context: context,
|
||||
side: ShadSheetSide.left,
|
||||
@@ -120,28 +135,149 @@ class _ArcDashboardState extends State<ArcDashboard> {
|
||||
builder: (context) {
|
||||
return ShadSheet(
|
||||
padding: const EdgeInsets.all(10),
|
||||
content: Column(
|
||||
children: [
|
||||
Text("Room ID: ${LiveInformation().roomDocumentID}"),
|
||||
Text("IP Address: ${LiveInformation().networkingModule.localIP}"),
|
||||
QrImageView(
|
||||
data: LiveInformation().generateRoomInfo(),
|
||||
size: 270,
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
ShadButton(
|
||||
text: Text("Copy Room Info"),
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: LiveInformation().generateRoomInfo()));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("Copied room info to clipboard"),
|
||||
)
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
content: Container(
|
||||
width: 400,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Text(
|
||||
"Room Information",
|
||||
style: ShadTheme.of(context).textTheme.h2
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
|
||||
if (LiveInformation().isHost)
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.amber,
|
||||
borderRadius: BorderRadius.circular(10)
|
||||
),
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Hosting room",
|
||||
style: ShadTheme.of(context).textTheme.h4.copyWith(
|
||||
height: 0.9
|
||||
)
|
||||
),
|
||||
],
|
||||
)
|
||||
)
|
||||
else
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.amber,
|
||||
borderRadius: BorderRadius.circular(10)
|
||||
),
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Connected to room via:",
|
||||
style: ShadTheme.of(context).textTheme.h4.copyWith(
|
||||
height: 0.9
|
||||
)
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Text(
|
||||
_rmconString(LiveInformation().connectionMethod) + " connection",
|
||||
style: ShadTheme.of(context).textTheme.p.copyWith(
|
||||
height: 0.9
|
||||
)
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
|
||||
ShadButton(
|
||||
text: Text("Show room QR Code"),
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
onPressed: () {
|
||||
|
||||
showShadDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return ShadDialog(
|
||||
|
||||
title: Text("Room QR Code"),
|
||||
content: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: QrImageView(
|
||||
data: LiveInformation().generateRoomInfo(),
|
||||
size: 200,
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
ShadButton(
|
||||
text: Text("Copy Room Info"),
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: LiveInformation().generateRoomInfo()));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("Copied room info to clipboard"),
|
||||
)
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
},
|
||||
),
|
||||
|
||||
ShadButton(
|
||||
text: Text("Make nearby discoverable"),
|
||||
onPressed: () {
|
||||
LiveInformation().p2pModule.startDiscovery();
|
||||
ShadToaster.of(context).show(
|
||||
ShadToast(
|
||||
title: Text("Discoverable"),
|
||||
description: Text("If it wasnt before, your device is now discoverable to nearby devices"),
|
||||
duration: const Duration(seconds: 3),
|
||||
)
|
||||
);
|
||||
},
|
||||
)
|
||||
|
||||
],
|
||||
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user