Skip to content

Instantly share code, notes, and snippets.

View graphicbeacon's full-sized avatar
🏠
Working from home

Jermaine Oppong graphicbeacon

🏠
Working from home
View GitHub Profile
@graphicbeacon
graphicbeacon / main.dart
Created March 21, 2020 19:30
Flutter AnimationController example
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 February 28, 2024 20:22
Flutter GestureDetector example - draggable square
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 March 19, 2020 20:11
"Learn Dart Before you Flutter" Youtube video solution
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 March 19, 2020 13:11
"Build Your Own Forms in Flutter" video tutorial
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 February 28, 2020 23:15
Flippable card effect in Flutter
// 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 September 17, 2021 01:46
Solution code on "Flutter for React developers" YouTube tutorial
// 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 December 31, 2019 15:49
"Dart2Native File Server Tutorial" solution code for tutorial on YouTube
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 April 3, 2023 09:29
"Dart File Upload Server Tutorial" solution for YouTube video tutorial
// 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 November 8, 2019 01:49
Code sample for 'Use Extension Methods in Dart' lesson on Egghead.io
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 September 20, 2022 12:48
Solution for "Understanding Reflection in Dart" video tutorial on YouTube
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));