added expansion panel
This commit is contained in:
@@ -55,6 +55,8 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
||||
headingAccuracy: 0.0,
|
||||
);
|
||||
|
||||
bool bimaExtended = false;
|
||||
|
||||
// all TextEditingController because its easier
|
||||
Map<String, Map<String, dynamic>> rmap = {
|
||||
"ID": {"controller": TextEditingController(), "required": false},
|
||||
@@ -120,30 +122,30 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
GeolocatorService.deteterminePosition(alwaysOnNeeded: true)
|
||||
.then((result) => currentPosition = result)
|
||||
.catchError((error) {
|
||||
if (error is LocationDisabledException) {
|
||||
if (mounted) {
|
||||
SnackBarHelper.showSnackBarMessage(
|
||||
context,
|
||||
AppLocalizations.of(context)!.locationDisabled,
|
||||
);
|
||||
}
|
||||
} else if (error is LocationForbiddenException) {
|
||||
if (mounted) {
|
||||
SnackBarHelper.showSnackBarMessage(
|
||||
context,
|
||||
AppLocalizations.of(context)!.locationForbidden,
|
||||
);
|
||||
}
|
||||
} else if (error is NeedAlwaysLocation) {
|
||||
if (mounted) {
|
||||
AddEntriesDialogHelper.locationSettingsDialog(context);
|
||||
}
|
||||
}
|
||||
return currentPosition;
|
||||
});
|
||||
GeolocatorService.deteterminePosition(
|
||||
alwaysOnNeeded: true,
|
||||
).then((result) => currentPosition = result).catchError((error) {
|
||||
if (error is LocationDisabledException) {
|
||||
if (mounted) {
|
||||
SnackBarHelper.showSnackBarMessage(
|
||||
context,
|
||||
AppLocalizations.of(context)!.locationDisabled,
|
||||
);
|
||||
}
|
||||
} else if (error is LocationForbiddenException) {
|
||||
if (mounted) {
|
||||
SnackBarHelper.showSnackBarMessage(
|
||||
context,
|
||||
AppLocalizations.of(context)!.locationForbidden,
|
||||
);
|
||||
}
|
||||
} else if (error is NeedAlwaysLocation) {
|
||||
if (mounted) {
|
||||
AddEntriesDialogHelper.locationSettingsDialog(context);
|
||||
}
|
||||
}
|
||||
return currentPosition;
|
||||
});
|
||||
|
||||
if (widget.existingData?.isNotEmpty ?? false) {
|
||||
for (var key in widget.existingData!.keys) {
|
||||
@@ -260,41 +262,68 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
||||
const SizedBox(height: 10),
|
||||
// ---------- Bima number
|
||||
const Divider(),
|
||||
// TODO implement expensionpanel
|
||||
const SizedBox(height: 10),
|
||||
VarTextField(
|
||||
textController: rmap["BimaNr"]!["controller"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaNr,
|
||||
dbName: "BimaNr",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
// ---------- Bima name
|
||||
VarTextField(
|
||||
textController: rmap["BimaName"]!["controller"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaName,
|
||||
dbName: "BimaName",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
// ---------- Bima user
|
||||
BimaNutzer(
|
||||
onBimaNutzerChanged: (value) {
|
||||
setState(() {
|
||||
rmap["BimaNutzer"]!["controller"]!.text = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
// ---------- Bima AGV
|
||||
VarTextField(
|
||||
textController: rmap["BimaAGV"]!["controller"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaAGV,
|
||||
dbName: "BimaAGV",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
child: ExpansionPanelList(
|
||||
expansionCallback:
|
||||
((int index, bool isExpanded) =>
|
||||
setState(() => bimaExtended = isExpanded)),
|
||||
expandedHeaderPadding: EdgeInsets.all(0),
|
||||
children: [
|
||||
ExpansionPanel(
|
||||
isExpanded: bimaExtended,
|
||||
canTapOnHeader: true,
|
||||
headerBuilder: (context, bool isOpen) => Padding(
|
||||
padding: const EdgeInsets.only(left: 15),
|
||||
child: Align(alignment: Alignment.centerLeft, child: Text("BImA", style: Theme.of(context).textTheme.bodyLarge,),),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(15),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
VarTextField(
|
||||
textController: rmap["BimaNr"]!["controller"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaNr,
|
||||
dbName: "BimaNr",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
// ---------- Bima name
|
||||
VarTextField(
|
||||
textController: rmap["BimaName"]!["controller"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaName,
|
||||
dbName: "BimaName",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
// ---------- Bima user
|
||||
BimaNutzer(
|
||||
onBimaNutzerChanged: (value) {
|
||||
setState(() {
|
||||
rmap["BimaNutzer"]!["controller"]!.text = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
// ---------- Bima AGV
|
||||
VarTextField(
|
||||
textController: rmap["BimaAGV"]!["controller"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaAGV,
|
||||
dbName: "BimaAGV",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -475,7 +504,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
||||
AddEntriesDialogHelper.showTemplateDialog(
|
||||
context,
|
||||
getFieldsText(),
|
||||
DatabasesEnum.excursion
|
||||
DatabasesEnum.excursion,
|
||||
);
|
||||
return;
|
||||
} else if (!empty) {
|
||||
|
||||
Reference in New Issue
Block a user