Изменил название пакета, начал работу по регистрации магазина
This commit is contained in:
@@ -15,18 +15,17 @@ apply plugin: 'com.android.application'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion '25.0.3'
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion '21.0.0'
|
||||
|
||||
lintOptions {
|
||||
disable 'InvalidPackage'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
targetSdkVersion 21
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.yourcompany.checker"
|
||||
applicationId "com.dinnect.checker"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -48,7 +47,7 @@ flutter {
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
androidTestCompile 'com.android.support:support-annotations:25.4.0'
|
||||
androidTestCompile 'com.android.support:support-annotations:21.0.0'
|
||||
androidTestCompile 'com.android.support.test:runner:0.5'
|
||||
androidTestCompile 'com.android.support.test:rules:0.5'
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.yourcompany.checker"
|
||||
package="com.dinnect.checker"
|
||||
android:versionCode="1"
|
||||
android:versionName="0.0.1">
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yourcompany.checker;
|
||||
package com.dinnect.checker;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.ActivityInfo;
|
||||
@@ -29,8 +29,8 @@ import net.sourceforge.zbar.Symbol;
|
||||
import net.sourceforge.zbar.SymbolSet;
|
||||
import net.sourceforge.zbar.Config;
|
||||
|
||||
import com.yourcompany.checker.R;
|
||||
import com.yourcompany.checker.view.CameraPreview;
|
||||
import com.dinnect.checker.R;
|
||||
import com.dinnect.checker.view.CameraPreview;
|
||||
|
||||
public class CameraActivity extends Activity {
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.yourcompany.checker;
|
||||
package com.dinnect.checker;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import com.yourcompany.checker.CameraActivity;
|
||||
import com.dinnect.checker.CameraActivity;
|
||||
|
||||
import io.flutter.app.FlutterActivity;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant;
|
||||
@@ -15,7 +15,7 @@ import io.flutter.plugin.common.MethodChannel.Result;
|
||||
|
||||
public class MainActivity extends FlutterActivity {
|
||||
|
||||
private static final String CHANNEL = "com.yourcompany.checker/scanner";
|
||||
private static final String CHANNEL = "com.dinnect.checker/scanner";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yourcompany.checker.view;
|
||||
package com.dinnect.checker.view;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@@ -370,7 +370,7 @@
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.checker;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.dinnect.checker;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -392,7 +392,7 @@
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.checker;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.dinnect.checker;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
|
||||
109
lib/main.dart
109
lib/main.dart
@@ -1,115 +1,14 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'registration.dart';
|
||||
|
||||
const String _name = "Ivan Murashov";
|
||||
|
||||
void main() {
|
||||
runApp(new DemoApp());
|
||||
runApp(new Checker());
|
||||
}
|
||||
|
||||
class DemoApp extends StatelessWidget {
|
||||
class Checker extends StatelessWidget {
|
||||
@override Widget build(BuildContext context) {
|
||||
return new MaterialApp(title: "DemoApp", home: new ChatScreen());
|
||||
}
|
||||
}
|
||||
|
||||
class ChatScreen extends StatefulWidget {
|
||||
@override State createState() => new ChatScreenState();
|
||||
}
|
||||
|
||||
class ChatScreenState extends State<ChatScreen> {
|
||||
|
||||
static const platform = const MethodChannel('com.yourcompany.checker/scanner');
|
||||
final List<ChatMessage> _messages = <ChatMessage>[];
|
||||
final TextEditingController _textController = new TextEditingController();
|
||||
|
||||
@override Widget build(BuildContext context) {
|
||||
return new Scaffold(appBar: new AppBar(
|
||||
title: new Text("DemoApp")), body: _buildScreen());
|
||||
}
|
||||
|
||||
Widget _buildScreen() {
|
||||
return new Column(children: <Widget>[
|
||||
new Flexible(child: new ListView.builder(
|
||||
padding: new EdgeInsets.all(8.0),
|
||||
reverse: true,
|
||||
itemBuilder: (_, int index) => _messages[index],
|
||||
itemCount: _messages.length)),
|
||||
new Divider(height: 1.0),
|
||||
new Container(decoration: _getDecoratedScreenComposer(),
|
||||
child: _buildStyledTextComposer())
|
||||
]);
|
||||
}
|
||||
|
||||
BoxDecoration _getDecoratedScreenComposer() {
|
||||
return new BoxDecoration(color: Theme.of(context).cardColor);
|
||||
}
|
||||
|
||||
Widget _buildStyledTextComposer() {
|
||||
return new IconTheme(data: _getIconThemeData(), child: _buildTextComposer());
|
||||
}
|
||||
|
||||
IconThemeData _getIconThemeData() {
|
||||
return new IconThemeData(color: Theme.of(context).accentColor);
|
||||
}
|
||||
|
||||
Widget _buildTextComposer() {
|
||||
return new Container(margin: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: _buildInputFieldRow());
|
||||
}
|
||||
|
||||
Row _buildInputFieldRow() {
|
||||
var textField = new InputDecoration.collapsed(hintText: "Send a message");
|
||||
return new Row(children: <Widget>[
|
||||
new Flexible(child: new TextField(controller: _textController,
|
||||
onSubmitted: _handleSubmitted,
|
||||
decoration: textField)),
|
||||
new Container(margin: new EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: new IconButton(icon: new Icon(Icons.send),
|
||||
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);
|
||||
setState(() {_messages.insert(0, message);});
|
||||
}
|
||||
}
|
||||
|
||||
class ChatMessage extends StatelessWidget {
|
||||
|
||||
final String text;
|
||||
|
||||
ChatMessage(this.text);
|
||||
|
||||
@override Widget build(BuildContext context) {
|
||||
return new Container(margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: _getMessageRow(context));
|
||||
}
|
||||
|
||||
Widget _getMessageRow(BuildContext context) {
|
||||
return new Row(crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Container(margin: const EdgeInsets.only(right: 16.0),
|
||||
child: new CircleAvatar(child: new Text(_name[0]))),
|
||||
new Column(crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(_name, style: Theme.of(context).textTheme.subhead),
|
||||
new Container(margin: const EdgeInsets.only(top: 4.0),
|
||||
child: new Text(text))
|
||||
])
|
||||
]);
|
||||
return new MaterialApp(title: "DemoApp", home: new RegistrationScreen());
|
||||
}
|
||||
}
|
||||
|
||||
54
lib/registration.dart
Normal file
54
lib/registration.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'dart:async';
|
||||
|
||||
/// Экран регистрации магазина и кассы.
|
||||
class RegistrationScreen extends StatefulWidget {
|
||||
@override State createState() => new _RegistrationScreenState();
|
||||
}
|
||||
|
||||
class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
|
||||
static const platform = const MethodChannel('com.dinnect.checker/scanner');
|
||||
|
||||
@override Widget build(BuildContext context) {
|
||||
return new Scaffold(appBar: new AppBar(
|
||||
title: new Text("Регистрация магазина")), body: _buildScreen());
|
||||
}
|
||||
|
||||
/// На экране будет отображаться Column, с отцентрированными виджетами.
|
||||
Widget _buildScreen() {
|
||||
return new Center(child: new Column(children: _getChildren()));
|
||||
}
|
||||
|
||||
Future<Null> startScanner() async {
|
||||
try {
|
||||
platform.invokeMethod('startScanner');
|
||||
} on PlatformException {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void _handleSubmitted(String text) {
|
||||
|
||||
}
|
||||
|
||||
List<Widget> _getChildren() {
|
||||
return<Widget>[
|
||||
_getLogo(),
|
||||
_getInputField("ID кассы"),
|
||||
_getInputField("Номер кассы"),
|
||||
];
|
||||
}
|
||||
|
||||
Row _getLogo() {
|
||||
return new Row(
|
||||
// TODO: Два Image() с логотипом
|
||||
);
|
||||
}
|
||||
|
||||
Container _getInputField(String hint) {
|
||||
return new Container(padding: new EdgeInsets.all(8.0),
|
||||
child: new TextField(decoration: new InputDecoration(hintText: hint))) ;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user