Compare commits
1 Commits
0.7.1-dev.
...
0.7.1-dev.
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b94ab263b |
@@ -744,8 +744,37 @@ Future<void> showTractionDetails(
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (auth.isElevated || canDeleteAsOwner) ...[
|
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
FilledButton.icon(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(ctx).pop();
|
||||||
|
navContext.push(
|
||||||
|
Uri(
|
||||||
|
path: '/traction',
|
||||||
|
queryParameters: {
|
||||||
|
'selection': 'single',
|
||||||
|
'transferFromLocoId': loco.id.toString(),
|
||||||
|
},
|
||||||
|
).toString(),
|
||||||
|
extra: {
|
||||||
|
'selection': 'single',
|
||||||
|
'transferFromLocoId': loco.id,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.swap_horiz),
|
||||||
|
label: const Text('Transfer allocations'),
|
||||||
|
),
|
||||||
|
if (auth.isElevated || canDeleteAsOwner) ...[
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
ExpansionTile(
|
||||||
|
tilePadding: EdgeInsets.zero,
|
||||||
|
childrenPadding: EdgeInsets.zero,
|
||||||
|
title: Text(
|
||||||
|
'More',
|
||||||
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
|
),
|
||||||
|
children: [
|
||||||
FilledButton.tonal(
|
FilledButton.tonal(
|
||||||
style: FilledButton.styleFrom(
|
style: FilledButton.styleFrom(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
@@ -764,11 +793,13 @@ Future<void> showTractionDetails(
|
|||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(false),
|
onPressed: () =>
|
||||||
|
Navigator.of(context).pop(false),
|
||||||
child: const Text('Cancel'),
|
child: const Text('Cancel'),
|
||||||
),
|
),
|
||||||
FilledButton(
|
FilledButton(
|
||||||
onPressed: () => Navigator.of(context).pop(true),
|
onPressed: () =>
|
||||||
|
Navigator.of(context).pop(true),
|
||||||
style: FilledButton.styleFrom(
|
style: FilledButton.styleFrom(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Theme.of(context).colorScheme.error,
|
Theme.of(context).colorScheme.error,
|
||||||
@@ -790,12 +821,16 @@ Future<void> showTractionDetails(
|
|||||||
Navigator.of(ctx).pop();
|
Navigator.of(ctx).pop();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
messenger.showSnackBar(
|
messenger.showSnackBar(
|
||||||
SnackBar(content: Text('Failed to delete loco: $e')),
|
SnackBar(
|
||||||
|
content: Text('Failed to delete loco: $e')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: const Text('Delete loco'),
|
child: const Text('Delete loco'),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ extension DataServiceTraction on DataService {
|
|||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
await api.post('/loco/alloc/transfer', {
|
await api.post('/loco/alloc/transfer', {
|
||||||
'loco_id': fromLocoId,
|
'from_loco_id': fromLocoId,
|
||||||
'to_loco_id': toLocoId,
|
'to_loco_id': toLocoId,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user