Skip to content

Instantly share code, notes, and snippets.

View boyuanx's full-sized avatar

Jack Xu boyuanx

  • Sign
  • Irvine, CA
  • 21:58 (UTC -07:00)
  • X @headcpx
View GitHub Profile
@boyuanx
boyuanx / convert-arraybuffer.js
Created August 1, 2020 23:38 — forked from nuclearglow/convert-arraybuffer.js
ArrayBuffer <-> JSON <-> ArrayBuffer
// array buffer to JSON
const dataString JSON.stringify(Array.from(new Uint8Array(arrayBuffer)));
// send around
// JSON to ArrayBuffer
new Uint8Array(JSON.parse(dataString)).buffer
@boyuanx
boyuanx / home_container.dart
Created April 20, 2020 05:45 — forked from CaiJingLong/home_container.dart
flutter 懒加载 切换保持状态
class HomeContainer extends StatefulWidget {
final List<Widget> children;
final int currentIndex;
const HomeContainer({
Key key,
this.children,
this.currentIndex,
}) : super(key: key);
import 'package:flutter/material.dart';
class FadeIndexedStack extends StatefulWidget {
final int index;
final List<Widget> children;
final Duration duration;
const FadeIndexedStack({
Key key,
this.index,