Skip to main content

Flutter Properties 'C'

 

1. child
This can hold any one of the widgets in flutter(such as Text, Column, Row, Container, Center, etc). 
To layout multiple widgets, let this widget's child be a widget such as Row, Column, or Stack, which have a children property, and then provide the children to that widget.
Type: Widget
Syntax:
    Widget(
        child: Widget(
        ))
Example:
     Center(
        child: Row(
                    children:[
                            Text("abc"), Text("abc"),
                    ] )
    )

2. children:
This can hold any number of widgets in flutter(such as Text, Column, Row, Container, Center, etc).
It creates an array of widgets.
Type: List<Widget>
Syntax:
    Widget(
        children:[widget1,widget2,widget3,...]
    )
Example:
    Column(
        children: [ 
            Container(child: Icon(Icons.person)),
            Text("Text_Here"),
            Text("Text_Here")                        
    ])

Comments

Popular posts from this blog

Adding Audio/sound in Flutter

  Adding Audio/Sound in Flutter First, Add dependencies: dependencies: audioplayers: ^0.18.3 Now, run an implicit dart pub get . Note: Install the latest version. Import it Now in your Dart code, you can use: import 'package:audioplayers/audioplayers.dart ' ; import 'package:audioplayers/audio_cache .dart ' ; Play  Sound/Audio after you open the app : AudioPlayer advancedPlayer ; Future loadMusic() async {      advancedPlayer = await AudioCache ().loop( "filename.mp3" );     //to play audio in a loop                    // OR      advancedPlayer = await AudioCache ().play( "filename.mp3" );    //to play audio once } @override void initState() {      loadMusic();      super .initState(); } To Stop  Sound/Audio : Future stopp(){          //created stopp() function to stop playing audio a...

TabBarView & TabBar in Flutter using DefaultTabController()

   Adding TabBarView & TabBar in Flutter using DefaultTabController Import it Now in your Dart code, you can use: import 'package:flutter/gestures .dart ' ;          //for drag gesture Three Simple Steps: 1. Remember to add DefaultTabController before Scaffold: class Timeline_PageState extends State<Timeline_Page>{ @override Widget build(BuildContext context) { return DefaultTabController ( initialIndex: 0 , // default is 0 length: 4 , // Number of Tabs      ); } } 2. TabBar Code: Container (color:Colors. grey . shade100 ,     //TAB_BAR Inside a Container height: 50 , child: TabBar (labelColor: Colors. black , tabs: [ Tab (text: 'About' , icon: Icon (Icons. account_box_outlined , color: Colors. indigo ,), iconMargin: EdgeInsets . only (bottom: 0.0 ),...