//flutter import 'package:flutter/material.dart'; void main() { return runApp(TestPage()); } //リスト4.15 class TestPage extends StatelessWidget{ final _path = 'https://flutter.github.io/assets-for-api-docs/assets/widgets/owl.jpg'; @override Widget build(BuildContext context) { return MaterialApp( title: 'カード', home: Scaffold( appBar: AppBar(title: Text('カード')), body: ListView( padding: EdgeInsets.all(10), children: [ makeCardSample1(), makeCardSample2(), makeCardSample3() ], ) ) ); } Widget makeCardSample1() => Card( child: Padding( padding: EdgeInsets.all(10), child: Text('サンプル1'), ), ); Widget makeCardSample2() => Card( clipBehavior: Clip.antiAlias, child: Image.network(_path) ); Widget makeCardSample3() => Card( elevation: 6, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20), ), child: Padding( padding: EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'サンプル3', style: TextStyle( fontSize: 28, fontWeight: FontWeight.bold, ), ), Text('角の丸みと影を強くしたカード'), ], ), ), ); }