import 'package:flutter/material.dart'; import 'package:softplayer_web/api/grpc/environments.dart'; import 'package:softplayer_web/helpers/providers/common.dart'; class EnvirnomentCard extends StatefulWidget { final EnvironmentLocalData env; const EnvirnomentCard({ super.key, required this.env, }); @override State createState() => _EnvirnomentCardState(); } class _EnvirnomentCardState extends State { late double elevation = 1.0; @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 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), ]), ], ) ], ), ), ), ), ), ); } }