Code Monkey home page Code Monkey logo

flutter_qweather's Introduction

Flutter 和风天气插件

pub package pub package CodeFactor GitHub license GitHub stars GitHub forks FlutterCandies

qweather_icons

若需要图标支持,请查看 qweather_icons 包。

已有功能

  • 城市信息查询
  • 热门城市查询
  • POI信息搜索
  • POI范围搜索
  • 实时天气查询
  • 逐天天气查询
  • 逐时天气查询
  • **地区未来2小时内每5分钟降水查询
  • 当天生活指数查询
  • 三天生活指数查询
  • 天气灾害预警
  • 灾害预警列表
  • 空气质量实况
  • 空气质量5天预报
  • 历史天气
  • 历史空气质量
  • 日出日落
  • 月升月落月相
  • 太阳高度角
  • 潮汐
  • 潮流
  • 台风列表
  • 台风实况和路径
  • 台风预报
  • 其他功能(好像没有了)

运行

注册账号 并 get 秘钥

首先你得有个和风天气的账号,去吧*年。账号注册成功后在应用管理创建应用。注意包名别写错了哦。

本项目 example 的包名

Android:com.fluttercandies.flutter_qweather_example
ios: com.fluttercandies.flutterQweatherExample

初始化插件

    QweatherConfig config = QweatherConfig(
        publicIdForAndroid: 'HE210xxxxxxxxxxxxx',
        keyForAndroid: '8453863xxxxxxxxxxxxxxxxxxxxxxxxxx',
        publicIdForIos: 'HE210xxxxxxxxxxxxx',
        keyForIos: 'aead742xxxxxxxxxxxxxxxxxxxxxxxxx',
        biz: false,
        debug: true);
    await FlutterQweather.instance.init(config);

location 为 LocationID 或者 经纬度; LocationID 可通过geo 接口查询 或 查看https://github.com/qwd/LocationList

实时天气查询

  String location = '116.41,39.92'WeatherNow? _resp = await FlutterQweather.instance.getWeatherNow(location);

逐天天气查询

  String location = '116.41,39.92'WeatherDailyResp? _resp = await FlutterQweather.instance.getWeatherDaily(location, WeatherDailyForecast.WeatherForecast3Day);

逐时天气查询

  String location = '116.41,39.92'WeatherHourlyResp? _resp = await FlutterQweather.instance.getWeatherHourly(location, WeatherHourlyForecast.WeatherForecast24Hour);

**地区未来2小时内每5分钟降水查询

  String location = '116.41,39.92'WeatherMinutelyResp? _resp = await FlutterQweather.instance.getWeatherMinuteLy(location);

其他接口....相信你能看懂怎么用

贡献代码

第一次写跟原生交互的插件,望各位大大多多指点,有写得不好的地方,请直接用 PR 来怼我。

flutter_qweather's People

Contributors

alexv525 avatar cierra-runis avatar cyjaysong avatar lycstar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flutter_qweather's Issues

air_api报错

Unhandled Exception: MissingPluginException(No implementation found for method GetAirNow on channel com.fluttercandies.qweather)
初始化,查看今天和近三天的天气能成功运行。

Android获取不到天气信息

获取天气信息失败:没有任何报错
手机型号:iQOO Neo5
系统版本:Android 12
flutter_qweather版本:
0.0.9,0.0.6都不行

其他Android手机没问题,iOS也没问题。就发现一台手机有问题。没有任何报错日志。。

不支持iOS模拟器调试吗

目前我的工程运行iOS模拟器,qweather报错,开来是没有包含模拟器的编译文件。
error:
Undefined symbols for architecture x86_64:、

我有几个问题

为什么kotlin要和java混用呢。我不太明白。
引入项目后,andoridstudio可以识别dart和kotlin文件,但是不能识别java,也不能创建java文件。

一个工程是不是只能引入一个sdk呢,我尝试引入高德地图sdk来定位,可是会闪退,我完全不知道为什么。

[Feature request] API支持多语言参数

Platforms

dart, Android, iOS

Description

原生应该是支持多言语的,能否在flutter层也开放支持多语言?
谢谢。这是一个好库。

Why

有多语言场景需求(总所周知现在国内越来越多政策。。)

W/System.err( 5254): android.content.res.Resources$NotFoundException: String resource ID #0x0

您好,我在按照example示例,插入自己的项目时候,提示这个错误

我把您的项目下载后运行example,也是提示这个错误. 我是flutter新手,我觉得可能是我环境的问题,但我不能确定这个问题出在哪里,您是否能指点一下解决思路呢?

Performing hot restart...
Syncing files to device Android SDK built for x86...
Restarted application in 2,419ms.
I/flutter ( 5254): 和风天气:初始化结果: true
W/Settings( 5254): Setting android_id has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
I/flutter ( 5254): Instance of 'Future<WarningRsp?>'
E/example.home_v( 5254): Invalid ID 0x00000000.
W/System.err( 5254): android.content.res.Resources$NotFoundException: String resource ID #0x0
W/System.err( 5254): 	at android.content.res.Resources.getText(Resources.java:444)
W/System.err( 5254): 	at android.content.res.Resources.getString(Resources.java:537)
W/System.err( 5254): 	at com.qweather.sdk.c.a.g(DeviceUtil.java:321)
W/System.err( 5254): 	at com.qweather.sdk.c.a.d(DeviceUtil.java:211)
W/System.err( 5254): 	at com.qweather.sdk.b.c.a(BaseData.java:84)
W/System.err( 5254): 	at com.qweather.sdk.b.l.a(WarningDataImpl.java:37)
W/System.err( 5254): 	at com.qweather.sdk.view.QWeather.getWarning(QWeather.java:831)
W/System.err( 5254): 	at com.qweather.sdk.view.QWeather.getWarning(QWeather.java:821)
W/System.err( 5254): 	at com.fluttercandies.flutter_qweather.ApiWarning.getWarning(ApiWarning.java:35)
W/System.err( 5254): 	at com.fluttercandies.flutter_qweather.FlutterQweatherPlugin.onMethodCall(FlutterQweatherPlugin.kt:37)
W/System.err( 5254): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
W/System.err( 5254): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
W/System.err( 5254): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
W/System.err( 5254): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
W/System.err( 5254): 	at android.os.Handler.handleCallback(Handler.java:938)
W/System.err( 5254): 	at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 5254): 	at android.os.Looper.loop(Looper.java:223)
W/System.err( 5254): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
W/System.err( 5254): 	at java.lang.reflect.Method.invoke(Native Method)
W/System.err( 5254): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
W/System.err( 5254): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

flutter doctor -v

[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [版本 10.0.19041.572], locale zh-CN)
    • Flutter version 3.0.5 at D:\Program Files\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (4 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at D:\Program Files\Android\SDK
    • Platform android-33, build-tools 33.0.0
    • Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.5)
    • Visual Studio at D:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.2.32616.157
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.2)
    • Android Studio at D:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] IntelliJ IDEA Ultimate Edition (version 2020.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2020.3
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] VS Code (version 1.69.2)
    • VS Code at C:\Users\shayne\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.44.0

[!] Proxy Configuration
    • HTTP_PROXY is set
    • NO_PROXY is localhost,127.0.0.1
    • NO_PROXY contains localhost
    ! NO_PROXY does not contain ::1
    • NO_PROXY contains 127.0.0.1

[√] Connected device (3 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Windows (desktop)                  • windows       • windows-x64    • Microsoft Windows [版本 10.0.19041.572]
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 104.0.5112.79

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.