Skip to content

Instantly share code, notes, and snippets.

View popeyelau's full-sized avatar
:octocat:
To the stars!

Popeye Lau popeyelau

:octocat:
To the stars!
View GitHub Profile
@bizz84
bizz84 / go_router_nested_navigation.dart
Created March 17, 2022 10:17
Example of GoRouter nested navigation using BottomNavigationBar
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
void main() => runApp(App());
class App extends StatelessWidget {
App({Key? key}) : super(key: key);
static const title = 'GoRouter Example: Nested Navigation';
@FelipeSantos75
FelipeSantos75 / glass.dart
Last active January 25, 2022 12:48
glass
import 'dart:ui';
import 'package:flutter/material.dart';
class GlassMorphism extends StatelessWidget {
final Widget child;
final double start;
final double end;
const GlassMorphism({
Key? key,
required this.child,
@PlugFox
PlugFox / main.dart
Last active December 10, 2020 02:05
Simple form managment
/// http://dartpad.dev/981a8d2145a9878dae2b52aebd9fae88
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() => runApp(App());
class App extends StatelessWidget {
@override
Widget build(BuildContext context) => const MaterialApp(
@gabrieloc
gabrieloc / Bash.swift
Last active December 29, 2023 00:26
Utilities for writing command line code in Swift
#!/usr/bin/env swift
import Foundation
struct TerminationStatus: Error {
let code: Int32
}
func run(_ command: Command) throws {
print(command.rendered.joined(separator: " "))
@rurickdev
rurickdev / creating_vars.dart
Last active September 14, 2020 12:23
Null Safety Codes and examples
void main (){
// In null-safe Dart, none of these can ever be null.
var i = 42; // Inferred to be int.
String name = getFileName(); // getFileName() should return string, never null.
final b = Foo(); // Inferred to be Foo.
// Nullable var declaration just needs an [?] after the type.
int? aNullableInt = null;
var x; // Inferred nullable
include: all_lint_rules.yaml
analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
# This is generated from the i18n vscode extension
- "**/i18n.dart"
strong-mode:
implicit-casts: false
implicit-dynamic: false
@seblegall
seblegall / reverseproxy.go
Last active November 10, 2024 08:08
A reverse proxy in Golang using Gin
package main
import (
"fmt"
"net/http"
"net/http/httputil"
"net/url"
"github.com/gin-gonic/gin"
)
@vital-edu
vital-edu / main.dart
Last active September 25, 2024 06:13
How to overlap SliverList on a SliverAppBar
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'How to overlap SliverList on a SliverAppBar',
debugShowCheckedModeBanner: false,
@tomalabaster
tomalabaster / init_in_main.dart
Created March 1, 2020 01:06
GOOD: Async init done in main method
void main() async {
WidgetsFlutterBinding.ensureInitialized();
var databasesPath = await getDatabasesPath();
var path = join(databasesPath, 'example.db');
var database = await openDatabase(path, version: 1, onCreate: (db, version) async {
await db.execute('''CREATE TABLE MyTable (
id INTEGER PRIMARY KEY,
name TEXT)''');
@ggichure
ggichure / main.dart
Created October 17, 2019 18:54
flutter theme changer and persist with shared prefrences
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
//https://stackoverflow.com/a/53107519/10409567
void main() async {
// load the shared preferences from disk before the app is started
WidgetsFlutterBinding.ensureInitialized();
final prefs = await SharedPreferences.getInstance();
// create new theme controller, which will get the currently selected from shared preferences