//flutter import 'package:flutter/material.dart'; void main() { return runApp(TestPage()); } //リスト4.47 class TestPage extends StatelessWidget { @override Widget build(BuildContext context) { final tabNames = <String>['First', 'Second', 'Third', 'Fourth']; return MaterialApp( title: 'Tab', home: DefaultTabController( length: tabNames.length, child: Scaffold( appBar: AppBar( bottom: TabBar( tabs: tabNames .map((tabName) => Tab(icon: Icon(Icons.wb_sunny), text: tabName)) .toList() ), title: Text('Tabs') ), body: TabBarView( children: tabNames .map((tabName) => Center(child: Text(tabName))) .toList() ) ) ) ); } }