2023/3/15/Flutter/translation of flutter_lints

 

 

nitpick : 粗探しする、重箱の隅をつつく

 

only to 原形 : ただVしただけだ」ということを表します。悪い結果となってしまった場合に使うことが多いです。 特に、「only to find ~」という形で使われることが多くあります。

https://study-z.net/30772

結局ここでは特にこの部分の意味を訳す必要は無い、ということだと思われる。

 

高校英文法:使役動詞 have + O + 原形不定詞

haveは「~してもらう」という意味だと思われる。


That’s the Dart analyzer spotting possible improvements in your code, called lints.

これは、Dart …

Flutter/Dart : 2023/2/14/Dio package has a new maintainer

 

経緯について知りたい方は関連記事をどうぞ

If you want to know the background, please see the related article.

 

昨日、Dioパッケージの継続不可能の発表について記事を投稿しましたが、その後、新しいメンテナーが現れるという喜ばしい結末となりました。

Yesterday we posted an article about the announcement of the Dio package’s inability to continue, with the happy conclusion that a new maintainer has

Flutter/Dart 2023/2/13/Announcement of discontinuation of Dio package

 

*2023/2/14に続報記事を投稿しました(新メンテナーへDioパッケージを移行)。

*A follow-up article was posted on 2023/2/14 (Dio package transferred to new maintainer).

 

Flutter/Dartのネットワーク用人気パッケージDioのGithubリポジトリにて、メンテナンスの継続が不可能であるとの発表がありました。(2023年2月13日時点)

The Github repository of Dio, a popular Flutter/Dart network package, announced that it could no longer be continued.(As of February 13,

Flutter : 期待通りの白と透明のグラデーション(white and transparent gradient)

 

最近はまったポイントを共有させていただきます。

I would like to share a point that I have been stuck on recently.

 

白と透明のグラデーションが欲しかったので下記のように書いたら明らかにグレイが混ざって、期待と違うものになりました。

I wanted a gradation of white and transparent, so when I wrote the following, gray was clearly mixed, and it turned out

2022/12/18/Flutter/Rowでオーバーフローする時の対処法

 

Rowの子の幅が大きかったりすると画面幅、window幅をはみ出してオーバーフローしてしまいます。

If the width of the child of Row is large, it will overflow the screen width and window width.

 

そういう時の対処法をいくつか考えてみましょう。

Let’s consider some ways to deal with this.


スタート地点

starting point

//Rowでオーバーフローする場合の対処法0。まずスタート地点。
import 'package:flutter/material.dart';

void main() {
  

2022/10/8/Flutter/Equality in Dart/related sample code

 

訳は文字起こしにあります。


Part1

//https://www.youtube.com/watch?v=DCKaFaU4jdk&t=30s
//Equality in Dart | Decoding Flutter
//パート1:

void main() {
  final a1 = A(title: 'a');
  final a2 = A(title: 'a');
  //デフォルトだと同一インスタンス以外は「等しくない」と評価される。
  //By default, instances other than the same instance are evaluated as "not equal".
  print(a1 == 

2022/9/22/Flutter/popUntil and WillPopScope

 

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : 

2022/9/14/Flutter/digging into PrimaryScrollController

 

PrimaryScrollController | Decoding Flutter

新しい回が出ましたね !

訳は文字起こしに日本語もありますのでそちらをご覧ください。

とりあえずざっくりまとめたいと思います。


=> ListView内の二つの項目を紐づけて、あるカードの特別なアイコンをクリックしたら別のカードへスクロールする場合。

=> AppBarをタップしたらListViewの最上部(top)に戻る挙動。

このような場合(他にもスクロール位置を取得したりコントロールしたり、プログラマティックにスクロールさせたりする場合)、ScrollControllerが必要になりますね、と。


基本的にスクロールするものは全てScrollControllerが必要。ListViewなどにScrollControllerを渡さずに生成した場合は、内部で自動的にScrollControllerが生成されている。


各Routeで自動的にPrimaryScrollControllerなるものを生成してInheritedWidgetの仕組みによってサブツリーと共有する。(Theme.of(context)やMediaQuery.of(context)などと同じように)

PrimaryScrollController.of(context,)

で取得できる。これを使ってスクロール位置の取得やスクロール操作を行うことができる。

ListViewなどにはprimaryプロパティがあり、

primary: true

にするとそのListViewはPrimaryScrollControllerを自身のcontrollerに設定する、という仕組み。


(PrimaryScrollControllerも含めて)ScrollControllerは、複数のScrollableと紐づけられることを嫌う。その場合、

The ScrollController is attached to multiple scroll views.

エラーが発生する。

モバイルは画面が小さいためListViewなどが複数同じ画面に存在することがあまりなかったが、web/desktopではより発生しやすい、ということになる。

(しかしFlutter3.3以降では、web/desktopのprimaryプロパティの値がデフォルトでfalseになったので、我々が何もしなければ基本的にこのエラーは発生しないようになった。)


Flutter3.3以降はprimaryプロパティのデフォルト値は

モバイルではtrue、…