Skip to content

Instantly share code, notes, and snippets.

View AlexV525's full-sized avatar
🌍
typedef Day = 🛏 || 🖥

Alex Li AlexV525

🌍
typedef Day = 🛏 || 🖥
View GitHub Profile
@AlexV525
AlexV525 / main.dart
Created March 5, 2024 02:57
Followed custom menu
// [Author] Alex (https://github.com/AlexV525)
// [Date] 2024/03/15 10:57
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
@AlexV525
AlexV525 / Podfile
Created January 9, 2024 11:51
Make your projects compatible with Xcode 14 & 15 at the same time
platform :ios, '12.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
Dart +2.9k/ -1.5k █████████▊░░░░░░░░░░░ 47.0%
Markdown +686/ -454 █████▎░░░░░░░░░░░░░░░ 25.4%
YAML +408/ -294 █▍░░░░░░░░░░░░░░░░░░░ 6.7%
JSON5 +662/ -8 █▍░░░░░░░░░░░░░░░░░░░ 6.6%
Python +146/ -99 ▊░░░░░░░░░░░░░░░░░░░░ 4.0%
SVG +16/ -0 ▌░░░░░░░░░░░░░░░░░░░░ 2.6%
Shell +218/ -0 ▍░░░░░░░░░░░░░░░░░░░░ 2.3%
Batchfile +256/ -0 ▍░░░░░░░░░░░░░░░░░░░░ 2.0%
TypeScript +122/ -0 ▎░░░░░░░░░░░░░░░░░░░░ 1.8%
JSON +204/ -2 ▏░░░░░░░░░░░░░░░░░░░░ 0.9%
@AlexV525
AlexV525 / init.gradle.kts
Last active February 21, 2024 18:42
Mirroring Gradle repositories
// Thanks to: https://gist.github.com/bennyhuo/af7c43cc4831661193605e124f539942
val urlMappings = mapOf(
"https://dl.google.com/dl/android/maven2" to "https://mirrors.tencent.com/nexus/repository/maven-public/",
"https://repo.maven.apache.org/maven2" to "https://mirrors.tencent.com/nexus/repository/maven-public/",
"https://plugins.gradle.org/m2" to "https://mirrors.tencent.com/nexus/repository/gradle-plugins/"
)
fun RepositoryHandler.mirroring() {
all {
@AlexV525
AlexV525 / formatter.dart
Created March 24, 2023 07:00
A regular expression input formatter that allows old value instead of clearing them
/// [Author] Alex (https://github.com/AlexV525)
/// [Date] 2022/03/14 11:59
import 'packages:flutter/services.dart';
/// A formatter that takes a [RegExp] to match the value.
///
/// Currently the formatter only support match the first group.
class RegExpFormatter extends TextInputFormatter {
RegExpFormatter(this.regExp);
/** https://github.com/dart-lang/pub-dev/issues/4416 **/
body {
background-color: #10161e;
color: #dcdcdc;
font-size: 14px;
line-height: 1.6;
margin: 0;
padding: 0;
overflow-wrap: break-word;
}
@AlexV525
AlexV525 / tri_state.dart
Last active August 17, 2022 07:54
`TriState` indicates the loading process of specific data
//
// [Author] Alex (https://github.com/AlexV525)
// [Date] 2022/08/17 13:45
//
import 'package:flutter/material.dart';
/// A tri-state indicates the loading process of specific data.
enum TriState {
/// The data is still loading, not available.
@AlexV525
AlexV525 / http_overrides.dart
Created June 8, 2022 14:32
Bypass Let's encrypt root certificates (typically on Android 7.x)
//
// [Author] Alex (https://github.com/AlexV525)
// [Date] 2022/6/8 20:46
//
import 'dart:convert';
import 'dart:io';
class CustomHttpOverrides extends HttpOverrides {
@override
//
// [Author] Alex (https://github.com/AlexV525)
// [Date] 2020/9/15 14:06
//
import 'dart:async';
import 'package:flutter/widgets.dart';
extension SafeSetStateExtension on State {
@AlexV525
AlexV525 / drawer.dart
Last active June 7, 2022 09:29
Drawer in a transparent page route
//
// [Author] Alex (https://github.com/AlexV525)
// [Date] 2022/6/7 16:35
//
import 'package:flutter/material.dart';
/// A wrapped [Drawer] that typically useful when placed in a transparent route.
class CustomDrawer extends StatefulWidget {
const CustomDrawer({