Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 81 additions & 6 deletions app/lib/domain/models/unit/unit_status.dart
Original file line number Diff line number Diff line change
@@ -1,26 +1,101 @@
/// @docImport 'unit.dart';
library;

import 'package:flutter/material.dart';

/// Possible statuses for a [Unit] to show its current activity.
enum UnitStatus {
pd('PD', 'Pre-Duty'),
ab('AB', 'Available Base'),
ra('RA', 'Returning Available'),
dp('DP', 'Dispatched'),
ds('DS', 'Dispatched to Standby'),
av('AV', 'Available - Voice'),
af('AF', 'Available - Foot'),
am('AM', 'Available - MDT'),
ra('RA', 'Available - Returning'),
sb('SB', 'Available - Standby'),
ms('MS', 'Mobile - Standby'),
dp('DP', 'Dispatched'),
mo('MO', 'Mobile'),
ms('MS', 'Mobile to Standby'),
as('AS', 'At Scene'),
wp('WP', 'With Patient'),
ls('LS', 'Left Scene'),
ah('AH', 'At Hospital'),
ho('HO', 'Handover'),
vc('VC', 'Vehicle Clear'),
os('OS', 'Out of Service'),
pd('PD', 'Pre-Duty');
rt('RT', 'Request Transport'),
nt('NT', 'No Transport Required'),
rv('RV', 'At Scene - RV Point'),
wp('WP', 'With Patient'),
ak('AK', 'Acknowledgement'),
os('OS', 'Out of Service');

const UnitStatus(this.abbreviation, this.name);

final String abbreviation;

final String name;

/// Gets the colour to display in the [Unit]'s row of the unit screen.
Color get backgroundColour => switch (this) {
UnitStatus.pd => Colors.grey,

UnitStatus.ab => Colors.orange,

UnitStatus.ds ||
UnitStatus.av ||
UnitStatus.af ||
UnitStatus.am ||
UnitStatus.sb ||
UnitStatus.ms => Colors.lightGreenAccent,

UnitStatus.ra => Colors.green.shade900,

UnitStatus.dp ||
UnitStatus.as ||
UnitStatus.ls ||
UnitStatus.ah ||
UnitStatus.ho ||
UnitStatus.nt ||
UnitStatus.rv ||
UnitStatus.wp ||
UnitStatus.ak => Colors.red,

UnitStatus.mo => Colors.pinkAccent,

UnitStatus.vc => Colors.lightBlueAccent.shade200,

UnitStatus.rt => Colors.red.shade900,

UnitStatus.os => Colors.black,
};

/// White text = Are doing, Grey text = Awaiting, Black text = Have actioned.
Color get fontColour => switch (this) {
/// White: Are doing
UnitStatus.pd ||
UnitStatus.ds ||
UnitStatus.av ||
UnitStatus.af ||
UnitStatus.am ||
UnitStatus.ra ||
UnitStatus.ms ||
UnitStatus.mo ||
UnitStatus.rt ||
UnitStatus.os => Colors.white,

/// Grey: Awaiting
UnitStatus.ds || UnitStatus.dp => Colors.grey,

/// Black: Have actioned
UnitStatus.ab ||
UnitStatus.sb ||
UnitStatus.as ||
UnitStatus.ls ||
UnitStatus.ah ||
UnitStatus.ho ||
UnitStatus.vc ||
UnitStatus.nt ||
UnitStatus.rv ||
UnitStatus.wp ||
UnitStatus.ak => Colors.black,
};
}
32 changes: 32 additions & 0 deletions ios/Flutter/ephemeral/flutter_lldb_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Generated file, do not edit.
#

import lldb

def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict):
"""Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages."""
base = frame.register["x0"].GetValueAsAddress()
page_len = frame.register["x1"].GetValueAsUnsigned()

# Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the
# first page to see if handled it correctly. This makes diagnosing
# misconfiguration (e.g. missing breakpoint) easier.
data = bytearray(page_len)
data[0:8] = b'IHELPED!'

error = lldb.SBError()
frame.GetThread().GetProcess().WriteMemory(base, data, error)
if not error.Success():
print(f'Failed to write into {base}[+{page_len}]', error)
return

def __lldb_init_module(debugger: lldb.SBDebugger, _):
target = debugger.GetDummyTarget()
# Caveat: must use BreakpointCreateByRegEx here and not
# BreakpointCreateByName. For some reasons callback function does not
# get carried over from dummy target for the later.
bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$")
bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__))
bp.SetAutoContinue(True)
print("-- LLDB integration loaded --")
5 changes: 5 additions & 0 deletions ios/Flutter/ephemeral/flutter_lldbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# Generated file, do not edit.
#

command script import --relative-to-command-file flutter_lldb_helper.py
11 changes: 11 additions & 0 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// Generated file. Do not edit.
//

// clang-format off

#include "generated_plugin_registrant.h"


void fl_register_plugins(FlPluginRegistry* registry) {
}
15 changes: 15 additions & 0 deletions linux/flutter/generated_plugin_registrant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Generated file. Do not edit.
//

// clang-format off

#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_

#include <flutter_linux/flutter_linux.h>

// Registers Flutter plugins.
void fl_register_plugins(FlPluginRegistry* registry);

#endif // GENERATED_PLUGIN_REGISTRANT_
23 changes: 23 additions & 0 deletions linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Generated file, do not edit.
#

list(APPEND FLUTTER_PLUGIN_LIST
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
)

set(PLUGIN_BUNDLED_LIBRARIES)

foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)

foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
10 changes: 10 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// Generated file. Do not edit.
//

import FlutterMacOS
import Foundation


func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
}
11 changes: 11 additions & 0 deletions macos/Flutter/ephemeral/Flutter-Generated.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=C:\Users\weasd\Documents\flutter
FLUTTER_APPLICATION_PATH=C:\Users\weasd\dev\non-OH\dispatch
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=true
TREE_SHAKE_ICONS=false
PACKAGE_CONFIG=.dart_tool/package_config.json
12 changes: 12 additions & 0 deletions macos/Flutter/ephemeral/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=C:\Users\weasd\Documents\flutter"
export "FLUTTER_APPLICATION_PATH=C:\Users\weasd\dev\non-OH\dispatch"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.dart_tool/package_config.json"