Hey everyone. I'm Remixie and this is my entry for the Flutter Create contest. It's a technical drawing app that's optimized for touchscreen devices.
main.dart
file with the one provided in the zip filepubspec.yaml
with the one provided in the zip fileassets
directory in the same directory as lib
Blueprint-Paper-by-RetinaShots.png
to the assets
directorypackages get
while in the pubspec.yaml
tab and verify that nothing is underlined with red in main.dart
upon saving itflutter run --release -d <device id>
on the Flutter project directory but not before replacing <device id>
make a point
, tap somewhere on the blueprint paper areamake a line segment
, tap somewhere else on the same arearemove your last point
, click the undo buttonreuse a point
, tap on itreset the area
, click the trashcan buttonmove the straightedge
, drag either or both of its black dotsTap on the straightedge
to make points and/or line segments at more precise coordinatesNote: If you tap on the straightedge at around the same coordinates where an existing point is located, your tap will be registered as a reuse, not as a new point aligned with the straightedge.
In terms of UI/UX, tons of details were taken into account. These are some of them:
faster editing
Contrast is maximized
through the use of black and white on the paper areareduce visual clutter
quickly see line segments
hidden hitbox area
that detects when a user taps within 35 pixels of itcorners are smooth and notch-less
exact positioning
of the straightedge, points and line segmentsThe main()
function runs MyApp
.
MyApp
is a StatelessWidget that builds a MaterialApp whose home property is set to DrawPage
.
DrawPage
is a StatefulWidget that builds ScopedModel<MathModel>
and returns a Scaffold
.
The Scaffold
returns a Stack widget whose children are a Container and another Stack. The Container has a Listener that detects when a user taps on it and calls MathModel.moveSEdge()
and Painter
. Its background is set to the public domain grid image asset provided by Retina Shots. The child Stack returns two instances of DragDot
.
DragDot
This is a Stateful widget that creates a DragDotState
.
int i
BuildContext bc
DrawPage
DragDotState
This builds a Container that has a GestureDetector child.
This GestureDetector calls MathModel.moveSEdge()
so this dot moves properly as an end-user drags it around.
var m
MathModel
instance from DrawPage
MathModel
This handles the model logic.
Fields:
List<Offset> p
static get hds
hds
)hds
)hds
)List<Offset> sEdge
List<double> screen
Methods:
void moveSEdge(int i, Offset o)
i
is the black dot indexo
is the new black dot offsetOffset getSEdgePoint(Offset o)
o
is the user defined pointo
that's on the straightegevoid addPoint(Offset o)
o
is the user defined pointo
is a reuse of an existing point, a point that should snap to the straightedge or just a freehanded point. The determined offset is then sent to p
Painter
This is a CustomPainter class that handles the rendering of blueprint paper objects.
List<Offset> u
List<Offset> sEdge
void paint()
u
, line segments, the straightedge and its black dotsBlueprint Touch has a long way to go before it becomes the standard for technical drawings on touchscreen devices. This is the current list of future developments, ordered by priority:
ETA for these developments: Q3 2019
boeledi. (2018, March 21). Flutter: how to prevent device orientation changes and force portrait? Retrieved March 21, 2019, from https://stackoverflow.com/questions/44179889/flutter-sdk-set-background-image
Bourne, M. (n.d.). Perpendicular Distance from a Point to a Line. Retrieved March 21, 2019, from https://www.intmath.com/plane-analytic-geometry/perpendicular-distance-point-line.php
Choudhary, H. (2018, September 05). Installation of Flutter and setup on MAC. Retrieved March 22, 2019, from https://www.youtube.com/watch?v=Xy-qHlaHr6c
Kumar, A. (2017, May 25). Flutter SDK Set Background image. Retrieved March 20, 2019, from https://stackoverflow.com/questions/44179889/flutter-sdk-set-background-image
Rumann. (2019, January 22). Drawing Custom Shapes in Flutter using a Custom Painter. Retrieved from https://zocada.com/drawing-custom-shapes-in-flutter-using-custompainter/
SnakeyHips. (2018, December 15). SnakeyHips/drawapp. Retrieved March 10, 2019, from https://github.com/SnakeyHips/drawapp
Stacky. (2014, November 2). How to calculate corner positions/marks of a rotated/tilted rectangle? Retrieved March 11, 2019, from https://gamedev.stackexchange.com/questions/86755/how-to-calculate-corner-positions-marks-of-a-rotated-tilted-rectangle
StrokeCap property. (n.d.). Retrieved March 20, 2019, from https://docs.flutter.io/flutter/dart-ui/Paint/strokeCap.html
Write your first Flutter app, part 1. (n.d.). Retrieved March 1, 2019, from https://flutter.dev/docs/get-started/codelab
Write Your First Flutter App, part 2. (n.d.). Retrieved March 3, 2019, from https://codelabs.developers.google.com/codelabs/first-flutter-app-pt2/
Xia, M., Sullivan, M., & Williams, J. (n.d.). Build Native Mobile Apps with Flutter. Retrieved March 6, 2019, from https://www.udacity.com/course/build-native-mobile-apps-with-flutter--ud905