flutter布局-卡片布局Card


卡片布局默认是撑满整个外部容器的,如果你想设置卡片的宽高,需要在外部容器就进行制定。

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var card = new Card(
        child: Column(
            children: [
                ListTile(
                    title: new Text('title', style: TextStyle(fontWeight: FontWeight.w500),),
                    subtitle: new Text('subtitle'),
                    leading: new Icon(Icons.account_box, color: Colors.blue,),
                ),
                new Divider(),
                ListTile(
                    title: new Text('title'),
                    subtitle: new Text('subtitle'),
                    leading: new Icon(Icons.account_box),
                ),
                new Divider(),
                ListTile(
                    title: new Text('title'),
                    subtitle: new Text('subtitle'),
                    leading: new Icon(Icons.account_box),
                )
            ],
        ),
    );
    return MaterialApp(
        title: 'flutter demo',
        home: Scaffold(
          appBar: new AppBar(
            title: new Text('卡片布局Card'),
          ),
          body: Center(child: card),
        ));
  }
}
View Code


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM