softplayer-web/lib/components/environment_preview.dart

91 lines
2.8 KiB
Dart
Raw Permalink Normal View History

2024-05-03 11:10:06 +00:00
import 'package:flutter/material.dart';
import 'package:softplayer_web/api/grpc/environments.dart';
import 'package:softplayer_web/helpers/providers/common.dart';
class EnvirnomentPreiview extends StatefulWidget {
@override
State<StatefulWidget> createState() => _EnvirnomentPreviewState();
final EnvironmentLocalData env;
const EnvirnomentPreiview({
super.key,
required this.env,
});
}
class _EnvirnomentPreviewState extends State<EnvirnomentPreiview> {
@override
Widget build(BuildContext context) {
Provider provider = ProviderHelper().getProvider(widget.env.provider);
String serverType;
String serverLocation;
try {
serverType = ProviderHelper().getServerType(widget.env.serverType);
serverLocation = provider.getServerLocation(widget.env.serverLocation);
} catch (e) {
rethrow;
}
return AlertDialog(
title: Text(widget.env.name),
content: SizedBox(
height: 420,
width: 420,
child: Column(
children: [
Table(
border: const TableBorder(
bottom: BorderSide.none,
left: BorderSide.none,
right: BorderSide.none,
top: BorderSide.none,
),
children: [
TableRow(children: [
const Text("Description"),
Text(widget.env.description),
]),
TableRow(children: [
const Text("Provider"),
Text(provider.getProviderName()),
]),
TableRow(children: [
const Text("Server Type"),
Text(serverType),
]),
TableRow(children: [
const Text("Location"),
Text(serverLocation),
]),
],
),
2024-05-22 11:03:44 +00:00
const Divider(),
2024-05-03 11:10:06 +00:00
Table(
border: const TableBorder(
bottom: BorderSide.none,
left: BorderSide.none,
right: BorderSide.none,
top: BorderSide.none,
),
2024-05-22 11:03:44 +00:00
children: const [
2024-05-03 11:10:06 +00:00
TableRow(children: [
2024-05-22 11:03:44 +00:00
Text("Price per hour"),
2024-05-03 11:10:06 +00:00
Text("0.52"),
]),
TableRow(children: [
2024-05-22 11:03:44 +00:00
Text("Current usage"),
2024-05-03 11:10:06 +00:00
Text("10.5"),
]),
],
),
],
),
),
actions: [
2024-05-22 11:03:44 +00:00
TextButton(onPressed: () => print("lala"), child: const Text("test")),
TextButton(onPressed: () => print("lala"), child: const Text("test")),
2024-05-03 11:10:06 +00:00
]);
}
}