Created
August 24, 2020 18:56
-
-
Save kirshiyin89/cd33c8abf05a2840134020ce92990fe7 to your computer and use it in GitHub Desktop.
The StartPage preparing the server info cards for displaying.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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