Flattern Splitter
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),
),
],
),
);
}
}
Angry Alpaca