Skip to content

Instantly share code, notes, and snippets.

Avatar
🤥
Retired

吉原拉面 yumi0629

🤥
Retired
View GitHub Profile
@yumi0629
yumi0629 / part_navigator_page.dart
Created May 15, 2019
Flutter 布局替换路由
View part_navigator_page.dart
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();
View gist:ac8505c469f6eaa8e600b85927f326fb
<!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 Apr 2, 2019
Flutter_webview_js
View main.dart
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';
View RecyclerViewScreenShot.kt
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?
View CombineBitmaps.kt
/**
* 拼接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) {
View fileToBase64.dart
import 'dart:convert';
import 'dart:io';
String fileToBase64(File file){
var imageByte = file.readAsBytesSync();
return base64Encode(imageByte);
}
View icon_gradient.dart
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,
],
View gradient_text.dart
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),
)