Added Sample app for SliverAppBar Widget (#117)

* Added Sample app for SliverAppBar Widget
This commit is contained in:
Sannidhya Dubey
2022-10-06 13:36:03 +05:30
committed by GitHub
parent 9fabd53d57
commit 5149889465
67 changed files with 1459 additions and 2 deletions

View File

@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
body: NestedScrollView(
floatHeaderSlivers: true,
headerSliverBuilder: (context, innerBoxIsScrolled) => [
const SliverAppBar(
expandedHeight: 240,
flexibleSpace: FlexibleSpaceBar(
title: Text('Sliver App Bar Demo'),
background: Image(
image: AssetImage('assets/sample.jpg'),
fit: BoxFit.cover,
),
),
floating: true,
),
],
body: ListView.separated(
padding: const EdgeInsets.all(12),
itemCount: 30,
itemBuilder: (context, index) => ListTile(
title: Text('Item $index'),
),
separatorBuilder: (context, index) => const SizedBox(
height: 10,
)),
),
));
}
}