desktop push

This commit is contained in:
ImBenji
2024-05-20 09:06:38 +01:00
parent e5a8d78bf1
commit 639faddfc8
19 changed files with 2455 additions and 996 deletions

View File

@@ -154,7 +154,7 @@ class _page2State extends State<_page2> {
child: SizedBox(
width: double.infinity,
// width: double.infinity,
child: Column(
@@ -162,7 +162,6 @@ class _page2State extends State<_page2> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Permissions",
style: TextStyle(
@@ -175,105 +174,172 @@ class _page2State extends State<_page2> {
height: 16,
),
ShadCard(
width: double.infinity,
title: Text(
"Location",
),
description: Text(
"Your location is required for automatically updating your nearest bus stop."
),
content: Container(
child: Column(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
SizedBox(
height: 4,
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
ShadCard(
width: 300,
height: 200,
title: Text(
"Location",
),
FutureBuilder(
future: Permission.location.isGranted,
builder: (context, val) {
bool isEnabled = true;
String text = "Request permission";
Color color = Colors.white;
if (val.hasData) {
isEnabled = !val.data!;
}
if (!isEnabled) {
text = "Permission granted!";
color = Colors.green.shade400;
}
return ShadButton(
text: Text(text),
onPressed: () async {
await Permission.location.request();
setState(() {
});
},
enabled: isEnabled,
backgroundColor: color,
);
},
description: Text(
"Your location is required for automatically updating your nearest bus stop."
),
],
),
),
),
content: Container(
child: Column(
children: [
SizedBox(
height: 16,
),
SizedBox(
height: 4,
),
ShadCard(
width: double.infinity,
title: Text(
"Storage",
),
description: Text(
"Storage access is required to access recorded announcements."
),
content: Container(
child: Column(
children: [
FutureBuilder(
future: Permission.location.isGranted,
builder: (context, val) {
bool isEnabled = true;
String text = "Request permission";
Color color = Colors.white;
SizedBox(
height: 4,
if (val.hasData) {
isEnabled = !val.data!;
}
if (!isEnabled) {
text = "Permission granted!";
color = Colors.green.shade400;
}
return ShadButton(
text: Text(text),
onPressed: () async {
await Permission.location.request();
setState(() {
});
},
enabled: isEnabled,
backgroundColor: color,
);
},
),
],
),
),
),
FutureBuilder(
future: Permission.manageExternalStorage.isGranted,
builder: (context, val) {
bool isEnabled = true;
String text = "Request permission";
Color color = Colors.white;
SizedBox(
width: 16,
),
if (val.hasData) {
isEnabled = !val.data!;
}
if (!isEnabled) {
text = "Permission granted!";
color = Colors.green.shade400;
}
ShadCard(
width: 300,
height: 200,
title: Text(
"Storage",
),
description: Text(
"Storage access is required to access recorded announcements."
),
content: Container(
child: Column(
children: [
return ShadButton(
text: Text(text),
onPressed: () async {
await Permission.manageExternalStorage.request();
setState(() {
SizedBox(
height: 4,
),
});
},
enabled: isEnabled,
backgroundColor: color,
);
},
)
],
),
FutureBuilder(
future: Permission.manageExternalStorage.isGranted,
builder: (context, val) {
bool isEnabled = true;
String text = "Request permission";
Color color = Colors.white;
if (val.hasData) {
isEnabled = !val.data!;
}
if (!isEnabled) {
text = "Permission granted!";
color = Colors.green.shade400;
}
return ShadButton(
text: Text(text),
onPressed: () async {
await Permission.manageExternalStorage.request();
setState(() {
});
},
enabled: isEnabled,
backgroundColor: color,
);
},
)
],
),
),
),
SizedBox(
width: 16,
),
ShadCard(
width: 300,
height: 200,
title: Text(
"Network",
),
description: Text(
"Network access is required for commincation between devices for multi mode."
),
content: Container(
child: Column(
children: [
SizedBox(
height: 4,
),
FutureBuilder(
future: Permission.nearbyWifiDevices.isGranted,
builder: (context, val) {
bool isEnabled = true;
String text = "Request permission";
Color color = Colors.white;
if (val.hasData) {
isEnabled = !val.data!;
}
if (!isEnabled) {
text = "Permission granted!";
color = Colors.green.shade400;
}
return ShadButton(
text: Text(text),
onPressed: () async {
await Permission.manageExternalStorage.request();
setState(() {
});
},
enabled: isEnabled,
backgroundColor: color,
);
},
)
],
),
),
),
],
),
),
@@ -306,7 +372,6 @@ class _page2State extends State<_page2> {
);
},
)
],
),
)