Search
 
SCRIPT & CODE EXAMPLE
 

DART

flutter sliver grid

 //Shohel Rana Shanto
         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

flutter sliver grid

import 'package:flutter/material.dart';  
  
void main() => runApp(MyApp());  
  
class MyApp extends StatelessWidget {  
  @override  
  Widget build(BuildContext context) {  
    return MaterialApp(  
      home: Scaffold(  
        body: CustomScrollView(  
          slivers: <Widget>[  
            SliverAppBar(  
              actions: <Widget>[  
                Icon(Icons.camera_front, size: 40,)  
            ],  
              title: Text("SliverGrid Example"),  
              leading: Icon(Icons.menu),  
              backgroundColor: Colors.green,  
              expandedHeight: 100.0,  
              floating: true,  
              pinned: true  
            ),  
            SliverGrid(  
              gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(  
                crossAxisCount: 4,  
              ) ,  
              delegate: SliverChildBuilderDelegate((BuildContext context, int index) {  
                return new Container(  
                    color: _randomPaint(index),  
                    height: 150.0  
                );  
              }),  
            ),  
          ],  
        ),  
      ),  
    );  
  }  
}  
Color _randomPaint(int index) {  
  if (index % 3 == 0) {  
    return Colors.orange;  
  } else if (index % 3 == 1) {  
    return Colors.blue;  
  }  
  return Colors.red;  
}  
Comment

PREVIOUS NEXT
Code Example
Dart :: Counting no of word in javascript string 
Dart :: Flutter(Dart) Find String Length 
Dart :: flutter text direction rtl 
Dart :: flutter get key from map 
Dart :: dart filter by attribute 
Dart :: dart convert iterable to list 
Dart :: dart difference between list.of and list.from 
Dart :: flutter remove appbar leading padding 
Dart :: dartlang tuple 
Dart :: flutter toast 
Dart :: elevated Button Theme background color in flutter 
Dart :: flutter ios disable back gesture 
Dart :: dart flutter countdown timer 
Dart :: srring reverse dart 
Dart :: flutter cupertinoapp 
Dart :: flutter dart imagepicker quality reduce resize 
Dart :: flutter iterate over list widget 
Dart :: flutter component position absolute 
Dart :: dart find in array 
Dart :: how to give width based on screen size flutter 
Dart :: dart list of maps 
Dart :: strapi starters 
Dart :: empty object in dart 
Dart :: flutter map 
Dart :: flutter hot reload to multiple devices 
Dart :: Flutter local asset run time path 
Dart :: flutter standarrt icon size 
Dart :: cricle in flutter 
Dart :: flutter download file 
Swift :: swift int to octal 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =