): T {
32 | return retrofit.create(clazz)
33 | }
34 |
35 | companion object {
36 | val instance by lazy {
37 | ApiManager()
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/base/BaseActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.base
2 |
3 | import android.content.Context
4 | import android.content.res.Configuration
5 | import android.os.Build
6 | import android.os.Bundle
7 | import android.view.Gravity
8 | import android.view.View
9 | import android.widget.Toast
10 | import androidx.appcompat.app.AppCompatActivity
11 |
12 | /**
13 | *
14 | * author : xiaweizi
15 | * class : com.example.flutter_dynamic_weather.base.BaseActivity
16 | * e-mail : 1012126908@qq.com
17 | * time : 2020/10/15
18 | * desc :
19 | *
20 | */
21 | abstract class BaseActivity : AppCompatActivity(), BaseCallback {
22 |
23 | override fun onCreate(savedInstanceState: Bundle?) {
24 | super.onCreate(savedInstanceState)
25 | setContentView(getLayoutId())
26 | initView()
27 | initData()
28 | }
29 |
30 | /**
31 | * 是否可以使用沉浸式
32 | * Is immersion bar enabled boolean.
33 | *
34 | * @return the boolean
35 | */
36 | protected open fun isImmersionBarEnabled(): Boolean {
37 | return true
38 | }
39 |
40 |
41 | override fun onConfigurationChanged(newConfig: Configuration) {
42 | super.onConfigurationChanged(newConfig)
43 |
44 | }
45 |
46 | override fun initView() {
47 |
48 | }
49 |
50 | override fun initData() {
51 |
52 | }
53 |
54 | private var toast: Toast? = null
55 |
56 | open fun showToastCenter(context: Context?, msg: String?) {
57 | if (toast != null) {
58 | toast!!.cancel()
59 | toast = null
60 | }
61 | toast = Toast.makeText(context, "", Toast.LENGTH_SHORT) //如果有居中显示需求
62 | toast?.setGravity(Gravity.CENTER, 0, 0)
63 | toast?.setText(msg)
64 | toast?.show()
65 | }
66 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/base/BaseCallback.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.base
2 |
3 | import androidx.annotation.LayoutRes
4 |
5 | /**
6 | *
7 | * author : xiaweizi
8 | * class : com.example.flutter_dynamic_weather.interfaces.BaseCallback
9 | * e-mail : 1012126908@qq.com
10 | * time : 2020/10/15
11 | * desc :
12 | *
13 | */
14 | interface BaseCallback {
15 | @LayoutRes
16 | fun getLayoutId(): Int
17 | fun initView()
18 | fun initData()
19 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/base/BaseConstant.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.base
2 |
3 | /**
4 | *
5 | * author : xiaweizi
6 | * class : com.example.flutter_dynamic_weather.base.BaseConstant
7 | * e-mail : 1012126908@qq.com
8 | * time : 2020/10/16
9 | * desc :
10 | *
11 | */
12 | class BaseConstant {
13 | companion object {
14 | const val BASE_URL = "https://api.caiyunapp.com/"
15 | const val FRAGMENT_NAME = "fragmentName"
16 | }
17 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/base/BaseFragment.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.base
2 |
3 | import android.content.Intent
4 | import android.os.Bundle
5 | import android.text.TextUtils
6 | import android.view.KeyEvent
7 | import android.view.LayoutInflater
8 | import android.view.View
9 | import android.view.ViewGroup
10 | import android.widget.Toast
11 | import androidx.fragment.app.Fragment
12 | import androidx.lifecycle.ViewModelProvider
13 | import com.umeng.analytics.MobclickAgent
14 |
15 |
16 | /**
17 | *
18 | * author : xiaweizi
19 | * class : com.example.flutter_dynamic_weather.base.BaseFragment
20 | * e-mail : 1012126908@qq.com
21 | * time : 2020/10/15
22 | * desc :
23 | *
24 | */
25 | abstract class BaseFragment : Fragment(), BaseCallback {
26 |
27 | private lateinit var mRootView: View
28 |
29 | override fun onCreateView(
30 | inflater: LayoutInflater,
31 | container: ViewGroup?,
32 | savedInstanceState: Bundle?
33 | ): View? {
34 | mRootView = inflater.inflate(getLayoutId(), container, false)
35 | return mRootView
36 | }
37 |
38 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
39 | super.onViewCreated(view, savedInstanceState)
40 | initView()
41 | initData()
42 | }
43 |
44 |
45 | override fun initView() {
46 | }
47 |
48 | override fun initData() {
49 | }
50 |
51 | fun finish() {
52 | if (activity != null && !activity!!.isFinishing) {
53 | activity?.finish()
54 | }
55 | }
56 |
57 | open fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
58 | return false
59 | }
60 |
61 | open fun onBackPressed(): Boolean {
62 | return false
63 | }
64 |
65 | open fun onNewIntent(intent: Intent?) {
66 | }
67 |
68 | // Fragment页面onResume函数重载
69 | override fun onResume() {
70 | super.onResume()
71 | MobclickAgent.onPageStart(this.javaClass.simpleName)
72 | }
73 |
74 | // Fragment页面onResume函数重载
75 | override fun onPause() {
76 | super.onPause()
77 | MobclickAgent.onPageEnd(this.javaClass.simpleName)
78 | }
79 |
80 | protected open fun showToast(message: String?) {
81 | if (!TextUtils.isEmpty(message)) {
82 | Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
83 | }
84 | }
85 |
86 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/base/BaseFragmentActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.base
2 |
3 | import android.content.Intent
4 | import android.view.KeyEvent
5 | import com.example.flutter_dynamic_weather.R
6 |
7 | /**
8 | *
9 | * author : xiaweizi
10 | * class : com.example.flutter_dynamic_weather.base.BaseFragmentActivity
11 | * e-mail : 1012126908@qq.com
12 | * time : 2020/10/15
13 | * desc :
14 | *
15 | */
16 | abstract class BaseFragmentActivity : BaseActivity() {
17 | var mFragment: BaseFragment? = null
18 | override fun getLayoutId() = R.layout.layout_public_activity
19 | override fun initView() {
20 | super.initView()
21 | // 初始化 fragment
22 | mFragment = getFragment()
23 | if (mFragment != null) {
24 | val beginTransaction = supportFragmentManager.beginTransaction()
25 | beginTransaction.replace(R.id.fl_root, mFragment!!)
26 | beginTransaction.commitAllowingStateLoss()
27 | }
28 | }
29 |
30 | abstract fun getFragment(): BaseFragment?
31 |
32 | override fun onNewIntent(intent: Intent?) {
33 | super.onNewIntent(intent)
34 | mFragment?.onNewIntent(intent)
35 | }
36 |
37 | override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
38 | if (mFragment != null) {
39 | if (!mFragment!!.onKeyDown(keyCode, event)) {
40 | return super.onKeyDown(keyCode, event)
41 | }
42 | }
43 | return super.onKeyDown(keyCode, event)
44 | }
45 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/base/CommonUtils.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.base
2 |
3 | import android.app.ActivityManager
4 | import android.app.PendingIntent
5 | import android.content.Context
6 | import android.content.Intent
7 | import android.location.LocationManager
8 | import android.net.Uri
9 | import androidx.core.content.ContextCompat.startActivity
10 | import com.eiffelyk.weather.weizi.map.MinuteFragment
11 |
12 |
13 | /**
14 | *
15 | * author : xiaweizi
16 | * class : com.eiffelyk.weather.weizi.middle.util.CommonUtils
17 | * e-mail : 1012126908@qq.com
18 | * time : 2020/10/21
19 | * desc :
20 | *
21 | */
22 |
23 | fun Intent.putParams(params: HashMap) {
24 | params.forEach {
25 | this.putExtra(it.key, it.value)
26 | }
27 | }
28 |
29 | class CommonUtils {
30 | companion object {
31 | private const val TAG = "CommonUtils::"
32 |
33 | fun startModuleActivity(
34 | context: Context,
35 | fragmentName: String,
36 | handleIntent: ((Intent) -> Unit)? = null
37 | ) {
38 | LogUtils.i(TAG, "startModuleActivity: $fragmentName")
39 | try {
40 | val intent = Intent(context, ModuleActivity::class.java)
41 | intent.putExtra(BaseConstant.FRAGMENT_NAME, fragmentName)
42 | handleIntent?.invoke(intent)
43 | startActivity(context, intent, null)
44 | } catch (e: Exception) {
45 | LogUtils.i(TAG, "startModuleActivity error ${e.message}")
46 | }
47 | }
48 |
49 | fun startMinutePage(context: Context, handleIntent: ((Intent) -> Unit)? = null) {
50 | startModuleActivity(context, MinuteFragment::class.java.name, handleIntent)
51 | }
52 |
53 | }
54 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/base/LogUtils.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.base
2 |
3 | import android.util.Log
4 |
5 | /**
6 | *
7 | * author : xiaweizi
8 | * class : com.eiffelyk.weather.weizi.middle.util.LogUtils
9 | * e-mail : 1012126908@qq.com
10 | * time : 2020/10/19
11 | * desc : 日志工具类
12 | *
13 | */
14 | class LogUtils {
15 | companion object {
16 | fun i(tag: String, content: String) {
17 | Log.i("Weather-$tag", content)
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/base/ModuleActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.base
2 |
3 | /**
4 | *
5 | * author : xiaweizi
6 | * class : com.example.flutter_dynamic_weather.base.ModuleActivity
7 | * e-mail : 1012126908@qq.com
8 | * time : 2020/10/21
9 | * desc :
10 | *
11 | */
12 | class ModuleActivity: BaseFragmentActivity() {
13 |
14 | override fun getFragment(): BaseFragment? {
15 | return newInsFragment()
16 | }
17 |
18 | private fun newInsFragment(): BaseFragment? {
19 | if (mFragment == null) {
20 | try {
21 | val fragmentName = intent.getStringExtra(BaseConstant.FRAGMENT_NAME)
22 | val onwClass = Class.forName(fragmentName!!)
23 | val instance = onwClass.newInstance()
24 | mFragment = instance as BaseFragment
25 | } catch (e: Throwable) {
26 | e.printStackTrace()
27 | }
28 | }
29 | return mFragment
30 | }
31 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/base/UiUtils.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.base
2 |
3 | import android.content.res.Resources
4 | import android.util.DisplayMetrics
5 | import androidx.appcompat.app.AppCompatActivity
6 | import androidx.fragment.app.FragmentActivity
7 |
8 | /**
9 | *
10 | * author : xiaweizi
11 | * class : com.eiffelyk.weather.weizi.middle.util.UiUtils
12 | * e-mail : 1012126908@qq.com
13 | * time : 2020/10/17
14 | * desc :
15 | *
16 | */
17 | class UiUtils {
18 | companion object {
19 | fun getStatusBarHeight(): Int {
20 | val resources = Resources.getSystem()
21 | val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
22 | return resources.getDimensionPixelOffset(resourceId)
23 | }
24 |
25 | fun getScreenHeight(context: FragmentActivity): Int {
26 | val outMetrics = DisplayMetrics()
27 | context.windowManager.defaultDisplay.getMetrics(outMetrics)
28 | return outMetrics.heightPixels
29 | }
30 |
31 | fun getScreenWidth(context: FragmentActivity): Int {
32 | val outMetrics = DisplayMetrics()
33 | context.windowManager.defaultDisplay.getRealMetrics(outMetrics)
34 | return outMetrics.widthPixels
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/base/WeatherUtils.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.base
2 |
3 | /**
4 | *
5 | * author ,xiaweizi
6 | * class ,com.example.flutter_dynamic_weather.base.WeatherUtils
7 | * e-mail ,1012126908@qq.com
8 | * time ,2020/11/15
9 | * desc :
10 | *
11 | */
12 | class WeatherUtils {
13 | companion object {
14 | val weatherMap = hashMapOf(
15 | Pair("CLEAR_DAY", "晴"),
16 | Pair("CLEAR_NIGHT", "晴"),
17 | Pair("PARTLY_CLOUDY_DAY", "多云"),
18 | Pair("PARTLY_CLOUDY_NIGHT", "多云"),
19 | Pair("CLOUDY", "阴"),
20 | Pair("LIGHT_HAZE", "霾"),
21 | Pair("MODERATE_HAZE", "霾"),
22 | Pair("HEAVY_HAZE", "霾"),
23 | Pair("LIGHT_RAIN", "小雨"),
24 | Pair("MODERATE_RAIN", "中雨"),
25 | Pair("HEAVY_RAIN", "大雨"),
26 | Pair("STORM_RAIN", "暴雨"),
27 | Pair("FOG", "雾"),
28 | Pair("LIGHT_SNOW", "小雪"),
29 | Pair("MODERATE_SNOW", "中雪"),
30 | Pair("HEAVY_SNOW", "大雪"),
31 | Pair("STORM_SNOW", "暴雪"),
32 | Pair("DUST", "浮尘"),
33 | Pair("SAND", "沙尘"),
34 | Pair("WIND", "大风"),
35 | )
36 |
37 | fun getWeatherDesc(type: String): String? {
38 | return weatherMap[type]
39 | }
40 |
41 | fun getAqiDesc(aqi: Int): String? {
42 | if (aqi in 0..50) {
43 | return "优"
44 | }
45 | if (aqi in 51..100) {
46 | return "良"
47 | }
48 | if (aqi in 101..150) {
49 | return "轻度污染"
50 | }
51 | if (aqi in 151..200) {
52 | return "中度污染"
53 | }
54 | if (aqi in 201..300) {
55 | return "重度污染"
56 | }
57 | return if (aqi > 300) {
58 | "严重污染"
59 | } else ""
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/fragment/JikeFragment.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.fragment
2 |
3 | import com.example.flutter_dynamic_weather.R
4 | import com.example.flutter_dynamic_weather.base.BaseFragment
5 |
6 | /**
7 | *
8 | * author : xiaweizi
9 | * class : com.example.flutter_dynamic_weather.fragment.ZhuGeFragment
10 | * e-mail : 1012126908@qq.com
11 | * time : 2020/11/22
12 | * desc :
13 | *
14 | */
15 | class JikeFragment : BaseFragment() {
16 | override fun getLayoutId() = R.layout.layout_jike
17 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/fragment/ZhuGeFragment.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.fragment
2 |
3 | import com.example.flutter_dynamic_weather.R
4 | import com.example.flutter_dynamic_weather.base.BaseFragment
5 |
6 | /**
7 | *
8 | * author : xiaweizi
9 | * class : com.example.flutter_dynamic_weather.fragment.ZhuGeFragment
10 | * e-mail : 1012126908@qq.com
11 | * time : 2020/11/22
12 | * desc :
13 | *
14 | */
15 | class ZhuGeFragment : BaseFragment() {
16 | override fun getLayoutId() = R.layout.layout_zhuge
17 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/map/AmapLocationMarkerView.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.map
2 |
3 | import android.content.Context
4 | import android.graphics.Canvas
5 | import android.graphics.Paint
6 | import android.util.AttributeSet
7 | import android.view.View
8 | import com.example.flutter_dynamic_weather.R
9 |
10 | /**
11 | *
12 | * author : xiaweizi
13 | * class : com.eiffelyk.weather.weizi.map.AmapLocationMarkerView
14 | * e-mail : 1012126908@qq.com
15 | * time : 2020/11/08
16 | * desc :
17 | *
18 | */
19 | class AmapLocationMarkerView : View {
20 | private var mOuterRadius = 0
21 | private var mInnerRadius = 0
22 | private var mPaint: Paint? = null
23 | private var mOuterColor = 0
24 | private var mInnerColor = 0
25 |
26 | constructor(context: Context?) : this(context, null)
27 | constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, -1)
28 | constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
29 | context,
30 | attrs,
31 | defStyleAttr
32 | ) {
33 | initView(context!!)
34 | }
35 |
36 |
37 | private fun initView(context: Context) {
38 | mOuterRadius =
39 | resources.getDimensionPixelSize(R.dimen.amap_marker_view_located_outer_radius)
40 | mInnerRadius =
41 | resources.getDimensionPixelSize(R.dimen.amap_marker_view_located_inner_radius)
42 | mOuterColor = resources.getColor(R.color.amap_marker_view_located_outer_color)
43 | mInnerColor = resources.getColor(R.color.amap_marker_view_located_inner_color)
44 | mPaint = Paint(Paint.ANTI_ALIAS_FLAG)
45 | mPaint!!.style = Paint.Style.FILL
46 | }
47 |
48 | override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
49 | super.onMeasure(widthMeasureSpec, heightMeasureSpec)
50 | setMeasuredDimension(mOuterRadius * 2, mOuterRadius * 2)
51 | }
52 |
53 | override fun onDraw(canvas: Canvas) {
54 | super.onDraw(canvas)
55 | mPaint!!.color = mOuterColor
56 | canvas.drawCircle(
57 | width / 2.toFloat(), height / 2.toFloat(), mOuterRadius.toFloat(),
58 | mPaint!!
59 | )
60 | mPaint!!.color = mInnerColor
61 | canvas.drawCircle(
62 | width / 2.toFloat(), height / 2.toFloat(), mInnerRadius.toFloat(),
63 | mPaint!!
64 | )
65 | }
66 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/map/MinuteProgressView.kt:
--------------------------------------------------------------------------------
1 | package com.eiffelyk.weather.weizi.map
2 |
3 | import android.annotation.SuppressLint
4 | import android.content.Context
5 | import android.graphics.*
6 | import android.util.AttributeSet
7 | import android.view.MotionEvent
8 | import android.view.View
9 | import com.example.flutter_dynamic_weather.R
10 | import kotlin.math.max
11 | import kotlin.math.min
12 |
13 | /**
14 | *
15 | * author : xiaweizi
16 | * class : com.eiffelyk.weather.weizi.map.MinuteProgressView
17 | * e-mail : 1012126908@qq.com
18 | * time : 2020/11/08
19 | * desc :
20 | *
21 | */
22 | class MinuteProgressView : View {
23 | private val mStartColor by lazy {
24 | resources.getColor(R.color.amap_progress_bg_start_color)
25 | }
26 | private val mEndColor by lazy {
27 | resources.getColor(R.color.amap_progress_bg_end_color)
28 | }
29 | private val mPaint = Paint(Paint.ANTI_ALIAS_FLAG)
30 | private val mRectF = RectF()
31 |
32 | private var mLinearGradient: LinearGradient? = null
33 | private var mRatio = 0.0f
34 | private var mCallback: OnProgressCallback? = null
35 | private var mIsPlaying = false
36 |
37 | constructor(context: Context?) : this(context, null)
38 | constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, -1)
39 | constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
40 | context,
41 | attrs,
42 | defStyleAttr
43 | )
44 |
45 | fun setProgressCallback(callback: OnProgressCallback?) {
46 | this.mCallback = callback
47 | }
48 |
49 | fun setRatio(ratio: Float) {
50 | mRatio = ratio
51 | invalidate()
52 | }
53 |
54 | override fun onDraw(canvas: Canvas?) {
55 | super.onDraw(canvas)
56 | if (mLinearGradient == null) {
57 | mLinearGradient = LinearGradient(
58 | 0f,
59 | 0f,
60 | width.toFloat(),
61 | height.toFloat(),
62 | intArrayOf(mStartColor, mEndColor),
63 | null,
64 | Shader.TileMode.CLAMP
65 | )
66 | mPaint.shader = mLinearGradient
67 | }
68 | mRectF.set(0f, 0f, width.toFloat() * mRatio, height.toFloat())
69 | canvas?.drawRect(mRectF, mPaint)
70 | }
71 |
72 | @SuppressLint("ClickableViewAccessibility")
73 | override fun onTouchEvent(event: MotionEvent?): Boolean {
74 | if (event != null && mCallback != null) {
75 | val x = event.x
76 | when (event.actionMasked) {
77 | MotionEvent.ACTION_DOWN -> {
78 | mRatio = min(width.toFloat(), max(0f, x)) / width
79 | invalidate()
80 | mIsPlaying = mCallback?.onDown(mRatio) ?: false
81 | }
82 | MotionEvent.ACTION_MOVE -> {
83 | mRatio = min(width.toFloat(), max(0f, x)) / width
84 | invalidate()
85 | mCallback?.onMove(mRatio)
86 | }
87 | MotionEvent.ACTION_UP -> {
88 | mCallback?.onUp(mIsPlaying)
89 | }
90 |
91 | }
92 | }
93 | return true
94 | }
95 |
96 | interface OnProgressCallback {
97 | fun onDown(ratio: Float): Boolean
98 | fun onMove(ratio: Float)
99 | fun onUp(isPlaying: Boolean)
100 | }
101 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/map/MinuteResponse.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.map
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 |
6 | /**
7 | *
8 | * author : xiaweizi
9 | * class : com.example.flutter_dynamic_weather.map.MinuteResponse
10 | * e-mail : 1012126908@qq.com
11 | * time : 2020/11/15
12 | * desc :
13 | *
14 | */
15 | data class MinuteResponse(
16 | @SerializedName("api_status")
17 | val apiStatus: String, // active
18 | @SerializedName("api_version")
19 | val apiVersion: String, // v2.5
20 | @SerializedName("lang")
21 | val lang: String, // zh_CN
22 | @SerializedName("location")
23 | val location: List,
24 | @SerializedName("result")
25 | val result: Result,
26 | @SerializedName("server_time")
27 | val serverTime: Int, // 1605416697
28 | @SerializedName("status")
29 | val status: String, // ok
30 | @SerializedName("timezone")
31 | val timezone: String, // Asia/Taipei
32 | @SerializedName("tzshift")
33 | val tzshift: Int, // 28800
34 | @SerializedName("unit")
35 | val unit: String // metric
36 | )
37 |
38 | data class Result(
39 | @SerializedName("forecast_keypoint")
40 | val forecastKeypoint: String, // 大风起兮……注意不要被风刮跑
41 | @SerializedName("minutely")
42 | val minutely: Minutely,
43 | @SerializedName("primary")
44 | val primary: Int // 0
45 | )
46 |
47 | data class Minutely(
48 | @SerializedName("datasource")
49 | val datasource: String, // gfs
50 | @SerializedName("description")
51 | val description: String, // 大风起兮……注意不要被风刮跑
52 | @SerializedName("precipitation")
53 | val precipitation: List,
54 | @SerializedName("precipitation_2h")
55 | val precipitation2h: List,
56 | @SerializedName("probability")
57 | val probability: List,
58 | @SerializedName("status")
59 | val status: String // ok
60 | )
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/map/MinuteService.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.map
2 |
3 | import okhttp3.ResponseBody
4 | import retrofit2.Call
5 | import retrofit2.http.GET
6 | import retrofit2.http.Path
7 | import retrofit2.http.Query
8 |
9 | /**
10 | *
11 | * author : xiaweizi
12 | * class : com.example.flutter_dynamic_weather.map.MinuteService
13 | * e-mail : 1012126908@qq.com
14 | * time : 2020/11/08
15 | * desc :
16 | *
17 | */
18 | interface MinuteService {
19 |
20 | @GET("/v1/radar/forecast_images?level=2&token=leWWGdduHOh6bAkw")
21 | fun getForecastImages(@Query("lon") lon: String, @Query("lat") lat: String): Call
22 |
23 | @GET("/v2.5/leWWGdduHOh6bAkw/{lon},{lat}/minutely.json")
24 | fun getMinutely(@Path("lon") lon: String, @Path("lat") lat: String): Call
25 |
26 | @GET("/v2.5/leWWGdduHOh6bAkw/{lon},{lat}/realtime.json")
27 | fun getRealtime(@Path("lon") lon: String, @Path("lat") lat: String): Call
28 | }
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/map/RainData.kt:
--------------------------------------------------------------------------------
1 | package com.eiffelyk.weather.weizi.map
2 |
3 | import android.graphics.Bitmap
4 |
5 | /**
6 | *
7 | * author : xiaweizi
8 | * class : com.eiffelyk.weather.weizi.map.MinuteData
9 | * e-mail : 1012126908@qq.com
10 | * time : 2020/11/08
11 | * desc :
12 | *
13 | */
14 | data class RainData(
15 | var leftLat: Double,
16 | var leftLong: Double,
17 | var rightLat: Double,
18 | var rightLong: Double,
19 | var srcBitmap: Bitmap? = null,
20 | var srcUrl: String,
21 | var time: String,
22 | )
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/map/WeatherAllData.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.map
2 |
3 | /**
4 | *
5 | * author : xiaweizi
6 | * class : com.example.flutter_dynamic_weather.map.MinuteData
7 | * e-mail : 1012126908@qq.com
8 | * time : 2020/11/15
9 | * desc :
10 | *
11 | */
12 | data class WeatherAllData(
13 | val minuteDesc: String,
14 | val precipitation2h: List,
15 | val weatherDesc: String,
16 | val temp: String,
17 | val aqiDesc: String,
18 | val updateTimeDesc: String,
19 | val updateTime: Long,
20 | )
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_dynamic_weather/widget/BigWidgetSettingActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_dynamic_weather.widget
2 |
3 | import android.app.Activity
4 | import android.appwidget.AppWidgetManager
5 | import android.content.Intent
6 | import androidx.appcompat.app.AppCompatActivity
7 | import android.os.Bundle
8 | import android.widget.RemoteViews
9 | import com.example.flutter_dynamic_weather.R
10 | import com.example.flutter_dynamic_weather.base.BaseActivity
11 |
12 | class BigWidgetSettingActivity : BaseActivity() {
13 |
14 | private var appWidgetId: Int = AppWidgetManager.INVALID_APPWIDGET_ID
15 | override fun initView() {
16 | super.initView()
17 | appWidgetId = intent?.extras?.getInt(
18 | AppWidgetManager.EXTRA_APPWIDGET_ID,
19 | AppWidgetManager.INVALID_APPWIDGET_ID
20 | ) ?: AppWidgetManager.INVALID_APPWIDGET_ID
21 | // onCancelConfig()
22 | }
23 |
24 | override fun getLayoutId() = R.layout.activity_big_widget_setting
25 |
26 | override fun onBackPressed() {
27 | onCompleteConfig()
28 | }
29 |
30 | private fun onCompleteConfig() {
31 | val appWidgetManager: AppWidgetManager = AppWidgetManager.getInstance(this)
32 | RemoteViews(packageName, R.layout.layout_widget_big).also { views->
33 | appWidgetManager.updateAppWidget(appWidgetId, views)
34 | }
35 | val resultValue = Intent().apply {
36 | putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
37 | }
38 | setResult(Activity.RESULT_OK, resultValue)
39 | finish()
40 | }
41 |
42 | private fun onCancelConfig() {
43 | val resultValue = Intent().apply {
44 | putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
45 | }
46 | setResult(Activity.RESULT_CANCELED, resultValue)
47 | }
48 |
49 | }
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-nodpi/example_appwidget_preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/drawable-nodpi/example_appwidget_preview.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/shape_minute_bottom_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/shape_minute_progress_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/android/app/src/main/res/layout/activity_big_widget_setting.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/main/res/layout/layout_jike.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
17 |
18 |
--------------------------------------------------------------------------------
/android/app/src/main/res/layout/layout_public_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/android/app/src/main/res/layout/layout_widget_big.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
--------------------------------------------------------------------------------
/android/app/src/main/res/layout/layout_zhuge.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
17 |
18 |
--------------------------------------------------------------------------------
/android/app/src/main/res/layout/weather_anim_widget.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/cloud.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/cloud.webp
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_common_location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/ic_common_location.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_common_refresh_vector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/ic_common_refresh_vector.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_rain_area_pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/ic_rain_area_pause.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_rain_area_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/ic_rain_area_play.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_zoom_in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/ic_zoom_in.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_zoom_out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/ic_zoom_out.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/icon_app_widget_tools_4x1_shili.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/icon_app_widget_tools_4x1_shili.webp
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/icon_app_widget_tools_4x2_shili.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/icon_app_widget_tools_4x2_shili.webp
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/icon_location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/icon_location.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/intensity_of_rainfall_legend.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/intensity_of_rainfall_legend.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/lightning0.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/lightning0.webp
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/lightning1.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/lightning1.webp
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/lightning2.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/lightning2.webp
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/lightning3.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/lightning3.webp
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/lightning4.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/lightning4.webp
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/rain.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/rain.webp
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/zx_left_drawer_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/android/app/src/main/res/mipmap-xxhdpi/zx_left_drawer_back.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #fff
5 |
6 | #0000
7 | #000
8 | #666666
9 | #E3E3E3
10 | #4277FF
11 | #fdfdfd
12 | #f0f0f0
13 |
14 | #33C55C45
15 | #C55C45
16 | #807272
17 | #992196F3
18 | #002196F3
19 |
20 | #33BF5256
21 | #2196F3
22 | #802196F3
23 | #032196F3
24 | #FFE1F5FE
25 | #FF81D4FA
26 | #FF039BE5
27 | #FF01579B
28 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 15.27dp
4 | 6.18dp
5 |
6 | 100dp
7 | 45dp
8 | 12dp
9 | 250dp
10 | 12dp
11 |
12 | 45dp
13 | 10dp
14 | 25dp
15 | 35dp
16 | 12dp
17 |
18 |
22 | 0dp
23 | 250dp
24 | 110dp
25 |
26 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | EXAMPLE
3 | Add widget
4 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
24 |
25 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/xml/big_widget_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/android/app/src/main/res/xml/filepaths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/android/app/src/main/res/xml/network_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/android/app/src/main/res/xml/weather_anim_widget_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext{
3 | kotlin_version = '1.4.10'
4 | retrofit_version = '2.5.0'
5 | lifecycle_version = '2.2.0'
6 | ext.glideVersion = '4.11.0'
7 | }
8 | repositories {
9 | google()
10 | jcenter()
11 | }
12 |
13 | dependencies {
14 | classpath "com.android.tools.build:gradle:4.0.2"
15 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | google()
22 | jcenter()
23 | }
24 | }
25 |
26 | rootProject.buildDir = '../build'
27 | subprojects {
28 | project.buildDir = "${rootProject.buildDir}/${project.name}"
29 | }
30 | subprojects {
31 | project.evaluationDependsOn(':app')
32 | }
33 |
34 | task clean(type: Delete) {
35 | delete rootProject.buildDir
36 | }
37 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.enableR8=true
3 | android.useAndroidX=true
4 | android.enableJetifier=true
5 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/assets/images/caiyun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/caiyun.png
--------------------------------------------------------------------------------
/assets/images/carWashing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/carWashing.png
--------------------------------------------------------------------------------
/assets/images/coldRisk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/coldRisk.png
--------------------------------------------------------------------------------
/assets/images/comfort.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/comfort.png
--------------------------------------------------------------------------------
/assets/images/dressing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/dressing.png
--------------------------------------------------------------------------------
/assets/images/empty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/empty.png
--------------------------------------------------------------------------------
/assets/images/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/error.png
--------------------------------------------------------------------------------
/assets/images/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/ic_launcher.png
--------------------------------------------------------------------------------
/assets/images/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/play.png
--------------------------------------------------------------------------------
/assets/images/typhoon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/typhoon.png
--------------------------------------------------------------------------------
/assets/images/ultraviolet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/ultraviolet.png
--------------------------------------------------------------------------------
/assets/images/weather/cloudy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/cloudy.png
--------------------------------------------------------------------------------
/assets/images/weather/cloudy_night.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/cloudy_night.png
--------------------------------------------------------------------------------
/assets/images/weather/foggy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/foggy.png
--------------------------------------------------------------------------------
/assets/images/weather/heavy_rain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/heavy_rain.png
--------------------------------------------------------------------------------
/assets/images/weather/heavy_snow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/heavy_snow.png
--------------------------------------------------------------------------------
/assets/images/weather/middle_rain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/middle_rain.png
--------------------------------------------------------------------------------
/assets/images/weather/middle_snow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/middle_snow.png
--------------------------------------------------------------------------------
/assets/images/weather/overcast.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/overcast.png
--------------------------------------------------------------------------------
/assets/images/weather/sandy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/sandy.png
--------------------------------------------------------------------------------
/assets/images/weather/small_rain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/small_rain.png
--------------------------------------------------------------------------------
/assets/images/weather/small_snow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/small_snow.png
--------------------------------------------------------------------------------
/assets/images/weather/sunny.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/sunny.png
--------------------------------------------------------------------------------
/assets/images/weather/sunny_night.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/sunny_night.png
--------------------------------------------------------------------------------
/assets/images/weather/sunrise.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/sunrise.png
--------------------------------------------------------------------------------
/assets/images/weather/sunset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/assets/images/weather/sunset.png
--------------------------------------------------------------------------------
/images/check.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/images/check.gif
--------------------------------------------------------------------------------
/images/grid.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/images/grid.gif
--------------------------------------------------------------------------------
/images/home.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/images/home.gif
--------------------------------------------------------------------------------
/images/list.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/images/list.gif
--------------------------------------------------------------------------------
/images/page.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/images/page.gif
--------------------------------------------------------------------------------
/images/qrcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/images/qrcode.png
--------------------------------------------------------------------------------
/images/weather1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/images/weather1.png
--------------------------------------------------------------------------------
/images/weather2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/images/weather2.png
--------------------------------------------------------------------------------
/images/weather3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/images/weather3.png
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/app.flx
22 | Flutter/app.zip
23 | Flutter/flutter_assets/
24 | Flutter/flutter_export_environment.sh
25 | ServiceDefinitions.json
26 | Runner/GeneratedPluginRegistrant.*
27 |
28 | # Exceptions to above rules.
29 | !default.mode1v3
30 | !default.mode2v3
31 | !default.pbxuser
32 | !default.perspectivev3
33 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - amap_core_fluttify (0.0.1):
3 | - AMapFoundation (~> 1.6)
4 | - Flutter
5 | - foundation_fluttify
6 | - amap_location_fluttify (0.0.1):
7 | - amap_core_fluttify
8 | - AMapLocation (~> 2.6.5)
9 | - Flutter
10 | - foundation_fluttify
11 | - AMapFoundation (1.6.4)
12 | - AMapLocation (2.6.5):
13 | - AMapFoundation (~> 1.6.3)
14 | - core_location_fluttify (0.0.1):
15 | - Flutter
16 | - Flutter (1.0.0)
17 | - flutter_tts (0.0.1):
18 | - Flutter
19 | - foundation_fluttify (0.0.1):
20 | - Flutter
21 | - "location_permissions (3.0.0+1)":
22 | - Flutter
23 | - package_info (0.0.1):
24 | - Flutter
25 | - shared_preferences (0.0.1):
26 | - Flutter
27 | - umeng_analytics_plugin (0.0.1):
28 | - Flutter
29 | - UMengAnalytics-NO-IDFA
30 | - UMengAnalytics-NO-IDFA (4.2.5)
31 | - url_launcher (0.0.1):
32 | - Flutter
33 |
34 | DEPENDENCIES:
35 | - amap_core_fluttify (from `.symlinks/plugins/amap_core_fluttify/ios`)
36 | - amap_location_fluttify (from `.symlinks/plugins/amap_location_fluttify/ios`)
37 | - core_location_fluttify (from `.symlinks/plugins/core_location_fluttify/ios`)
38 | - Flutter (from `Flutter`)
39 | - flutter_tts (from `.symlinks/plugins/flutter_tts/ios`)
40 | - foundation_fluttify (from `.symlinks/plugins/foundation_fluttify/ios`)
41 | - location_permissions (from `.symlinks/plugins/location_permissions/ios`)
42 | - package_info (from `.symlinks/plugins/package_info/ios`)
43 | - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
44 | - umeng_analytics_plugin (from `.symlinks/plugins/umeng_analytics_plugin/ios`)
45 | - url_launcher (from `.symlinks/plugins/url_launcher/ios`)
46 |
47 | SPEC REPOS:
48 | trunk:
49 | - AMapFoundation
50 | - AMapLocation
51 | - UMengAnalytics-NO-IDFA
52 |
53 | EXTERNAL SOURCES:
54 | amap_core_fluttify:
55 | :path: ".symlinks/plugins/amap_core_fluttify/ios"
56 | amap_location_fluttify:
57 | :path: ".symlinks/plugins/amap_location_fluttify/ios"
58 | core_location_fluttify:
59 | :path: ".symlinks/plugins/core_location_fluttify/ios"
60 | Flutter:
61 | :path: Flutter
62 | flutter_tts:
63 | :path: ".symlinks/plugins/flutter_tts/ios"
64 | foundation_fluttify:
65 | :path: ".symlinks/plugins/foundation_fluttify/ios"
66 | location_permissions:
67 | :path: ".symlinks/plugins/location_permissions/ios"
68 | package_info:
69 | :path: ".symlinks/plugins/package_info/ios"
70 | shared_preferences:
71 | :path: ".symlinks/plugins/shared_preferences/ios"
72 | umeng_analytics_plugin:
73 | :path: ".symlinks/plugins/umeng_analytics_plugin/ios"
74 | url_launcher:
75 | :path: ".symlinks/plugins/url_launcher/ios"
76 |
77 | SPEC CHECKSUMS:
78 | amap_core_fluttify: bc2e4245c6a6d869727ed16b009a9fa3dbefcf4a
79 | amap_location_fluttify: b273a9b719a7f877ba426d1c6aeadd520e0bf7b6
80 | AMapFoundation: 3638198dfa40be54648570c3520edefad288286b
81 | AMapLocation: c566d448285cd502c1e313063d9e2460bd4d7100
82 | core_location_fluttify: 24cc9dcd986ac7059916632d2cb3babb1568ff61
83 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
84 | flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d
85 | foundation_fluttify: 0c45145e3fad1fb99188e4979daed5b24cd9b278
86 | location_permissions: 7e0f9aa0f60deb8ff93ddf0e2a164c7e8197bc94
87 | package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
88 | shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
89 | umeng_analytics_plugin: 7035dfb8c5636e50429ab935125e5a3f0d23e72e
90 | UMengAnalytics-NO-IDFA: 16666e32edce5be44ae5b14aaaa7f3582e09d6ab
91 | url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
92 |
93 | PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
94 |
95 | COCOAPODS: 1.9.1
96 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 | import AMapFoundationKit
4 |
5 | @UIApplicationMain
6 | @objc class AppDelegate: FlutterAppDelegate {
7 | override func application(
8 | _ application: UIApplication,
9 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
10 | ) -> Bool {
11 | GeneratedPluginRegistrant.register(with: self)
12 | AMapServices.shared()?.apiKey = "1acd2fca2d9361152f3e77d0d7807043"
13 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | },
6 | "images" : [
7 | {
8 | "idiom" : "ipad",
9 | "filename" : "icon-40.png",
10 | "scale" : "1x",
11 | "size" : "40x40"
12 | },
13 | {
14 | "scale" : "2x",
15 | "filename" : "icon-40@2x.png",
16 | "size" : "40x40",
17 | "idiom" : "ipad"
18 | },
19 | {
20 | "idiom" : "iphone",
21 | "size" : "60x60",
22 | "filename" : "icon-60@2x.png",
23 | "scale" : "2x"
24 | },
25 | {
26 | "size" : "72x72",
27 | "idiom" : "ipad",
28 | "scale" : "1x",
29 | "filename" : "icon-72.png"
30 | },
31 | {
32 | "size" : "72x72",
33 | "filename" : "icon-72@2x.png",
34 | "idiom" : "ipad",
35 | "scale" : "2x"
36 | },
37 | {
38 | "idiom" : "ipad",
39 | "scale" : "1x",
40 | "size" : "76x76",
41 | "filename" : "icon-76.png"
42 | },
43 | {
44 | "filename" : "icon-76@2x.png",
45 | "idiom" : "ipad",
46 | "scale" : "2x",
47 | "size" : "76x76"
48 | },
49 | {
50 | "filename" : "icon-small-50.png",
51 | "size" : "50x50",
52 | "idiom" : "ipad",
53 | "scale" : "1x"
54 | },
55 | {
56 | "idiom" : "ipad",
57 | "filename" : "icon-small-50@2x.png",
58 | "scale" : "2x",
59 | "size" : "50x50"
60 | },
61 | {
62 | "filename" : "icon-small.png",
63 | "idiom" : "iphone",
64 | "scale" : "1x",
65 | "size" : "29x29"
66 | },
67 | {
68 | "size" : "29x29",
69 | "scale" : "2x",
70 | "idiom" : "iphone",
71 | "filename" : "icon-small@2x.png"
72 | },
73 | {
74 | "idiom" : "iphone",
75 | "size" : "57x57",
76 | "scale" : "1x",
77 | "filename" : "icon.png"
78 | },
79 | {
80 | "scale" : "2x",
81 | "idiom" : "iphone",
82 | "size" : "57x57",
83 | "filename" : "icon@2x.png"
84 | },
85 | {
86 | "idiom" : "iphone",
87 | "scale" : "3x",
88 | "filename" : "icon-small@3x.png",
89 | "size" : "29x29"
90 | },
91 | {
92 | "idiom" : "iphone",
93 | "filename" : "icon-40@3x.png",
94 | "scale" : "3x",
95 | "size" : "40x40"
96 | },
97 | {
98 | "filename" : "icon-60@3x.png",
99 | "size" : "60x60",
100 | "idiom" : "iphone",
101 | "scale" : "3x"
102 | },
103 | {
104 | "filename" : "icon-40@2x.png",
105 | "idiom" : "iphone",
106 | "scale" : "2x",
107 | "size" : "40x40"
108 | },
109 | {
110 | "filename" : "icon-small.png",
111 | "size" : "29x29",
112 | "scale" : "1x",
113 | "idiom" : "ipad"
114 | },
115 | {
116 | "size" : "29x29",
117 | "filename" : "icon-small@2x.png",
118 | "idiom" : "ipad",
119 | "scale" : "2x"
120 | },
121 | {
122 | "size" : "83.5x83.5",
123 | "scale" : "2x",
124 | "idiom" : "ipad",
125 | "filename" : "icon-83.5@2x.png"
126 | },
127 | {
128 | "scale" : "2x",
129 | "idiom" : "iphone",
130 | "filename" : "notification-icon@2x.png",
131 | "size" : "20x20"
132 | },
133 | {
134 | "idiom" : "iphone",
135 | "scale" : "3x",
136 | "filename" : "notification-icon@3x.png",
137 | "size" : "20x20"
138 | },
139 | {
140 | "idiom" : "ipad",
141 | "scale" : "1x",
142 | "filename" : "notification-icon~ipad.png",
143 | "size" : "20x20"
144 | },
145 | {
146 | "idiom" : "ipad",
147 | "scale" : "2x",
148 | "size" : "20x20",
149 | "filename" : "notification-icon~ipad@2x.png"
150 | },
151 | {
152 | "filename" : "ios-marketing.png",
153 | "scale" : "1x",
154 | "idiom" : "ios-marketing",
155 | "size" : "1024x1024"
156 | }
157 | ]
158 | }
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-72.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-small-50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-small-50.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-small-50@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-small-50@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-small.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-small@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-small@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-small@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-small@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/ios-marketing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/ios-marketing.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/notification-icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/notification-icon@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/notification-icon@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/notification-icon@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/notification-icon~ipad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/notification-icon~ipad.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/notification-icon~ipad@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/AppIcon.appiconset/notification-icon~ipad@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaweizi/SimplicityWeather/b40c28aeb03a7a22ca5efa60f852911d456ac88c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | 简悦天气
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 | NSLocationWhenInUseUsageDescription
45 | 需要定位权限
46 | LSApplicationQueriesSchemes
47 |
48 | iosamap
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/app/res/analytics_constant.dart:
--------------------------------------------------------------------------------
1 | class AnalyticsConstant {
2 | static const String initMainPage = "init_home_page";
3 | static const String cityTotalCount = "city_total_count";
4 | static const String locatedCityName = "located_city_name";
5 | static const String searchCityName = "search_city_name";
6 | static const String bottomSheet = "bottom_sheet";
7 | static const String aboutClick = "about_click";
8 | static const String pageShow = "page_show";
9 | static const String weatherType = "weather_type";
10 | static const String ota = "ota";
11 | static const String aboutWeatherClick = "aboutWeatherClick";
12 | static const String exampleClick = "example_click";
13 |
14 | }
--------------------------------------------------------------------------------
/lib/app/res/common_extension.dart:
--------------------------------------------------------------------------------
1 | extension StringExtension on String {
2 | DateTime get dateTime => DateTime.parse(this.substring(0, this.length - 6)); // 对时间进行裁剪
3 | }
4 |
5 | extension NumExtension on int {
6 | String get gapTime => this < 10 ? "0$this" : "$this"; // 缺0 补0
7 | }
8 |
9 |
--------------------------------------------------------------------------------
/lib/app/res/dimen_constant.dart:
--------------------------------------------------------------------------------
1 | class DimenConstant {
2 | static const singleDayForecastHeight = 90.0;
3 | static const dayForecastMarginBottom = 20.0;
4 | static const aqiMinuteHeight = 50.0;
5 | static const aqiChartHeight = 120.0;
6 | static const realtimeMinHeight = 400.0;
7 |
8 | static const mainMarginStartEnd = 10.0;
9 | static const cardMarginStartEnd = 15.0;
10 | static const dayMiddleMargin = 15.0;
11 | static const cardRadius = 16.0;
12 | }
--------------------------------------------------------------------------------
/lib/app/res/string_constant.dart:
--------------------------------------------------------------------------------
1 | class StringConstant {
2 | static const appName = "动态天气";
3 | }
--------------------------------------------------------------------------------
/lib/app/res/widget_state.dart:
--------------------------------------------------------------------------------
1 | enum WidgetState {
2 | loading,
3 | success,
4 | error,
5 | }
6 |
--------------------------------------------------------------------------------
/lib/app/router.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/services.dart';
3 | import 'package:flutter_dynamic_weather/app/res/analytics_constant.dart';
4 | import 'package:flutter_dynamic_weather/app/utils/print_utils.dart';
5 | import 'package:flutter_dynamic_weather/example/anim_view.dart';
6 | import 'package:flutter_dynamic_weather/example/grid_view.dart';
7 | import 'package:flutter_dynamic_weather/example/list_view.dart';
8 | import 'package:flutter_dynamic_weather/example/main.dart';
9 | import 'package:flutter_dynamic_weather/example/page_view.dart';
10 | import 'package:flutter_dynamic_weather/views/pages/about/about_page.dart';
11 | import 'package:flutter_dynamic_weather/views/pages/manager/manager_page.dart';
12 | import 'package:flutter_dynamic_weather/views/pages/search/search_page.dart';
13 | import 'package:umeng_analytics_plugin/umeng_analytics_plugin.dart';
14 |
15 | import 'utils/router_utils.dart';
16 |
17 | class AppAnalysis extends NavigatorObserver {
18 | @override
19 | void didPush(Route route, Route previousRoute) {
20 | if (route.settings.name != null) {
21 | weatherPrint("AppAnalysis didPush: ${route.settings.name}");
22 | UmengAnalyticsPlugin.event(AnalyticsConstant.pageShow,
23 | label: "${route.settings.name}");
24 | UmengAnalyticsPlugin.pageStart(route.settings.name);
25 | }
26 | }
27 |
28 | @override
29 | void didPop(Route route, Route previousRoute) {
30 | if (route.settings.name != null) {
31 | weatherPrint("AppAnalysis didPop: ${route.settings.name}");
32 | UmengAnalyticsPlugin.pageEnd(route.settings.name);
33 | }
34 | }
35 | }
36 |
37 | class WeatherRouter {
38 | static const String CHANNEL_NAME = 'com.example.flutter_dynamic_weather/router';
39 |
40 | static const String manager = 'manager';
41 | static const String search = 'search';
42 | static const String about = 'about';
43 | static const String example = 'example';
44 | static const String minute = 'minute';
45 | static const String zhuge = 'zhuge';
46 | static const String jike = 'jike';
47 |
48 | static const String routePage = "page";
49 | static const String routeList = "list";
50 | static const String routeGrid = "grid";
51 | static const String routeAnim = "anim";
52 |
53 | static Future jumpToNativePage(String name) async {
54 | MethodChannel channel = MethodChannel(CHANNEL_NAME);
55 | channel.invokeMethod("startActivity", {"name": name});
56 | }
57 |
58 | static Route generateRoute(RouteSettings settings) {
59 | switch (settings.name) {
60 | //根据名称跳转相应页面
61 | case search:
62 | return FadeRouter(
63 | child: SearchPage(), settings: RouteSettings(name: search));
64 |
65 | case manager:
66 | return FadeRouter(
67 | child: ManagerPage(), settings: RouteSettings(name: manager));
68 | case about:
69 | return FadeRouter(child: AboutPage(), settings: settings);
70 | case example:
71 | return FadeRouter(child: MyExampleApp(), settings: settings);
72 | case routePage:
73 | return FadeRouter(child: PageViewWidget(), settings: settings);
74 | case routeList:
75 | return FadeRouter(child: ListViewWidget(), settings: settings);
76 | case routeGrid:
77 | return FadeRouter(child: GridViewWidget(), settings: settings);
78 | case routeAnim:
79 | return FadeRouter(child: AnimViewWidget(), settings: settings);
80 | default:
81 | return MaterialPageRoute(
82 | builder: (_) => Scaffold(
83 | body: Center(
84 | child: Text('No route defined for ${settings.name}'),
85 | ),
86 | ));
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/lib/app/utils/color_utils.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_dynamic_weather/app/utils/print_utils.dart';
5 |
6 | //Color randomColor(){/// 用来返回一个随机色
7 | //var random=Random();
8 | //var a = random.nextInt(256);//透明度值
9 | //var r = random.nextInt(256);//红值
10 | //var g = random.nextInt(256);//绿值
11 | //var b = random.nextInt(256);//蓝值
12 | //return Color.fromARGB(a, r, g, b);//生成argb模式的颜色
13 | //}
14 |
15 | //Color randomColor(int limitA){
16 | // var random=Random();
17 | // var a = limitA+random.nextInt(256-limitA);//透明度值
18 | // var r = random.nextInt(256);//红值
19 | // var g = random.nextInt(256);//绿值
20 | // var b = random.nextInt(256);//蓝值
21 | // return Color.fromARGB(a, r, g, b);//生成argb模式的颜色
22 | //}
23 |
24 | class ColorUtils {
25 |
26 | /// 使用方法:
27 | /// var color1=ColorUtils.parse("#33428A43");
28 | /// var color2=ColorUtils.parse("33428A43");
29 | /// var color3=ColorUtils.parse("#428A43");
30 | ///var color4=ColorUtils.parse("428A43");
31 | ///
32 | static Color parse(String code) {
33 | Color result =Colors.red;
34 | var value = 0 ;
35 | if (code.contains("#")) {
36 | try {
37 | value = int.parse(code.substring(1), radix: 16);
38 | } catch (e) {
39 | weatherPrint(e.toString());
40 | }
41 | switch (code.length) {
42 | case 1 + 6://6位
43 | result = Color(value + 0xFF000000);
44 | break;
45 | case 1 + 8://8位
46 | result = Color(value);
47 | break;
48 | default:
49 | result =Colors.red;
50 | }
51 | }else {
52 | try {
53 | value = int.parse(code, radix: 16);
54 | } catch (e) {
55 | weatherPrint(e.toString());
56 | }
57 | switch (code.length) {
58 | case 6:
59 | result = Color(value + 0xFF000000);
60 | break;
61 | case 8:
62 | result = Color(value);
63 | break;
64 | default:
65 | result =Colors.red;
66 | }
67 | }
68 | return result;
69 | }
70 |
71 | static String colorString(Color color) =>
72 | "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}";
73 | }
74 |
75 |
--------------------------------------------------------------------------------
/lib/app/utils/image_utils.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 | import 'dart:ui' as ui;
3 | import 'dart:typed_data';
4 |
5 | import 'package:flutter/services.dart';
6 |
7 | class ImageUtils {
8 | static Future getImage(String asset) async {
9 | ByteData data = await rootBundle.load(asset);
10 | Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List());
11 | FrameInfo fi = await codec.getNextFrame();
12 | return fi.image;
13 | }
14 | }
--------------------------------------------------------------------------------
/lib/app/utils/location_util.dart:
--------------------------------------------------------------------------------
1 | class LocationUtil {
2 | static String convertToFlag(String longitude, String latitude) {
3 | return "$longitude,$latitude";
4 | }
5 |
6 | static List parseFlag(String flag) {
7 | return flag.split(",").toList();
8 | }
9 |
10 | static String getCityFlag(String key) {
11 | return key.substring(0, key.lastIndexOf(","));
12 | }
13 |
14 | static String convertCityFlag(String cityFlag, bool isLocated) {
15 | return "$cityFlag,$isLocated";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/lib/app/utils/ota_utils.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_dynamic_weather/app/res/analytics_constant.dart';
5 | import 'package:flutter_dynamic_weather/app/utils/toast.dart';
6 | import 'package:flutter_dynamic_weather/net/weather_api.dart';
7 | import 'package:flutter_dynamic_weather/views/app/flutter_app.dart';
8 | import 'package:ota_update/ota_update.dart';
9 | import 'package:package_info/package_info.dart';
10 | import 'package:umeng_analytics_plugin/umeng_analytics_plugin.dart';
11 |
12 | class OTAUtils {
13 | static startOTA(String url, void onData(OtaEvent event)) async {
14 | try {
15 | OtaUpdate()
16 | .execute(
17 | url,
18 | destinationFilename: 'SimplicityWeather.apk',
19 | )
20 | .listen(
21 | (OtaEvent event) {
22 | onData(event);
23 | print('status: ${event.status}, value: ${event.value}');
24 | if (event.status == OtaStatus.DOWNLOAD_ERROR) {
25 | ToastUtils.show("下载失败", globalKey.currentContext);
26 | UmengAnalyticsPlugin.event(AnalyticsConstant.ota,
27 | label: "download_error");
28 | } else if (event.status == OtaStatus.INTERNAL_ERROR) {
29 | ToastUtils.show("未知失败", globalKey.currentContext);
30 | UmengAnalyticsPlugin.event(AnalyticsConstant.ota,
31 | label: "internal_error");
32 | } else if (event.status == OtaStatus.PERMISSION_NOT_GRANTED_ERROR) {
33 | UmengAnalyticsPlugin.event(AnalyticsConstant.ota,
34 | label: "permission_not_granted_error");
35 | ToastUtils.show("请打开权限", globalKey.currentContext);
36 | } else if (event.status == OtaStatus.INSTALLING) {
37 | UmengAnalyticsPlugin.event(AnalyticsConstant.ota,
38 | label: "installing");
39 | ToastUtils.show("正在安装...", globalKey.currentContext);
40 | }
41 | },
42 | );
43 | } catch (e) {
44 | print('Failed to make OTA update. Details: $e');
45 | }
46 | }
47 |
48 | static initOTA() async {
49 | if (!Platform.isAndroid) {
50 | return;
51 | }
52 | var otaData = await WeatherApi().getOTA();
53 | if (otaData != null && otaData["data"] != null) {
54 | String url = otaData["data"]["url"];
55 | String desc = otaData["data"]["desc"];
56 | String versionName = ""; // todo 添加 versionName 的接口配置
57 | int appCode = int.parse(otaData["data"]["appCode"]);
58 | var packageInfo = await PackageInfo.fromPlatform();
59 | var number = int.parse(packageInfo.buildNumber);
60 | if (appCode > number) {
61 | UmengAnalyticsPlugin.event(AnalyticsConstant.ota, label: "needOTA");
62 | showOTADialog(url, desc, versionName);
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/lib/app/utils/print_utils.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/widgets.dart';
2 |
3 | typedef WeatherPrint = void Function(String message,
4 | {int wrapWidth, String tag});
5 |
6 | const DEBUG = true;
7 |
8 | WeatherPrint weatherPrint = debugPrintThrottled;
9 |
10 | void debugPrintThrottled(String message, {int wrapWidth, String tag}) {
11 | if (DEBUG) {
12 | debugPrint("flutter-weather: $tag: $message", wrapWidth: wrapWidth);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/lib/app/utils/shared_preference_util.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_dynamic_weather/app/utils/print_utils.dart';
5 | import 'package:flutter_dynamic_weather/model/city_model_entity.dart';
6 | import 'package:flutter_dynamic_weather/model/weather_model_entity.dart';
7 | import 'package:shared_preferences/shared_preferences.dart';
8 |
9 | class SPUtil {
10 | static SharedPreferences _sp;
11 | static const KEY_CITY_MODELS = "city_models";
12 | static const KEY_WEATHER_MODELS = "weather_models";
13 |
14 | static Future get sp async {
15 | _sp = _sp ?? await SharedPreferences.getInstance();
16 | return _sp;
17 | }
18 |
19 | static Future saveCityModels(List cityModels) async {
20 | weatherPrint("saveCityModels ${cityModels?.length}", tag: "SPUtil");
21 | var prefs = await sp;
22 | var encodeStr = json.encode(cityModels);
23 | weatherPrint('sp -encode: $encodeStr');
24 | return prefs.setString(KEY_CITY_MODELS, encodeStr);
25 | }
26 |
27 | static Future> getCityModels() async {
28 | weatherPrint("getCityModels", tag: "SPUtil");
29 | var prefs = await sp;
30 | var parseValue = prefs.getString(KEY_CITY_MODELS);
31 | weatherPrint('sp-get: $parseValue');
32 | if (parseValue == null || parseValue == "") {
33 | return null;
34 | }
35 | List decodeObject = json.decode(parseValue);
36 | List model = [];
37 | decodeObject.forEach((element) {
38 | model.add(CityModel.fromJson(element));
39 | });
40 | return model;
41 | }
42 |
43 | static Future saveAllWeatherModels(Map allWeatherDat) async {
44 | weatherPrint("saveAllWeatherModels ${allWeatherDat?.length}", tag: "SPUtil");
45 | var prefs = await sp;
46 | var encodeStr = json.encode(allWeatherDat);
47 | return prefs.setString(KEY_WEATHER_MODELS, encodeStr);
48 | }
49 |
50 | static Future