1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-11 07:18:15 +00:00

Add ValueTabController – generic feature!

This commit is contained in:
Kevin Moore
2019-05-24 20:29:50 -07:00
parent f87c2bb577
commit 62ffd22505
3 changed files with 92 additions and 90 deletions

View File

@@ -12,6 +12,7 @@ import 'flutter.dart';
import 'puzzle_flow_delegate.dart';
import 'shared_theme.dart';
import 'themes.dart';
import 'value_tab_controller.dart';
class PuzzleHomeState extends State with TickerProviderStateMixin, AppState {
@override
@@ -163,7 +164,8 @@ Widget _updateConstraints(
Widget _doBuild(BuildContext _, BoxConstraints constraints) =>
_updateConstraints(constraints, _doBuildCore);
Widget _doBuildCore(bool small) => PuzzleThemeTabController(
Widget _doBuildCore(bool small) => ValueTabController<SharedTheme>(
values: themes,
child: Consumer<SharedTheme>(
builder: (_, theme, __) => AnimatedContainer(
duration: puzzleAnimationDuration,
@@ -190,8 +192,7 @@ Widget _doBuildCore(bool small) => PuzzleThemeTabController(
margin:
const EdgeInsets.symmetric(horizontal: 20),
child: TabBar(
controller:
PuzzleThemeTabController.of(context),
controller: ValueTabController.of(context),
labelPadding:
const EdgeInsets.fromLTRB(0, 20, 0, 12),
labelColor: theme.puzzleAccentColor,