This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MultiTapsToPanGestureRecognizer extends TapAndPanGestureRecognizer { | |
var minTapsToDrag = 1; | |
var timeoutToTaps = const Duration(milliseconds: 200); | |
@protected | |
var canDrag = false; | |
@protected | |
var firedDrag = false; | |
@protected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/foundation.dart'; | |
// V0.85, S0.1 -> 0.9 | |
// V0.84, S0.1 -> 0.8 | |
// V0.48, S1.0 -> 0 | |
// V4.80, S5.0 -> 5 | |
// V6.10, S3.0 -> 6 | |
double snapValue(double value, double min, double max, double step) { | |
final wideValue = () { | |
if (step == 0) return value; // no restricted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VariableTokenStore<Token> { | |
/// validate token is valid | |
/// - true = ok | |
/// - false = not ok | |
/// - neverthrow | |
final Future<bool> Function(Token token) checkToken; | |
/// fetch a new token | |
/// - null = require authenticate | |
/// - not null = ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef Middleware<C> = dynamic Function(C context, Function() next); | |
class Interceptor<C> { | |
static _noop() {} | |
final List<Middleware<C>> middlewares = List.empty(growable: true); | |
Future<void> call<T>(C context, [Function() fn = _noop]) async { | |
if (middlewares.isEmpty) return fn(); | |
return middlewares.reduce((pre, cur) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// if true, will pop the last | |
typedef LRUPolicyTest<K, V> = bool Function(LRULinkedMap lru, _Node<K, V> item); | |
class _Node<K, V> { | |
late K key; | |
late V value; | |
_Node<K, V>? prev; | |
_Node<K, V>? next; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Translation { | |
// "zh-a-b-c" -> m"-c" | |
static final _localeSuffixRE = RegExp(r"-[^-]+$"); | |
final bool localeCaseSensitive; | |
var _currentLocale = "en"; | |
var _fallbackLocale = "en"; | |
Map<String, Map<String, String>> dict = Map(); | |
Translation({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/widgets.dart'; | |
class TouchOpacity extends StatefulWidget { | |
final Widget child; | |
final void Function()? onTap; | |
const TouchOpacity({ | |
super.key, | |
this.child = const SizedBox(), | |
this.onTap, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port: 7890 | |
socks-port: 7891 | |
allow-lan: true | |
mode: Global | |
log-level: info | |
external-controller: 127.0.0.1:9090 | |
# https://developer.android.com/studio/run/emulator-networking?hl=zh-cn#networkaddresses | |
proxies: | |
- {name: "AVD Host", desc: "(10.0.2.2)", server: 10.0.2.2, port: 7890, type: socks5 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getDependencyTree, Reaction } from "mobx" | |
import React, { useRef, useState, useLayoutEffect } from "react" | |
import { isUsingStaticRendering } from "./staticRendering" | |
import { printDebugValue } from "./utils/printDebugValue" | |
function observerComponentNameFor(baseComponentName: string) { | |
return `observer${baseComponentName}` | |
} |
NewerOlder