Search
 
SCRIPT & CODE EXAMPLE
 

DART

flutter sliver

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}
class MyApp extends StatefulWidget {
  const MyApp({ Key? key }) : super(key: key);

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

class _MyAppState extends State<MyApp> {
  @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> {
  var sona= ['manush','ShoyTan'];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CustomScrollView(
        slivers: [
          SliverAppBar(
            backgroundColor: Colors.blue.withOpacity(0.7),
            leading: Icon(Icons.menu),
            actions: [
              
              Icon(Icons.notifications),
              Icon(Icons.search),
              // Shohel Rana Shanto
              ],
            pinned: true,
           
          
            expandedHeight: 200,
            floating: true,
            flexibleSpace: FlexibleSpaceBar(
              
              title: Text('Flutter Sliver'),
                centerTitle: true,
                background: Image(image: NetworkImage('https://pfps.gg/assets/banners/2547-illusion-gif.gif'), fit: BoxFit.cover,),

              ),
              
            ),

         SliverList(
           
           delegate: SliverChildBuilderDelegate(
        
           (context,index){
             
             return Card(
               color: Colors.pink[100*(index%9+1)],
               child: ListTile(title: Text(sona[index]),),
             );
           },
           childCount: sona.length ,
           addAutomaticKeepAlives: false,
         )),
         SliverGrid(
           
           delegate: SliverChildBuilderDelegate(
        
           (context,index){
             
             return Card(
               color: Colors.green[100*(index%9+1)],
               child: ListTile(title: Text("shohel$index"),),
             );
           },
           childCount: 100,
         ),
         gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
         ),
        ],
      ),
    );
  }
}
Comment

PREVIOUS NEXT
Code Example
Dart :: flutter persistent header 
Dart :: how to print data types in dart 
Dart :: flutter create new map 
Dart :: creating a stateful widget 
Dart :: convert timeofday to string flutter 
Dart :: how to sort and order a list by date in flutter 
Dart :: change app font flutter 
Dart :: scroll with mouse in flutter 
Dart :: keyboard height flutter 
Dart :: flutter asign class to map 
Dart :: select date from datepicker in textfield flutter 
Dart :: dart interfaces 
Dart :: flutter datacolumn center text 
Dart :: add fullscreen modal on a page in flutter app 
Dart :: how to send sms in flutter 
Dart :: flutter pageview show next page 
Dart :: flutter mouse tracker error 
Dart :: selecting a particular sublist in list in dart 
Dart :: how to change color notification bar in flutter 
Dart :: how to format timeofday in custom format flutter 
Dart :: select an item woth index list dart 
Dart :: flutter radial gradient with alignment 
Dart :: Flutter Text new fline 
Dart :: flutter toast not working 
Dart :: return type of a function 
Dart :: dart class with 
Swift :: swift open url 
Swift :: uistackview insets 
Swift :: custom screen presentation controller coner radius swift 
Swift :: swift uipickerview 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =