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 createState() => _EnvirnomentPreviewState(); final EnvironmentLocalData env; const EnvirnomentPreiview({ super.key, required this.env, }); } class _EnvirnomentPreviewState extends State { @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), ]), ], ), const Divider(), Table( border: const TableBorder( bottom: BorderSide.none, left: BorderSide.none, right: BorderSide.none, top: BorderSide.none, ), children: const [ TableRow(children: [ Text("Price per hour"), Text("0.52"), ]), TableRow(children: [ Text("Current usage"), Text("10.5"), ]), ], ), ], ), ), actions: [ TextButton(onPressed: () => print("lala"), child: const Text("test")), TextButton(onPressed: () => print("lala"), child: const Text("test")), ]); } }