added sliverAppBar as 12th animation

This commit is contained in:
Ayan Das
2023-05-07 20:37:21 +05:30
parent ca23e046dc
commit d0012ed65d
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,52 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
class ScrollAnimation extends StatefulWidget {
final String title;
const ScrollAnimation({
Key? key,
required this.title,
}) : super(key: key);
@override
State<ScrollAnimation> createState() => _ScrollAnimationState();
}
class _ScrollAnimationState extends State<ScrollAnimation> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: CustomScrollView(slivers: [
SliverAppBar(
leading: const Icon(Icons.menu),
title: const Text("SLIVERAPPBAR"),
expandedHeight: 200,
pinned: true,
backgroundColor: Colors.deepPurpleAccent,
flexibleSpace: FlexibleSpaceBar(
background: Image.network(
"https://static.vecteezy.com/system/resources/thumbnails/008/856/903/small/mountain-road-landscape-illustration-nature-highway-through-trees-and-meadow-cartoon-background-vector.jpg",
fit: BoxFit.cover,
),
),
),
SliverList(
delegate: SliverChildBuilderDelegate((context, index) => Container(
decoration: BoxDecoration(
color: Colors.deepPurple[100],
borderRadius: BorderRadius.circular(10)),
height: 300,
width: 100,
margin: const EdgeInsets.all(10),
child: Center(
child: Text("The index is $index"),
),
)),
)
]),
);
}
}

View File

@ -10,6 +10,7 @@ import 'package:animations/Screens/lecture8.dart';
import 'package:animations/Screens/lecture9.dart'; import 'package:animations/Screens/lecture9.dart';
import 'package:animations/Screens/practice1.dart'; import 'package:animations/Screens/practice1.dart';
import 'package:animations/Screens/practice2.dart'; import 'package:animations/Screens/practice2.dart';
import 'package:animations/Screens/scrollAnimation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'Screens/lecture1.dart'; import 'Screens/lecture1.dart';
@ -53,6 +54,7 @@ class MyApp extends StatelessWidget {
title: "Animated Prompt", title: "Animated Prompt",
), ),
'practice2/': (context) => const Practice2(title: "Radial Menu"), 'practice2/': (context) => const Practice2(title: "Radial Menu"),
'sliverappbar/': (context) => const ScrollAnimation(title: "Animation"),
}, },
); );
} }
@ -95,7 +97,8 @@ class _MyHomePageState extends State<MyHomePage> {
Link(link: 'lec7/', title: "CustomPainter & Polygons"), Link(link: 'lec7/', title: "CustomPainter & Polygons"),
Link(link: 'lec8/', title: "3D Drawer"), Link(link: 'lec8/', title: "3D Drawer"),
Link(link: 'lec9/', title: "Animated Prompt"), Link(link: 'lec9/', title: "Animated Prompt"),
Link(link: 'practice2/', title: "Radial Menu") Link(link: 'practice2/', title: "Radial Menu"),
Link(link: 'sliverappbar/', title: "SliverAppBar"),
], ],
), ),
), ),