Scaffold

  • Usage

    Syntax

    
                    Scaffold(
                      appBar:  /*some application bar*/,
                      body:  /*some body*/,
                      floatingActionButton:  /*some floating action button*/,
                    );
    
                    

    constructor and properties

    
                    const Scaffold({  
                      Key key,  
                      this.appBar,  
                      this.body,  
                      this.floatingActionButton,  
                      this.floatingActionButtonLocation,  
                      this.persistentFooterButtons,  
                      this.drawer,  
                      this.endDrawer,  
                      this.bottomNavigationBar,  
                      this.bottomSheet,  
                      this.floatingActionButtonAnimator,  
                      this.backgroundColor,  
                      this.resizeToAvoidBottomPadding = true,  
                      this.primary = true,  
                    })  
    
                    

    floatingActionButton

    
                    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(title: const Text('GeeksforGeeks')),
        body: const Center(
          child: Text(
            "Welcome to GeeksforGeeks!!!",
            style: TextStyle(
              color: Colors.black,
              fontSize: 40.0,
            ),
          ),
        ),
        floatingActionButton: FloatingActionButton(
          elevation: 10.0,
          child: const Icon(Icons.add),
          onPressed: () {
            // action on button press
          },
        ),
      );
    }
                    

    drawer

    
    drawer: Drawer(
      child: ListView(
        children: const <Widget>[
          DrawerHeader(
            decoration: BoxDecoration(
              color: Colors.green,
            ),
            child: Text(
              'GeeksforGeeks',
              style: TextStyle(
                color: Colors.green,
                fontSize: 24,
              ),
            ),
          ),
          ListTile(
            title: Text('Item 1'),
          ),
          ListTile(
            title: Text('Item 2'),
          ),
        ],
      ),
    ),
    

    bottomNavigationBar

    
    bottomNavigationBar: BottomNavigationBar(
    		currentIndex: 0,
    		fixedColor: Colors.green,
    		items: const [
    		BottomNavigationBarItem(
    			label: "Home",
    			icon: Icon(Icons.home),
    		),
    		BottomNavigationBarItem(
    			label: "Search",
    			icon: Icon(Icons.search),
    		),
    		BottomNavigationBarItem(
    			label: "Profile",
    			icon: Icon(Icons.account_circle),
    		),
    		],
    		onTap: (int indexOfItem) {}),