Skip to content

Instantly share code, notes, and snippets.

@HassanTeslim007
Last active July 28, 2023 20:12
Show Gist options
  • Save HassanTeslim007/3ed141135db4f0bf3b43f2b839e810e2 to your computer and use it in GitHub Desktop.
Save HassanTeslim007/3ed141135db4f0bf3b43f2b839e810e2 to your computer and use it in GitHub Desktop.
Using Slivers
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: CustomScrollView(
slivers: [
// SliverAppBar
SliverAppBar(
expandedHeight: 200.0,
pinned: true,
flexibleSpace: FlexibleSpaceBar(
background: Image.network(
'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBYWFRgWFhYZGRgZHBwaGBocGhwcGhwaHBoaGhoaGBocIS4lHB4rHxoZJzgmKy8xNTU1HCQ7QDs0Py40NTEBDAwMEA8QHxISHzQrJSw0NDQ0NDY0NDQ2NDQ0NDQ0Nj00NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NP/AABEIAMYA/gMBIgACEQEDEQH/xAAbAAABBQEBAAAAAAAAAAAAAAAEAQIDBQYAB//EADwQAAEDAgQEBAUCBQMEAwEAAAEAAhEDIQQSMUEFUWFxIoGRoQYTMrHB0fAUQlKC4SOS8RVicqIzstIH/8QAGgEAAwEBAQEAAAAAAAAAAAAAAAECAwQFBv/EACcRAAICAgICAQQCAwAAAAAAAAABAhEDIRIxQVEEEyJhgXGhMpHx/9oADAMBAAIRAxEAPwDzJcnJIQMRdCe0KRrUARhqeGp7WKQMQMhypMqIypDTQIghIpXNSZUwIwuhOhdCdCGQuhPhIQigGJCU+EhCKAjSlLCVFBYiaSnJIRQWJKbKUpIRQWLK6UsJCigFlIuhIUxCpRCaCulADgQukJrVzkDFlcmpwKQEgCUNSgJ4Cko5rU9rVwCnYxIBGMRDaSfRpo5lHogAFlCUjsOthwbgYc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dSST5lIuTJJAwDRKRskXIEPabBNK5cgBjXkWTvmFcuQBKNB5JCVy5IZFXbKWkYsuXIQEjXQkN0q5AHAJthsuXIA4uXERuuXIAkovKWs68ch91y5V4ERu6JgXLkAK2uYmB56enPzT2YrwmB4swuQLN5DrK5ckMhDzMyZ5lJnsXHTSBaTtPRcuQAOx5cZKnfVN+gP4C5cgBlPEG3T8o3OuXJslH//Z',
fit: BoxFit.cover,
),
title:const Text('Sage SliverAppBar'),
centerTitle: true,
),
),
// SliverList
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return ListTile(
title: Text('List Item $index'),
);
},
childCount: 10,
),
),
// SliverGrid
SliverGrid(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
),
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return Card(
child: Center(
child: Text('Grid Item $index'),
),
);
},
childCount: 6,
),
),
// SliverPersistentHeader
SliverPersistentHeader(
delegate: MyPersistentHeaderDelegate(),
),
// SliverToBoxAdapter
const SliverToBoxAdapter(
child: Padding(
padding: EdgeInsets.all(16.0),
child: Text('SliverToBoxAdapter Example'),
),
),
// SliverFillRemaining
const SliverFillRemaining(
child: Center(
child: Text('SliverFillRemaining Example'),
),
),
],
),
),
);
}
}
// Custom SliverPersistentHeader Delegate
class MyPersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
@override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
return Container(
color: Colors.blue,
alignment: Alignment.center,
child: Text(
'Persistent Header',
style: TextStyle(color: Colors.white, fontSize: 18),
),
);
}
@override
double get maxExtent => 100.0;
@override
double get minExtent => 100.0;
@override
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment