Erweiterungen
This commit is contained in:
1 parent
3dab4025e7
commit
3d7ae9de2a
16 files changed
+438
-327
No files matched your search
@@ -3,13 +3,16 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_broadcast_receiver/flutter_broadcast_receiver.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:stadtbote/content_views/accepted_jobs_page.dart';
|
||||
import 'package:stadtbote/content_views/assigned_jobs_page.dart';
|
||||
import 'package:stadtbote/content_views/finished_jobs_page.dart';
|
||||
import 'package:stadtbote/content_views/messages_page.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:stadtbote/model/status.dart';
|
||||
import 'package:stadtbote/popups/infos_popup.dart';
|
||||
import 'package:stadtbote/tools/session_info_update.dart';
|
||||
|
||||
import '../main.dart';
|
||||
import '../model/job.dart';
|
||||
@@ -17,7 +20,16 @@ import '../tools/constants.dart';
|
||||
import '../tools/util.dart';
|
||||
|
||||
class MainPage extends ContentViewWidget {
|
||||
const MainPage({super.key});
|
||||
final ValueNotifier<String> _zipValueNotifier = ValueNotifier("----");
|
||||
final ValueNotifier<String> _sidValueNotifier = ValueNotifier("----");
|
||||
|
||||
MainPage({super.key}) {
|
||||
Status? status = MyApp.isarInstance.status.where().findFirstSync();
|
||||
if (status != null) {
|
||||
_zipValueNotifier.value = status.locZip;
|
||||
_sidValueNotifier.value = status.sid;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
State<MainPage> createState() => _MainPageState();
|
||||
@@ -27,21 +39,31 @@ class MainPage extends ContentViewWidget {
|
||||
return HeaderInfo(
|
||||
titleWidget: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 3),
|
||||
child: const Column(children: [
|
||||
Text(
|
||||
'Zeile 1',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18.0,
|
||||
),
|
||||
child: Column(children: [
|
||||
ValueListenableBuilder<String>(
|
||||
valueListenable: _zipValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18.0,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
'Zeile 2',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18.0,
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
ValueListenableBuilder<String>(
|
||||
valueListenable: _sidValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18.0,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
]),
|
||||
),
|
||||
@@ -55,6 +77,13 @@ class MainPage extends ContentViewWidget {
|
||||
}
|
||||
|
||||
class _MainPageState extends State<MainPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_initMessages();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
@@ -123,7 +152,7 @@ class _MainPageState extends State<MainPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void _test() async {
|
||||
_test() async {
|
||||
var json = await rootBundle.loadString('assets/job.json');
|
||||
var jsonMap = jsonDecode(json);
|
||||
var payload = jsonMap["payload"];
|
||||
@@ -138,4 +167,10 @@ class _MainPageState extends State<MainPage> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_initMessages() {
|
||||
BroadcastReceiver().subscribe<StatusInfoUpdate>(Constants.messageTopicStatusInfoUpdate, (statusInfoUpdate) {
|
||||
widget._sidValueNotifier.value = statusInfoUpdate.status.sid;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user