Skip to content

Instantly share code, notes, and snippets.

@aryzae
aryzae / flutter_study_3rd_4.dart
Last active June 23, 2020 10:25
Flutter勉強会3回目の資料(Mixin)
void main() {
Owl owl = Owl();
print(owl.canFly);
owl.fly();
print(owl.canRun);
owl.run();
Dog dog = Dog();
print(dog.canRun);
dog.run();
@aryzae
aryzae / flutter_study_3rd_3.dart
Last active June 23, 2020 09:25
Flutter勉強会3回目の資料(継承)
void main() {
Animal animal1 = Mike();
print(animal1.breed);
animal1.bark();
Animal animal2 = Shiba();
print(animal2.breed);
animal2.bark();
Animal animal3 = Stranger();
@aryzae
aryzae / flutter_study_3rd_2.dart
Last active June 23, 2020 09:20
Flutter勉強会3回目の資料(抽象化クラス)
void main() {
// error
Animal animal0 = Animal();
Animal animal1 = Mike();
print(animal1.breed);
animal1.bark();
Animal animal2 = Shiba();
print(animal2.breed);
@aryzae
aryzae / flutter_study_3rd_1.dart
Last active June 23, 2020 09:20
Flutter勉強会3回目の資料(クラス)
void main() {
// instance
Sample sample = Sample('Hello Dart World!');
sample.speakPublicMessage();
sample.setPrivateMessage('Goodbye Native World.');
sample.speakPrivateMessage();
}
@aryzae
aryzae / Request.swift
Created June 15, 2020 07:16
Associatedtype name change Response to DTO
import Foundation
import APIKit
struct HogeRequest: SampleRequest {
typealias DTO = ResponseDTO
}
protocol SampleRequest: Request {
associatedtype Response = DTO
associatedtype DTO
@aryzae
aryzae / .gitignore
Created May 24, 2020 05:26
.gitignore For Flutter
@@ -0,0 +1,72 @@
# Miscellaneous
*.class
*.lock
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
@aryzae
aryzae / Flutter疑問点.md
Last active May 14, 2020 02:12
Flutterの本やドキュメント読んでる途中で思った疑問

Flutter周りで気になったこと(あとで解消できるか方法探す)

  • 画像を指定する方法が文字列(最低限R.swiftみたいな予測でるようにならないか?)
  • 型が決まってるのにInstance生成のために型を書かなきゃいけないの面倒(省略か.から書き始めれないの?)
    • => 無理ぽい
  • 引数とるコンポーネントの作り方
    • =>
  • 動的変更があとから必要になった時のことを考えるとStatefulWidgetで全部作ったほうがいい気がするけど、StatelessWidget使うメリットって何?
    • 仮にあとでStatelessからStatefulに変える場合の手間はどのくらいだろう
  • Iconのcolor指定をsuggestで確定させた際に,が邪魔
@aryzae
aryzae / StoryboardDependencySample.swift
Created July 10, 2019 15:01
Storyboardを使ったDIもどき
final class ViewController: UIViewController {
// MARK: - Private Property
private var dependency: Int!
// MARK: - Initilizer
static func initiate(dependency: Int) -> ViewController {
let viewController = UIStoryboard.instantiateInitialViewController(from: self)
viewController.dependency = dependency
return viewController
}
@aryzae
aryzae / youtube_api.playground
Last active February 15, 2019 03:27
youtube api for playground (Swift 4)
import UIKit
let youtubeURLs: [String] = [
"https://www.youtube.com/get_video_info?video_id=e0okrDbEsXM",
"https://www.youtube.com/get_video_info?video_id=Dwh9hpBWtYQ",
"https://www.youtube.com/get_video_info?video_id=aNyNLEoPx4k"//,
// "https://www.youtube.com/get_video_info?video_id=mM5_T-F1Yn4",
// "https://www.youtube.com/get_video_info?video_id=XYra2ovcWxE"
]
@aryzae
aryzae / CircleLineGraphView.swift
Last active January 31, 2019 09:52
circle.swift
import UIKit
final class CircleLineGraphView: UIView {
private enum CircleType {
case background
case main(percentage: CGFloat)
}
private enum CircleAlignment {
case outside
case center