diff --git a/assets/home2.svg b/assets/home2.svg new file mode 100644 index 0000000..d7f55ab --- /dev/null +++ b/assets/home2.svg @@ -0,0 +1,42 @@ + + + + + + image/svg+xml + + + + + + + + + + diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index fdc193a..996be30 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -2,6 +2,7 @@ + io.flutter.embedded_views_preview LSApplicationQueriesSchemes googlechromes diff --git a/lib/main.dart b/lib/main.dart index 3764e26..f406437 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -14,10 +14,8 @@ void main() async { await precacheRive(); } catch (e) { } - runApp(DevicePreview( - child: FSTApp( + runApp(FSTApp( themeModel: themeModel, - ), )); } diff --git a/lib/models/enums/department.dart b/lib/models/enums/department.dart index 15cfa3f..a853698 100644 --- a/lib/models/enums/department.dart +++ b/lib/models/enums/department.dart @@ -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 { diff --git a/lib/models/from_postgres/contact/contact_model.dart b/lib/models/from_postgres/contact/contact_model.dart index ce0f6ad..eefb22e 100644 --- a/lib/models/from_postgres/contact/contact_model.dart +++ b/lib/models/from_postgres/contact/contact_model.dart @@ -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; @@ -76,6 +77,7 @@ class Contact { } } +// TODO: document _PhoneNumber @richtwin567 class _PhoneNumber { int _id; int _contactID; diff --git a/lib/models/from_postgres/contact/contact_platform.dart b/lib/models/from_postgres/contact/contact_platform.dart index ebff694..95dfb3e 100644 --- a/lib/models/from_postgres/contact/contact_platform.dart +++ b/lib/models/from_postgres/contact/contact_platform.dart @@ -1,3 +1,4 @@ +// TODO: document ContactPlatform @richtwin567 enum ContactPlatform { textCall, whatsapp } extension PlatformShortString on ContactPlatform { diff --git a/lib/models/from_postgres/contact/contact_type.dart b/lib/models/from_postgres/contact/contact_type.dart index d758c4d..a035f5c 100644 --- a/lib/models/from_postgres/contact/contact_type.dart +++ b/lib/models/from_postgres/contact/contact_type.dart @@ -1,3 +1,4 @@ +// TODO: document ContactType @richtwin567 enum ContactType { emergency, office, facultyStaff, other } extension ContactTypeShortString on ContactType { diff --git a/lib/models/from_postgres/map/campus_map.dart b/lib/models/from_postgres/map/campus_map.dart index 10b51de..f4012c7 100644 --- a/lib/models/from_postgres/map/campus_map.dart +++ b/lib/models/from_postgres/map/campus_map.dart @@ -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/'; diff --git a/lib/models/from_postgres/map/geo_json_types/feature.dart b/lib/models/from_postgres/map/geo_json_types/feature.dart index 7c51d7c..d0a20b1 100644 --- a/lib/models/from_postgres/map/geo_json_types/feature.dart +++ b/lib/models/from_postgres/map/geo_json_types/feature.dart @@ -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( diff --git a/lib/models/from_postgres/map/geo_json_types/feature_collection.dart b/lib/models/from_postgres/map/geo_json_types/feature_collection.dart index 09c5fd9..595ac95 100644 --- a/lib/models/from_postgres/map/geo_json_types/feature_collection.dart +++ b/lib/models/from_postgres/map/geo_json_types/feature_collection.dart @@ -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 features; FeatureCollection({@required this.features}) diff --git a/lib/models/from_postgres/map/geo_json_types/geo_json_object.dart b/lib/models/from_postgres/map/geo_json_types/geo_json_object.dart index 2b3d0b6..146a9f3 100644 --- a/lib/models/from_postgres/map/geo_json_types/geo_json_object.dart +++ b/lib/models/from_postgres/map/geo_json_types/geo_json_object.dart @@ -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 bbox; diff --git a/lib/models/from_postgres/map/geo_json_types/geo_json_type.dart b/lib/models/from_postgres/map/geo_json_types/geo_json_type.dart index 917c6bf..c2d0b5a 100644 --- a/lib/models/from_postgres/map/geo_json_types/geo_json_type.dart +++ b/lib/models/from_postgres/map/geo_json_types/geo_json_type.dart @@ -1,3 +1,4 @@ +// TODO: document GeoJsonType @richtwin567 enum GeoJsonType { feature, featureCollection, diff --git a/lib/models/from_postgres/map/geometry_types/geomerty_collection.dart b/lib/models/from_postgres/map/geometry_types/geomerty_collection.dart index 73e98a5..aaf2389 100644 --- a/lib/models/from_postgres/map/geometry_types/geomerty_collection.dart +++ b/lib/models/from_postgres/map/geometry_types/geomerty_collection.dart @@ -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 geometries; GeoJsonGeometryCollection({@required geometries}) diff --git a/lib/models/from_postgres/map/geometry_types/geometry_object.dart b/lib/models/from_postgres/map/geometry_types/geometry_object.dart index becfa83..a5948d3 100644 --- a/lib/models/from_postgres/map/geometry_types/geometry_object.dart +++ b/lib/models/from_postgres/map/geometry_types/geometry_object.dart @@ -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; diff --git a/lib/models/from_postgres/map/geometry_types/geometry_type.dart b/lib/models/from_postgres/map/geometry_types/geometry_type.dart index c2ead1b..dd80b71 100644 --- a/lib/models/from_postgres/map/geometry_types/geometry_type.dart +++ b/lib/models/from_postgres/map/geometry_types/geometry_type.dart @@ -1,3 +1,4 @@ +// TODO: document @richtwin567 enum GeoJsonGeometryType { point, multiPoint, diff --git a/lib/models/from_postgres/map/geometry_types/line_string.dart b/lib/models/from_postgres/map/geometry_types/line_string.dart index 983edfc..bf6e48d 100644 --- a/lib/models/from_postgres/map/geometry_types/line_string.dart +++ b/lib/models/from_postgres/map/geometry_types/line_string.dart @@ -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 _coordinates; diff --git a/lib/models/from_postgres/map/geometry_types/linear_ring.dart b/lib/models/from_postgres/map/geometry_types/linear_ring.dart index c4ce93d..1ce15b3 100644 --- a/lib/models/from_postgres/map/geometry_types/linear_ring.dart +++ b/lib/models/from_postgres/map/geometry_types/linear_ring.dart @@ -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'] && diff --git a/lib/models/from_postgres/map/geometry_types/multi_line_string.dart b/lib/models/from_postgres/map/geometry_types/multi_line_string.dart index 267ad34..7123c31 100644 --- a/lib/models/from_postgres/map/geometry_types/multi_line_string.dart +++ b/lib/models/from_postgres/map/geometry_types/multi_line_string.dart @@ -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 coordinates; GeoJsonMultiLineString({@required coordsJson}) diff --git a/lib/models/from_postgres/map/geometry_types/multi_point.dart b/lib/models/from_postgres/map/geometry_types/multi_point.dart index be1d3a4..e77663c 100644 --- a/lib/models/from_postgres/map/geometry_types/multi_point.dart +++ b/lib/models/from_postgres/map/geometry_types/multi_point.dart @@ -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 _coordinates; diff --git a/lib/models/from_postgres/map/geometry_types/multi_polygon.dart b/lib/models/from_postgres/map/geometry_types/multi_polygon.dart index 4be349e..abd2f95 100644 --- a/lib/models/from_postgres/map/geometry_types/multi_polygon.dart +++ b/lib/models/from_postgres/map/geometry_types/multi_polygon.dart @@ -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 coordinates; GeoJsonMultiPolygon({@required coordsJson}) : super(GeoJsonGeometryType.multiPolygon) { diff --git a/lib/models/from_postgres/map/geometry_types/point.dart b/lib/models/from_postgres/map/geometry_types/point.dart index e3b40d5..bf430c0 100644 --- a/lib/models/from_postgres/map/geometry_types/point.dart +++ b/lib/models/from_postgres/map/geometry_types/point.dart @@ -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; diff --git a/lib/models/from_postgres/map/geometry_types/polygon.dart b/lib/models/from_postgres/map/geometry_types/polygon.dart index db46fc9..b96f0c4 100644 --- a/lib/models/from_postgres/map/geometry_types/polygon.dart +++ b/lib/models/from_postgres/map/geometry_types/polygon.dart @@ -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 _coordinates; diff --git a/lib/models/from_postgres/map/position.dart b/lib/models/from_postgres/map/position.dart index 2372345..839788c 100644 --- a/lib/models/from_postgres/map/position.dart +++ b/lib/models/from_postgres/map/position.dart @@ -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 diff --git a/lib/models/from_postgres/map/properties.dart b/lib/models/from_postgres/map/properties.dart index dee3d64..730a145 100644 --- a/lib/models/from_postgres/map/properties.dart +++ b/lib/models/from_postgres/map/properties.dart @@ -1,5 +1,6 @@ import 'package:fst_app_flutter/models/enums/department.dart'; +// TODO: document @richtwin567 class Properties { final String title; final Department associatedWith; diff --git a/lib/models/preferences/theme_model.dart b/lib/models/preferences/theme_model.dart index 5625872..603620f 100644 --- a/lib/models/preferences/theme_model.dart +++ b/lib/models/preferences/theme_model.dart @@ -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 diff --git a/lib/models/preferences/theme_preference.dart b/lib/models/preferences/theme_preference.dart index 694f973..d795e17 100644 --- a/lib/models/preferences/theme_preference.dart +++ b/lib/models/preferences/theme_preference.dart @@ -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(); diff --git a/lib/models/sharing/vcard.dart b/lib/models/sharing/vcard.dart index 823c597..03d42f4 100644 --- a/lib/models/sharing/vcard.dart +++ b/lib/models/sharing/vcard.dart @@ -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; diff --git a/lib/models/svg_model.dart b/lib/models/svg_model.dart new file mode 100644 index 0000000..843d0b6 --- /dev/null +++ b/lib/models/svg_model.dart @@ -0,0 +1,74 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; + +// TODO: document @richtwin567 + +class LinePoint extends Point { + 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 extends Point { + 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 extends Point { + 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 extends Point { + 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 extends Point { + 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 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); +} diff --git a/lib/routing/slide_up_route.dart b/lib/routing/slide_up_route.dart index 17fa976..7533e70 100644 --- a/lib/routing/slide_up_route.dart +++ b/lib/routing/slide_up_route.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; +// TODO: document @richtwin567 class SlideUpPageRoute extends PageRouteBuilder { final Widget page; diff --git a/lib/routing/stateful_popup_route.dart b/lib/routing/stateful_popup_route.dart index fc3fb91..f5e3cc7 100644 --- a/lib/routing/stateful_popup_route.dart +++ b/lib/routing/stateful_popup_route.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; +// TODO: document @richtwin567 class StatefulPopupRoute extends PopupRoute { Widget page; diff --git a/lib/screens/contact_screen/contact_detail_page.dart b/lib/screens/contact_screen/contact_detail_page.dart index 7dbcf83..ae592e5 100644 --- a/lib/screens/contact_screen/contact_detail_page.dart +++ b/lib/screens/contact_screen/contact_detail_page.dart @@ -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. @@ -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, diff --git a/lib/services/handle_heroku_requests.dart b/lib/services/handle_heroku_requests.dart index 1ca73b5..d56a4d6 100644 --- a/lib/services/handle_heroku_requests.dart +++ b/lib/services/handle_heroku_requests.dart @@ -1,7 +1,7 @@ import 'dart:convert'; import 'package:http/http.dart' as http; -/// The +// TODO: document @richtwin567 class HerokuRequest { /// The [query] should be the end of the url for sending a request to the server. /// diff --git a/lib/utils/app_theme.dart b/lib/utils/app_theme.dart index 75bc5b3..f5c7d6c 100644 --- a/lib/utils/app_theme.dart +++ b/lib/utils/app_theme.dart @@ -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), diff --git a/lib/utils/permissions.dart b/lib/utils/permissions.dart index 251743c..230d404 100644 --- a/lib/utils/permissions.dart +++ b/lib/utils/permissions.dart @@ -1,5 +1,6 @@ import 'package:permission_handler/permission_handler.dart'; +// TODO: document @richtwin567 Future requestPermission(Permission p) async { return await p.request().isGranted; } diff --git a/lib/utils/precache_rive.dart b/lib/utils/precache_rive.dart index 3cff277..626a582 100644 --- a/lib/utils/precache_rive.dart +++ b/lib/utils/precache_rive.dart @@ -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 precacheRive() async { diff --git a/lib/utils/social_media_contact_share.dart b/lib/utils/social_media_contact_share.dart index 955cbe3..088966c 100644 --- a/lib/utils/social_media_contact_share.dart +++ b/lib/utils/social_media_contact_share.dart @@ -6,6 +6,8 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:url_launcher/url_launcher.dart'; import 'dart:io'; +// TODO: document @richtwin567 + openWhatsAppChat({@required String phone, String message = ''}) async { String formatUrl() { if (Platform.isIOS) { diff --git a/lib/utils/string_to_enum.dart b/lib/utils/string_to_enum.dart index fda4284..4556930 100644 --- a/lib/utils/string_to_enum.dart +++ b/lib/utils/string_to_enum.dart @@ -2,6 +2,8 @@ import 'package:fst_app_flutter/models/enums/department.dart'; import 'package:fst_app_flutter/models/from_postgres/contact/contact_type.dart'; import 'package:fst_app_flutter/models/from_postgres/map/geometry_types/geometry_type.dart'; +// TODO: document @richtwin567 + Department stringToDepartment(str) { switch (str) { case 'BIOCHEM': diff --git a/lib/widgets/animated_icons/rive_animated_icon_button.dart b/lib/widgets/animated_icons/rive_animated_icon_button.dart index e4dd928..b36a405 100644 --- a/lib/widgets/animated_icons/rive_animated_icon_button.dart +++ b/lib/widgets/animated_icons/rive_animated_icon_button.dart @@ -1,6 +1,7 @@ import 'package:flare_flutter/flare_actor.dart'; import 'package:flutter/material.dart'; +// TODO: document @richtwin567 class RiveIconButton extends StatefulWidget { final String name; final String animationName; diff --git a/lib/widgets/contact_widgets/contact_detail_image.dart b/lib/widgets/contact_widgets/contact_detail_image.dart index 246f478..f0832af 100644 --- a/lib/widgets/contact_widgets/contact_detail_image.dart +++ b/lib/widgets/contact_widgets/contact_detail_image.dart @@ -1,31 +1,6 @@ import 'dart:math'; import 'package:flutter/material.dart'; - -/// Defines a point to which a straight line should drawn in a vertical direction only. -class VerticalPoint extends Point { - VerticalPoint(num y, [num x]) : super(x, y); -} - -/// Defines a point to which a straight line should be drawn in a horizontal direction only. -class HorizontalPoint extends Point { - 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. -class MovePoint extends Point { - MovePoint(T x, T y) : super(x, y); -} - -/// Defines a series of points which together create a curved line. -class CurvePoints extends Point { - 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); -} +import 'package:fst_app_flutter/models/svg_model.dart'; /// The [CustomPainter] implementation of the svg version of [Icons.person]. class ContactDetailSvg extends CustomPainter { @@ -71,31 +46,6 @@ class ContactDetailSvg extends CustomPainter { {@required this.color, this.scale = 1.0, @required this.start}) : super(); - /// 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 points, Point start) { - Path path = Path(); - points.forEach((p) { - if (p is MovePoint) { - p = 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 { - 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); - } - /// Uses [drawPathFromPoints] to paint the icon onto the [canvas]. @override void paint(Canvas canvas, Size size) { @@ -112,10 +62,10 @@ class ContactDetailSvg extends CustomPainter { ..color = color ..style = PaintingStyle.fill; - drawPathFromPoints(canvas, path1Paint, path1, start); + drawPathFromPoints(canvas, path1Paint, path1, start, scale, false); canvas.drawCircle(Offset(start.x, start.y), 4.0 * scale, path2Paint); Point start2 = Point(start.x, start.y + (6 * scale)); - drawPathFromPoints(canvas, path3Paint, path3, start2); + drawPathFromPoints(canvas, path3Paint, path3, start2, scale, false); } @override diff --git a/lib/widgets/contact_widgets/contact_tile.dart b/lib/widgets/contact_widgets/contact_tile.dart index 68b6227..a7d3cdd 100644 --- a/lib/widgets/contact_widgets/contact_tile.dart +++ b/lib/widgets/contact_widgets/contact_tile.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -/// A [ListTile] that +/// A [ListTile] on a [Card] that /// allows navigation to the [ContactDetailPage] for this [ContactTile] when tapped. class ContactTile extends StatelessWidget { /// The title of this ContactTile. diff --git a/lib/widgets/home_screen_art.dart b/lib/widgets/home_screen_art.dart new file mode 100644 index 0000000..f1166d2 --- /dev/null +++ b/lib/widgets/home_screen_art.dart @@ -0,0 +1,70 @@ +import 'dart:math'; +import 'package:flutter/material.dart'; +import 'package:fst_app_flutter/models/svg_model.dart'; + +class HomeArt extends CustomPainter { + List> wave1 = [ + MovePoint(15.601, 53.64), + CurvePoints(0.0, 0.0, 28.6, -71.5, 126.1, -49.4), + CurvePoints(97.5, 22.1, 210.6, 114.4, 248.3, 85.8), + CurvePoints(37.7, -28.6, 96.2, -14.3, 96.2, -14.3), + VerticalPoint(68.9, 0.0), + HorizontalPoint(-461.5, 0.0) + ]; + List> wave2 = [ + MovePoint(250.901000, 78.340000), + CurvePoints(61.1, -33.8, 202.8, -78.0, 227.5, -62.4), + CurvePoints(24.7, 15.6, 7.8, 174.2, 7.8, 174.2), + LinePoint(-235.3, -27.3), + ]; + List> wave3 = [ + MovePoint(7.801000, 122.540000), + CurvePoints(0.0, 0.0, 187.2, -123.5, 245.7, -84.5), + CurvePoints(58.5, 39.0, 131.431, 31.542, 131.431, 31.542), + LinePoint(101.27, -19.498), + VerticalPoint(136.5, 0.0), + HorizontalPoint(-478.401, 0.0) + ]; + + List> viewBox = [ + MovePoint(0.0, 0.0), + HorizontalPoint(491.842, 0.0), + VerticalPoint(-190.139, 0.0), + HorizontalPoint(-491.842, 0.0), + //VerticalPoint(190.139, -491.842), + ]; + + final Color colorOne; + final Color colorTwo; + final Color colorThree; + + HomeArt(this.colorOne, this.colorTwo, this.colorThree); + + @override + void paint(Canvas canvas, Size size) { + print(size.height); + print(size.width); + print(size); + Paint wavePaint1 = Paint() + ..color = colorOne + ..style = PaintingStyle.fill; + Paint wavePaint2 = Paint() + ..color = colorTwo + ..style = PaintingStyle.fill; + Paint wavePaint3 = Paint() + ..color = colorThree + ..style = PaintingStyle.fill; +/* + drawPathFromPoints(canvas, Paint()..color = Colors.black, viewBox, + MovePoint(0.0, 0.0), 0.5); */ + + drawPathFromPoints(canvas, wavePaint1, wave1, MovePoint(0.0, -68.9), 1.0,true); + drawPathFromPoints( + canvas, wavePaint2, wave2, MovePoint(250.901000, -78.340000), 1.0,true); + drawPathFromPoints( + canvas, wavePaint3, wave3, MovePoint(7.801000, -31.0), 1.0,true); + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) => false; +} diff --git a/lib/widgets/map_widgets/data_window.dart b/lib/widgets/map_widgets/data_window.dart index 363fb2e..4b7307d 100644 --- a/lib/widgets/map_widgets/data_window.dart +++ b/lib/widgets/map_widgets/data_window.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:fst_app_flutter/models/from_postgres/map/properties.dart'; import 'package:fst_app_flutter/widgets/shape_borders/arrowed_tooltip.dart'; + +// TODO: document @richtwin567 class DataWindow extends StatefulWidget { final Properties properties; final ArrowedTooltip shape; diff --git a/lib/widgets/preferences/theme_chooser_dialog.dart b/lib/widgets/preferences/theme_chooser_dialog.dart index 8f745b3..a604a81 100644 --- a/lib/widgets/preferences/theme_chooser_dialog.dart +++ b/lib/widgets/preferences/theme_chooser_dialog.dart @@ -3,6 +3,7 @@ import 'package:flutter/scheduler.dart'; import 'package:fst_app_flutter/models/preferences/theme_model.dart'; import 'package:fst_app_flutter/utils/app_theme.dart'; +// TODO: document @richtwin567 class ThemeChooserDialog extends StatefulWidget { const ThemeChooserDialog({Key key}) : super(key: key); diff --git a/lib/widgets/shape_borders/arrowed_tooltip.dart b/lib/widgets/shape_borders/arrowed_tooltip.dart index 2cef38e..2550a93 100644 --- a/lib/widgets/shape_borders/arrowed_tooltip.dart +++ b/lib/widgets/shape_borders/arrowed_tooltip.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; +// TODO: document @richtwin567 abstract class ArrowedTooltip extends ShapeBorder { final double arrowWidth; final double arrowLength;