blob: d4e1ba3133abfdacd99f7d292778002102dc5c54 [file] [log] [blame]
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
abstract class BackLayerItem extends StatefulWidget {
final int index;
const BackLayerItem({Key key, @required this.index}) : super(key: key);
class BackLayer extends StatefulWidget {
final List<BackLayerItem> backLayerItems;
final TabController tabController;
const BackLayer({Key key, this.backLayerItems, this.tabController})
: super(key: key);
_BackLayerState createState() => _BackLayerState();
class _BackLayerState extends State<BackLayer> {
void initState() {
widget.tabController.addListener(() => setState(() {}));
Widget build(BuildContext context) {
final tabIndex = widget.tabController.index;
return IndexedStack(
index: tabIndex,
children: [
for (BackLayerItem backLayerItem in widget.backLayerItems)
excluding: backLayerItem.index != tabIndex,
child: backLayerItem,