Skip to content

Instantly share code, notes, and snippets.

View obumnwabude's full-sized avatar
🎯
Focusing

Obum obumnwabude

🎯
Focusing
View GitHub Profile
@obumnwabude
obumnwabude / main.dart
Created November 28, 2023 14:03
CustomPaint equivalent of the five point star svg at Wikipedia https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
import 'package:intl/intl.dart';
extension DateTimeX on DateTime {
bool get isToday {
return now.day == day && now.month == month && now.year == year;
}
bool get isYesterday {
return now.day - 1 == day && now.month == month && now.year == year;
}
@obumnwabude
obumnwabude / main.dart
Created October 2, 2023 12:26
Minimum Reproducible of Unfocusable Keyboard when there is GoRouter and ScreenUtil in a Flutter Project.
import 'dart:convert';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:go_router/go_router.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
@obumnwabude
obumnwabude / password_form.dart
Last active August 5, 2023 17:17
Improve Flutter Forms
class PasswordForm extends StatefulWidget {
const PasswordForm({super.key});
@override
State<PasswordForm> createState() => _PasswordFormState();
}
class _PasswordFormState extends State<PasswordForm> {
bool _isPasswordObscure = true;
final _passwordController = TextEditingController();
@obumnwabude
obumnwabude / responsive.dart
Created July 21, 2023 17:09
Code Snippets for HTML/CSS and Flutter that were used during the "Flutter For Web Developers" session in Google I/O Extended Onitsha 2023. Find the Event Slide at https://docs.google.com/presentation/d/10yZRHJjEbtIq83oY5HrO7wC3xTSckz2CY1AK_tPgObY/edit?usp=sharing
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
@obumnwabude
obumnwabude / index.js
Created January 6, 2023 23:02
Firebase Cloud Functions Code for CORS proxy.
const admin = require('firebase-admin');
const cors = require('cors')({ origin: true });
const fetch = require('node-fetch');
const functions = require('firebase-functions');
exports.cors = functions.https.onRequest((req, res) => {
// Reject requests that don't have a URL.
if (!req.query.url) return res.json({ error: 'No URL provided!' });
// Extract necessary information from the request.
@obumnwabude
obumnwabude / main.dart
Last active July 26, 2022 18:02
Example usage of FlutterToast package
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@obumnwabude
obumnwabude / firebase.json
Created June 30, 2022 01:06
Firebase Hosting setup for URL shortener and Firebase Cloud Functions code for URL shortener backend engine.
{
"functions": {
"source": "functions"
},
"hosting": {
"public": "public",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
@obumnwabude
obumnwabude / main.dart
Created June 2, 2022 01:46
Example of using Stack in Flutter
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
@obumnwabude
obumnwabude / app.component.html
Created March 26, 2022 13:09
Angular Form for managing questions and their answers
<mat-toolbar class="mat-elevation-z1" id="navbar">
<span>Questions</span>
</mat-toolbar>
<form [formGroup]="questionForm" (ngSubmit)="onSubmit()">
<mat-form-field>
<mat-label>Question</mat-label>
<textarea matInput required formControlName="value"></textarea>
<mat-error> Question is <strong>required</strong> </mat-error>
</mat-form-field>