refactor: disable Mawasalati feature, wrap controller initialization in post-frame callbacks, and add documentation plan
This commit is contained in:
@@ -149,11 +149,11 @@ class MapMenuWidget extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 4),
|
||||
children: [
|
||||
MenuListItem(
|
||||
title: 'Mawasalati'.tr,
|
||||
icon: Icons.directions_bus_filled_rounded,
|
||||
onTap: () => Get.to(() => const TransitHomePage()),
|
||||
),
|
||||
// MenuListItem(
|
||||
// title: 'Mawasalati'.tr,
|
||||
// icon: Icons.directions_bus_filled_rounded,
|
||||
// onTap: () => Get.to(() => const TransitHomePage()),
|
||||
// ),
|
||||
MenuListItem(
|
||||
title: 'My Balance'.tr,
|
||||
icon: Icons.account_balance_wallet_outlined,
|
||||
|
||||
@@ -24,7 +24,9 @@ class _TransitLiveMapPageState extends State<TransitLiveMapPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Get.find<TransitController>().openLiveRoute(widget.routeId);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
Get.find<TransitController>().openLiveRoute(widget.routeId);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -78,52 +80,56 @@ class _TransitLiveMapPageState extends State<TransitLiveMapPage> {
|
||||
title: widget.routeName,
|
||||
isleading: true,
|
||||
body: [
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
IntaleqMap(
|
||||
apiKey: Env.mapSaasKey,
|
||||
initialCameraPosition: CameraPosition(target: initialTarget, zoom: 14),
|
||||
markers: markers,
|
||||
onMapCreated: (ctrl) => _mapController = ctrl,
|
||||
Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
IntaleqMap(
|
||||
apiKey: Env.mapSaasKey,
|
||||
initialCameraPosition: CameraPosition(target: initialTarget, zoom: 14),
|
||||
markers: markers,
|
||||
onMapCreated: (ctrl) => _mapController = ctrl,
|
||||
),
|
||||
if (c.isLoadingLiveTrip)
|
||||
const Positioned.fill(
|
||||
child: ColoredBox(
|
||||
color: Colors.black12,
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
),
|
||||
if (!c.isLoadingLiveTrip && c.liveError.isNotEmpty)
|
||||
Positioned(
|
||||
top: 16,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: _statusBanner(c.liveError, AppColor.redColor),
|
||||
),
|
||||
if (!c.isLoadingLiveTrip &&
|
||||
c.liveError.isEmpty &&
|
||||
c.liveBusPosition == null)
|
||||
Positioned(
|
||||
top: 16,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: _statusBanner(
|
||||
'No bus running on this route right now'.tr, AppColor.yellowColor),
|
||||
),
|
||||
if (c.liveTripData?['trip']?['delay_minutes'] != null &&
|
||||
(int.tryParse(c.liveTripData!['trip']['delay_minutes'].toString()) ?? 0) > 0)
|
||||
Positioned(
|
||||
bottom: 24,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: _statusBanner(
|
||||
'${'Bus is delayed'.tr} ${c.liveTripData!['trip']['delay_minutes']} ${'min'.tr}',
|
||||
AppColor.yellowColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (c.isLoadingLiveTrip)
|
||||
const Positioned.fill(
|
||||
child: ColoredBox(
|
||||
color: Colors.black12,
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
),
|
||||
if (!c.isLoadingLiveTrip && c.liveError.isNotEmpty)
|
||||
Positioned(
|
||||
top: 16,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: _statusBanner(c.liveError, AppColor.redColor),
|
||||
),
|
||||
if (!c.isLoadingLiveTrip &&
|
||||
c.liveError.isEmpty &&
|
||||
c.liveBusPosition == null)
|
||||
Positioned(
|
||||
top: 16,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: _statusBanner(
|
||||
'No bus running on this route right now'.tr, AppColor.yellowColor),
|
||||
),
|
||||
if (c.liveTripData?['trip']?['delay_minutes'] != null &&
|
||||
(int.tryParse(c.liveTripData!['trip']['delay_minutes'].toString()) ?? 0) > 0)
|
||||
Positioned(
|
||||
bottom: 24,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: _statusBanner(
|
||||
'${'Bus is delayed'.tr} ${c.liveTripData!['trip']['delay_minutes']} ${'min'.tr}',
|
||||
AppColor.yellowColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user