Card

Card

Card (child : Column(children : [ Image.asset(‘assets/resim_ismi.jpg’), Text(‘Örnek Yazı’) ] ) )

açıklama

Kartvizit widgeti…

konum

MaterialApp({ title,theme, home: Scaffold({ appBar, body: Center(child:  Card (child : Column(children :  [ Image.asset('assets/resim_ismi.jpg'), Text('Örnek Yazı') ] )  )), }), })

parametreler

Card (child : Column(children :  [ ] )  ) : Materyal.dart in sundugu bir hazır kartvizit widgetidir denebilir.
                            Kart, bir albüm, coğrafi bir yer, bir yemek, iletişim bilgileri vb. İle ilgili bazı bilgileri göstermek için child ina, cildren alan widgetler verilerek yapılabilir.
                            Dolayısıyala colon yada listwiev gibi children alan widgetlere ihtiyaç duyar.

örnek uygulama

card-orn
 
/*
Nguyen Duc Hoang (Mr)
Programming tutorial channel:
https://www.youtube.com/c/nguyenduchoang
Flutter, React, React Native, IOS development, Swift, Python, Angular
* */
import 'package:flutter/material.dart';

//Define "root widget"
void main() => runApp(new MyApp());//one-line function
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //build function returns a "Widget"
    var card = new Card(
      child: new Column(
        children: [
          new ListTile(
            leading: new Icon(Icons.account_box, color: Colors.blue,size: 26.0,),
            title: new Text("Nguyen Duc Hoang"
            ,style: new TextStyle(fontWeight: FontWeight.w400),),
            subtitle: new Text("Software developer"),
          ),
          new Divider(color: Colors.blue,indent: 16.0,),
          new ListTile(
            leading: new Icon(Icons.email, color: Colors.blue, size: 26.0,),
            title: new Text("sunlight4d@gmail.com"
              ,style: new TextStyle(fontWeight: FontWeight.w400),),
          ),
          new ListTile(
            leading: new Icon(Icons.phone, color: Colors.blue, size: 26.0,),
            title: new Text("+84-123.456.789"
              ,style: new TextStyle(fontWeight: FontWeight.w400),),
          )
        ],
      ),
    );
    final sizedBox = new Container(
      margin: new EdgeInsets.only(left: 10.0, right: 10.0),
      child: new SizedBox(
        height: 220.0,
        child: card,
      ),
    );
    final center = new Center(
      child: sizedBox,
    );
    return new MaterialApp(
      title: "",
//      home: new Text("Add Google fonts to Flutter App")
      home: new Scaffold(appBar: new AppBar(
        title: new Text("Card example")
      ),
        body: center,
      )
    );
  }
}


Bir cevap yazın

KAPAT
%d blogcu bunu beğendi: