2024-04-29 10:42:16 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2024-04-30 15:31:53 +00:00
|
|
|
import 'package:softplayer_web/api/grpc/environments.dart';
|
2024-05-02 17:09:44 +00:00
|
|
|
import 'package:softplayer_web/helpers/providers/common.dart';
|
2024-04-29 10:42:16 +00:00
|
|
|
|
2024-05-02 21:56:55 +00:00
|
|
|
class EnvirnomentCard extends StatefulWidget {
|
2024-04-30 15:31:53 +00:00
|
|
|
final EnvironmentLocalData env;
|
2024-04-29 10:42:16 +00:00
|
|
|
|
|
|
|
const EnvirnomentCard({
|
|
|
|
super.key,
|
2024-04-30 15:31:53 +00:00
|
|
|
required this.env,
|
2024-04-29 10:42:16 +00:00
|
|
|
});
|
|
|
|
|
2024-05-02 21:56:55 +00:00
|
|
|
@override
|
|
|
|
State<EnvirnomentCard> createState() => _EnvirnomentCardState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _EnvirnomentCardState extends State<EnvirnomentCard> {
|
|
|
|
late double elevation = 1.0;
|
|
|
|
|
2024-04-29 10:42:16 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-05-02 21:56:55 +00:00
|
|
|
Provider provider = ProviderHelper().getProvider(widget.env.provider);
|
2024-05-02 17:09:44 +00:00
|
|
|
|
|
|
|
String serverType;
|
|
|
|
String serverLocation;
|
|
|
|
try {
|
2024-05-02 21:56:55 +00:00
|
|
|
serverType = ProviderHelper().getServerType(widget.env.serverType);
|
|
|
|
serverLocation = provider.getServerLocation(widget.env.serverLocation);
|
2024-05-02 17:09:44 +00:00
|
|
|
} catch (e) {
|
|
|
|
rethrow;
|
|
|
|
}
|
|
|
|
|
2024-05-02 21:56:55 +00:00
|
|
|
return Container(
|
|
|
|
margin: const EdgeInsets.all(8.0),
|
|
|
|
height: 10,
|
|
|
|
child: MouseRegion(
|
|
|
|
onExit: (event) {
|
|
|
|
setState(() {
|
|
|
|
elevation = 1.0;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onEnter: (event) {
|
|
|
|
setState(() {
|
|
|
|
elevation = 5.0;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Card(
|
|
|
|
elevation: elevation,
|
|
|
|
child: SelectionArea(
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () => showBottomSheet(
|
|
|
|
context: context,
|
|
|
|
builder: (context) => Text(widget.env.uuid!),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Text(widget.env.name),
|
|
|
|
const Divider(),
|
|
|
|
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-04-30 15:31:53 +00:00
|
|
|
),
|
2024-05-02 21:56:55 +00:00
|
|
|
),
|
|
|
|
),
|
2024-04-30 15:31:53 +00:00
|
|
|
),
|
2024-04-29 10:42:16 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|