Commit df78ec2b authored by Hixie's avatar Hixie

fix framework to match new mojo sdk

The dart bindings changed semantics in a non-compatible way.
parent b55dfd60
...@@ -142,7 +142,7 @@ class MeasurementFragmentState extends State<MeasurementFragment> { ...@@ -142,7 +142,7 @@ class MeasurementFragmentState extends State<MeasurementFragment> {
new Input( new Input(
key: weightKey, key: weightKey,
placeholder: 'Enter weight', placeholder: 'Enter weight',
keyboardType: KeyboardType.NUMBER, keyboardType: KeyboardType.number,
onChanged: _handleWeightChanged onChanged: _handleWeightChanged
), ),
], ],
......
...@@ -63,7 +63,7 @@ class SettingsFragmentState extends State<SettingsFragment> { ...@@ -63,7 +63,7 @@ class SettingsFragmentState extends State<SettingsFragment> {
content: new Input( content: new Input(
key: weightGoalKey, key: weightGoalKey,
placeholder: 'Goal weight in lbs', placeholder: 'Goal weight in lbs',
keyboardType: KeyboardType.NUMBER, keyboardType: KeyboardType.number,
onChanged: _handleGoalWeightChanged onChanged: _handleGoalWeightChanged
), ),
actions: <Widget>[ actions: <Widget>[
......
...@@ -113,7 +113,7 @@ class MineDiggerState extends State<MineDigger> { ...@@ -113,7 +113,7 @@ class MineDiggerState extends State<MineDigger> {
probe(ix, iy); probe(ix, iy);
}, },
onLongPress: () { onLongPress: () {
userFeedback.performHapticFeedback(HapticFeedbackType.LONG_PRESS); userFeedback.performHapticFeedback(HapticFeedbackType.longPress);
flag(ix, iy); flag(ix, iy);
}, },
child: new Listener( child: new Listener(
......
...@@ -57,10 +57,10 @@ void handlePointerPacket(ByteData serializedPacket) { ...@@ -57,10 +57,10 @@ void handlePointerPacket(ByteData serializedPacket) {
PointerPacket packet = PointerPacket.deserialize(message); PointerPacket packet = PointerPacket.deserialize(message);
for (Pointer pointer in packet.pointers) { for (Pointer pointer in packet.pointers) {
if (pointer.type == PointerType.DOWN) { if (pointer.type == PointerType.down) {
color = new ui.Color.fromARGB(255, 0, 0, 255); color = new ui.Color.fromARGB(255, 0, 0, 255);
ui.window.scheduleFrame(); ui.window.scheduleFrame();
} else if (pointer.type == PointerType.UP) { } else if (pointer.type == PointerType.up) {
color = new ui.Color.fromARGB(255, 0, 255, 0); color = new ui.Color.fromARGB(255, 0, 255, 0);
ui.window.scheduleFrame(); ui.window.scheduleFrame();
} }
......
...@@ -88,7 +88,7 @@ void handlePointerPacket(ByteData serializedPacket) { ...@@ -88,7 +88,7 @@ void handlePointerPacket(ByteData serializedPacket) {
PointerPacket packet = PointerPacket.deserialize(message); PointerPacket packet = PointerPacket.deserialize(message);
for (Pointer pointer in packet.pointers) { for (Pointer pointer in packet.pointers) {
if (pointer.type == PointerType.UP) { if (pointer.type == PointerType.up) {
imageCache.load(url2).first.then(handleImageLoad); imageCache.load(url2).first.then(handleImageLoad);
} }
} }
......
...@@ -60,7 +60,7 @@ class DemoBinding extends BindingBase with Scheduler, Renderer { ...@@ -60,7 +60,7 @@ class DemoBinding extends BindingBase with Scheduler, Renderer {
); );
PointerPacket packet = PointerPacket.deserialize(message); PointerPacket packet = PointerPacket.deserialize(message);
for (Pointer pointer in packet.pointers) { for (Pointer pointer in packet.pointers) {
if (pointer.type == PointerType.MOVE) if (pointer.type == PointerType.move)
image.growth = math.max(0.0, image.growth + pointer.x - touches[pointer.pointer].x); image.growth = math.max(0.0, image.growth + pointer.x - touches[pointer.pointer].x);
touches[pointer.pointer] = new Touch(pointer.x, pointer.y); touches[pointer.pointer] = new Touch(pointer.x, pointer.y);
} }
......
...@@ -42,7 +42,7 @@ class PointerEventConverter { ...@@ -42,7 +42,7 @@ class PointerEventConverter {
assert(_pointerKindMap.containsKey(datum.kind)); assert(_pointerKindMap.containsKey(datum.kind));
PointerDeviceKind kind = _pointerKindMap[datum.kind]; PointerDeviceKind kind = _pointerKindMap[datum.kind];
switch (datum.type) { switch (datum.type) {
case PointerType.DOWN: case PointerType.down:
assert(!_pointers.containsKey(datum.pointer)); assert(!_pointers.containsKey(datum.pointer));
_PointerState state = _pointers.putIfAbsent( _PointerState state = _pointers.putIfAbsent(
datum.pointer, datum.pointer,
...@@ -84,7 +84,7 @@ class PointerEventConverter { ...@@ -84,7 +84,7 @@ class PointerEventConverter {
tilt: datum.tilt tilt: datum.tilt
); );
break; break;
case PointerType.MOVE: case PointerType.move:
// If the service starts supporting hover pointers, then it must also // If the service starts supporting hover pointers, then it must also
// start sending us ADDED and REMOVED data points. // start sending us ADDED and REMOVED data points.
// See also: https://github.com/flutter/flutter/issues/720 // See also: https://github.com/flutter/flutter/issues/720
...@@ -114,14 +114,14 @@ class PointerEventConverter { ...@@ -114,14 +114,14 @@ class PointerEventConverter {
tilt: datum.tilt tilt: datum.tilt
); );
break; break;
case PointerType.UP: case PointerType.up:
case PointerType.CANCEL: case PointerType.cancel:
assert(_pointers.containsKey(datum.pointer)); assert(_pointers.containsKey(datum.pointer));
_PointerState state = _pointers[datum.pointer]; _PointerState state = _pointers[datum.pointer];
assert(state.down); assert(state.down);
assert(position == state.lastPosition); assert(position == state.lastPosition);
state.setUp(); state.setUp();
if (datum.type == PointerType.UP) { if (datum.type == PointerType.up) {
yield new PointerUpEvent( yield new PointerUpEvent(
timeStamp: timeStamp, timeStamp: timeStamp,
pointer: state.pointer, pointer: state.pointer,
...@@ -175,9 +175,9 @@ class PointerEventConverter { ...@@ -175,9 +175,9 @@ class PointerEventConverter {
} }
static const Map<PointerKind, PointerDeviceKind> _pointerKindMap = const <PointerKind, PointerDeviceKind>{ static const Map<PointerKind, PointerDeviceKind> _pointerKindMap = const <PointerKind, PointerDeviceKind>{
PointerKind.TOUCH: PointerDeviceKind.touch, PointerKind.touch: PointerDeviceKind.touch,
PointerKind.MOUSE: PointerDeviceKind.mouse, PointerKind.mouse: PointerDeviceKind.mouse,
PointerKind.STYLUS: PointerDeviceKind.stylus, PointerKind.stylus: PointerDeviceKind.stylus,
PointerKind.INVERTED_STYLUS: PointerDeviceKind.invertedStylus, PointerKind.invertedStylus: PointerDeviceKind.invertedStylus,
}; };
} }
...@@ -40,14 +40,14 @@ class _DatePickerState extends State<DatePicker> { ...@@ -40,14 +40,14 @@ class _DatePickerState extends State<DatePicker> {
_DatePickerMode _mode = _DatePickerMode.day; _DatePickerMode _mode = _DatePickerMode.day;
void _handleModeChanged(_DatePickerMode mode) { void _handleModeChanged(_DatePickerMode mode) {
userFeedback.performHapticFeedback(HapticFeedbackType.VIRTUAL_KEY); userFeedback.performHapticFeedback(HapticFeedbackType.virtualKey);
setState(() { setState(() {
_mode = mode; _mode = mode;
}); });
} }
void _handleYearChanged(DateTime dateTime) { void _handleYearChanged(DateTime dateTime) {
userFeedback.performHapticFeedback(HapticFeedbackType.VIRTUAL_KEY); userFeedback.performHapticFeedback(HapticFeedbackType.virtualKey);
setState(() { setState(() {
_mode = _DatePickerMode.day; _mode = _DatePickerMode.day;
}); });
...@@ -56,7 +56,7 @@ class _DatePickerState extends State<DatePicker> { ...@@ -56,7 +56,7 @@ class _DatePickerState extends State<DatePicker> {
} }
void _handleDayChanged(DateTime dateTime) { void _handleDayChanged(DateTime dateTime) {
userFeedback.performHapticFeedback(HapticFeedbackType.VIRTUAL_KEY); userFeedback.performHapticFeedback(HapticFeedbackType.virtualKey);
if (config.onChanged != null) if (config.onChanged != null)
config.onChanged(dateTime); config.onChanged(dateTime);
} }
......
...@@ -21,7 +21,7 @@ class Input extends Scrollable { ...@@ -21,7 +21,7 @@ class Input extends Scrollable {
this.hideText: false, this.hideText: false,
this.isDense: false, this.isDense: false,
this.onChanged, this.onChanged,
this.keyboardType: KeyboardType.TEXT, this.keyboardType: KeyboardType.text,
this.onSubmitted this.onSubmitted
}) : super( }) : super(
key: key, key: key,
......
...@@ -110,7 +110,7 @@ class _TimePickerState extends State<TimePicker> { ...@@ -110,7 +110,7 @@ class _TimePickerState extends State<TimePicker> {
_TimePickerMode _mode = _TimePickerMode.hour; _TimePickerMode _mode = _TimePickerMode.hour;
void _handleModeChanged(_TimePickerMode mode) { void _handleModeChanged(_TimePickerMode mode) {
userFeedback.performHapticFeedback(HapticFeedbackType.VIRTUAL_KEY); userFeedback.performHapticFeedback(HapticFeedbackType.virtualKey);
setState(() { setState(() {
_mode = mode; _mode = mode;
}); });
......
...@@ -62,13 +62,13 @@ class _Shell { ...@@ -62,13 +62,13 @@ class _Shell {
ServiceProviderProxy services = new ServiceProviderProxy.unbound(); ServiceProviderProxy services = new ServiceProviderProxy.unbound();
_shell.connectToApplication(url, services, null); _shell.connectToApplication(url, services, null);
var pipe = new core.MojoMessagePipe(); core.MojoMessagePipe pipe = new core.MojoMessagePipe();
proxy.impl.bind(pipe.endpoints[0]); proxy.impl.bind(pipe.endpoints[0]);
services.ptr.connectToService(proxy.name, pipe.endpoints[1]); services.ptr.connectToService(proxy.serviceName, pipe.endpoints[1]);
services.close(); services.close();
} }
void connectToService(String url, Object proxy) { void connectToService(String url, bindings.ProxyBase proxy) {
if (overrideConnectToService != null && overrideConnectToService(url, proxy)) if (overrideConnectToService != null && overrideConnectToService(url, proxy))
return; return;
_connectToService(url, proxy); _connectToService(url, proxy);
......
...@@ -126,7 +126,7 @@ class LongPressDraggable<T> extends DraggableBase<T> { ...@@ -126,7 +126,7 @@ class LongPressDraggable<T> extends DraggableBase<T> {
gestureArena: Gesturer.instance.gestureArena, gestureArena: Gesturer.instance.gestureArena,
longTapDelay: kLongPressTimeout, longTapDelay: kLongPressTimeout,
onLongTapDown: (Point position, int pointer) { onLongTapDown: (Point position, int pointer) {
userFeedback.performHapticFeedback(HapticFeedbackType.VIRTUAL_KEY); userFeedback.performHapticFeedback(HapticFeedbackType.virtualKey);
starter(position, pointer); starter(position, pointer);
} }
); );
......
...@@ -8,8 +8,8 @@ dependencies: ...@@ -8,8 +8,8 @@ dependencies:
collection: '>=1.1.3 <2.0.0' collection: '>=1.1.3 <2.0.0'
intl: '>=0.12.4+2 <0.13.0' intl: '>=0.12.4+2 <0.13.0'
material_design_icons: '>=0.0.3 <0.1.0' material_design_icons: '>=0.0.3 <0.1.0'
sky_engine: 0.0.83 sky_engine: 0.0.84
sky_services: 0.0.83 sky_services: 0.0.84
vector_math: '>=1.4.5 <2.0.0' vector_math: '>=1.4.5 <2.0.0'
quiver: '>=0.21.4 <0.22.0' quiver: '>=0.21.4 <0.22.0'
......
import 'package:flutter/src/services/shell.dart' as shell; import 'package:flutter/src/services/shell.dart' as shell;
import 'package:mojo/bindings.dart' as bindings;
// Tests can use ServiceMocker to register replacement implementations // Tests can use ServiceMocker to register replacement implementations
// of Mojo services. // of Mojo services.
...@@ -10,12 +11,12 @@ class _ServiceMocker { ...@@ -10,12 +11,12 @@ class _ServiceMocker {
// Map of interface names to mock implementations. // Map of interface names to mock implementations.
Map<String, Object> _interfaceMock = new Map<String, Object>(); Map<String, Object> _interfaceMock = new Map<String, Object>();
bool _connectToService(String url, dynamic proxy) { bool _connectToService(String url, bindings.ProxyBase proxy) {
Object mock = _interfaceMock[proxy.impl.name]; Object mock = _interfaceMock[proxy.serviceName];
if (mock != null) { if (mock != null) {
// Replace the proxy's implementation of the service interface with the // Replace the proxy's implementation of the service interface with the
// mock. // mock. The mojom bindings put the "ptr" field on all proxies.
proxy.ptr = mock; (proxy as dynamic).ptr = mock;
return true; return true;
} else { } else {
return false; return false;
......
...@@ -29,7 +29,7 @@ class MockKeyboard implements KeyboardService { ...@@ -29,7 +29,7 @@ class MockKeyboard implements KeyboardService {
void main() { void main() {
MockKeyboard mockKeyboard = new MockKeyboard(); MockKeyboard mockKeyboard = new MockKeyboard();
serviceMocker.registerMockService(KeyboardServiceName, mockKeyboard); serviceMocker.registerMockService(KeyboardService.serviceName, mockKeyboard);
test('Editable text has consistent width', () { test('Editable text has consistent width', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment