Created
April 21, 2020 03:00
-
-
Save erluxman/6874032a7a1ea129640b8f617f7ffed3 to your computer and use it in GitHub Desktop.
SliverAppbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: SliverAppBarDemo()), | |
); | |
} | |
} | |
class SliverAppBarDemo extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return CustomScrollView( | |
slivers: <Widget>[ | |
SliverAppBar( | |
title: Text( | |
"SilverAppBar title", | |
), | |
snap: true, | |
floating: true, | |
pinned: true, | |
stretch: true, | |
//Max height of background Image | |
expandedHeight: 160.0, | |
flexibleSpace: FlexibleSpaceBar( | |
collapseMode: CollapseMode.pin, | |
background: Image.network( | |
"https://cdn.pixabay.com/photo/2017/09/14/22/42/milky-way-2750627__340.jpg", | |
fit: BoxFit.fill, | |
), | |
), | |
), | |
// SliverList( | |
SliverFillRemaining( | |
child: Center(child: Text("Body")), | |
), | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment