Erweiterungen
This commit is contained in:
1 parent
dbe821b08d
commit
ebe61c1674
7 files changed
+299
-303
No files matched your search
@@ -1,130 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:kumi_popup_window/kumi_popup_window.dart';
|
||||
import 'package:stadtbote/main.dart';
|
||||
import 'package:stadtbote/model/job.dart';
|
||||
import 'package:stadtbote/tools/util.dart';
|
||||
|
||||
void showAcceptJobPopup(BuildContext context, Job job) async {
|
||||
showPopupWindow(
|
||||
context,
|
||||
//childSize:Size(240, MediaQuery.of(context).size.width * 0.8),
|
||||
gravity: KumiPopupGravity.center,
|
||||
//curve: Curves.elasticOut,
|
||||
bgColor: Colors.grey.withOpacity(0.5),
|
||||
clickOutDismiss: true,
|
||||
clickBackDismiss: true,
|
||||
customAnimation: false,
|
||||
customPop: false,
|
||||
customPage: false,
|
||||
// targetRenderBox: (btnKey.currentContext.findRenderObject() as RenderBox),
|
||||
//needSafeDisplay: true,
|
||||
underStatusBar: false,
|
||||
underAppBar: false,
|
||||
//offsetX: -180,
|
||||
//offsetY: 50,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
onShowStart: (pop) {},
|
||||
onShowFinish: (pop) {},
|
||||
onDismissStart: (pop) {},
|
||||
onDismissFinish: (pop) {},
|
||||
onClickOut: (pop) {},
|
||||
onClickBack: (pop) {},
|
||||
childFun: (pop) {
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: MediaQuery.of(context).size.height * 0.5,
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Container(
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(DateFormat('dd.MM.yyyy HH:mm').format(DateTime.parse(job.ordertime)).toString(), textAlign: TextAlign.left),
|
||||
Text('Auftragsnummer: ${job.id}'),
|
||||
Text(job.tours[0].comp),
|
||||
Text(job.tours[0].street),
|
||||
Text(job.tours[0].city),
|
||||
const SizedBox(height: 20),
|
||||
Container(
|
||||
height: 200,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: const Color(0xfffff4e4),
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: const SingleChildScrollView(
|
||||
child: Text('asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd '),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: getDefaultButton(
|
||||
'Ablehnen',
|
||||
() => {_sendAnswer()}),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
Expanded(
|
||||
child: getDefaultButton(
|
||||
'Annehmen',
|
||||
() => {}),
|
||||
)
|
||||
]
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
private void SendAnswer(int item)
|
||||
{
|
||||
JObject payloadObject;
|
||||
|
||||
var location = App.CurrentLocation;
|
||||
if (location != null)
|
||||
payloadObject = new JObject(
|
||||
new JProperty("reaction", new JObject(
|
||||
new JProperty("id", _jobViewModel.IdString),
|
||||
new JProperty("ver", _jobViewModel.Version),
|
||||
new JProperty("item", item),
|
||||
new JProperty("track", new JObject(
|
||||
new JProperty("time", DateTime.Now.ToString("o")),
|
||||
new JProperty("pos", new JObject(
|
||||
new JProperty("lat", location.Latitude),
|
||||
new JProperty("long", location.Longitude),
|
||||
new JProperty("acc", location.Accuracy))))))));
|
||||
else
|
||||
payloadObject = new JObject(
|
||||
new JProperty("reaction", new JObject(
|
||||
new JProperty("id", _jobViewModel.IdString),
|
||||
new JProperty("ver", _jobViewModel.Version),
|
||||
new JProperty("item", item),
|
||||
new JProperty("track", new JObject(
|
||||
new JProperty("time", DateTime.Now.ToString("o")))))));
|
||||
|
||||
App.Core.SendJsonMessageAsync("job", payloadObject);
|
||||
}
|
||||
*/
|
||||
|
||||
_sendAnswer() {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
import 'package:expandable/expandable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:kumi_popup_window/kumi_popup_window.dart';
|
||||
import 'package:stadtbote/main.dart';
|
||||
import 'package:stadtbote/model/job.dart';
|
||||
import 'package:stadtbote/tools/constants.dart';
|
||||
import 'package:stadtbote/tools/util.dart';
|
||||
import 'package:badges/badges.dart' as badges;
|
||||
|
||||
void showAcceptJobsPopup(BuildContext context) async {
|
||||
var entries = await _createListEntries();
|
||||
|
||||
showPopupWindow(
|
||||
context,
|
||||
//childSize:Size(240, MediaQuery.of(context).size.width * 0.8),
|
||||
gravity: KumiPopupGravity.center,
|
||||
//curve: Curves.elasticOut,
|
||||
bgColor: Colors.grey.withOpacity(0.5),
|
||||
clickOutDismiss: true,
|
||||
clickBackDismiss: true,
|
||||
customAnimation: false,
|
||||
customPop: false,
|
||||
customPage: false,
|
||||
// targetRenderBox: (btnKey.currentContext.findRenderObject() as RenderBox),
|
||||
//needSafeDisplay: true,
|
||||
underStatusBar: false,
|
||||
underAppBar: false,
|
||||
//offsetX: -180,
|
||||
//offsetY: 50,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
onShowStart: (pop) {},
|
||||
onShowFinish: (pop) {},
|
||||
onDismissStart: (pop) {},
|
||||
onDismissFinish: (pop) {},
|
||||
onClickOut: (pop) {},
|
||||
onClickBack: (pop) {},
|
||||
childFun: (pop) {
|
||||
_createListEntries();
|
||||
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: MediaQuery.of(context).size.height * 0.85,
|
||||
width: MediaQuery.of(context).size.width * 0.85,
|
||||
child: Container(
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: SingleChildScrollView(child: Column(children: entries)),
|
||||
));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<List<Widget>> _createListEntries() async {
|
||||
List<Widget> entries = [];
|
||||
|
||||
var jobs = await MyApp.isarInstance.jobs.filter().stateEqualTo(0).findAll();
|
||||
jobs.addAll(await MyApp.isarInstance.jobs.filter().stateEqualTo(0).findAll());
|
||||
jobs.addAll(await MyApp.isarInstance.jobs.filter().stateEqualTo(0).findAll());
|
||||
jobs.addAll(await MyApp.isarInstance.jobs.filter().stateEqualTo(0).findAll());
|
||||
for (var job in jobs) {
|
||||
entries.add(ExpandableNotifier(
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
title: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: Constants.colorPrimary,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: badges.Badge(
|
||||
position: badges.BadgePosition.topEnd(top: -10, end: -5),
|
||||
showBadge: true,
|
||||
badgeContent: const Text(
|
||||
'Neu',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10.0,
|
||||
),
|
||||
),
|
||||
badgeStyle: badges.BadgeStyle(
|
||||
shape: badges.BadgeShape.square,
|
||||
badgeColor: Colors.green,
|
||||
padding: const EdgeInsets.all(5),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
borderSide: const BorderSide(color: Constants.colorPrimary, width: 0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(DateFormat('dd.MM.yyyy HH:mm').format(DateTime.parse(job.ordertime)).toString(), textAlign: TextAlign.left),
|
||||
Text('Auftragsnummer: ${job.id}'),
|
||||
Text(job.tours[0].comp),
|
||||
Text(job.tours[0].street),
|
||||
Text(job.tours[0].city),
|
||||
const SizedBox(height: 20),
|
||||
ScrollOnExpand(
|
||||
scrollOnExpand: true,
|
||||
scrollOnCollapse: false,
|
||||
child: ExpandablePanel(
|
||||
theme: const ExpandableThemeData(
|
||||
headerAlignment: ExpandablePanelHeaderAlignment.center,
|
||||
tapBodyToCollapse: true,
|
||||
),
|
||||
header: const Padding(
|
||||
padding: EdgeInsets.all(0),
|
||||
child: Text(
|
||||
"Weitere Infos....",
|
||||
style: TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.bold),
|
||||
)),
|
||||
collapsed: SizedBox(),
|
||||
expanded: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 200,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: const Color(0xfffff4e4),
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: Text('asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd '),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(children: [
|
||||
Expanded(
|
||||
child: getDefaultButton('Ablehnen', () => {_sendAnswer()}),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
Expanded(
|
||||
child: getDefaultButton('Annehmen', () => {}),
|
||||
)
|
||||
])
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
/*
|
||||
private void SendAnswer(int item)
|
||||
{
|
||||
JObject payloadObject;
|
||||
|
||||
var location = App.CurrentLocation;
|
||||
if (location != null)
|
||||
payloadObject = new JObject(
|
||||
new JProperty("reaction", new JObject(
|
||||
new JProperty("id", _jobViewModel.IdString),
|
||||
new JProperty("ver", _jobViewModel.Version),
|
||||
new JProperty("item", item),
|
||||
new JProperty("track", new JObject(
|
||||
new JProperty("time", DateTime.Now.ToString("o")),
|
||||
new JProperty("pos", new JObject(
|
||||
new JProperty("lat", location.Latitude),
|
||||
new JProperty("long", location.Longitude),
|
||||
new JProperty("acc", location.Accuracy))))))));
|
||||
else
|
||||
payloadObject = new JObject(
|
||||
new JProperty("reaction", new JObject(
|
||||
new JProperty("id", _jobViewModel.IdString),
|
||||
new JProperty("ver", _jobViewModel.Version),
|
||||
new JProperty("item", item),
|
||||
new JProperty("track", new JObject(
|
||||
new JProperty("time", DateTime.Now.ToString("o")))))));
|
||||
|
||||
App.Core.SendJsonMessageAsync("job", payloadObject);
|
||||
}
|
||||
*/
|
||||
|
||||
_sendAnswer() {}
|
||||
Reference in new issue
Block a user