1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| import 'package:flutter/material.dart';
class SliverHome extends StatefulWidget { const SliverHome({super.key});
@override State<SliverHome> createState() => _SliverHomeState(); }
class _SliverHomeState extends State<SliverHome> { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: CustomScrollView( slivers: [ SliverAppBar( title: Text('SliverAppBar'), floating: true, flexibleSpace: FlexibleSpaceBar( background: Image.asset("assets/images/r.png",fit: BoxFit.cover,), ), expandedHeight: 200, ), SliverList(delegate: SliverChildBuilderDelegate((context, index) => Card( color: Colors.pinkAccent.shade100, shape: ContinuousRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(15)), side: BorderSide(color: Colors.orange,width: 1) ), child: ListTile( title: Text("Song and Poem",style: TextStyle(color: Colors.white,fontWeight: FontWeight.w600),), subtitle: Text("favorite things",style: TextStyle(color: Colors.white,fontSize: 12)), trailing: Icon(Icons.unfold_more,color: Colors.yellow,size: 30,), ), ), childCount: 3, )), SliverList(delegate: SliverChildBuilderDelegate((context, index) => Card( color: Colors.pinkAccent.shade100, shape: UnderlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(15)), borderSide: BorderSide(color: Colors.orange,width: 10) ), child: ListTile( title: Text("Song and Poem",style: TextStyle(color: Colors.white,fontWeight: FontWeight.w600),), subtitle: Text("favorite things",style: TextStyle(color: Colors.white,fontSize: 12)), trailing: Icon(Icons.unfold_more,color: Colors.yellow,size: 30,), ), ), childCount: 2, )),
SliverList(delegate: SliverChildBuilderDelegate((context, index) => Card( color: Colors.pinkAccent.shade100, shape: StadiumBorder( side: BorderSide(color: Colors.orange,width: 1) ), child: ListTile( title: Text("Song and Poem",style: TextStyle(color: Colors.white,fontWeight: FontWeight.w600),), subtitle: Text("favorite things",style: TextStyle(color: Colors.white,fontSize: 12)), trailing: Icon(Icons.unfold_more,color: Colors.yellow,size: 30,), ), ), childCount: 3, )),
SliverPadding(padding: EdgeInsets.all(15), sliver: SliverGrid(delegate: SliverChildBuilderDelegate((context, index) => Card( color: Colors.red[100*index], shape: BeveledRectangleBorder( borderRadius: BorderRadius.circular(15), side: BorderSide(color: Colors.orange,width: 1) ), ), childCount: 6,
), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, mainAxisSpacing: 10, crossAxisSpacing: 10, childAspectRatio: 3
)), )
], ), ), ); } }
|