Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
Add resizeToAvoidBottomInset member on LitTabView
Browse files Browse the repository at this point in the history
  • Loading branch information
eightgran committed Jun 16, 2021
1 parent 26ab39d commit 37e1cef
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Constrain the action buttons on `LitTitledDialog`.
- Alter button styling on `LitDatePicker`.
- Alter `LitCreditsScreen`'s back button color.
- Add `resizeToAvoidBottomInset` member on `LitTabView` to enforce overlapping according to [Material Design's guidelines](https://material.io/components/app-bars-bottom#behavior).

## 1.0.4

Expand Down
25 changes: 20 additions & 5 deletions lib/src/widgets/scaffold/lit_tab_view.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
import 'package:flutter/material.dart';
import 'package:lit_ui_kit/bottom_navigation.dart';

/// A wrapper widget allowing to navigate the provided tab widgets inside an
/// surrounding tab view. It implements the required logic for tracking the
/// state and the for navigating between the tabs.
/// A screen widget allowing to navigate the provided tab widgets inside an
/// surrounding tab view.
///
/// It implements the [LitBottomNavigation] as a view layer and the required
/// logic for tracking the state and the for navigating between the tabs.
/// The tab wiew will ignore the any overlapping widgets when using a keyboard
/// by disabling the [Scaffold.resizeToAvoidBottomInset]. To reenable the
/// resize when using a keyboard, set the [resizeToAvoidBottomInset] to `true`.
///
/// Accoring to Material Design's guidelines (https://material.io/components/),
/// bottom app bars should be able to overlap when using the keyboard.
///
/// The [LitBottomNavigation] is used as view layer.
class LitTabView extends StatefulWidget {
/// The tabs the tab view should display.
final List<LitNavigableTab> tabs;

/// States whether to resize the tab view widgets when using a keyboard.
final bool resizeToAvoidBottomInset;

/// Creates a [LitTabView].
///
/// * [tabs] are the widget and data objects the view should display.
const LitTabView({Key? key, required this.tabs}) : super(key: key);
const LitTabView({
Key? key,
required this.tabs,
this.resizeToAvoidBottomInset = false,
}) : super(key: key);

@override
_LitTabViewState createState() => _LitTabViewState();
Expand Down Expand Up @@ -54,6 +68,7 @@ class _LitTabViewState extends State<LitTabView> {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset,
body: Builder(
builder: (context) {
return Stack(
Expand Down

0 comments on commit 37e1cef

Please sign in to comment.