Commit f68daece authored by Budi Prasetyo's avatar Budi Prasetyo

hilangin appbar pas discroll

parent efdca11d
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:medapp_eksad/api/setting_api.dart'; import 'package:medapp_eksad/api/setting_api.dart';
import 'package:medapp_eksad/appbar/appbar_home.dart'; import 'package:medapp_eksad/appbar/appbar_home.dart';
...@@ -51,6 +52,55 @@ class _HomePageState extends State<HomePage> { ...@@ -51,6 +52,55 @@ class _HomePageState extends State<HomePage> {
curve: Curves.fastLinearToSlowEaseIn); curve: Curves.fastLinearToSlowEaseIn);
} }
bool _showAppbar = true;
//ScrollController controller2 = new ScrollController();
bool _show = true;
bool isScrollingDown = false;
@override
void initState() {
super.initState();
myScroll();
}
@override
void dispose() {
super.dispose();
controller2.removeListener(() {});
super.dispose();
}
void showBottomBar() {
setState(() {
_show = true;
});
}
void hideBottomBar() {
setState(() {
_show = false;
});
}
void myScroll() async {
controller2.addListener(() {
if (controller2.position.userScrollDirection == ScrollDirection.reverse) {
if (!isScrollingDown) {
isScrollingDown = true;
_showAppbar = false;
hideBottomBar();
}
}
if (controller2.position.userScrollDirection == ScrollDirection.forward) {
if (isScrollingDown) {
isScrollingDown = false;
_showAppbar = true;
showBottomBar();
}
}
});
}
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -59,10 +109,15 @@ class _HomePageState extends State<HomePage> { ...@@ -59,10 +109,15 @@ class _HomePageState extends State<HomePage> {
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
floatingActionButton: WAChat(), floatingActionButton: WAChat(),
appBar: ResponsiveWidget.isSmallScreen(context) appBar: _showAppbar
? AppBarKecil() ? ResponsiveWidget.isSmallScreen(context)
: AppbarHomeLarge(screenSize, context, Colors.blue, Colors.black, ? AppBarKecil()
Colors.black, Colors.black, Colors.black), : AppbarHomeLarge(screenSize, context, Colors.blue, Colors.black,
Colors.black, Colors.black, Colors.black)
: PreferredSize(
child: Container(),
preferredSize: Size(0.0, 0.0),
),
drawer: const DrawerMedApp(), drawer: const DrawerMedApp(),
body: ResponsiveWidget.isSmallScreen(context) body: ResponsiveWidget.isSmallScreen(context)
? Stack( ? Stack(
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:medapp_eksad/api/setting_api.dart'; import 'package:medapp_eksad/api/setting_api.dart';
import 'package:medapp_eksad/appbar/appbar_home.dart'; import 'package:medapp_eksad/appbar/appbar_home.dart';
...@@ -51,6 +52,55 @@ class _AboutUsState extends State<AboutUs> { ...@@ -51,6 +52,55 @@ class _AboutUsState extends State<AboutUs> {
curve: Curves.fastLinearToSlowEaseIn); curve: Curves.fastLinearToSlowEaseIn);
} }
bool _showAppbar = true;
//ScrollController controller2 = new ScrollController();
bool _show = true;
bool isScrollingDown = false;
@override
void initState() {
super.initState();
myScroll();
}
@override
void dispose() {
super.dispose();
controller2.removeListener(() {});
super.dispose();
}
void showBottomBar() {
setState(() {
_show = true;
});
}
void hideBottomBar() {
setState(() {
_show = false;
});
}
void myScroll() async {
controller2.addListener(() {
if (controller2.position.userScrollDirection == ScrollDirection.reverse) {
if (!isScrollingDown) {
isScrollingDown = true;
_showAppbar = false;
hideBottomBar();
}
}
if (controller2.position.userScrollDirection == ScrollDirection.forward) {
if (isScrollingDown) {
isScrollingDown = false;
_showAppbar = true;
showBottomBar();
}
}
});
}
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -59,10 +109,15 @@ class _AboutUsState extends State<AboutUs> { ...@@ -59,10 +109,15 @@ class _AboutUsState extends State<AboutUs> {
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
floatingActionButton: WAChat(), floatingActionButton: WAChat(),
appBar: ResponsiveWidget.isSmallScreen(context) appBar: _showAppbar
?ResponsiveWidget.isSmallScreen(context)
? AppBarKecil() ? AppBarKecil()
: AppbarHomeLarge(screenSize, context, Colors.black, Colors.blue, : AppbarHomeLarge(screenSize, context, Colors.black, Colors.blue,
Colors.black, Colors.black, Colors.black), Colors.black, Colors.black, Colors.black)
:PreferredSize(
child: Container(),
preferredSize: Size(0.0, 0.0),
),
drawer: const DrawerMedApp(), drawer: const DrawerMedApp(),
body: ResponsiveWidget.isSmallScreen(context) body: ResponsiveWidget.isSmallScreen(context)
? Stack( ? Stack(
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:medapp_eksad/api/setting_api.dart'; import 'package:medapp_eksad/api/setting_api.dart';
import 'package:medapp_eksad/appbar/appbar_home.dart'; import 'package:medapp_eksad/appbar/appbar_home.dart';
...@@ -45,6 +46,55 @@ class _ContactUsState extends State<ContactUs> { ...@@ -45,6 +46,55 @@ class _ContactUsState extends State<ContactUs> {
curve: Curves.fastLinearToSlowEaseIn); curve: Curves.fastLinearToSlowEaseIn);
} }
bool _showAppbar = true;
//ScrollController controller2 = new ScrollController();
bool _show = true;
bool isScrollingDown = false;
@override
void initState() {
super.initState();
myScroll();
}
@override
void dispose() {
super.dispose();
controller2.removeListener(() {});
super.dispose();
}
void showBottomBar() {
setState(() {
_show = true;
});
}
void hideBottomBar() {
setState(() {
_show = false;
});
}
void myScroll() async {
controller2.addListener(() {
if (controller2.position.userScrollDirection == ScrollDirection.reverse) {
if (!isScrollingDown) {
isScrollingDown = true;
_showAppbar = false;
hideBottomBar();
}
}
if (controller2.position.userScrollDirection == ScrollDirection.forward) {
if (isScrollingDown) {
isScrollingDown = false;
_showAppbar = true;
showBottomBar();
}
}
});
}
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -52,10 +102,15 @@ class _ContactUsState extends State<ContactUs> { ...@@ -52,10 +102,15 @@ class _ContactUsState extends State<ContactUs> {
var screenSize = MediaQuery.of(context).size; var screenSize = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: ResponsiveWidget.isSmallScreen(context) appBar: _showAppbar
?ResponsiveWidget.isSmallScreen(context)
? AppBarKecil() ? AppBarKecil()
: AppbarHomeLarge(screenSize, context, Colors.black, Colors.black, : AppbarHomeLarge(screenSize, context, Colors.black, Colors.black,
Colors.black, Colors.black, Colors.blue), Colors.black, Colors.black, Colors.blue)
:PreferredSize(
child: Container(),
preferredSize: Size(0.0, 0.0),
),
drawer: const DrawerMedApp(), drawer: const DrawerMedApp(),
body: ResponsiveWidget.isSmallScreen(context) body: ResponsiveWidget.isSmallScreen(context)
? Stack( ? Stack(
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:medapp_eksad/api/setting_api.dart'; import 'package:medapp_eksad/api/setting_api.dart';
import 'package:medapp_eksad/appbar/appbar_home.dart'; import 'package:medapp_eksad/appbar/appbar_home.dart';
...@@ -40,6 +41,55 @@ class _SolutionsState extends State<Solutions> { ...@@ -40,6 +41,55 @@ class _SolutionsState extends State<Solutions> {
curve: Curves.fastLinearToSlowEaseIn); curve: Curves.fastLinearToSlowEaseIn);
} }
bool _showAppbar = true;
//ScrollController controller2 = new ScrollController();
bool _show = true;
bool isScrollingDown = false;
@override
void initState() {
super.initState();
myScroll();
}
@override
void dispose() {
super.dispose();
controller2.removeListener(() {});
super.dispose();
}
void showBottomBar() {
setState(() {
_show = true;
});
}
void hideBottomBar() {
setState(() {
_show = false;
});
}
void myScroll() async {
controller2.addListener(() {
if (controller2.position.userScrollDirection == ScrollDirection.reverse) {
if (!isScrollingDown) {
isScrollingDown = true;
_showAppbar = false;
hideBottomBar();
}
}
if (controller2.position.userScrollDirection == ScrollDirection.forward) {
if (isScrollingDown) {
isScrollingDown = false;
_showAppbar = true;
showBottomBar();
}
}
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
setPageTitle('Our Solutions', context); setPageTitle('Our Solutions', context);
...@@ -47,10 +97,15 @@ class _SolutionsState extends State<Solutions> { ...@@ -47,10 +97,15 @@ class _SolutionsState extends State<Solutions> {
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
floatingActionButton: WAChat(), floatingActionButton: WAChat(),
appBar: ResponsiveWidget.isSmallScreen(context) appBar: _showAppbar
?ResponsiveWidget.isSmallScreen(context)
? AppBarKecil() ? AppBarKecil()
: AppbarHomeLarge(screenSize, context, Colors.black, Colors.black, : AppbarHomeLarge(screenSize, context, Colors.black, Colors.black,
Colors.blue, Colors.black, Colors.black), Colors.blue, Colors.black, Colors.black)
:PreferredSize(
child: Container(),
preferredSize: Size(0.0, 0.0),
),
drawer: const DrawerMedApp(), drawer: const DrawerMedApp(),
body: ResponsiveWidget.isSmallScreen(context) body: ResponsiveWidget.isSmallScreen(context)
? Stack( ? Stack(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment