Skip to content

Instantly share code, notes, and snippets.

Avatar

Jermaine Oppong graphicbeacon

View GitHub Profile
@graphicbeacon
graphicbeacon / main.dart
Created Mar 21, 2020
Flutter AnimationController example
View main.dart
import 'package:flutter/animation.dart';
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Padding(
padding: const EdgeInsets.only(top: 20, left: 20, right: 20),
child: PageAnimation()
)
@graphicbeacon
graphicbeacon / main.dart
Last active Mar 22, 2020
Flutter GestureDetector example - draggable square
View main.dart
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Padding(
// padding: const EdgeInsets.only(top: 20, left: 20, right: 20),
padding: const EdgeInsets.all(0),
child: Page()
)
@graphicbeacon
graphicbeacon / main.dart
Created Mar 19, 2020
"Learn Dart Before you Flutter" Youtube video solution
View main.dart
class Order {
var _id;
var _reference;
var date;
var code;
List<String> bookings;
Order(this._id, this._reference, {this.date});
Order.withDiscount(this._id, this._reference, [this.code]) {
date = DateTime.now();
@graphicbeacon
graphicbeacon / main.dart
Last active Mar 19, 2020
"Build Your Own Forms in Flutter" video tutorial
View main.dart
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Padding(
padding: const EdgeInsets.all(20),
child: PageForm()
)
)
@graphicbeacon
graphicbeacon / flippable_card.dart
Created Feb 28, 2020
Flippable card effect in Flutter
View flippable_card.dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@graphicbeacon
graphicbeacon / main.dart
Last active Sep 17, 2021
Solution code on "Flutter for React developers" YouTube tutorial
View main.dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math' as math;
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@graphicbeacon
graphicbeacon / main.dart
Created Dec 31, 2019
"Dart2Native File Server Tutorial" solution code for tutorial on YouTube
View main.dart
import 'dart:io';
import 'package:args/args.dart';
import 'package:http_server/http_server.dart';
main(List<String> arguments) async {
ArgParser parser = ArgParser()
..addOption('dir', defaultsTo: 'web')
..addOption('port', defaultsTo: '8085');
var parsedResults = parser.parse(arguments);
@graphicbeacon
graphicbeacon / main.dart
Last active Dec 31, 2019
"Dart File Upload Server Tutorial" solution for YouTube video tutorial
View main.dart
// bin/main.dart
import 'dart:io';
import 'package:mime/mime.dart';
main() async {
var server = await HttpServer.bind('localhost', 8085);
server.listen((request) async {
@graphicbeacon
graphicbeacon / main.dart
Created Nov 8, 2019
Code sample for 'Use Extension Methods in Dart' lesson on Egghead.io
View main.dart
import 'dart:async';
getDuration(int seconds) {
return Duration(seconds: seconds);
}
extension MyInt on int {
Duration get seconds => Duration(seconds: this);
DateTime monthsAgo() => DateTime.now().subtract(Duration(hours: 24 * 30 * this));
}
@graphicbeacon
graphicbeacon / main.dart
Last active Jul 8, 2019
Solution for "Understanding Reflection in Dart" video tutorial on YouTube
View main.dart
import 'dart:io';
import 'dart:mirrors';
main() async {
var server = await HttpServer.bind('localhost', 8085);
await for (HttpRequest req in server) {
// Create InstanceMirror type from which
// we retrieve metadata information
var ref = reflect(Endpoint(req));