import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: Text('内容'), ), body: HomeContent(), ), ); } } class HomeContent extends StatelessWidget { @override Widget build(BuildContext context) { Widget titleSection = new Container( padding: const EdgeInsets.all(32.0), child: Row( children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( child: Text( '我是标题呀', style: TextStyle(fontWeight: FontWeight.bold), ), ), Text( '我是描述呀', ), ], ), ), Icon(Icons.star, color: Colors.red), Text('41'), ], ), ); Widget buttonSection = Container( child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ buildButtonColumn(Icons.call, 'CALL'), buildButtonColumn(Icons.near_me, 'ROUTE'), buildButtonColumn(Icons.share, 'SHARE'), ], ), ); Widget textSection = Container( padding: const EdgeInsets.all(32.0), child: Text( 'Lake Oeschinen lies at the foot of the Blüemlisalp in the Bernese Alps. Situated 1,578 meters above sea level, it is one of the larger Alpine Lakes. A gondola ride from Kandersteg, followed by a half-hour walk through pastures and pine forest, leads you to the lake, which warms to 20 degrees Celsius in the summer. Activities enjoyed here include rowing, and riding the summer toboggan run.', softWrap: true, ), ); return ListView( children: [ Image( image: NetworkImage( 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1577273909469&di=2f8f9992947c1e3a99d60eeb7554decf&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201703%2F01%2F20170301163305_sCd8j.gif'), height: 220.0, fit: BoxFit.cover, ), titleSection, buttonSection, textSection, ], ); } Column buildButtonColumn(IconData icon, String label) { const color = Colors.blue; return new Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(icon, color: color), new Container( margin: const EdgeInsets.only(top: 8.0), child: Text( label, style: TextStyle( color: color, ), ), ), ], ); } }
效果展示
作者:兰叶书