This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { FirebaseDatabase } from '@blaugold/angular-firebase' | |
| import 'rxjs/add/operator/map' | |
| /** | |
| * This example demonstrates the type checking ability when the database is used with a schema. | |
| * Open this file with an ide like VS Code or WebStorm and you should see error highlighting. | |
| */ | |
| interface DBSchema { | |
| todoLists: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:ui'; | |
| /// Returns control points which can be used to create a bezier path which is smooth at the joins between [knots]. | |
| /// | |
| /// The result contains one less set of control points than there are [knots]. To construct a path start by moving to | |
| /// the first knot and add cubic bezier segments for the other knots. | |
| /// | |
| /// Ported from https://www.codeproject.com/Articles/31859/Draw-a-Smooth-Curve-through-a-Set-of-2D-Offsets-wit | |
| List<List<Offset>> bezierSplineControlOffsets(List<Offset> knots) { | |
| assert(knots != null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:ui'; | |
| class QuadraticBezier { | |
| final Offset p0; | |
| final Offset p1; | |
| final Offset p2; | |
| /// Returns a list of [QuadraticBezier]s which represent smooth line joins between knots. | |
| /// | |
| /// To reduce the smoothing at the joins reduce [maxJoinSegmentLength]. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
| void main() { | |
| runApp(MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| @override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void withBuilder() { | |
| return Builder( | |
| builder: (context) { | |
| return RaisedButton( | |
| child: Text('Button'), | |
| onPressed: () { | |
| final renderObject = context.findRenderObject(); | |
| } | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| /// Overlays [overlay] over [anchor], when pushed. | |
| /// | |
| /// This route extends [PopupRoute], but if your implementing your own route | |
| /// I suggest skimming the docs of [TransitionRoute], [ModalRoute] and | |
| /// [PageRoute]. [PopupRoute] is just the most natural base class for a route | |
| /// like this one. | |
| class OverlayRoute<T> extends PopupRoute<T> with WidgetsBindingObserver { | |
| OverlayRoute({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/foundation.dart'; | |
| void withAssert() { | |
| assert(() { | |
| runConditionalCode(); | |
| return true; | |
| }); | |
| } | |
| void withEnvironmentFlag() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
| void main() { | |
| runApp(MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| @override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Future<MutableDocument> createNote({ | |
| required String title, | |
| required String body, | |
| }) async { | |
| // In Couchbase Lite, data is stored in JSON like documents. The default | |
| // constructor of MutableDocument creates a new document with a randomly | |
| // generated id. | |
| final doc = MutableDocument({ | |
| // Since documents of different types are all stored in the same database, | |
| // it is customary to store the type of the document in the `type` field. |
OlderNewer