croupier: Upgrade to Flutter 0.0.14
This upgrades us to flutter 14 and solves a bunch of issues we had.
- android M permissions (given by Mojo now)
- syncbase name (not needed for the non "cloud" members)
- mojo path change (now a path directly to mojo_run)
- another file exports Orientation (so I renamed to CardCollectionOrientation)
- ui.view is now ui.window
Note: While 0.0.15 is available (embedder => shell), the UI doesn't
draw when I start the app (https://github.com/flutter/engine/issues/1901),
so I have fixed Croupier to 0.0.14
Change-Id: I2194f589107008aaa13f6570d930167f4e60b4b0
diff --git a/Makefile b/Makefile
index f787620..8f7d25e 100644
--- a/Makefile
+++ b/Makefile
@@ -41,10 +41,6 @@
# TODO(alexfandrianto): If we can do a better job of this, we won't have to
# special-case the first device.
SYNCBASE_FLAGS += --name=$(NAME)
-else
- # It turns out that the other syncbases need to be mounted too.
- # If not, it looks like they won't sync values to each other.
- SYNCBASE_FLAGS += --name=foo$(ANDROID)
endif
else
@@ -71,7 +67,7 @@
pub run sky_tools -v --very-verbose run_mojo \
--app $1 \
$(MOJO_ANDROID_FLAGS) \
- --mojo-path $(MOJO_DIR)/src \
+ --mojo-path $(MOJO_DIR)/src/mojo/devtools/common/mojo_run \
--checked \
--mojo-debug \
-- $(MOJO_SHELL_FLAGS) \
diff --git a/lib/components/board.dart b/lib/components/board.dart
index 1a44ce0..4e98cbb 100644
--- a/lib/components/board.dart
+++ b/lib/components/board.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-import 'card_collection.dart' show CardCollectionComponent, Orientation;
+import 'card_collection.dart' show CardCollectionComponent, CardCollectionOrientation;
import '../logic/card.dart' as logic_card;
import '../logic/game/game.dart' show Game, GameType;
import '../logic/hearts/hearts.dart' show HeartsGame;
@@ -69,7 +69,7 @@
for (int i = 0; i < 4; i++) {
List<logic_card.Card> cards =
game.cardCollections[i + HeartsGame.OFFSET_HAND];
- Orientation ori = i % 2 == 0 ? Orientation.horz : Orientation.vert;
+ CardCollectionOrientation ori = i % 2 == 0 ? CardCollectionOrientation.horz : CardCollectionOrientation.vert;
bool wide = (this.width >= this.height);
double smallerSide = wide ? this.height : this.width;
@@ -133,7 +133,7 @@
double MARGIN = 10.0;
CardCollectionComponent ccc = new CardCollectionComponent(
- cards, true, Orientation.show1,
+ cards, true, CardCollectionOrientation.show1,
width: this.cardWidth,
widthCard: this.cardWidth,
height: this.cardHeight,
diff --git a/lib/components/card_collection.dart b/lib/components/card_collection.dart
index d917b91..80c76a5 100644
--- a/lib/components/card_collection.dart
+++ b/lib/components/card_collection.dart
@@ -9,7 +9,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/material.dart' as material;
-enum Orientation { vert, horz, fan, show1, suit }
+enum CardCollectionOrientation { vert, horz, fan, show1, suit }
enum DropType {
none,
card,
@@ -30,7 +30,7 @@
class CardCollectionComponent extends StatefulComponent {
final List<logic_card.Card> cards;
- final Orientation orientation;
+ final CardCollectionOrientation orientation;
final bool faceUp;
final AcceptCb acceptCallback;
final bool dragChildren;
@@ -105,13 +105,13 @@
// returns null if it's up to the container (like a Flex) to figure this out.
double get desiredHeight {
switch (config.orientation) {
- case Orientation.vert:
+ case CardCollectionOrientation.vert:
return config.height;
- case Orientation.horz:
- case Orientation.fan:
- case Orientation.show1:
+ case CardCollectionOrientation.horz:
+ case CardCollectionOrientation.fan:
+ case CardCollectionOrientation.show1:
return _produceRowHeight;
- case Orientation.suit:
+ case CardCollectionOrientation.suit:
return _produceRowHeight * 4 + _whiteLineHeight * 3;
default:
assert(false);
@@ -122,12 +122,12 @@
// returns null if it's up to the container (like a Flex) to figure this out.
double get desiredWidth {
switch (config.orientation) {
- case Orientation.vert:
- case Orientation.show1:
+ case CardCollectionOrientation.vert:
+ case CardCollectionOrientation.show1:
return _produceColumnWidth;
- case Orientation.horz:
- case Orientation.fan:
- case Orientation.suit:
+ case CardCollectionOrientation.horz:
+ case CardCollectionOrientation.fan:
+ case CardCollectionOrientation.suit:
return config.width;
default:
assert(false);
@@ -214,16 +214,16 @@
Widget wrapCards(List<Widget> cardWidgets) {
switch (config.orientation) {
- case Orientation.vert:
+ case CardCollectionOrientation.vert:
return _produceColumn(cardWidgets);
- case Orientation.horz:
+ case CardCollectionOrientation.horz:
return _produceRow(cardWidgets);
- case Orientation.fan:
+ case CardCollectionOrientation.fan:
// unimplemented, so we'll fall through to show1, for now.
// Probably a Stack + Positioned
- case Orientation.show1:
+ case CardCollectionOrientation.show1:
return _produceSingle(cardWidgets);
- case Orientation.suit:
+ case CardCollectionOrientation.suit:
List<Widget> cs = new List<Widget>();
List<Widget> ds = new List<Widget>();
List<Widget> hs = new List<Widget>();
diff --git a/lib/components/croupier.dart b/lib/components/croupier.dart
index 8c9a4e7..bd1bc62 100644
--- a/lib/components/croupier.dart
+++ b/lib/components/croupier.dart
@@ -28,7 +28,7 @@
void initState() {
super.initState();
- // TODO(alexfandrianto): ui.view.width and ui.view.height?
+ // TODO(alexfandrianto): ui.window.size.width and ui.window.size.height?
// Croupier (logic) needs this in case of syncbase watch updates.
config.croupier.informUICb = _informUICb;
@@ -61,7 +61,7 @@
case logic_croupier.CroupierState.Welcome:
// in which we show them a UI to start a new game, join a game, or change some settings.
return new Container(
- padding: new EdgeDims.only(top: ui.view.paddingTop),
+ padding: new EdgeDims.only(top: ui.window.padding.top),
child: new Column([
new FlatButton(
child: new Text('Create Game'),
@@ -79,7 +79,7 @@
case logic_croupier.CroupierState.Settings:
// in which we let them pick an avatar, name, and color. And return to the previous screen after.
return new Container(
- padding: new EdgeDims.only(top: ui.view.paddingTop),
+ padding: new EdgeDims.only(top: ui.window.padding.top),
child: new CroupierSettingsComponent(
config.croupier.settings,
config.croupier.settings_manager.save,
@@ -87,7 +87,7 @@
case logic_croupier.CroupierState.ChooseGame:
// in which we let them pick a game out of the many possible games... There aren't that many.
return new Container(
- padding: new EdgeDims.only(top: ui.view.paddingTop),
+ padding: new EdgeDims.only(top: ui.window.padding.top),
child: new Flex([
new FlatButton(
child: new Text('Proto'),
@@ -113,7 +113,7 @@
case logic_croupier.CroupierState.AwaitGame:
// in which players wait for game invitations to arrive.
return new Container(
- padding: new EdgeDims.only(top: ui.view.paddingTop),
+ padding: new EdgeDims.only(top: ui.window.padding.top),
child: new Column([
new Text("Waiting for invitations..."),
new FlatButton(
@@ -130,7 +130,7 @@
// TODO(alexfandrianto): You can only start the game once there are enough players.
return new Container(
- padding: new EdgeDims.only(top: ui.view.paddingTop),
+ padding: new EdgeDims.only(top: ui.window.padding.top),
child: new Column([
new Grid(profileWidgets, maxChildExtent: 150.0),
new FlatButton(
@@ -144,7 +144,7 @@
]));
case logic_croupier.CroupierState.PlayGame:
return new Container(
- padding: new EdgeDims.only(top: ui.view.paddingTop),
+ padding: new EdgeDims.only(top: ui.window.padding.top),
child: component_game.createGameComponent(
config.croupier.game, () {
config.croupier.game.quit();
diff --git a/lib/components/game.dart b/lib/components/game.dart
index 734f483..3bb7105 100644
--- a/lib/components/game.dart
+++ b/lib/components/game.dart
@@ -10,7 +10,7 @@
import '../logic/solitaire/solitaire.dart' show SolitaireGame, SolitairePhase;
import 'board.dart' show HeartsBoard;
import 'card_collection.dart'
- show CardCollectionComponent, DropType, Orientation, AcceptCb;
+ show CardCollectionComponent, DropType, CardCollectionOrientation, AcceptCb;
import 'package:flutter/material.dart';
import 'package:flutter/material.dart' as material;
diff --git a/lib/components/hearts/hearts.part.dart b/lib/components/hearts/hearts.part.dart
index d14ec7e..2785ff0 100644
--- a/lib/components/hearts/hearts.part.dart
+++ b/lib/components/hearts/hearts.part.dart
@@ -243,7 +243,7 @@
plays.add(new CardCollectionComponent(
game.cardCollections[i + HeartsGame.OFFSET_PLAY],
true,
- Orientation.show1,
+ CardCollectionOrientation.show1,
width: config.width));
}
cardCollections.add(new Container(
@@ -263,7 +263,7 @@
child: new CardCollectionComponent(
game.cardCollections[p + HeartsGame.OFFSET_PLAY],
true,
- Orientation.show1,
+ CardCollectionOrientation.show1,
acceptCallback: _makeGameMoveCallback,
acceptType: p == game.whoseTurn ? DropType.card : DropType.none,
width: config.width,
@@ -277,7 +277,7 @@
List<logic_card.Card> cards = game.cardCollections[p];
CardCollectionComponent c = new CardCollectionComponent(
- cards, game.playerNumber == p, Orientation.suit,
+ cards, game.playerNumber == p, CardCollectionOrientation.suit,
dragChildren: game.whoseTurn == p,
comparator: _compareCards,
width: config.width);
@@ -361,7 +361,7 @@
justifyContent: FlexJustifyContent.spaceBetween));
Widget handArea = new CardCollectionComponent(
- hand, true, Orientation.suit,
+ hand, true, CardCollectionOrientation.suit,
acceptCallback: cb,
dragChildren: draggable,
acceptType: draggable ? DropType.card : null,
@@ -380,7 +380,7 @@
Widget _topCardWidget(List<logic_card.Card> cards, AcceptCb cb) {
Widget ccc = new CardCollectionComponent(
- cards, true, Orientation.show1,
+ cards, true, CardCollectionOrientation.show1,
acceptCallback: cb,
dragChildren: cb != null,
acceptType: cb != null ? DropType.card : null,
diff --git a/lib/components/proto/proto.part.dart b/lib/components/proto/proto.part.dart
index 6268da5..d714e89 100644
--- a/lib/components/proto/proto.part.dart
+++ b/lib/components/proto/proto.part.dart
@@ -22,7 +22,7 @@
for (int i = 0; i < 4; i++) {
List<logic_card.Card> cards = config.game.cardCollections[i];
CardCollectionComponent c = new CardCollectionComponent(
- cards, config.game.playerNumber == i, Orientation.horz,
+ cards, config.game.playerNumber == i, CardCollectionOrientation.horz,
dragChildren: true,
acceptType: DropType.card,
acceptCallback: _makeGameMoveCallback,
@@ -34,7 +34,7 @@
decoration: new BoxDecoration(
backgroundColor: material.Colors.green[500], borderRadius: 5.0),
child: new CardCollectionComponent(
- config.game.cardCollections[4], true, Orientation.show1,
+ config.game.cardCollections[4], true, CardCollectionOrientation.show1,
dragChildren: true,
acceptType: DropType.card,
acceptCallback: _makeGameMoveCallback,
diff --git a/lib/components/solitaire/solitaire.part.dart b/lib/components/solitaire/solitaire.part.dart
index 28630f0..15ebe8f 100644
--- a/lib/components/solitaire/solitaire.part.dart
+++ b/lib/components/solitaire/solitaire.part.dart
@@ -108,7 +108,7 @@
new CardCollectionComponent(
game.cardCollections[SolitaireGame.OFFSET_ACES + 0],
true,
- Orientation.show1,
+ CardCollectionOrientation.show1,
widthCard: cardSize,
heightCard: cardSize,
acceptCallback: _moveCallback,
@@ -117,7 +117,7 @@
new CardCollectionComponent(
game.cardCollections[SolitaireGame.OFFSET_ACES + 1],
true,
- Orientation.show1,
+ CardCollectionOrientation.show1,
widthCard: cardSize,
heightCard: cardSize,
acceptCallback: _moveCallback,
@@ -126,7 +126,7 @@
new CardCollectionComponent(
game.cardCollections[SolitaireGame.OFFSET_ACES + 2],
true,
- Orientation.show1,
+ CardCollectionOrientation.show1,
widthCard: cardSize,
heightCard: cardSize,
acceptCallback: _moveCallback,
@@ -135,7 +135,7 @@
new CardCollectionComponent(
game.cardCollections[SolitaireGame.OFFSET_ACES + 3],
true,
- Orientation.show1,
+ CardCollectionOrientation.show1,
widthCard: cardSize,
heightCard: cardSize,
acceptCallback: _moveCallback,
@@ -147,7 +147,7 @@
new CardCollectionComponent(
game.cardCollections[SolitaireGame.OFFSET_DISCARD],
true,
- Orientation.show1,
+ CardCollectionOrientation.show1,
widthCard: cardSize,
heightCard: cardSize,
dragChildren: true),
@@ -155,7 +155,7 @@
child: new CardCollectionComponent(
game.cardCollections[SolitaireGame.OFFSET_DRAW],
false,
- Orientation.show1,
+ CardCollectionOrientation.show1,
widthCard: cardSize,
heightCard: cardSize),
onTap: game.canDrawCard ? game.drawCardUI : null),
@@ -167,7 +167,7 @@
child: new CardCollectionComponent(
game.cardCollections[SolitaireGame.OFFSET_DOWN + i],
false,
- Orientation.show1,
+ CardCollectionOrientation.show1,
widthCard: cardSize,
heightCard: cardSize),
onTap: game.cardCollections[SolitaireGame.OFFSET_UP + i].length == 0
@@ -179,7 +179,7 @@
row3.add(new CardCollectionComponent(
game.cardCollections[SolitaireGame.OFFSET_UP + i],
true,
- Orientation.vert,
+ CardCollectionOrientation.vert,
widthCard: cardSize,
heightCard: cardSize,
height: config.height * 0.6,
diff --git a/pubspec.yaml b/pubspec.yaml
index 5e0491d..3da9478 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -2,7 +2,7 @@
dependencies:
discovery: ">=0.0.0 <0.1.0"
syncbase: ">=0.0.0 <0.1.0"
- flutter: ">=0.0.3 <0.1.0"
+ flutter: "0.0.14"
sky_tools: any
test: any