Skip to content

Instantly share code, notes, and snippets.

🐶
( ´・‿・`)

Masayuki Ono mono0926

🐶
( ´・‿・`)
Block or report user

Report or block mono0926

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mono0926
mono0926 / main.dart
Last active Jun 19, 2019
一気にpopしたときのdisposeの順番が不定なので後ろの方に積まれた画面でdispose済みのListenableにアクセスしてしまってエラーになることがある問題
View main.dart
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() => runApp(App());
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
View main_gesture.dart
import 'dart:math' show pow;
import 'package:flutter/material.dart';
void main() => runApp(const App());
class App extends StatelessWidget {
const App();
@override
Widget build(BuildContext context) {
View app_size.md
. iOS Android
ネイティブ ? ?
Flutter 10.8MB 4.06MB
View PopupPresentationController.swift
import Foundation
public protocol PopupTargetViewController {
func popupPresenting()
func popupDismissing()
}
public protocol PresentationApprearanceDelegate: class {
func presentationAppearanceTransitionWillBegin()
func presentationAppearanceTransitionDidEnd()
func presentationAppearanceDismissalWillBegin()
View tear_off.dart
import 'package:meta/meta.dart';
void main() {
foo(1); // 'b' is required という警告出る
// tear-off
bar(foo); // 'b' is required という警告出ない
bar((x) => foo(x)); // 'b' is required という警告出る
}
View test.md
  • a
  • b
  • ( ´・‿・`)
@mono0926
mono0926 / overflow_detectable_text.dart
Last active May 16, 2019
通常通り文字を表示しつつ、表示しきれたかどうかの結果を通知してくれるText Widget
View overflow_detectable_text.dart
import 'package:flutter/scheduler.dart';
import 'package:flutter/widgets.dart';
typedef OverflowDetector = void Function(bool overflowed);
class OverflowDetectableText extends StatelessWidget {
const OverflowDetectableText(
this.data, {
Key key,
@required this.style,
@mono0926
mono0926 / better_cached_network_image_provider.dart
Last active May 16, 2019
画像ロード状態監視可能な CachedNetworkImageProvider
View better_cached_network_image_provider.dart
import 'dart:async' show Future;
import 'dart:io' show File;
import 'dart:typed_data';
import 'dart:ui' as ui show instantiateImageCodec, Codec;
import 'package:common/util/util.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
View bottom_popup_route.dart
import 'dart:math' show min;
import 'package:flutter/material.dart';
class BottomPopupRoute<T> extends PopupRoute<T> {
BottomPopupRoute({
@required this.builder,
RouteSettings settings,
this.barrierLabel = 'Dismiss',
this.barrierColor = const Color(0x80000000),
@mono0926
mono0926 / better_animated_opacity.dart
Last active May 15, 2019
AnimatedOpacityの、opacityがゼロになったらVisibilityのvisibleがfalseになる版(透明Widgetの無駄がほぼゼロになる) BetterFadeTransition(https://gist.github.com/mono0926/e6f4b2238e02fdf5beb761b911b38a1c )を内部で利用。
View better_animated_opacity.dart
import 'package:common/widgets/widgets.dart';
import 'package:flutter/widgets.dart';
class BetterAnimatedOpacity extends ImplicitlyAnimatedWidget {
const BetterAnimatedOpacity({
Key key,
this.child,
@required this.opacity,
Curve curve = Curves.linear,
@required Duration duration,
You can’t perform that action at this time.