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