Skip to content

Commit

Permalink
Merge pull request #32 from 2d-inc/upgrade_provider
Browse files Browse the repository at this point in the history
Upgrade provider to 2.0.0-dev
  • Loading branch information
filiph authored Apr 22, 2019
2 parents 387c819 + 02d9da0 commit d5e9f6a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
10 changes: 5 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class _MyAppState extends State<MyApp> {
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider(notifier: User()),
ChangeNotifierProvider(notifier: widget.world),
ChangeNotifierProvider(notifier: widget.world.characterPool),
ChangeNotifierProvider(notifier: widget.world.taskPool),
ChangeNotifierProvider(notifier: widget.world.company),
ChangeNotifierProvider(builder: (_) => User()),
ChangeNotifierProvider.value(notifier: widget.world),
ChangeNotifierProvider.value(notifier: widget.world.characterPool),
ChangeNotifierProvider.value(notifier: widget.world.taskPool),
ChangeNotifierProvider.value(notifier: widget.world.company),
],
child: MaterialApp(
title: 'Flutter Demo',
Expand Down
5 changes: 3 additions & 2 deletions lib/src/game_screen/character_pool_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class CharacterPoolPage extends StatelessWidget {
const EdgeInsets.only(left: 15.0, right: 15.0, bottom: 128.0),
itemCount: characterPool.children.length,
gridDelegate: _gridStructure,
itemBuilder: (context, index) => ChangeNotifierProvider<Character>(
itemBuilder: (context, index) =>
ChangeNotifierProvider<Character>.value(
notifier: characterPool.children[index],
key: ValueKey(characterPool.children[index]),
child: CharacterListItem(),
Expand Down Expand Up @@ -155,7 +156,7 @@ class CharacterDisplay extends StatelessWidget {
showDialog<void>(
context: context,
builder: (BuildContext context) {
return ChangeNotifierProvider<Character>(
return ChangeNotifierProvider<Character>.value(
notifier: character,
child: CharacterModal(),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/game_screen/task_pool_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TaskPoolPage extends StatelessWidget {
slivers.add(SliverList(
delegate: SliverChildBuilderDelegate((context, index) {
WorkItem item = workItems[index];
return ChangeNotifierProvider<WorkItem>(
return ChangeNotifierProvider<WorkItem>.value(
notifier: item,
key: ValueKey(item),
child: item is Bug ? BugListItem() : TaskListItem(),
Expand Down
7 changes: 1 addition & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ dependencies:
flutter:
sdk: flutter
intl: any
provider:
git:
url: https://github.com/rrousselGit/provider.git
# Pin the package to a specific commit in the v2.0 branch.
# TODO: use pub once 2.0 lands there
ref: ac6813432f1700b24cf7e4e8ff3f173e105c7d66
provider: ^2.0.0-dev

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
Expand Down

0 comments on commit d5e9f6a

Please sign in to comment.