Browse Source

1.优化ios侧边返回的显示

tags/0.0.11+6
“yanghuaxuan” 4 years ago
parent
commit
db32e98c40
3 changed files with 51 additions and 45 deletions
  1. +29
    -29
      example/android/app/build.gradle
  2. +7
    -7
      example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java
  3. +15
    -9
      lib/pages/home_page/home_page.dart

+ 29
- 29
example/android/app/build.gradle View File

@@ -53,8 +53,8 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk { ndk {
//选择要添加的对应cpu类型的.so库。 //选择要添加的对应cpu类型的.so库。
// abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a' abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a'
abiFilters 'armeabi-v7a','x86_64' // abiFilters 'armeabi-v7a','x86_64'
} }
} }


@@ -109,33 +109,33 @@ android {




// 应用信息配置 // 应用信息配置
productFlavors { // productFlavors {
// 智夜生活 // // 智夜生活
zhiying { // zhiying {
applicationId "cn.zhios.zhiying" // applicationId "cn.zhios.zhiying"
versionCode 60 // versionCode 60
dimension "app" // dimension "app"
versionName '1.3.20' // versionName '1.3.20'
// 签名信息 // // 签名信息
signingConfig signingConfigs.zhiying // signingConfig signingConfigs.zhiying
} // }
} // }
//
// 打包脚本 // // 打包脚本
android.applicationVariants.all { variant -> // android.applicationVariants.all { variant ->
if (variant.buildType.name != "debug") { // if (variant.buildType.name != "debug") {
variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk") // variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk")
} // }
//
variant.outputs.all { output -> // variant.outputs.all { output ->
def outputFile = output.outputFile // def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) { // if (outputFile != null && outputFile.name.endsWith('.apk')) {
//这里修改apk文件名 // //这里修改apk文件名
def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk" // def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk"
outputFileName = fileName // outputFileName = fileName
} // }
} // }
} // }


configurations.all { configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details -> resolutionStrategy.eachDependency { DependencyResolveDetails details ->


+ 7
- 7
example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java View File

@@ -154,15 +154,15 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN
@Override @Override
public Map getSetting() { public Map getSetting() {
Map map = new HashMap(); Map map = new HashMap();
// ///测试 ///测试
// map.put("domain", "http://inapi.izhyin.cn/");//"http://120.76.175.204:8989");http://47.114.51.254:80 http://inapi.izhyin.cn/ map.put("domain", "http://inapi.izhyin.cn/");//"http://120.76.175.204:8989");http://47.114.51.254:80 http://inapi.izhyin.cn/
// map.put("master_id", "123456"); map.put("master_id", "123456");
// map.put("secret_key", "123456"); map.put("secret_key", "123456");


///正式 ///正式
map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn84198689 // map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn84198689
map.put("master_id", "99813608"); // map.put("master_id", "99813608");
map.put("secret_key", "123456"); // map.put("secret_key", "123456");


//客户测试 //客户测试
// map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn84198689 // map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn84198689


+ 15
- 9
lib/pages/home_page/home_page.dart View File

@@ -59,7 +59,7 @@ class HomePage extends StatefulWidget {
_HomePageState createState() => _HomePageState(); _HomePageState createState() => _HomePageState();
} }


class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, TickerProviderStateMixin { class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
int _currentIndex = 0; int _currentIndex = 0;
List<Map<String, dynamic>> _data = List(); List<Map<String, dynamic>> _data = List();
static const EventChannel _eventChannel = const EventChannel('JAVA_TO_FLUTTER'); static const EventChannel _eventChannel = const EventChannel('JAVA_TO_FLUTTER');
@@ -70,7 +70,7 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti
StreamSubscription logOutSubscription; StreamSubscription logOutSubscription;
StreamSubscription loginSubscription; StreamSubscription loginSubscription;


StreamSubscription eventChannelSubscription; StreamSubscription eventChannelSubscription;


@override @override
void initState() { void initState() {
@@ -126,7 +126,7 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti
//app后台杀死时候的还原 //app后台杀死时候的还原
Moblink.restoreScene(_restore); Moblink.restoreScene(_restore);
// 监听开始(传递监听到原生端,用户监听场景还原的数据回传回来) // 监听开始(传递监听到原生端,用户监听场景还原的数据回传回来)
eventChannelSubscription= _eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError); eventChannelSubscription = _eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError);


MobPushUtil.addPushReceiver(); MobPushUtil.addPushReceiver();
aliasSubscription = EventUtil.instance.on<LoginSuccessEvent>().listen((event) async { aliasSubscription = EventUtil.instance.on<LoginSuccessEvent>().listen((event) async {
@@ -153,13 +153,10 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti
MobPushUtil.setAlias(masterId + "_" + userInfo.userId); MobPushUtil.setAlias(masterId + "_" + userInfo.userId);
} }
}); });


} catch (e, s) { } catch (e, s) {
print(e); print(e);
print(s); print(s);
} }

} }


initBaseSet() { initBaseSet() {
@@ -194,6 +191,11 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti
super.didChangeAppLifecycleState(state); super.didChangeAppLifecycleState(state);
} }


@override
void didUpdateWidget(covariant HomePage oldWidget) {
super.didUpdateWidget(oldWidget);
}

@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ScreenUtil.init(context, width: 750, height: 1334); ScreenUtil.init(context, width: 750, height: 1334);
@@ -401,12 +403,15 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti
print("首页调用可见"); print("首页调用可见");
IntellectCreate.setCheck(true); IntellectCreate.setCheck(true);
} }

@override
// TODO: implement wantKeepAlive
bool get wantKeepAlive => true;
} }


final RouteObserver<Route> lifeObserver = RouteObserver(); final RouteObserver<Route> lifeObserver = RouteObserver();


abstract class LifeState<T extends StatefulWidget> extends State<T> abstract class LifeState<T extends StatefulWidget> extends State<T> with RouteAware {
with RouteAware {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@@ -424,13 +429,14 @@ abstract class LifeState<T extends StatefulWidget> extends State<T>
super.dispose(); super.dispose();
} }



void didPop() { void didPop() {
onPaused(); onPaused();
} }


void didPopNext() { void didPopNext() {
onResume(); onResume();
print("回到首页");
setState(() {});
} }


void didPush() { void didPush() {


||||||
x
 
000:0
Loading…
Cancel
Save