web: slide_puzzle - update to latest provider port

pull/92/head
Kevin Moore 5 years ago
parent 3d405359c7
commit 7a42263344

@ -90,7 +90,7 @@ class PuzzleHomeState extends State
providers: [ providers: [
Provider<AppState>.value(value: this), Provider<AppState>.value(value: this),
ListenableProvider<PuzzleControls>.value( ListenableProvider<PuzzleControls>.value(
listenable: _autoPlayListenable, value: _autoPlayListenable,
) )
], ],
child: Material( child: Material(
@ -201,91 +201,85 @@ Widget _doBuildCore(bool small) => ValueTabController<SharedTheme>(
values: themes, values: themes,
child: Consumer<SharedTheme>( child: Consumer<SharedTheme>(
builder: (_, theme, __) => AnimatedContainer( builder: (_, theme, __) => AnimatedContainer(
duration: puzzleAnimationDuration, duration: puzzleAnimationDuration,
color: theme.puzzleThemeBackground, color: theme.puzzleThemeBackground,
child: Center( child: Center(
child: theme.styledWrapper( child: theme.styledWrapper(
small, small,
SizedBox( SizedBox(
width: 580, width: 580,
child: Consumer<AppState>( child: Consumer<AppState>(
builder: (context, appState, _) => Column( builder: (context, appState, _) => Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Container( Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
color: Colors.black26, color: Colors.black26,
width: 1, width: 1,
), ),
), ),
), ),
margin: margin: const EdgeInsets.symmetric(horizontal: 20),
const EdgeInsets.symmetric(horizontal: 20), child: TabBar(
child: TabBar( controller: ValueTabController.of(context),
controller: ValueTabController.of(context), labelPadding: const EdgeInsets.fromLTRB(0, 20, 0, 12),
labelPadding: labelColor: theme.puzzleAccentColor,
const EdgeInsets.fromLTRB(0, 20, 0, 12), indicatorColor: theme.puzzleAccentColor,
labelColor: theme.puzzleAccentColor, indicatorWeight: 1.5,
indicatorColor: theme.puzzleAccentColor, unselectedLabelColor: Colors.black.withOpacity(0.6),
indicatorWeight: 1.5, tabs: themes
unselectedLabelColor: .map((st) => Text(
Colors.black.withOpacity(0.6), st.name.toUpperCase(),
tabs: themes style: const TextStyle(
.map((st) => Text( letterSpacing: 0.5,
st.name.toUpperCase(),
style: const TextStyle(
letterSpacing: 0.5,
),
))
.toList(),
),
),
Flexible(
child: Container(
padding: const EdgeInsets.all(10),
child: Flow(
delegate: PuzzleFlowDelegate(
small
? const Size(90, 90)
: const Size(140, 140),
appState.puzzle,
appState.animationNotifier,
),
children: List<Widget>.generate(
appState.puzzle.length,
(i) => theme.tileButtonCore(
i, appState.puzzle, small),
), ),
), ))
), .toList(),
), ),
Container( ),
decoration: const BoxDecoration( Flexible(
border: Border( child: Container(
top: BorderSide( padding: const EdgeInsets.all(10),
color: Colors.black26, width: 1), child: Flow(
), delegate: PuzzleFlowDelegate(
), small ? const Size(90, 90) : const Size(140, 140),
padding: const EdgeInsets.only( appState.puzzle,
left: 10, appState.animationNotifier,
bottom: 6, ),
top: 2, children: List<Widget>.generate(
right: 10, appState.puzzle.length,
), (i) => theme.tileButtonCore(
child: Consumer<PuzzleControls>( i, appState.puzzle, small),
builder: (_, controls, __) => Row( ),
children: theme.bottomControls(controls)),
),
)
],
), ),
), ),
),
Container(
decoration: const BoxDecoration(
border: Border(
top: BorderSide(color: Colors.black26, width: 1),
),
),
padding: const EdgeInsets.only(
left: 10,
bottom: 6,
top: 2,
right: 10,
),
child: Consumer<PuzzleControls>(
builder: (_, controls, __) =>
Row(children: theme.bottomControls(controls)),
),
)
],
), ),
), ),
), ),
), ),
),
),
), ),
); );

@ -68,7 +68,7 @@ class _ValueTabControllerState<T> extends State<ValueTabController<T>>
controller: _controller, controller: _controller,
enabled: TickerMode.of(context), enabled: TickerMode.of(context),
child: ValueListenableProvider.value( child: ValueListenableProvider.value(
valueListenable: _notifier, value: _notifier,
child: widget.child, child: widget.child,
), ),
); );

@ -339,10 +339,10 @@ packages:
description: description:
path: "." path: "."
ref: flutter_web ref: flutter_web
resolved-ref: "5cf4521d4d635d7d7ca8ddbd6e28048a7f319ee0" resolved-ref: e41db8e7d554360a6d8314c23b4fb4d5d5d9aac4
url: "https://github.com/kevmoo/provider" url: "https://github.com/kevmoo/provider"
source: git source: git
version: "2.1.0" version: "3.0.0+1"
pub_semver: pub_semver:
dependency: transitive dependency: transitive
description: description:

Loading…
Cancel
Save