forked from flutter/gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add debugLabel to HighlightFocus * Remove decrated property * Add focus to DestinationCards * Add index property to Forms * Move BackLayer stuff to its own file * Add focus * Revert deprecated change * Address feedback Former-commit-id: 49c7244
- Loading branch information
Showing
8 changed files
with
159 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// 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; | ||
|
||
BackLayerItem({Key key, 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); | ||
|
||
@override | ||
_BackLayerState createState() => _BackLayerState(); | ||
} | ||
|
||
class _BackLayerState extends State<BackLayer> { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
widget.tabController.addListener(() => setState(() {})); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final tabIndex = widget.tabController.index; | ||
return DefaultFocusTraversal( | ||
policy: WidgetOrderFocusTraversalPolicy(), | ||
child: IndexedStack( | ||
index: tabIndex, | ||
children: [ | ||
for (BackLayerItem backLayerItem in widget.backLayerItems) | ||
Focus( | ||
canRequestFocus: backLayerItem.index == tabIndex, | ||
debugLabel: 'backLayerItem: $backLayerItem', | ||
child: backLayerItem, | ||
) | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters