Skip to content

Instantly share code, notes, and snippets.

@kirshiyin89
Created August 24, 2020 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirshiyin89/cd33c8abf05a2840134020ce92990fe7 to your computer and use it in GitHub Desktop.
Save kirshiyin89/cd33c8abf05a2840134020ce92990fe7 to your computer and use it in GitHub Desktop.
The StartPage preparing the server info cards for displaying.
List<Widget> _prepareServerInfoCards(List<ServerInfo> serverInfo) {
List<Widget> serverInfoCells = [];
// we can call the rest service here?
for (ServerInfo category in serverInfo) {
serverInfoCells.add(_getServerInfoCard(category));
}
return serverInfoCells;
}
Container _getServerInfoCard(ServerInfo serverInfo) {
return new Container(
width: 200.0,
height: 300.0,
child: Card(
elevation: 2.0,
color: _getColorByServerStatus(serverInfo),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
verticalDirection: VerticalDirection.down,
children: _prepareStatusText(serverInfo)),
));
}
List<Widget> _prepareStatusText(ServerInfo serverInfo) {
final TextStyle textStyle =
TextStyle(fontWeight: FontWeight.bold, height: 3);
return <Widget>[
new Center(
child: new Text(serverInfo.name.toUpperCase(), style: textStyle),
),
new Center(
child: _createStatusTable(serverInfo),
),
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment