hamburger-tech-nits

主にプログラミングのNITSな話

プログラミング

FlutterのTabのラベルの色はLabelStyleで設定できない

api.flutter.dev This does not influence color of the tab labels even if TextStyle.color is non-null. Refer labelColor to color selected tab labels instead. LabelStyleにcolorを設定しても無視される。代わりにLabelColorに色を設定する。 何か理…

FlutterのBottomNavigationItemのデザインをThemeで設定するときは気をつけよう

FlutterのBottomNavigationBarに設定するBottomNavigationItemの色を変更したい。その時にウィジェットのselectedLabelStyleやunselectedLabelStyleを変更すれば値が反映されるが、Themeの設定を変えてもデフォルトのままになり設定は反映されない。というバ…

Flutterアプリでfirebase_ui_authを使ってメールログインを追加する

事前準備 firebase.google.com Firebaseプロジェクトを作成し、アプリリポジトリを接続する。特にこだわりがなければ、firebase_analyticsを導入して動作確認するのがオススメ。 FirebaseAuthの準備 Firebaseのコンソールを開き、Authを有効にする。Authはロ…

uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:firebase_analytics]

Flutterでfirebase_analyticsを導入したところ、Androidでビルドエラーになった。 ***/android/app/src/debug/AndroidManifest.xml Error: uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:firebase_analytics] ***/bui…

Unhandled Exception: Binding has not yet been initialized.

FlutterアプリにFirebaseを導入した。pub get後に関数(analyticsのメソッド)を呼び出したらエラーが発生した。 E/flutter ( 6837): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Binding has not yet been initialized. E/flut…

Freezedで生成したClassにインスタンスメソッドを追加する

FlutterでFreezedを利用した際に、生成したClassに独自メソッドを追加する方法を調査しました。 pub.dev @freezed class Person with _$Person { const factory Person(String name, {int? age}) = _Person; void method() { print('hello world'); } } この…

Warning: CocoaPods not installed. Skipping pod install.

FlutterのiOSビルドをしたところエラーになった。 Warning: CocoaPods not installed. Skipping pod install. CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without…

Manifest merger failed : android:exported needs to be explicitly specified for element <activity#~

社内ライブラリのtargetSdkVersionを30から33に上げたらビルドエラーになった * What went wrong: Execution failed for task ':app:processDebugMainManifest'. > Manifest merger failed : android:exported needs to be explicitly specified for element <activity#${Activity}></activity#${activity}>…

〇〇-playgroundのリポジトリに書き捨てコードを登録する

課題感 ちょっとしたコードの置き場所がちゃんと定まっていなくて毎回悩んでいた。例えば、 webエディタ(Kotlin Playgroundやdartpadなど) gistに登録 専用リポジトリを作る とか。ただgithubを使わないと後から発掘できなくなったり、新規リポジトリ作るの…