From d073fd43c09bfd50c9a89931013b79300e119dd5 Mon Sep 17 00:00:00 2001 From: Harshith Goka Date: Sun, 23 Dec 2018 13:53:25 +0530 Subject: [PATCH] [BlogPage] fixed keyboard overlay problem --- lib/src/routes/blogpage.dart | 154 ++++++++++++++++++----------------- 1 file changed, 80 insertions(+), 74 deletions(-) diff --git a/lib/src/routes/blogpage.dart b/lib/src/routes/blogpage.dart index 332bc932..dfc599d4 100644 --- a/lib/src/routes/blogpage.dart +++ b/lib/src/routes/blogpage.dart @@ -70,8 +70,9 @@ class _BlogPageState extends State { child: TextField( autofocus: true, decoration: InputDecoration( - prefixIcon: Icon(OMIcons.search), - hintText: "Search...",), + prefixIcon: Icon(OMIcons.search), + hintText: "Search...", + ), onChanged: (query) async { if (query.length > 4) { blogBloc.query = query; @@ -88,86 +89,91 @@ class _BlogPageState extends State { : null; return Scaffold( + resizeToAvoidBottomPadding: true, key: _scaffoldKey, - bottomNavigationBar: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - searchMode - ? Container( - decoration: BoxDecoration( - border: Border( - top: Divider.createBorderSide(context, width: 1.0), + bottomNavigationBar: Transform.translate( + offset: Offset(0.0, -1 * MediaQuery.of(context).viewInsets.bottom), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + searchMode + ? Container( + decoration: BoxDecoration( + color: Colors.white, + border: Border( + top: Divider.createBorderSide(context, width: 1.0), + ), ), - ), - child: SafeArea( - child: ButtonTheme.bar( - child: SafeArea( - top: false, - child: Row(children: footerButtons), + child: SafeArea( + child: ButtonTheme.bar( + child: SafeArea( + top: false, + child: Row(children: footerButtons), + ), ), ), + ) + : Container( + width: 0, + height: 0, ), - ) - : Container( - width: 0, - height: 0, - ), - BottomAppBar( - child: new Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconButton( - tooltip: "Show bottom sheet", - icon: Icon( - OMIcons.menu, - semanticLabel: "Show bottom sheet", - ), - onPressed: _bottomSheetActive - ? null - : () { - setState(() { - //disable button - _bottomSheetActive = true; - }); - _scaffoldKey.currentState - .showBottomSheet((context) { - // BottomDrawer.setPageIndex( - // bloc, - // widget.blogType == BlogType.Placement - // ? 4 - // : 5); - return BottomDrawer(); - }) - .closed - .whenComplete(() { - setState(() { - _bottomSheetActive = false; + BottomAppBar( + child: new Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + tooltip: "Show bottom sheet", + icon: Icon( + OMIcons.menu, + semanticLabel: "Show bottom sheet", + ), + onPressed: _bottomSheetActive + ? null + : () { + setState(() { + //disable button + _bottomSheetActive = true; + }); + _scaffoldKey.currentState + .showBottomSheet((context) { + // BottomDrawer.setPageIndex( + // bloc, + // widget.blogType == BlogType.Placement + // ? 4 + // : 5); + return BottomDrawer(); + }) + .closed + .whenComplete(() { + setState(() { + _bottomSheetActive = false; + }); }); - }); - }, - ), - IconButton( - icon: Icon(actionIcon), - onPressed: () { - setState(() { - if (searchMode) { - actionIcon = OMIcons.search; - blogBloc.query = ""; - blogBloc.refresh(); - } else { - actionIcon = OMIcons.close; - } + }, + ), + IconButton( + icon: Icon(actionIcon), + onPressed: () { + setState(() { + if (searchMode) { + actionIcon = OMIcons.search; + blogBloc.query = ""; + blogBloc.refresh(); + } else { + actionIcon = OMIcons.close; + } - searchMode = !searchMode; - }); - }, - ) - ], + searchMode = !searchMode; + }); + }, + ) + ], + ), ), - ), - ], + ], + ), ), body: AnimatedContainer( duration: Duration(milliseconds: 500),