Skip to content

Instantly share code, notes, and snippets.

View lopo12123's full-sized avatar
☹️
sorry for my pessimistic view

lopo lopo12123

☹️
sorry for my pessimistic view
  • Wonderland
View GitHub Profile
@lopo12123
lopo12123 / main.dart
Created July 29, 2024 15:17
BadFL Example Code (impl/event_center)
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
void handler1(dynamic eventData) {
@lopo12123
lopo12123 / main.dart
Created July 15, 2024 14:32
BadFL Example Code (helper/throttle)
import 'dart:async';
class BadThrottler {
/// default action to be called when the throttler is called without a action
final FutureOr<void> Function()? defaultAction;
bool _running = false;
BadThrottler({this.defaultAction});
@lopo12123
lopo12123 / main.dart
Created July 15, 2024 14:29
BadFL Example Code (helper/debounce)
import 'dart:async';
class BadDebouncer {
final Duration delay;
/// default action to be called when the debouncer is called without a action
final void Function()? defaultAction;
Timer? _timer;
@lopo12123
lopo12123 / main.dart
Last active July 24, 2024 06:41
BadFL Example Code (extension/num)
extension NumExt on num {
String readableFixed([int fractionDigits = 1]) {
final absVal = abs();
String raw = '';
String unit = '';
switch (absVal) {
case < 1e3:
raw = toStringAsFixed(fractionDigits);
@lopo12123
lopo12123 / main.dart
Last active July 29, 2024 15:18
BadFL Example Code (extension/iterable)
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@lopo12123
lopo12123 / main.dart
Last active June 10, 2024 14:33
BadFL Example Code (BadCheckBox)
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(
@lopo12123
lopo12123 / build.gradle
Created February 22, 2023 14:10
maven 阿里云镜像
buildscript {
ext.kotlin_version = '1.5.20'
repositories {
// google()
// mavenCentral()
maven{ url 'https://maven.aliyun.com/repository/central' }
maven{ url 'https://maven.aliyun.com/repository/public' }
maven{ url 'https://maven.aliyun.com/repository/google' }
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin' }
}
@lopo12123
lopo12123 / pregojs.js
Created March 22, 2022 02:42
Remove the watermark that comes with gojs
// npm install 之后先使用
// serve-with-gojs/build-with-gojs
// 对 node_module 中相关的文件进行处理
// 去除开源版本的 gojs 自带的水印
const fs = require('fs')
const path = require('path')
const file_js = path.join(__dirname, './node_modules/gojs/release/go.js')
const file_mjs = path.join(__dirname, './node_modules/gojs/release/go.mjs')
const file_module = path.join(__dirname, './node_modules/gojs/release/go-module.js')