“Siver Flutter Sliver” Kod odpowiedzi

Siver Flutter Sliver

 //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),
         ),
Angry Alpaca

Siver Flutter Sliver

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;  
}  
Helpless Hummingbird

Odpowiedzi podobne do “Siver Flutter Sliver”

Pytania podobne do “Siver Flutter Sliver”

Więcej pokrewnych odpowiedzi na “Siver Flutter Sliver” w Dart

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu