animated_appbar

AppBar which can dynamically change height with page navigation.

Usage
This package is expected to be used with BaseLayout and AnimatedAppBar
import 'package:flutter/material.dart';
import 'package:animated_appbar/animated_appbar.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> with TickerProviderStateMixin{
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: BaseLayout(
appBar: AnimatedAppBar(
initHeight: 135.0,
backgroundColor: Color(0xff7a7ad1),
child: Container(
key: UniqueKey(),
child:Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(
Icons.apps,
color: Colors.white,
size: 20.0,
),
Text(
"You can customise this Area",
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
),
),
Icon(
Icons.manage_search,
color: Colors.white,
size: 20.0,
),
],
),
),
),
),
scaffold: Page1(),
),
);
}
}
class Page1 extends StatelessWidget with RoutePage{
Widget newAppBar = Container(
key:UniqueKey(),
child:Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"AppBar changed!!",
style: TextStyle(
color: Color(0xfff7f4cc),
fontSize: 20,
),
),
Text(
"You can customise here too..🔥",
style: TextStyle(
color: Color(0xfff7f4cc),
fontSize: 20,
),
),
],
),
);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child:Column(
mainAxisAlignment:MainAxisAlignment.center,
children: [
Text(
"Page 1 😄",
style:TextStyle(
fontSize: 50,
),
),
SizedBox(height: 5),
Container(
decoration:BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.all(
Radius.circular(8)
),
),
padding: EdgeInsets.all(10.0),
child: TextButton(
onPressed: ()=> routePageWithNewAppBar(Page2(),newAppBar),
child: Text(
"Click here to navigate Page2!",
style: TextStyle(
fontSize: 20,
color: Colors.white
),
),
),
),
],
),
),
);
}
}
class Page2 extends StatelessWidget with RoutePage{
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child:Column(
mainAxisAlignment:MainAxisAlignment.center,
children: [
Text(
"Page 2 🚩",
style:TextStyle(
fontSize: 50,
),
),
SizedBox(height: 5),
Container(
decoration:BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.all(
Radius.circular(8)
),
),
padding: EdgeInsets.all(10.0),
child: TextButton(
onPressed: () => previousPage(),
child: Text(
"back to Page1",
style: TextStyle(
fontSize: 20,
color: Colors.white
),
),
),
),
],
),
),
);
}
}
If you have any requests / contributes or questions, please feel free to visit github.