build method
Builds this widget using the output context.
The build method is responsbile for building the tree of widgets below this one. It must never invoke the build or render methods of other widgets.
Implementation
@override
OutputWidget build(final OutputContext context) {
final connection = context.get<DatabaseConnection>();
final portString = connection.port == 5432 ? '' : ':${connection.port}';
final connectionString =
'postgresql://${connection.host}$portString/${connection.name}'
'?sslmode=${connection.requiresSsl ? 'require' : 'disable'}';
return SuccessTextWidget(
'''
Connection details:
Host: ${connection.host}
Port: ${connection.port}
Database: ${connection.name}''',
followUp: '''
This psql command can be used to connect to the database (it will prompt for the password):
psql "$connectionString" --user <username>''',
);
}