0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Flutterのデフォルトプロジェクトを触ってみる

0
Posted at

前に環境構築をしてみたのですが、カウントアップできるUIがビルドされていました。
でも、MainActivityを見ると中身が何もありません。

MainActivity.kt
import io.flutter.embedding.android.FlutterActivity

class MainActivity : FlutterActivity()

どこでUIが実装されているのか調べてみたところ、main.dartに実装されているようです。

まずは小さな変更を加えてみようと思います。

カウントを「+1」から「+2」に変更してみます。

main.dart
  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

こちらがカウントのロジック部分のようです。

main.dart
  void _incrementCounter() {
    setState(() {
      _counter += 2;
    });
  }

に変更してみました。

カウントが「+2」になったので成功です。

FlutterではUIはDart側で実装されていることが分かりました。

まだ分からないことが多いので、少しずつ実装してみようと思います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?