When I try to make an android status bar like a top bar in my app I use a gesture detector but I don't know how to proceed with it. How do I hide the container above and get the container while swiping like below:
How do I do something after a swipe ends and measure the swipe distance. The top bar should settle down or up and not stay in-between. How do I animate it to make it do it similar to how it is now. I tried onVerticalDrag
etc but I don't have an idea how to it.
Flutter Slivers can do that for you.
Check the following code:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body:NestedScrollView(
headerSliverBuilder: (BuildContext context, bool _) {
return <Widget>[
SliverAppBar(
expandedHeight: 200.0,
floating: true,
pinned: true,
snap: true,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
title: Text("Collapsing Toolbar",
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
),
),
),
),
];
},
body: Center(
child: Text("My Fancy Text"),
),
),
),
);
}
}