Skip to content

Instantly share code, notes, and snippets.

@TheNova22
Last active October 7, 2020 05:11
Show Gist options
  • Save TheNova22/3631de5657d6fe97717c737ed266804f to your computer and use it in GitHub Desktop.
Save TheNova22/3631de5657d6fe97717c737ed266804f to your computer and use it in GitHub Desktop.
Sliver App Bar
// vim: syntax=dart
@override
Widget build(BuildContext context) {
var width = MediaQuery.of(context).size.width;
final theme = Theme.of(context);
return Scaffold(
// ANCHOR Extended App Bar
body: NestedScrollView(headerSliverBuilder: (
BuildContext context,bool innerBox){
return <Widget>[SliverAppBar(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius : BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30)
)
),
backgroundColor: Colors.orangeAccent,
expandedHeight: 200,
floating: true,
forceElevated: true,
pinned: true,
title: Row(mainAxisAlignment: MainAxisAlignment.spaceAround,children: [
Icon(Icons.add,color: Colors.transparent,),
Container(
margin: EdgeInsets.only(right:width/2 - 130),
child: Text("Today's Task")
),
Container(
height : 25,
width : 25,
decoration : BoxDecoration(
border : Border.all(color:Colors.white),
),
alignment: Alignment.center,
child: Text(ind.toString(),style: TextStyle(fontSize: 14),),
),
],
),
flexibleSpace:Container(
margin: EdgeInsets.only(top : 75),
child: FlexibleSpaceBar(
centerTitle: true,
background: Column(
children: <Widget>[
Icon(Icons.arrow_drop_down),
Theme(
data : theme.copyWith(
accentColor: Colors.white,// highlted color
textTheme: theme.textTheme.copyWith(
headline5: theme.textTheme.headline5.copyWith(
fontSize: 40
), //other highlighted style
bodyText2: theme.textTheme.bodyText2.copyWith(
fontSize: 27
), //not highlighted styles
)),
// ANCHOR Number Picker
child: NumberPicker.horizontal(initialValue: ind, minValue: 1, maxValue: 31, onChanged: (n){
setState(() {
ind = n;
});
},
),
),
Icon(Icons.arrow_drop_up),
],
),
),
),
),
];
},
//
body: Center(child: Text("Sample"),)),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment