Skip to main content

現場で使える Flutter開発入門の6章と7章を読んで不明点を調べた

現場で使える Flutter開発入門の6章の不明点を調べた
の続編

調べたことを備忘録で記載する。


・Flutter
・UnderlineInputBorder
下線を引ける
>両方のUnderlineInputBorderの引数「borderSide」にBoderSideを指定します。
https://www.choge-blog.com/programming/fluttertextformfield0underlineboder-color/

・Expanded
>ExpandedというWidgetは、RowやColumnの子Widget間の隙間を目一杯埋めたいときに使います。
https://qiita.com/nannany_hey/items/d4114f615e4d53964121

 

・Flutterのネイティブ連携
・FlutterBinaryMessenger
メッセージのやり取りに使う。
>A facility for communicating with the Flutter side using asynchronous message passing with binary messages.
https://api.flutter.dev/objcdoc/Protocols/FlutterBinaryMessenger.html

・Platform Views
画面を転送して使えるようにしてるらしい
https://qiita.com/kurun_pan/items/7c9c8fba3346ab4c7c5f
AndroidはVirtualDisplay
iOSはCALayer
https://qiita.com/kikuchy/items/397b7664ad32656748bf

・StandardMessageCodec
ネイティブとFlutter間のメッセージのやりとり。
>データの受け渡しですが、MessageCodecに準拠したエンコーダによってバイトデータに変換されます。MethodChannelとEventChannelは標準でStandardMessageCodecというエンコーダを利用しています。
https://logmi.jp/tech/articles/324430

・Platform Viewsへのパラメータの渡し方
>AndroidViewの引数viewTypeは、FirstWidgetPluginのregisterViewFactory()の第一引数で指定した命名と一致させます。これでAndroidViewとKotlin側で実装したViewとが関連付きます。Flutter側からパラメータを渡したい場合は、creationParamsという引数を追加して値を渡します。DartからKotlinにデータを受け渡すことになるので、型の対応に注意する必要があります。
https://medium.com/@iktakahiro/flutter-platformview-with-kotlin-1f52a4dd1505

・PlatformViewLink
Androidでネイティブの機能をさらに使えるようにする。
>PlatformViewLink()がFlutterに統合されたAndroidネイティブのビューを作成してくれているっぽいです。
https://xmlpro.github.io/posts/2020-10-24-1516/

・PlatformViewHitTestBehavior
>Opaque targets can be hit by hit tests, causing them to both receive events within their bounds and prevent targets visually behind them from also receiving events.
https://api.flutter.dev/flutter/rendering/PlatformViewHitTestBehavior.html

・OneSequenceGestureRecognizer
>Base class for gesture recognizers that can only recognize one gesture at a time. For example, a single TapGestureRecognizer can never recognize two taps happening simultaneously, even if multiple pointers are placed on the same widget.
https://api.flutter.dev/flutter/gestures/OneSequenceGestureRecognizer-class.html

 

・iOS
・podspec
いつもPodfileいじってたけどこれもCocoaPodsのやつらしい。
Plugin作成時にはiosパッケージの中にある。
>どのGitリポジトリのどのファイルをインストールすればいいかを記載したテキストファイル
https://qiita.com/yusuga/items/d7c764c23e9ad9d6d5de

・Xcodeでコード補完を効くようにする
exampleのiosパッケージに遷移して
pod install
を実行する。
その後、AndroidStudioの右上からXcodeを開くのリンクを押す。
事前にpod installしないと3rd partyやFlutter系の補完が効かないので注意
Pods/Development Pods/hello/../../example/ios/.symlinks/plugins/hello/ios/Classes/Swift[プラグイン名]Plugin.swift
https://qiita.com/Aosanori620/items/8c764f26d76608b5a5bd

・key-valueを持った変数の初期化

var dic  = [String: Int]()

https://qiita.com/hiroo0529/items/f4b01159cfa4c9fa396c

 

・Android
・AndroidManifest.xml
権限を追加するにはandroidパッケージの中のxmlファイルをいじれば良い。

 

関連記事:

Pocket