updated the sheet
This commit is contained in:
@@ -17,7 +17,6 @@ import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:miler/providers/pickup/pickup_provider.dart';
|
||||
import 'package:miler/providers/pickuplog/pickuplog_provider.dart';
|
||||
import 'package:miler/views/Dashboard/orders/orderstaus_button.dart';
|
||||
import 'package:miler/views/helpers/constants/apiconstants.dart';
|
||||
import 'package:miler/views/helpers/constants/Colorconstants.dart';
|
||||
import 'package:miler/views/helpers/constants/miler_surface.dart';
|
||||
import 'package:miler/views/helpers/widgets/app_widgets.dart';
|
||||
@@ -59,6 +58,7 @@ import 'package:miler/views/Dashboard/pickups/pickups.dart' as pickups;
|
||||
import 'package:miler/background/live_tracking_service.dart';
|
||||
import 'package:miler/data/accepted_store.dart';
|
||||
import 'package:miler/data/api_config.dart';
|
||||
import 'package:miler/data/heartbeat.dart';
|
||||
import 'package:miler/data/consignment_state.dart';
|
||||
import 'package:miler/views/Dashboard/pickups/collect_payment.dart';
|
||||
import 'package:miler/views/Dashboard/pickups/stop_type.dart';
|
||||
@@ -1699,11 +1699,13 @@ class _HomepageState extends State<Homepage>
|
||||
Future<Duration> _getLogInterval() async {
|
||||
try {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final secs = prefs.getInt('logseconds');
|
||||
final int interval = (secs != null && secs > 0) ? secs : 30;
|
||||
// Already correct — routed through the shared resolver so the 30 lives in
|
||||
// one place. See [kDefaultLogSeconds] for what a zero here used to cost
|
||||
// the rider-log loop, which read the same pref and did not guard it.
|
||||
final int interval = resolveLogSeconds(prefs.getInt('logseconds'));
|
||||
return Duration(seconds: interval);
|
||||
} catch (_) {
|
||||
return const Duration(seconds: 30);
|
||||
return const Duration(seconds: kDefaultLogSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -932,7 +932,15 @@ class _PickupMapScreenState extends State<_PickupMapScreen>
|
||||
final top = media.padding.top + 72;
|
||||
await _camera.fit(
|
||||
<LatLng>[_routeStart, _routeEnd],
|
||||
padding: EdgeInsets.fromLTRB(48, top, 48, viewport * _sheetWorking + 24),
|
||||
// The sheet is lifted by the gesture bar, so the space it covers is
|
||||
// taller than the bare fraction — see [_sheetLift]. Framing against the
|
||||
// old figure would tuck the route's near end under the sheet.
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
48,
|
||||
top,
|
||||
48,
|
||||
viewport * (_sheetWorking + _sheetLift(media)) + 24,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1102,18 +1110,49 @@ class _PickupMapScreenState extends State<_PickupMapScreen>
|
||||
/// Three stops and no more: a glance, the working height, and the detail
|
||||
/// view. A drag with many arbitrary rest points feels loose and gives the
|
||||
/// rider nothing to aim at.
|
||||
/// The system's own bar at the foot of the screen, as a fraction of the
|
||||
/// viewport — so the three snap fractions below can be lifted clear of it.
|
||||
///
|
||||
/// The snaps are fractions and the bar is an absolute height, so the two only
|
||||
/// meet through the viewport. Clamped because a fraction derived from a
|
||||
/// measurement should never be able to swallow the sheet on a device that
|
||||
/// reports something strange.
|
||||
double _sheetLift(MediaQueryData media) {
|
||||
final double height = media.size.height;
|
||||
if (height <= 0) return 0;
|
||||
final double bar = math.max(
|
||||
media.viewInsets.bottom,
|
||||
media.viewPadding.bottom,
|
||||
);
|
||||
return (bar / height).clamp(0.0, 0.15);
|
||||
}
|
||||
|
||||
static const double _sheetGlance = 0.35;
|
||||
static const double _sheetWorking = 0.45;
|
||||
static const double _sheetDetail = 0.75;
|
||||
|
||||
Widget _buildDraggableBottomSheet() {
|
||||
// ── Every stop is lifted by the height of the gesture bar ──
|
||||
//
|
||||
// Padding the content alone would have kept the sheet the same height and
|
||||
// simply moved everything in it up, costing the rider a bar's worth of the
|
||||
// stop he is reading. Growing the sheet by the same amount puts the glass
|
||||
// *behind* the bar and leaves the visible content area exactly the size it
|
||||
// was — which is what "the sheet is touching the navigation" actually asks
|
||||
// for. The two work together: this makes room, the list's bottom padding
|
||||
// keeps the CTA out of it.
|
||||
final double lift = _sheetLift(MediaQuery.of(context));
|
||||
final double glance = (_sheetGlance + lift).clamp(0.0, 1.0);
|
||||
final double working = (_sheetWorking + lift).clamp(0.0, 1.0);
|
||||
final double detail = (_sheetDetail + lift).clamp(0.0, 1.0);
|
||||
|
||||
return DraggableScrollableSheet(
|
||||
initialChildSize: _sheetWorking,
|
||||
minChildSize: _sheetGlance,
|
||||
maxChildSize: _sheetDetail,
|
||||
initialChildSize: working,
|
||||
minChildSize: glance,
|
||||
maxChildSize: detail,
|
||||
// Snap to the three, so the sheet always settles somewhere meant.
|
||||
snap: true,
|
||||
snapSizes: const [_sheetGlance, _sheetWorking, _sheetDetail],
|
||||
snapSizes: [glance, working, detail],
|
||||
// ── Frosted, not opaque ──
|
||||
//
|
||||
// A solid white slab over a map takes away 45% of the one thing this
|
||||
@@ -1157,7 +1196,32 @@ class _PickupMapScreenState extends State<_PickupMapScreen>
|
||||
// has, and it is why that sheet reads at arm's length.
|
||||
child: ListView(
|
||||
controller: scrollController,
|
||||
padding: EdgeInsets.fromLTRB(20.w, 16.h, 20.w, 8.h),
|
||||
// ── The gesture bar sat on top of the CTA ──
|
||||
//
|
||||
// Eight points of bottom padding, on a sheet anchored to
|
||||
// the bottom of the screen: the last thing in this list is
|
||||
// [_buildPrimaryAction] — the slide control that closes the
|
||||
// stop — and on a gesture-navigation phone the system's own
|
||||
// bar was drawn across it. The rider's swipe either missed
|
||||
// the control or went to the OS.
|
||||
//
|
||||
// The glass still bleeds to the screen edge, which is what
|
||||
// it is for; what has to clear the bar is the *content*.
|
||||
// Same rule the sheet kit applies to every modal sheet —
|
||||
// `max(keyboard, gesture bar)`, never the sum, because the
|
||||
// keyboard replaces the bar rather than stacking with it.
|
||||
// This sheet is hand-built rather than presented through
|
||||
// [MilerSheetScaffold], so it never inherited that rule.
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
20.w,
|
||||
16.h,
|
||||
20.w,
|
||||
8.h +
|
||||
math.max(
|
||||
MediaQuery.viewInsetsOf(context).bottom,
|
||||
MediaQuery.viewPaddingOf(context).bottom,
|
||||
),
|
||||
),
|
||||
children: [
|
||||
_LiveEtaHeader(
|
||||
meters: _liveMetersToStop,
|
||||
@@ -1635,13 +1699,11 @@ class _PickupMapScreenState extends State<_PickupMapScreen>
|
||||
if (_isNavigating || !mounted) return;
|
||||
final outcome = await DeliveryProofPage.askOutcome(context);
|
||||
if (!mounted || outcome == null) return;
|
||||
await _closeDelivery(
|
||||
switch (outcome) {
|
||||
ProofOutcome.delivered => DeliveryOutcome.delivered,
|
||||
ProofOutcome.skipped => DeliveryOutcome.skipped,
|
||||
ProofOutcome.cancelled => DeliveryOutcome.cancelled,
|
||||
},
|
||||
);
|
||||
await _closeDelivery(switch (outcome) {
|
||||
ProofOutcome.delivered => DeliveryOutcome.delivered,
|
||||
ProofOutcome.skipped => DeliveryOutcome.skipped,
|
||||
ProofOutcome.cancelled => DeliveryOutcome.cancelled,
|
||||
});
|
||||
}
|
||||
|
||||
/// The end of the stop, whichever of the three it is.
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
class ApiConstants {
|
||||
static String mainDev = "dev";
|
||||
static String mainRoute = "live";
|
||||
|
||||
// ── There is no maps key any more ──
|
||||
//
|
||||
// A `googleMapsApiKey` used to live here, feeding `flutter_polyline_points`
|
||||
// and both native projects. It was revoked, so every tile request and every
|
||||
// Directions call came back `REQUEST_DENIED` and the app looked broken rather
|
||||
// than unconfigured.
|
||||
//
|
||||
// The maps no longer need one: tiles come from OpenStreetMap and routes from
|
||||
// OSRM, both keyless. See `lib/views/helpers/widgets/miler_map.dart` and
|
||||
// `lib/helpers/miler_router.dart` — including the note on what those free
|
||||
// services are and are not suitable for.
|
||||
|
||||
//Collection Queue - v2
|
||||
static String pickupQueueDev =
|
||||
"https://jupiter.doormile.app/$mainDev/api/v2/pickups/getpickupqueues";
|
||||
static String pickupQueueLive =
|
||||
"https://jupiter.doormile.app/$mainRoute/api/v2/pickups/getpickupqueues";
|
||||
|
||||
//Current Collection - v1
|
||||
static String currentPickupDev =
|
||||
"https://jupiter.doormile.app/$mainDev/api/v1/pickups/getpickups";
|
||||
static String currentPickupLive =
|
||||
"https://jupiter.doormile.app/$mainRoute/api/v1/pickups/getpickups";
|
||||
|
||||
//Current Collection V3 - v3 (date-bounded)
|
||||
static String currentPickupV3Dev =
|
||||
"https://jupiter.doormile.app/$mainDev/api/v3/pickups/getpickups";
|
||||
static String currentPickupV3Live =
|
||||
"https://jupiter.doormile.app/$mainRoute/api/v3/pickups/getpickups";
|
||||
|
||||
//Update Collection - v1
|
||||
static String updatePickupDev =
|
||||
"https://queue.workolik.com/live/api/v1/pickups/updatepickup";
|
||||
static String updatePickupLive =
|
||||
"https://queue.workolik.com/live/api/v1/pickups/updatepickup";
|
||||
|
||||
//Get Rider Log - v1
|
||||
static String getRiderLogDev =
|
||||
"https://jupiter.doormile.app/$mainDev/api/v1/partners/getriderlog";
|
||||
static String getRiderLogLive =
|
||||
"https://jupiter.doormile.app/$mainRoute/api/v1/partners/getriderlog";
|
||||
|
||||
//Create Rider Log - v2
|
||||
static String createRiderLogDev =
|
||||
"https://queue.workolik.com/live/api/v2/partners/createriderlog";
|
||||
static String createRiderLogLive =
|
||||
"https://queue.workolik.com/live/api/v2/partners/createriderlog";
|
||||
|
||||
//Update Rider Log - v1
|
||||
static String updateRiderLogDev =
|
||||
"https://jupiter.doormile.app/$mainDev/api/v1/partners/updateriderlog";
|
||||
static String updateRiderLogLive =
|
||||
"https://jupiter.doormile.app/$mainRoute/api/v1/partners/updateriderlog";
|
||||
|
||||
//Get Rider Count - v1
|
||||
static String getRiderCountDev =
|
||||
"https://jupiter.doormile.app/$mainDev/api/v1/partners/getridercount";
|
||||
static String getRiderCountLive =
|
||||
"https://jupiter.doormile.app/$mainRoute/api/v1/partners/getridercount";
|
||||
|
||||
//Create Break Rider Log - v2
|
||||
static String createBreakRiderLogDev =
|
||||
"https://queue.workolik.com/live/api/v2/partners/createbreaklog";
|
||||
static String createBreakRiderLogLive =
|
||||
"https://queue.workolik.com/live/api/v2/partners/createbreaklog";
|
||||
|
||||
//Update Break Rider Log - v2
|
||||
static String updateBreakRiderLogDev =
|
||||
"https://queue.workolik.com/live/api/v2/partners/updatebreaklog";
|
||||
static String updateBreakRiderLogLive =
|
||||
"https://queue.workolik.com/live/api/v2/partners/updatebreaklog";
|
||||
|
||||
//Create Collection Log - v2
|
||||
static String createPickupLogDev =
|
||||
"https://queue.workolik.com/live/api/v2/pickups/createpickuplog";
|
||||
static String createPickupLogLive =
|
||||
"https://queue.workolik.com/live/api/v2/pickups/createpickuplog";
|
||||
|
||||
//Summary API - v2
|
||||
static String summaryApiLive =
|
||||
'https://jupiter.doormile.app/$mainRoute/api/v2/partners';
|
||||
|
||||
//Summary Rider Weekly KMs - v1
|
||||
static String summaryriderkmLive =
|
||||
'https://jupiter.doormile.app/$mainRoute/api/v1/partners';
|
||||
}
|
||||
Reference in New Issue
Block a user