Search
 
SCRIPT & CODE EXAMPLE
 

DART

flutter sliver TabBar

import 'package:flutter/material.dart';
//Shohel Rana Shanto

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({ Key? key }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HomePage(),
      
    );
  }
}
class HomePage extends StatefulWidget {
  const HomePage({ Key? key }) : super(key: key);

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length:4 ,
      child: Scaffold(
        body: NestedScrollView(headerSliverBuilder: (context,_){
          return [
            SliverAppBar(
              pinned: true,
              title: Text('Sliver TabBar'),
              backgroundColor: Colors.black87,
              bottom: TabBar(tabs: [
                Tab(text: 'Grid',),
                Tab(text: 'List',),
                Tab(text: 'Images',),
                Tab(text: 'Color',),
              ]),
            )
          ];
        },
        
         body: TabBarView(children: [
           Container(color: Colors.green,child: GridView.count(crossAxisCount: 3,
           children: 
             List.generate(100, (index) => 
             Card(color: Colors.amber,child: Text('Grid$index'),)
             )
           
           
           ),),
           Container(color: Colors.red,child: ListView.builder(
             itemCount: 6,
             itemBuilder: (context,index){
             return Card(
               child: ListTile(
                 title: Text('List$index'),
               ),
             );
           }),),
           Container(color: Colors.yellow,),
           Container(color: Colors.blue,),
         ]),
      
      ),
      ),
    );
  }
}
Comment

PREVIOUS NEXT
Code Example
Dart :: flutter thin line 
Dart :: flutter remove appbar leading padding 
Dart :: border radius to card flutter dart 
Dart :: dart while 
Dart :: dart null aware 
Dart :: flutter toast 
Dart :: dart read csv files 
Dart :: todate format dart 
Dart :: Chang height of the bottom Navigation bar in flutter 
Dart :: list in dart 
Dart :: flutter auto size text 
Dart :: Flutter bottom navigation bar change page programmatically 
Dart :: dart check runtime type 
Dart :: FlutterError (Navigator operation requested with a context that does not include a Navigator. The context used to push or pop routes from the Navigator must be that of a widget that is a descendant of a Navigator widget.) 
Dart :: flutter delete directory 
Dart :: flutter component position absolute 
Dart :: dart map.foreach 
Dart :: clipboard flutter 
Dart :: dart if else 
Dart :: flutter tabbar 
Dart :: flutter remove character from string 
Dart :: dark mode in flutter packages 
Dart :: How to i convert this python code to dart? 
Dart :: dart svg drawer 
Dart :: Try adding a case clause for the missing constant, or adding a default clause.dartmissing_enum_constant_in_switch. 
Dart :: dart async map 
Dart :: dart get href attribute 
Dart :: cascade notation 
Swift :: swift change button text 
Swift :: swift pop to specific view controller 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =