Skip to content

Instantly share code, notes, and snippets.

View yumi0629's full-sized avatar
🌸
Focusing

吉原拉面 yumi0629

🌸
Focusing
  • Shanghai
View GitHub Profile
@yumi0629
yumi0629 / part_navigator_page.dart
Created May 15, 2019 07:57
Flutter 布局替换路由
import 'package:flutter/material.dart';
class PartNavigatorPage extends StatefulWidget {
final Map<String, WidgetBuilder> routes;
final Widget home;
const PartNavigatorPage({Key key, this.routes, this.home}) : super(key: key);
@override
State<StatefulWidget> createState() => PartNavigatorState();
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Amaze UI 在线调试</title>
<link rel="stylesheet" href="http://cdn.amazeui.org/amazeui/2.5.0/css/amazeui.min.css"/>
</head>
@yumi0629
yumi0629 / main.dart
Created April 2, 2019 02:22
Flutter_webview_js
Please add below in ‘pubspec.yaml’:
webview_flutter: ^0.3.5+2
oktoast: ^2.0.0
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:oktoast/oktoast.dart';
fun BaseQuickAdapter<*, BaseViewHolder>.shotRecyclerView(
recyclerView: RecyclerView, bgColor: Int? = null): Bitmap {
val size = itemCount
var height = 0
val maxMemory: Int = ((Runtime.getRuntime().maxMemory() / 1024).toInt())
// Use 1/8th of the available memory for this memory cache.
val cacheSize = maxMemory / 8
val bitmapCache: LruCache<String, Bitmap> = LruCache(cacheSize)
for (i in 0 until size) {
var itemView: View?
/**
* 拼接bitmap
* @param bgColor 画布颜色,默认为null,透明色
*/
fun combineBitmaps(vararg bitmaps: Bitmap, bgColor: Int? = null, direction: CombineDirection = CombineDirection.Vertical, maxLength: Int? = null): Bitmap {
var height = 0
var width = 0
// 计算组合后宽高
loop@ for (bitmap in bitmaps) {
when (direction) {
@yumi0629
yumi0629 / fileToBase64.dart
Created January 4, 2019 03:16
fileToBase64
import 'dart:convert';
import 'dart:io';
String fileToBase64(File file){
var imageByte = file.readAsBytesSync();
return base64Encode(imageByte);
}
ShaderMask(
blendMode: BlendMode.srcIn,
shaderCallback: (Rect bounds) {
return ui.Gradient.linear(
Offset(4.0, 24.0),
Offset(24.0, 4.0),
[
Colors.blue[200],
Colors.amber,
],
final Shader linearGradient = LinearGradient(
colors: <Color>[Colors.pink, Colors.green],
).createShader(Rect.fromLTWH(0.0, 0.0, 200.0, 70.0));
Text('Hello Gradients!',
style: new TextStyle(
fontSize: 60.0,
fontWeight: FontWeight.bold,
foreground: Paint()..shader = linearGradient),
)