1. Import
This commit is contained in:
commit
cb4525a774
165 files changed
+14763
No files matched your search
@@ -0,0 +1,142 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_broadcast_receiver/flutter_broadcast_receiver.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/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:stadtbote/popups/infos_popup.dart';
|
||||
|
||||
import '../main.dart';
|
||||
import '../model/job.dart';
|
||||
import '../tools/constants.dart';
|
||||
import '../tools/util.dart';
|
||||
|
||||
class MainPage extends ContentViewWidget {
|
||||
const MainPage({super.key});
|
||||
|
||||
@override
|
||||
State<MainPage> createState() => _MainPageState();
|
||||
|
||||
@override
|
||||
Future<HeaderInfo> getHeaderInfo(BuildContext context) async {
|
||||
return HeaderInfo(
|
||||
titleWidget: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 3),
|
||||
child: Column(children: const [
|
||||
Text(
|
||||
'Zeile 1',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18.0,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
'Zeile 2',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18.0,
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
rightButtonEnabled: true,
|
||||
rightButtonVisible: true,
|
||||
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.info_outline, size: 20.0, color: Colors.white)),
|
||||
rightButtonOnPressed: () async {
|
||||
showInfosPopup(context);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _MainPageState extends State<MainPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
getDefaultButton(
|
||||
'Zugewiesene Aufträge',
|
||||
image: Image.asset('assets/zugewiesene_auftraege.png', width: 30, height: 30),
|
||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const AssignedJobsPage())}),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton(
|
||||
'Angenommene Aufträge',
|
||||
image: Image.asset('assets/angenommene_auftraege.png', width: 30, height: 30),
|
||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const AcceptedJobsPage())}),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton(
|
||||
'Erledigte Aufträge',
|
||||
image: Image.asset('assets/erledigte_auftraege.png', width: 30, height: 30),
|
||||
() => {BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())}),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton(
|
||||
'Nachrichten',
|
||||
image: Image.asset('assets/nachrichten.png', width: 30, height: 30),
|
||||
() => {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())
|
||||
}),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton(
|
||||
'Anfahrtsbereich',
|
||||
image: Image.asset('assets/anfahrtsbereich.png', width: 30, height: 30),
|
||||
() => {
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())
|
||||
}),
|
||||
const SizedBox(height: 10),
|
||||
getDefaultButton(
|
||||
'Abmelden',
|
||||
image: Image.asset('assets/abmelden.png', width: 30, height: 30),
|
||||
() => {
|
||||
_test()
|
||||
//BroadcastReceiver().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const FinishedJobsPage())
|
||||
}),
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
border: Border.all(
|
||||
color: Colors.transparent,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
'assets/sb_logo.png',
|
||||
width: 100,
|
||||
height: 100,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _test() async {
|
||||
var json = await rootBundle.loadString('assets/job.json');
|
||||
var jsonMap = jsonDecode(json);
|
||||
var payload = jsonMap["payload"];
|
||||
|
||||
var jobsPayload = JobsPayload.fromJson(payload);
|
||||
|
||||
if (jobsPayload.jobs != null) {
|
||||
MyApp.isarInstance.writeTxnSync(() {
|
||||
for (var job in jobsPayload.jobs as List<Job>) {
|
||||
MyApp.isarInstance.jobs.putSync(job);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user