Navigation between screens without previous states showing.
This commit is contained in:
@@ -15,15 +15,15 @@ apply plugin: 'com.android.application'
|
|||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 25
|
compileSdkVersion 27
|
||||||
buildToolsVersion '25.0.0'
|
buildToolsVersion '27.0.3'
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
disable 'InvalidPackage'
|
disable 'InvalidPackage'
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
targetSdkVersion 21
|
targetSdkVersion 27
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
applicationId "com.dinect.checker"
|
applicationId "com.dinect.checker"
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,8 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flavorDimensions "checker"
|
||||||
|
|
||||||
// Не смог разобраться, как коомбинировать flavors в flutter при запуске
|
// Не смог разобраться, как коомбинировать flavors в flutter при запуске
|
||||||
|
|
||||||
productFlavors {
|
productFlavors {
|
||||||
@@ -185,7 +187,7 @@ flutter {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
compile 'com.android.support:appcompat-v7:27.1.0'
|
||||||
compile 'com.squareup.okhttp3:okhttp:3.8.1'
|
compile 'com.squareup.okhttp3:okhttp:3.8.1'
|
||||||
compile 'com.squareup.okio:okio:1.13.0'
|
compile 'com.squareup.okio:okio:1.13.0'
|
||||||
compile 'me.dm7.barcodescanner:zxing:1.9.8'
|
compile 'me.dm7.barcodescanner:zxing:1.9.8'
|
||||||
|
|||||||
@@ -15,15 +15,13 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginBottom="56dp"
|
android:layout_marginBottom="56dp"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"/>
|
||||||
android:background="#с0000000" />
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="56dp"
|
android:layout_marginTop="56dp"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5" />
|
||||||
android:background="#с0000000" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
google()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
google()
|
||||||
maven {
|
maven {
|
||||||
url "https://maven.google.com"
|
url "https://maven.google.com"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,10 +39,17 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext ctx) {
|
void initState() {
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
requestAsyncData(user);
|
requestAsyncData(user);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext ctx) {
|
||||||
return getMainWidget();
|
return getMainWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +179,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
child: new FlatButton(
|
child: new FlatButton(
|
||||||
child: new Text(title, style: new TextStyle(color: textColor)),
|
child: new Text(title, style: new TextStyle(color: textColor)),
|
||||||
// FIXME: onPressed: () => startScanner(context, app, helper)),
|
// FIXME: onPressed: () => startScanner(context, app, helper)),
|
||||||
onPressed: () => print('startScanner')),
|
onPressed: () => Navigator.of(context).pop(true)),
|
||||||
decoration: new BoxDecoration(
|
decoration: new BoxDecoration(
|
||||||
border: new Border.all(
|
border: new Border.all(
|
||||||
color: Resources.getButtonColor(app), width: 1.0),
|
color: Resources.getButtonColor(app), width: 1.0),
|
||||||
|
|||||||
@@ -28,13 +28,28 @@ class SplashScreen extends BaseScreen {
|
|||||||
class _SplashScreenState extends BaseState<SplashScreen> {
|
class _SplashScreenState extends BaseState<SplashScreen> {
|
||||||
|
|
||||||
_SplashScreenState(SqliteHelper helper, String app) : super(helper, app);
|
_SplashScreenState(SqliteHelper helper, String app) : super(helper, app);
|
||||||
|
bool a = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
|
||||||
|
print('init state!');
|
||||||
|
|
||||||
|
new Future.delayed(const Duration(milliseconds: 1000), () {
|
||||||
|
showNextScreen();
|
||||||
|
a = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext ctx) {
|
Widget build(BuildContext ctx) {
|
||||||
new Future.delayed(const Duration(milliseconds: 1000), () {
|
return a ? new Container(
|
||||||
showNextScreen();
|
decoration: new BoxDecoration(
|
||||||
});
|
image: new DecorationImage(
|
||||||
return getScreenContent();
|
image: new ExactAssetImage(Resources.getSplash(nullq)),
|
||||||
|
fit: BoxFit.cover))) : getScreenContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -151,6 +166,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
|||||||
// Канал ловит вызовы методов из "нативной" части приложения.
|
// Канал ловит вызовы методов из "нативной" части приложения.
|
||||||
// Могут быть вызваны либо exit либо faq, либо purchase.
|
// Могут быть вызваны либо exit либо faq, либо purchase.
|
||||||
platform.setMethodCallHandler((MethodCall call) {
|
platform.setMethodCallHandler((MethodCall call) {
|
||||||
|
print(this.toString());
|
||||||
if (call.method == 'findUser') {
|
if (call.method == 'findUser') {
|
||||||
String cardPhone = call.arguments[0];
|
String cardPhone = call.arguments[0];
|
||||||
var userResponse = getUser(call.arguments[1], cardPhone, token);
|
var userResponse = getUser(call.arguments[1], cardPhone, token);
|
||||||
@@ -190,18 +206,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
|||||||
String card = call.arguments[1];
|
String card = call.arguments[1];
|
||||||
print('$userString, $card');
|
print('$userString, $card');
|
||||||
|
|
||||||
new Future.delayed(const Duration(milliseconds: 200), () {
|
startScanner(token, userString, card);
|
||||||
var route = new MaterialPageRoute<bool>(
|
|
||||||
builder: (BuildContext context) => new PurchaseScreen(helper, app, userString, card),
|
|
||||||
fullscreenDialog: true);
|
|
||||||
Navigator.of(context).push(route).then((b) {
|
|
||||||
if (b) {
|
|
||||||
setState(() {
|
|
||||||
print('restart scanner!');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -221,6 +226,17 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startScanner(String token, String userString, String card) {
|
||||||
|
new Future.delayed(const Duration(milliseconds: 200), () {
|
||||||
|
var route = new MaterialPageRoute<bool>(
|
||||||
|
builder: (BuildContext context) => new PurchaseScreen(helper, app, userString, card), fullscreenDialog: true);
|
||||||
|
Navigator.of(context).push(route).then((b) {
|
||||||
|
print('purchase closed: $b');
|
||||||
|
_initAndStartScanner(context, app, token, helper);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Future<Response> getUser(String type, String cardPhone, String token) {
|
Future<Response> getUser(String type, String cardPhone, String token) {
|
||||||
try {
|
try {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user