Skip to content

Instantly share code, notes, and snippets.

@jmolins
jmolins / date_picker.dart
Last active February 24, 2023 19:32
Add a date picker to a flutter app
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const MaterialApp(
@jmolins
jmolins / how_to_block_flutter_ui_with_await.dart
Created December 24, 2018 23:53
How to block Flutter ui with an inappropriate await
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new MyHomePage(),
);
////////////////////////////////////
////// api_key.dart
////////////////////////////////////
String key = "..............................";
////////////////////////////////////
////// config.dart
////////////////////////////////////
import 'package:devfest_asturias/api_key.dart';
@jmolins
jmolins / main_login_layout_fsj.dart
Created September 17, 2018 18:49
Login page for layout practice in Flutter Study Jam #1 Madrid
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(new MyApp());
debugPaintSizeEnabled = false;
}
class MyApp extends StatelessWidget {
@override
@jmolins
jmolins / baseline_box_with_example.dart
Created July 4, 2018 19:41
BaselineBox complete, widget and example
import 'package:flutter/widgets.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/material.dart';
void main() => runApp(new BaselineExampleApp());
class BaselineExampleApp extends StatelessWidget {
@override
@jmolins
jmolins / hot_reload_medium_post_2.dart
Last active June 27, 2018 10:15
Hot Reload Medium post snippet 2
class MyHome extends StatelessWidget {
MyHome({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Center(
child: RaisedButton(
child: Text('Click here'),
onPressed: () {
showDialog(
@jmolins
jmolins / hot_reload_medium_post_1.dart
Last active June 27, 2018 10:15
Hot reload medium post
import 'package:flutter/material.dart';
void main() => runApp(new MaterialApp(
home: Scaffold(
appBar: AppBar(title: new Text('Test')),
body: MyHome(),
),
));
class MyHome extends StatelessWidget {
@jmolins
jmolins / main.dart
Created May 14, 2018 21:07 — forked from slightfoot/main.dart
RotatedWidget example
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:meta/meta.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@jmolins
jmolins / error_capture.dart
Created May 14, 2018 19:55 — forked from slightfoot/error_capture.dart
Crash Reporting / Error Capture for Flutter
///
/// Flutter Captured Error Reporting
/// Created by Simon Lightfoot
///
/// Copyright (C) DevAngels Limited 2018
/// License: APACHE 2.0 - https://www.apache.org/licenses/LICENSE-2.0
///
import 'dart:async';
import 'dart:io';
import 'dart:ui' as ui show window;
@jmolins
jmolins / curves_simulation.dart
Last active April 4, 2018 17:39 — forked from nhancv/demo2.dart
Curves simulation
import 'dart:ui' as ui;
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/animation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;
class DemoPage extends StatefulWidget {
@override
_DemoPageState createState() => new _DemoPageState();