Ranking erweitert
This commit is contained in:
1 parent
32ec25af14
commit
91f641f998
6 files changed
+449
-327
No files matched your search
@@ -10,6 +10,7 @@ import 'package:stadtbote/popups/tasks_popups/zip_popup.dart';
|
||||
import 'package:stadtbote/protocoll_messages/zip_message.dart';
|
||||
import 'package:stadtbote/tools/constants.dart';
|
||||
import 'package:stadtbote/tools/message_service.dart';
|
||||
import 'package:stadtbote/tools/messages/ranking_updated.dart';
|
||||
import 'package:stadtbote/tools/mqtt_core.dart';
|
||||
|
||||
import '../tools/util.dart';
|
||||
@@ -40,7 +41,7 @@ class ApproachAreaPage extends ContentViewWidget {
|
||||
}
|
||||
|
||||
class _ApproachAreaPageState extends State<ApproachAreaPage> {
|
||||
late List<Rank>? _ranking;
|
||||
late Ranking? _ranking;
|
||||
|
||||
late bool _initCompleted = false;
|
||||
|
||||
@@ -49,12 +50,10 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> {
|
||||
super.initState();
|
||||
|
||||
Future.delayed(const Duration(seconds: 0), () async {
|
||||
_ranking = await MyApp.isarInstance.ranks.where().findAll();
|
||||
_ranking = await MyApp.isarInstance.rankings.where().findFirst();
|
||||
|
||||
_initCompleted = true;
|
||||
|
||||
_sendZip(Rank(), "24893");
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
|
||||
@@ -74,6 +73,8 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> {
|
||||
return Util.getWaitWidget(context);
|
||||
}
|
||||
|
||||
_fillColumns();
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: InteractiveViewer(
|
||||
@@ -93,8 +94,8 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> {
|
||||
List<Widget> columns = [];
|
||||
|
||||
if (_ranking != null) {
|
||||
for (int i = 0; i < _ranking!.length; i++) {
|
||||
var rank = _ranking![i];
|
||||
for (int i = 0; i < _ranking!.ranks.length; i++) {
|
||||
var rank = _ranking!.ranks[i];
|
||||
|
||||
List<Widget> entries = [];
|
||||
entries.add(
|
||||
@@ -196,10 +197,10 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> {
|
||||
}
|
||||
|
||||
_initMessages() {
|
||||
/*MessageService().subscribe<RankingUpdated>(Constants.messageTopicRankingUpdated, this, (rankingUpdateMessage) async {
|
||||
MessageService().subscribe<RankingUpdated>(Constants.messageTopicRankingUpdated, this, (rankingUpdateMessage) async {
|
||||
_ranking = await MyApp.isarInstance.rankings.where().findFirst();
|
||||
|
||||
setState(() {});
|
||||
});*/
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ class _MessagesPageState extends State<MessagesPage> {
|
||||
author: message.from == _sid ? _user : _central,
|
||||
createdAt: DateTime.parse(message.time).toLocal().millisecondsSinceEpoch,
|
||||
id: message.id.toString(),
|
||||
text: message.text,
|
||||
text: message.subj + "\n" + message.text,
|
||||
));
|
||||
|
||||
_messages.sort((a, b) => b.createdAt! > a.createdAt! ? 1 : 0);
|
||||
|
||||
Reference in new issue
Block a user