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
Widget _buildGridView(BuildContext context, List<ServerInfo> serverInfo) { | |
return GridView.count( | |
primary: false, | |
padding: const EdgeInsets.all(1.5), | |
crossAxisCount: determineCrossAxisCount(context), | |
childAspectRatio: 1.2, | |
mainAxisSpacing: 1.0, | |
crossAxisSpacing: 1.0, | |
children: _prepareServerInfoCards(serverInfo), //new Cards() | |
shrinkWrap: true, |
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
import 'package:flutter/material.dart'; | |
int determineCrossAxisCount(BuildContext context) { | |
int _crossAxisCount = 1; | |
final double screenWidthSize = MediaQuery.of(context).size.width; | |
if (screenWidthSize > 820) { | |
_crossAxisCount = 4; | |
} else if (screenWidthSize > 720) { | |
_crossAxisCount = 3; | |
} else if (screenWidthSize > 520) { |
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) { |
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
Widget _createStatusTable(ServerInfo serverInfo) { | |
if (serverInfo.notAvailable()) { | |
return new Text('Server unreachable'); | |
} | |
return Table( | |
border: TableBorder.all( | |
color: Colors.black26, width: 1, style: BorderStyle.none), | |
children: _createStatusCells(serverInfo.services)); | |
} |
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
TextStyle _getStyleByServiceStatus(bool running) { | |
if (!running) { | |
return TextStyle(fontStyle: FontStyle.italic); | |
} | |
return TextStyle(); | |
} |
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
Color _getColorByServerStatus(ServerInfo info) { | |
if (info.running()) { | |
return Colors.teal[600]; | |
} else { | |
return Colors.red[200]; | |
} | |
} |
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
import 'package:myapp/serverinfo.dart'; | |
import 'dart:js' as js; | |
import 'package:http/http.dart' as http; | |
import 'dart:async'; | |
import 'dart:convert'; | |
Future<List<ServerInfo>> fetchServerInfo() async { | |
final response = await http.get("http://localhost:8080/api"); | |
if (response.statusCode == 200) { |
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
import 'package:flutter/material.dart'; | |
import 'package:myapp/dataservice.dart'; | |
import 'dart:async'; | |
import 'package:myapp/serverinfo.dart'; | |
import 'package:myapp/startpage.dart'; | |
void main() { | |
runApp(MyApp()); |
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
dependencies { | |
implementation 'org.springframework.boot:spring-boot-starter-web' | |
} |
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
repositories { | |
mavenCentral() | |
maven { | |
url 'https://github.com/psiegman/mvn-repo/raw/master/releases' | |
} | |
} | |
dependencies { | |
compile 'com.rabbitmq:amqp-client:5.9.0' | |
compile group: 'nl.siegmann.epublib', name: 'epublib-core', version: '3.1' |