行
CoddyのFlutterジャーニー「はじめてのアプリ」セクションの一部。レッスン 20/32。
RowはColumnを横向きにしたものです。子要素を左から右へ並べます。
Row(
children: [
Text('Yes'),
Text('No'),
],
)ほとんどすべてのFlutter画面は、行を縦に並べたり、行の中に列を配置したりするなど、行と列を使ってレイアウトされています。
チャレンジ
簡単2つの単語が縦に並んでいます。横に並べ、Leftを先に、Rightを後にしてください。
自分で試してみよう
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: Column(
children: [
Text('Left', style: TextStyle(fontSize: 24)),
Text('Right', style: TextStyle(fontSize: 24)),
],
),
),
),
);
}
}
このレッスンには短いクイズがあります。レッスンを始めて解答し、進捗を記録しましょう。
はじめてのアプリのすべてのレッスン
自分で練習してみよう: Flutterオンラインコンパイラ