Compare commits
2 Commits
65f0f4451b
...
44500835d7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44500835d7 | ||
|
|
b2be3ec4ae |
@ -24,10 +24,13 @@ android {
|
|||||||
applicationId = "com.goutezplanb.planb_logistic"
|
applicationId = "com.goutezplanb.planb_logistic"
|
||||||
// You can update the following values to match your application needs.
|
// You can update the following values to match your application needs.
|
||||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||||
minSdk = 23 // Required for Google Navigation Flutter
|
minSdk = flutter.minSdkVersion // Required for Google Navigation Flutter
|
||||||
targetSdk = flutter.targetSdkVersion
|
targetSdk = flutter.targetSdkVersion
|
||||||
versionCode = flutter.versionCode
|
versionCode = flutter.versionCode
|
||||||
versionName = flutter.versionName
|
versionName = flutter.versionName
|
||||||
|
|
||||||
|
// OAuth redirect scheme for flutter_appauth
|
||||||
|
manifestPlaceholders["appAuthRedirectScheme"] = "com.goutezplanb.delivery"
|
||||||
}
|
}
|
||||||
|
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
|
|||||||
@ -312,7 +312,7 @@ class _DarkModeMapComponentState extends State<DarkModeMapComponent> {
|
|||||||
|
|
||||||
// Calculate dynamic padding for bottom button bar
|
// Calculate dynamic padding for bottom button bar
|
||||||
final topPadding = 0.0;
|
final topPadding = 0.0;
|
||||||
final bottomPadding = widget.selectedDelivery != null ? 110.0 : 0.0;
|
final bottomPadding = 110.0;
|
||||||
|
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
@ -327,10 +327,34 @@ class _DarkModeMapComponentState extends State<DarkModeMapComponent> {
|
|||||||
_navigationController = controller;
|
_navigationController = controller;
|
||||||
// Apply dark mode style with a small delay to ensure map is ready
|
// Apply dark mode style with a small delay to ensure map is ready
|
||||||
await Future.delayed(const Duration(milliseconds: 500));
|
await Future.delayed(const Duration(milliseconds: 500));
|
||||||
|
|
||||||
|
// Safety check: ensure widget is still mounted before proceeding
|
||||||
|
if (!mounted) return;
|
||||||
|
|
||||||
await _applyDarkModeStyle();
|
await _applyDarkModeStyle();
|
||||||
controller.animateCamera(
|
|
||||||
|
// Wrap camera animation in try-catch to handle "No valid view found" errors
|
||||||
|
// This can happen on Android when the view isn't fully ready
|
||||||
|
try {
|
||||||
|
if (mounted && _navigationController != null) {
|
||||||
|
await controller.animateCamera(
|
||||||
CameraUpdate.newLatLngZoom(initialPosition, 12),
|
CameraUpdate.newLatLngZoom(initialPosition, 12),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('Camera animation error (view may not be ready): $e');
|
||||||
|
// Retry once after a longer delay
|
||||||
|
await Future.delayed(const Duration(milliseconds: 1000));
|
||||||
|
if (mounted && _navigationController != null) {
|
||||||
|
try {
|
||||||
|
await controller.animateCamera(
|
||||||
|
CameraUpdate.newLatLngZoom(initialPosition, 12),
|
||||||
|
);
|
||||||
|
} catch (e2) {
|
||||||
|
debugPrint('Camera animation retry failed: $e2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
initialCameraPosition: CameraPosition(
|
initialCameraPosition: CameraPosition(
|
||||||
target: initialPosition,
|
target: initialPosition,
|
||||||
@ -338,8 +362,7 @@ class _DarkModeMapComponentState extends State<DarkModeMapComponent> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Bottom action button bar
|
// Bottom action button bar - 4 equal-width buttons (always visible)
|
||||||
if (widget.selectedDelivery != null)
|
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
@ -361,53 +384,47 @@ class _DarkModeMapComponentState extends State<DarkModeMapComponent> {
|
|||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
// Recenter button
|
// Start button
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildBottomActionButton(
|
child: _buildBottomActionButton(
|
||||||
label: 'Recenter',
|
label: _isNavigating ? 'Stop' : 'Start',
|
||||||
icon: Icons.location_on,
|
icon: _isNavigating ? Icons.stop : Icons.navigation,
|
||||||
onPressed: _recenterMap,
|
onPressed: _isStartingNavigation || _isInitializing || (widget.selectedDelivery == null && !_isNavigating)
|
||||||
|
? null
|
||||||
|
: (_isNavigating ? _stopNavigation : _startNavigation),
|
||||||
|
isDanger: _isNavigating,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 8),
|
||||||
// Mark Complete button (if not already delivered)
|
// Photo button
|
||||||
if (!widget.selectedDelivery!.delivered)
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildBottomActionButton(
|
child: _buildBottomActionButton(
|
||||||
label: 'Mark Complete',
|
label: 'Photo',
|
||||||
icon: Icons.check_circle,
|
icon: Icons.camera_alt,
|
||||||
onPressed: () => widget.onAction?.call('complete'),
|
onPressed: () => widget.onAction?.call('photo'),
|
||||||
isPrimary: true,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (widget.selectedDelivery!.delivered)
|
const SizedBox(width: 8),
|
||||||
|
// Note button
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildBottomActionButton(
|
child: _buildBottomActionButton(
|
||||||
label: _isInitializing ? 'Initializing...' : 'Start Navigation',
|
label: 'Note',
|
||||||
icon: Icons.directions,
|
icon: Icons.note_add,
|
||||||
onPressed: _isInitializing ? null : _startNavigation,
|
onPressed: () => widget.onAction?.call('note'),
|
||||||
isPrimary: true,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!_isNavigating && !widget.selectedDelivery!.delivered)
|
const SizedBox(width: 8),
|
||||||
const SizedBox(width: 12),
|
// Completed button
|
||||||
if (!_isNavigating && !widget.selectedDelivery!.delivered)
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildBottomActionButton(
|
child: _buildBottomActionButton(
|
||||||
label: _isStartingNavigation || _isInitializing ? 'Loading...' : 'Navigate',
|
label: widget.selectedDelivery?.delivered == true ? 'Undo' : 'Completed',
|
||||||
icon: Icons.directions,
|
icon: widget.selectedDelivery?.delivered == true ? Icons.undo : Icons.check_circle,
|
||||||
onPressed: _isStartingNavigation || _isInitializing ? null : _startNavigation,
|
onPressed: widget.selectedDelivery != null
|
||||||
),
|
? () => widget.onAction?.call(
|
||||||
),
|
widget.selectedDelivery!.delivered ? 'uncomplete' : 'complete',
|
||||||
if (_isNavigating)
|
)
|
||||||
const SizedBox(width: 12),
|
: null,
|
||||||
if (_isNavigating)
|
isPrimary: widget.selectedDelivery != null && !widget.selectedDelivery!.delivered,
|
||||||
Expanded(
|
|
||||||
child: _buildBottomActionButton(
|
|
||||||
label: 'Stop',
|
|
||||||
icon: Icons.stop,
|
|
||||||
onPressed: _stopNavigation,
|
|
||||||
isDanger: true,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -486,12 +503,12 @@ class _DarkModeMapComponentState extends State<DarkModeMapComponent> {
|
|||||||
Color textColor = Colors.white;
|
Color textColor = Colors.white;
|
||||||
|
|
||||||
if (isDanger) {
|
if (isDanger) {
|
||||||
backgroundColor = Colors.red.shade600;
|
backgroundColor = SvrntyColors.crimsonRed;
|
||||||
} else if (isPrimary) {
|
} else if (isPrimary) {
|
||||||
backgroundColor = SvrntyColors.crimsonRed;
|
backgroundColor = SvrntyColors.crimsonRed;
|
||||||
} else {
|
} else {
|
||||||
backgroundColor = Theme.of(context).colorScheme.surfaceContainerHighest;
|
// Use the same slateGray as delivery list badges
|
||||||
textColor = Theme.of(context).colorScheme.onSurface;
|
backgroundColor = SvrntyColors.slateGray;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reduce opacity when disabled
|
// Reduce opacity when disabled
|
||||||
@ -507,8 +524,8 @@ class _DarkModeMapComponentState extends State<DarkModeMapComponent> {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 12,
|
horizontal: 14,
|
||||||
vertical: 12,
|
vertical: 14,
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -517,15 +534,15 @@ class _DarkModeMapComponentState extends State<DarkModeMapComponent> {
|
|||||||
Icon(
|
Icon(
|
||||||
icon,
|
icon,
|
||||||
color: textColor,
|
color: textColor,
|
||||||
size: 18,
|
size: 24,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 8),
|
||||||
Text(
|
Text(
|
||||||
label,
|
label,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: textColor,
|
color: textColor,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w600,
|
||||||
fontSize: 14,
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user