Skip to content

Instantly share code, notes, and snippets.

View AlexV525's full-sized avatar
🌍
typedef Day = πŸ› || πŸ–₯

Alex Li AlexV525

🌍
typedef Day = πŸ› || πŸ–₯
  • China, Shanghai
  • 10:41 (UTC +08:00)
  • X @AlexV525
View GitHub Profile
@AlexV525
AlexV525 / build.gradle.kts
Last active August 6, 2025 01:25
Consist Flutter Android modules/libraries JVM targets (with KTS)
allprojects {
repositories {
google()
mavenCentral()
}
}
val newBuildDir: Directory =
rootProject.layout.buildDirectory
.dir("../../build")
@AlexV525
AlexV525 / sliver_clip_rect.dart
Last active October 11, 2025 15:43
SliverClipRRect
// Author: Alex Li (https://github.com/AlexV525)
// Date: 2025/04/20
//
// Complete by the Gemini 2.5 Flash within 5 talks.
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
/// A sliver that clips its child using a rounded rectangle.
@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 +85.3k/ -65.4k β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–β–‘β–‘ 87.6%
Markdown +1.1k/ -511 β–ˆβ–Žβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 6.4%
YAML +1.2k/ -1.1k β–Œβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 2.6%
Kotlin +654/ -208 ▏░░░░░░░░░░░░░░░░░░░░ 0.9%
XML +123/ -209 ▏░░░░░░░░░░░░░░░░░░░░ 0.8%
Objective… +416/ -132 ▏░░░░░░░░░░░░░░░░░░░░ 0.8%
Gradle +107/ -309 β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 0.4%
SVG +12/ -0 β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 0.1%
Java +60/ -20 β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 0.1%
Swift +46/ -28 β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 0.1%
@AlexV525
AlexV525 / init.gradle.kts
Last active April 7, 2025 14:03
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.