Skip to content

Instantly share code, notes, and snippets.

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

Alex Li AlexV525

🌍
typedef Day = 🛏 || 🖥
  • China, Shanghai
  • 16:52 (UTC +08:00)
  • X @AlexV525
View GitHub Profile
@AlexV525
AlexV525 / log_packaegs_in_notices.dart
Created July 4, 2024 04:55
Show packages in Flutter App asset NOTICES
import 'dart:io';
final separator = '-' * 80;
void main() {
final file = File('NOTICES').readAsStringSync();
final sections =
file.split('\n$separator\n').map((e) => e.split('\n').first).toSet();
print(sections.join('\n'));
}
@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 +4.9k/ -6.4k ██████████████████▏░░ 86.8%
Markdown +290/ -68 █░░░░░░░░░░░░░░░░░░░░ 5.3%
SVG +102/ -0 ▊░░░░░░░░░░░░░░░░░░░░ 3.7%
YAML +134/ -278 ▍░░░░░░░░░░░░░░░░░░░░ 2.0%
XML +146/ -4 ▎░░░░░░░░░░░░░░░░░░░░ 1.3%
Objective… +40/ -30 ░░░░░░░░░░░░░░░░░░░░░ 0.4%
Java +62/ -0 ░░░░░░░░░░░░░░░░░░░░░ 0.3%
Swift +0/ -16 ░░░░░░░░░░░░░░░░░░░░░ 0.1%
Shell +16/ -0 ░░░░░░░░░░░░░░░░░░░░░ 0.1%
C +0/ -8 ░░░░░░░░░░░░░░░░░░░░░ 0.0%
@AlexV525
AlexV525 / init.gradle.kts
Last active August 19, 2024 07:22
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 {