Commit f68daece authored by Budi Prasetyo's avatar Budi Prasetyo

hilangin appbar pas discroll

parent efdca11d
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:medapp_eksad/api/setting_api.dart';
import 'package:medapp_eksad/appbar/appbar_home.dart';
......@@ -51,6 +52,55 @@ class _HomePageState extends State<HomePage> {
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>();
@override
Widget build(BuildContext context) {
......@@ -59,10 +109,15 @@ class _HomePageState extends State<HomePage> {
return Scaffold(
key: _scaffoldKey,
floatingActionButton: WAChat(),
appBar: ResponsiveWidget.isSmallScreen(context)
appBar: _showAppbar
? ResponsiveWidget.isSmallScreen(context)
? AppBarKecil()
: AppbarHomeLarge(screenSize, context, Colors.blue, Colors.black,
Colors.black, Colors.black, Colors.black),
Colors.black, Colors.black, Colors.black)
: PreferredSize(
child: Container(),
preferredSize: Size(0.0, 0.0),
),
drawer: const DrawerMedApp(),
body: ResponsiveWidget.isSmallScreen(context)
? Stack(
......
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:medapp_eksad/api/setting_api.dart';
import 'package:medapp_eksad/appbar/appbar_home.dart';
......@@ -51,6 +52,55 @@ class _AboutUsState extends State<AboutUs> {
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>();
@override
Widget build(BuildContext context) {
......@@ -59,10 +109,15 @@ class _AboutUsState extends State<AboutUs> {
return Scaffold(
key: _scaffoldKey,
floatingActionButton: WAChat(),
appBar: ResponsiveWidget.isSmallScreen(context)
appBar: _showAppbar
?ResponsiveWidget.isSmallScreen(context)
? AppBarKecil()
: 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(),
body: ResponsiveWidget.isSmallScreen(context)
? Stack(
......
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:medapp_eksad/api/setting_api.dart';
import 'package:medapp_eksad/appbar/appbar_home.dart';
......@@ -45,6 +46,55 @@ class _ContactUsState extends State<ContactUs> {
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>();
@override
Widget build(BuildContext context) {
......@@ -52,10 +102,15 @@ class _ContactUsState extends State<ContactUs> {
var screenSize = MediaQuery.of(context).size;
return Scaffold(
key: _scaffoldKey,
appBar: ResponsiveWidget.isSmallScreen(context)
appBar: _showAppbar
?ResponsiveWidget.isSmallScreen(context)
? AppBarKecil()
: 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(),
body: ResponsiveWidget.isSmallScreen(context)
? Stack(
......
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:medapp_eksad/api/setting_api.dart';
import 'package:medapp_eksad/appbar/appbar_home.dart';
......@@ -40,6 +41,55 @@ class _SolutionsState extends State<Solutions> {
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
Widget build(BuildContext context) {
setPageTitle('Our Solutions', context);
......@@ -47,10 +97,15 @@ class _SolutionsState extends State<Solutions> {
return Scaffold(
key: _scaffoldKey,
floatingActionButton: WAChat(),
appBar: ResponsiveWidget.isSmallScreen(context)
appBar: _showAppbar
?ResponsiveWidget.isSmallScreen(context)
? AppBarKecil()
: 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(),
body: ResponsiveWidget.isSmallScreen(context)
? 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