Sfoglia il codice sorgente

1.统一字体,不跟随系统

2.优化启动页
tags/0.0.3+6
“yanghuaxuan” 4 anni fa
parent
commit
53560edf16
10 ha cambiato i file con 82 aggiunte e 40 eliminazioni
  1. +0
    -0
     
  2. +0
    -0
     
  3. +2
    -2
      example/android/app/build.gradle
  4. +57
    -3
      example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java
  5. +1
    -1
      example/android/app/src/main/res/values/strings.xml
  6. +3
    -14
      example/android/app/src/main/res/values/styles.xml
  7. BIN
     
  8. +6
    -2
      example/lib/main.dart
  9. +4
    -12
      example/pubspec.yaml
  10. +9
    -6
      lib/pages/launch_page/launch_page.dart

+ 0
- 0
Vedi File


+ 0
- 0
Vedi File


+ 2
- 2
example/android/app/build.gradle Vedi File

@@ -112,9 +112,9 @@ android {
// 智夜生活
zhiying {
applicationId "cn.zhios.zhiying"
versionCode 24
versionCode 25
dimension "app"
versionName '1.2.4'
versionName '1.2.5'
// 签名信息
signingConfig signingConfigs.zhiying
}


+ 57
- 3
example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java Vedi File

@@ -7,8 +7,12 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -30,15 +34,58 @@ import io.flutter.plugins.GeneratedPluginRegistrant;

public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommNativable {

FrameLayout view;

FrameLayout launchImageFrame;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
configureWindowForTransparency();
configureStatusBarForFullscreenFlutterExperience();

MobLink.setRestoreSceneListener(new MoblinkPlugin.SceneListener());
addLaunchView();

}


///添加启动页
void addLaunchView() {
view = (FrameLayout) this.getWindow().getDecorView();

launchImageFrame = new FrameLayout(this);

FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);

params.gravity = Gravity.CENTER;

launchImageFrame.setLayoutParams(params);


ImageView launchImageView = new ImageView(this);

FrameLayout.LayoutParams b_p = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);

b_p.gravity = Gravity.CENTER_HORIZONTAL;
launchImageView.setScaleType(ImageView.ScaleType.FIT_XY);
launchImageView.setLayoutParams(b_p);
launchImageView.setImageResource(R.mipmap.start);

launchImageFrame.addView(launchImageView, b_p);

view.addView(launchImageFrame, params);
}

///移除启动页
void removeLaunchView() {

if(view!=null&&launchImageFrame!=null){
Log.d("----------------","----------------------清除启动页---------------");
view.removeView(launchImageFrame);
}
launchImageFrame=null;
view=null;
}

@Override
@@ -92,7 +139,7 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN
Map map = new HashMap();
map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989");
// map.put("domain", "http://192.168.0.113:5000");
map.put("master_id", "123456");
map.put("master_id", "ios_review");
map.put("secret_key", "123456");
// map.put("token", "123465");
return map;
@@ -103,16 +150,23 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN
return;
}

@Override
public void initSuccess() {
Log.d("----------------","----------------------清除启动页---------------");
removeLaunchView();
}

@Override
protected void onDestroy() {
super.onDestroy();
ZhiyingFlutterCommNative.getInstance().unregist();
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);

if (newConfig.fontScale != 1){
if (newConfig.fontScale != 1) {
getResources();
}//非默认值
}


+ 1
- 1
example/android/app/src/main/res/values/strings.xml Vedi File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">智莺生活_内测版</string>
<string name="app_name">智莺生活</string>
</resources>

+ 3
- 14
example/android/app/src/main/res/values/styles.xml Vedi File

@@ -7,16 +7,11 @@
<!--这个是预先设置的背景图片-->
<item name="android:windowBackground">@mipmap/start</item>
<!--设置过渡效果,禁用窗口的预览动画-->
<item name="android:windowDisablePreview">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowDisablePreview">false</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:fullBackupOnly">true</item>
<item name="android:screenOrientation">portrait</item>
<item name="android:windowSoftInputMode">stateHidden</item>
<item name="android:configChanges">orientation|keyboardHidden|screenSize</item>



</style>
@@ -32,13 +27,7 @@
<item name="android:windowDisablePreview">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:fullBackupOnly">true</item>
<item name="android:screenOrientation">portrait</item>
<item name="android:windowSoftInputMode">stateHidden</item>
<item name="android:configChanges">orientation|keyboardHidden|screenSize</item>

</style>

</resources>

BIN
Vedi File


+ 6
- 2
example/lib/main.dart Vedi File

@@ -71,10 +71,14 @@ class _MyAppState extends State<MyApp> {
],
child: MaterialApp(
builder: (context,child){
MediaQuery.of(context).copyWith(textScaleFactor: 1);
return child;
return MediaQuery(
//设置文字大小不随系统设置改变
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: child,
);
},
theme: ThemeData(
fontFamily: 'PingFang',
primaryColor: HexColor.fromHex('#FF4242'),
accentColor: HexColor.fromHex('#FF4242'),
),


+ 4
- 12
example/pubspec.yaml Vedi File

@@ -52,17 +52,9 @@ flutter:
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
fonts:
- family: PingFang
fonts:
- asset: assets/fonts/PingFang.otf
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages

+ 9
- 6
lib/pages/launch_page/launch_page.dart Vedi File

@@ -55,7 +55,10 @@ class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin {
Logger.debug('ConnectivityResult.wifi');
print('ConnectivityResult.wifi');
Application.init().then((_) async {
NativeUtil.notifyInitSuccess();

Timer(Duration(milliseconds: 300), (){
NativeUtil.notifyInitSuccess();
});

PackageInfo packageInfo = await PackageInfo.fromPlatform();
String versionNumber = await SharedPreferencesUtil.getStringValue(Constants.versionNumber);
@@ -134,11 +137,11 @@ class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin {
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: Image.asset(
'assets/images/launch_image/launch_image.png',
package: 'zhiying_base_widget',
fit: BoxFit.fill,
),
// child: Image.asset(
// 'assets/images/launch_image/launch_image.png',
// package: 'zhiying_base_widget',
// fit: BoxFit.fill,
// ),
);
}
}

Caricamento…
Annulla
Salva