Skip to content

Commit

Permalink
documentation needed
Browse files Browse the repository at this point in the history
  • Loading branch information
richtwin567 committed Sep 7, 2020
1 parent 57c48b2 commit cbf822f
Show file tree
Hide file tree
Showing 44 changed files with 236 additions and 63 deletions.
42 changes: 42 additions & 0 deletions assets/home2.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http:https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>io.flutter.embedded_views_preview</key><true/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>googlechromes</string>
Expand Down
4 changes: 1 addition & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ void main() async {
await precacheRive();
} catch (e) {
}
runApp(DevicePreview(
child: FSTApp(
runApp(FSTApp(
themeModel: themeModel,
),
));
}

Expand Down
1 change: 1 addition & 0 deletions lib/models/enums/department.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:fst_app_flutter/global_const.dart';

// TODO: document Department @richtwin567
enum Department { biochem, chem, comp, geo, life, math, phys, other }

extension DepartmentExt on Department {
Expand Down
2 changes: 2 additions & 0 deletions lib/models/from_postgres/contact/contact_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:fst_app_flutter/utils/string_to_enum.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:fst_app_flutter/utils/permissions.dart';

// TODO: document Contact @richtwin567
class Contact {
int _id;
String _name;
Expand Down Expand Up @@ -76,6 +77,7 @@ class Contact {
}
}

// TODO: document _PhoneNumber @richtwin567
class _PhoneNumber {
int _id;
int _contactID;
Expand Down
1 change: 1 addition & 0 deletions lib/models/from_postgres/contact/contact_platform.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: document ContactPlatform @richtwin567
enum ContactPlatform { textCall, whatsapp }

extension PlatformShortString on ContactPlatform {
Expand Down
1 change: 1 addition & 0 deletions lib/models/from_postgres/contact/contact_type.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: document ContactType @richtwin567
enum ContactType { emergency, office, facultyStaff, other }

extension ContactTypeShortString on ContactType {
Expand Down
1 change: 1 addition & 0 deletions lib/models/from_postgres/map/campus_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:fst_app_flutter/models/from_postgres/map/geo_json_types/feature.
import 'package:fst_app_flutter/models/from_postgres/map/geo_json_types/feature_collection.dart';
import 'package:fst_app_flutter/services/handle_heroku_requests.dart';

// TODO: document @richtwin567
class CampusMap {
static const String _herokuFeatures = 'feature/';

Expand Down
5 changes: 2 additions & 3 deletions lib/models/from_postgres/map/geo_json_types/feature.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/polygon.
import 'package:fst_app_flutter/models/from_postgres/map/properties.dart';
import 'package:fst_app_flutter/utils/string_to_enum.dart';

// TODO: document Feature @richtwin567
class Feature extends GeoJsonObject {
GeoJsonGeometryObject geometry;
Properties properties;
int id;


int id;

Feature(dynamic feature) : super(GeoJsonType.feature) {
properties = Properties(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:fst_app_flutter/models/enums/department.dart';

// TODO: document FeatureCollection @richtwin567
class FeatureCollection extends GeoJsonObject {
List<Feature> features;
FeatureCollection({@required this.features})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:fst_app_flutter/models/from_postgres/map/geo_json_types/geo_json_type.dart';

// TODO: document GeoJsonObject @richtwin567
abstract class GeoJsonObject {
GeoJsonType type;
List<int> bbox;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: document GeoJsonType @richtwin567
enum GeoJsonType {
feature,
featureCollection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry_object.dart';
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry_type.dart';

// TODO: document GeoJsonGeometryCollection @richtwin567
class GeoJsonGeometryCollection extends GeoJsonGeometryObject {
List<GeoJsonGeometryObject> geometries;
GeoJsonGeometryCollection({@required geometries})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry_type.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

// TODO: document GeoJsonGeometryObject @richtwin567
abstract class GeoJsonGeometryObject {
final GeoJsonGeometryType type;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: document @richtwin567
enum GeoJsonGeometryType {
point,
multiPoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry_type.dart';
import 'package:fst_app_flutter/models/from_postgres/map/position.dart';

// TODO: document @richtwin567
class GeoJsonLineString extends GeoJsonGeometryObject {
List<GeoJsonPosition> _coordinates;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/line_string.dart';

// TODO: document @richtwin567
class GeoJsonLinearRing extends GeoJsonLineString {
GeoJsonLinearRing({@required coordsJson})
: assert(coordsJson.first['longitude'] == coordsJson.last['longitude'] &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry_type.dart';
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/line_string.dart';

// TODO: document @richtwin567
class GeoJsonMultiLineString extends GeoJsonGeometryObject {
List<GeoJsonLineString> coordinates;
GeoJsonMultiLineString({@required coordsJson})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry_type.dart';
import 'package:fst_app_flutter/models/from_postgres/map/position.dart';

// TODO: document @richtwin567
class GeoJsonMultiPoint extends GeoJsonGeometryObject {
List<GeoJsonPosition> _coordinates;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry_type.dart';
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/polygon.dart';

// TODO: document GeoJsonMultiPolygon @richtwin567
class GeoJsonMultiPolygon extends GeoJsonGeometryObject {
List<GeoJsonPolygon> coordinates;
GeoJsonMultiPolygon({@required coordsJson}) : super(GeoJsonGeometryType.multiPolygon) {
Expand Down
1 change: 1 addition & 0 deletions lib/models/from_postgres/map/geometry_types/point.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry_type.dart';
import 'package:fst_app_flutter/models/from_postgres/map/position.dart';

// TODO: document @richtwin567
class GeoJsonPoint extends GeoJsonGeometryObject {
GeoJsonPosition _coordinates;

Expand Down
1 change: 1 addition & 0 deletions lib/models/from_postgres/map/geometry_types/polygon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry_type.dart';
import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/linear_ring.dart';

// TODO: document GeoJsonPolygon @richtwin567
class GeoJsonPolygon extends GeoJsonGeometryObject {
List<GeoJsonLinearRing> _coordinates;

Expand Down
1 change: 1 addition & 0 deletions lib/models/from_postgres/map/position.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

// TODO: document @richtwin567
class GeoJsonPosition {
double _longitude; //MUST COME BEFORE LATITUDE

Expand Down
1 change: 1 addition & 0 deletions lib/models/from_postgres/map/properties.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:fst_app_flutter/models/enums/department.dart';

// TODO: document @richtwin567
class Properties {
final String title;
final Department associatedWith;
Expand Down
1 change: 1 addition & 0 deletions lib/models/preferences/theme_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:fst_app_flutter/models/preferences/theme_preference.dart';

// TODO: document ThemeModel @richtwin567
class ThemeModel with ChangeNotifier {
static ThemePreference _themePreference = ThemePreference();
//set to system theme by default
Expand Down
1 change: 1 addition & 0 deletions lib/models/preferences/theme_preference.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'dart:async';

// TODO: document ThemePreference @richtwin567
class ThemePreference {
var lightThemeStatus = ThemeMode.light.toString();
var systemThemeStatus = ThemeMode.system.toString();
Expand Down
1 change: 1 addition & 0 deletions lib/models/sharing/vcard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:fst_app_flutter/models/from_postgres/contact/contact_model.dart'
import 'package:fst_app_flutter/models/from_postgres/contact/contact_platform.dart';
import 'package:fst_app_flutter/models/from_postgres/contact/contact_type.dart';

// TODO: document @richtwin567
class VCard {
final String vcf;

Expand Down
74 changes: 74 additions & 0 deletions lib/models/svg_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import 'dart:math';

import 'package:flutter/material.dart';

// TODO: document @richtwin567

class LinePoint<T extends num> extends Point<T> {
LinePoint(T x, T y) : super(x, y);
}

/// Defines a point to which a straight line should drawn in a vertical direction only.
///
/// Denoted by V or v in svg followed by a number
class VerticalPoint<T extends num> extends Point<T> {
VerticalPoint(num y, num x) : super(x, y);
}

/// Defines a point to which a straight line should be drawn in a horizontal direction only.
///
/// Denoted by H or h in svg followed by a number
class HorizontalPoint<T extends num> extends Point<T> {
HorizontalPoint(num x, num y) : super(x, y);
}

/// Defines a point where a path starts and the painter should therefore move to the
/// starting point.
///
/// Denoted by M or m in svg followed by 2 numbers
class MovePoint<T extends num> extends Point<T> {
MovePoint(T x, T y) : super(x, y);
}

/// Defines a series of points which together create a curved line.
///
/// Denoted by C, c, S, s followed by 3 pairs of points
class CurvePoints<T extends num> extends Point<T> {
final num x2;
final num y2;
final num x3;
final num y3;
CurvePoints(num x1, num y1, this.x2, this.y2, this.x3, this.y3)
: super(x1, y1);
}

// TODO: document @richtwin567
/// Draws a path onto the [canvas] at the [start] based on the type of [points] supplied
/// and the [paint] that should be used.
drawPathFromPoints(Canvas canvas, Paint paint, List<Point> points, Point start,
double scale, bool applyScaleToStart) {
Path path = Path();
points.forEach((p) {
if (p is MovePoint) {
p = applyScaleToStart
? MovePoint(start.x * scale, start.y * scale)
: MovePoint(start.x, start.y);
path.moveTo(p.x, p.y);
} else if (p is VerticalPoint) {
p = VerticalPoint(p.y * scale, (p.x * scale));
path.relativeLineTo(p.x, p.y);
} else if (p is HorizontalPoint) {
p = HorizontalPoint((p.x * scale), (p.y * scale));
path.relativeLineTo(p.x, p.y);
} else if (p is LinePoint) {
p = LinePoint(p.x * scale, p.y * scale);
path.relativeLineTo(p.x, p.y);
} else {
CurvePoints cp = p as CurvePoints;
cp = CurvePoints((cp.x * scale), (cp.y * scale), (cp.x2 * scale),
(cp.y2 * scale), (cp.x3 * scale), (cp.y3 * scale));
path.relativeCubicTo(cp.x, cp.y, cp.x2, cp.y2, cp.x3, cp.y3);
}
});
canvas.drawPath(path, paint);
}
1 change: 1 addition & 0 deletions lib/routing/slide_up_route.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';

// TODO: document @richtwin567
class SlideUpPageRoute extends PageRouteBuilder {
final Widget page;

Expand Down
1 change: 1 addition & 0 deletions lib/routing/stateful_popup_route.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';

// TODO: document @richtwin567
class StatefulPopupRoute extends PopupRoute {
Widget page;

Expand Down
5 changes: 3 additions & 2 deletions lib/screens/contact_screen/contact_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:fst_app_flutter/utils/social_media_contact_share.dart';
import 'package:fst_app_flutter/widgets/contact_widgets/contact_card.dart';
import 'package:fst_app_flutter/widgets/contact_widgets/contact_detail_image.dart';

// TODO: document(update) @richtwin567
/// A page that shows all the details for the selected contact.
/// It allows the user to open websites, call the contact and send an email to
/// the contact directly from the app.
Expand Down Expand Up @@ -54,12 +55,12 @@ class ContactDetailPage extends StatelessWidget {
background: CustomPaint(
painter: ContactDetailSvg(
start: Point(
mq.size.width / 2, (mq.size.height / 2.5) / 2),
mq.size.width / 2.0, (mq.size.height / 2.5) / 2.0),
scale:
(mq.devicePixelRatio / mq.size.aspectRatio) * 1.5,
color: Theme.of(context).accentColor)),
title: Padding(
padding: EdgeInsets.only(right: mq.size.width / 4),
padding: EdgeInsets.only(right: mq.size.width / 4.0),
child: Text(
contactDetails.name,
maxLines: 1,
Expand Down
2 changes: 1 addition & 1 deletion lib/services/handle_heroku_requests.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:convert';
import 'package:http/http.dart' as http;

/// The
// TODO: document @richtwin567
class HerokuRequest<T> {
/// The [query] should be the end of the url for sending a request to the server.
///
Expand Down
1 change: 1 addition & 0 deletions lib/utils/app_theme.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:fst_app_flutter/models/preferences/theme_model.dart';

// TODO: document @richtwin567
class AppTheme {
static ColorScheme _lightColorScheme = ColorScheme(
primary: Color(0xFF003D8A),
Expand Down
1 change: 1 addition & 0 deletions lib/utils/permissions.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:permission_handler/permission_handler.dart';

// TODO: document @richtwin567
Future<bool> requestPermission(Permission p) async {
return await p.request().isGranted;
}
1 change: 1 addition & 0 deletions lib/utils/precache_rive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flare_flutter/flare_cache.dart';
import 'package:flare_flutter/provider/asset_flare.dart';
import 'package:flutter/services.dart';

// TODO: document @richtwin567
const _filesToWarmup = ['assets/rive/animated_icons/search_clear.flr'];

Future<void> precacheRive() async {
Expand Down

0 comments on commit cbf822f

Please sign in to comment.