Skip to content

Instantly share code, notes, and snippets.

View CaiJingLong's full-sized avatar
💭
I may be slow to respond.

Caijinglong CaiJingLong

💭
I may be slow to respond.
View GitHub Profile
@CaiJingLong
CaiJingLong / main.dart
Last active December 18, 2018 01:32
a example for compress
import 'package:flutter/material.dart';
import 'package:photo/photo.dart';
import 'package:flutter_image_compress/flutter_image_compress.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
@CaiJingLong
CaiJingLong / app.dart
Last active December 28, 2021 13:09
不随系统字体大小发生变化
import 'package:flutter/material.dart';
import 'scale_text_widget.dart';
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
@CaiJingLong
CaiJingLong / getJpegDimensions.dart
Created April 7, 2019 06:48 — forked from kinex/getJpegDimensions.dart
Get JPEG image dimensions in Dart
// translated to Dart from a code snippet presented here:
// https://stackoverflow.com/questions/672916/how-to-get-image-height-and-width-using-java
Future<Size> getJpegDimensions(File jpegFile) async {
final f = await jpegFile.open();
Size dimension;
try {
// check for SOI marker
if (await f.readByte() != 255 || await f.readByte() != 216) {
throw new FormatException(
"SOI (Start Of Image) marker 0xff 0xd8 missing");
@CaiJingLong
CaiJingLong / animated_page.dart
Created April 28, 2019 08:46
flutter_AnimatedList_example
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
@CaiJingLong
CaiJingLong / automatic_example.dart
Created April 29, 2019 09:15
AutomaticKeepAliveClientMixin for tabbar example
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
@CaiJingLong
CaiJingLong / get_dart_lock.go
Created May 16, 2019 13:10
根据传入的lock文件获取dart工程的依赖(不包含sdk), 以pubspec.yaml的格式输出
package main
import (
"fmt"
"gopkg.in/yaml.v2"
"io/ioutil"
)
func main() {
params := make(map[string]interface{})
@CaiJingLong
CaiJingLong / main.dart
Created May 24, 2019 05:37
a example for flutter compress
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:flutter_image_compress/flutter_image_compress.dart';
import 'package:path_provider/path_provider.dart' as path_provider;
void main() {
runApp(MyApp());
}
@CaiJingLong
CaiJingLong / random_point_painter.dart
Last active May 28, 2019 08:57
flutter painter 随机点
import 'dart:math';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
@CaiJingLong
CaiJingLong / AndroidManifest.xml
Created June 13, 2019 09:36
flutter 指纹识别/脸识别
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
@CaiJingLong
CaiJingLong / UIHelper.dart
Last active February 29, 2024 14:09
Use Offstage widget to measure the widget size.
import 'dart:async';
import 'package:flutter/material.dart';
class MeasureWidget extends StatefulWidget {
final Widget child;
final ValueSetter<Rect> measureRect;
final BoxConstraints boxConstraints;
const MeasureWidget({