Начал разбираться с вызовом специфичной для андроида Activity

This commit is contained in:
Ivan Murashov
2017-07-11 19:00:56 +03:00
parent f0759467a8
commit 824f5142d9
5 changed files with 70 additions and 6 deletions

View File

@@ -1,4 +1,7 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
const String _name = "Ivan Murashov";
@@ -18,6 +21,7 @@ class ChatScreen extends StatefulWidget {
class ChatScreenState extends State<ChatScreen> {
static const platform = const MethodChannel('samples.flutter.io/battery');
final List<ChatMessage> _messages = <ChatMessage>[];
final TextEditingController _textController = new TextEditingController();
@@ -64,10 +68,19 @@ class ChatScreenState extends State<ChatScreen> {
decoration: textField)),
new Container(margin: new EdgeInsets.symmetric(horizontal: 4.0),
child: new IconButton(icon: new Icon(Icons.send),
onPressed: () => _handleSubmitted(_textController.text)))
onPressed: () => startScanner()))
// onPressed: () => _handleSubmitted(_textController.text)))
]);
}
Future<Null> startScanner() async {
try {
platform.invokeMethod('startScanner');
} on PlatformException catch (e) {
}
}
void _handleSubmitted(String text) {
_textController.clear();
ChatMessage message = new ChatMessage(text);