Начал разбираться с вызовом специфичной для андроида Activity
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user