Skip to content

Instantly share code, notes, and snippets.

View jogboms's full-sized avatar
πŸ’™
Building Awesome w/ Dart & Flutter

Jeremiah Ogbomo jogboms

πŸ’™
Building Awesome w/ Dart & Flutter
View GitHub Profile
@sma
sma / hyper.dart
Created February 28, 2021 08:58
a proof of concept micro web framework inspired by an older version of Jorge Bucaran's hyperapp
import 'dart:async';
import 'dart:html';
/// [H] is what you'd call a virtual DOM node, representing HTML elements.
///
/// You call it with a tag name that optionally contains one or more class
/// names prefixed by `.` and/or an ID prefixed by `#`. If you pass a `Map`,
/// it is used as properties. If you pass other objects, they are used as
/// children. `List` objects are flattened, `null` values are ignored, other
/// [H] instances are taken literally, everything else is converted into
@sma
sma / json.dart
Created December 14, 2020 18:11
a typesafe wrapper for accessing json
class Json extends Iterable<Json> {
Json(this.value);
Json.from(String s) : this(jsonDecode(s));
final dynamic value;
@override
String toString() => jsonEncode(value);
@timsneath
timsneath / PolarCoordinate.dart
Last active May 27, 2023 18:08
Demonstrates a polar coordinate system with Flutter
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/gestures.dart';
const double kTwoPi = 2 * math.pi;
class SectorConstraints extends Constraints {
const SectorConstraints({
@sma
sma / gap.dart
Created May 3, 2020 08:56
A widget to add gaps to Row and Column widgets
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@dwchiang
dwchiang / Makefile
Created May 1, 2020 14:42
Flutter: intl_translation: extract_to_arb & generate_from_arb
.PHONY: help l10n-extract-to-arb l10n-generate-from-arb
help:
@ echo 'Available commands:'
@ echo
@ echo ' l10n-extract-to-arb : Extract app_localizations.dart into intl_messages.arb'
@ echo ' Duplicate content of intl_messages.arb into intl_xx.arb'
@ echo ' l10n-generate-from-arb : Generate messages_*.dart files from intl_*.arb'
@ echo
@ echo
@antfu
antfu / πŸ“Š Weekly development breakdown
Last active November 5, 2025 05:23
πŸ“Š Weekly development breakdown
TypeScript 21 hrs 47 mins β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–’β–‘β–‘β–‘ 67.1%
Vue.js 6 hrs 21 mins β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 19.6%
JSON 2 hrs 10 mins β–ˆβ–ˆβ–ˆβ–ˆβ–’β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 6.7%
JavaScript 46 mins β–ˆβ–ˆβ–ˆβ–’β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 2.4%
import 'package:flutter/material.dart';
class FadeIndexedStack extends StatefulWidget {
final int index;
final List<Widget> children;
final Duration duration;
const FadeIndexedStack({
Key key,
this.index,
@lukepighetti
lukepighetti / extents_page_view.dart
Last active January 19, 2025 11:24
Flutter PageView that loads the next/previous page off-screen
import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart' hide PageView;
/// This is copy-pasted from the Flutter framework with a support added for building
/// pages off screen using [Viewport.cacheExtents] and a [LayoutBuilder]
///
/// Based on commit 3932ffb1cd5dfa0c3891c60977ee4f9cd70ade66 on channel dev
// Having this global (mutable) page controller is a bit of a hack. We need it
@slightfoot
slightfoot / split_bar.dart
Last active March 8, 2022 14:06
Split Bar in Flutter. Lets you touch between two horizontal sections to resize the split point.
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main() {
runApp(
MaterialApp(
theme: ThemeData(
primaryColor: Colors.indigo,
accentColor: Colors.pinkAccent,
),
@slightfoot
slightfoot / MainActivity.java
Created August 7, 2019 13:25
Transparent Navigation in Flutter on Android.
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;