Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加 Windows 支持 #71

Merged
merged 7 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/

## [Unreleased]

### Added

- 添加 Windows 支持

## [0.5.6] - 2020-08-17

### Added
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@

## Requirements

- Flutter (Channel dev, 1.22.0-1.0.pre)
- Flutter (Channel dev, 1.23.0-4.0.pre)

## Setup

启用 Web 功能
启用 Web 和 Windows 功能

```shell
flutter channel beta
flutter channel dev
flutter upgrade
flutter config --enable-web
flutter config --enable-windows-desktop
```

## Run
Expand All @@ -30,6 +31,14 @@ flutter run -t ./lib/main_dev.dart
编译正式版 `Android` 软件需要先根据 [文档](https://flutter.dev/docs/deployment/android) 创建签名。
接着运行 `flutter build apk --split-per-abi -t ./lib/main_prod.dart` 完成编译。

## Web

使用 `flutter build web -t ./lib/main_prod.dart` 编译网页版。

## Windows

使用 `flutter build windows -t ./lib/main_prod.dart` 编译 Windows 版。

## Tags

创建和共享标签
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (keystorePropertiesFile.exists()) {
}

android {
compileSdkVersion 28
compileSdkVersion 29

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -45,7 +45,7 @@ android {
defaultConfig {
applicationId "com.hehome.home"
minSdkVersion 16
targetSdkVersion 28
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.smart_home">
package="com.hehome.home">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.smart_home">
package="com.hehome.home">

<uses-permission android:name="android.permission.INTERNET" />
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
Expand Down Expand Up @@ -46,4 +46,4 @@
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.smart_home
package com.hehome.home

import io.flutter.embedding.android.FlutterActivity

Expand Down
18 changes: 18 additions & 0 deletions android/app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.

This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
2 changes: 1 addition & 1 deletion android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.smart_home">
package="com.hehome.home">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ trigger:

variables:
flutter_channel: 'dev'
flutter_version: '1.22.0-1.0.pre'
flutter_version: '1.23.0-4.0.pre'

pool:
vmImage: 'macOS-latest'
Expand Down
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.smartHome;
PRODUCT_BUNDLE_IDENTIFIER = com.hehome.home;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -431,7 +431,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.smartHome;
PRODUCT_BUNDLE_IDENTIFIER = com.hehome.home;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -458,7 +458,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.smartHome;
PRODUCT_BUNDLE_IDENTIFIER = com.hehome.home;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/blog/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -66,7 +67,7 @@ class _BlogHomePageState extends State<BlogHomePage> {
),
),
],
body: !kIsWeb
body: (!kIsWeb && !Platform.isWindows)
? WillPopScope(
onWillPop: () async {
if (controller.hasData &&
Expand Down
4 changes: 3 additions & 1 deletion lib/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down Expand Up @@ -89,7 +91,7 @@ class _HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// 仅在客户端上注册 Shortcut
if (!kIsWeb) {
if (!kIsWeb && !Platform.isWindows) {
final QuickActions quickActions = QuickActions();
quickActions.initialize((String shortcutType) async {
if (shortcutType == 'action_iot') {
Expand Down
6 changes: 4 additions & 2 deletions lib/widgets/gravatar.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand All @@ -15,8 +17,8 @@ class CircleGravatar extends StatelessWidget {

@override
Widget build(BuildContext context) {
// CachedNetworkImage 暂时不支持 web
if (!kIsWeb) {
// CachedNetworkImage 暂时不支持 web, windows
if (!kIsWeb && !Platform.isWindows) {
return CachedNetworkImage(
imageUrl: getGravatarUrl(email: email, size: size),
imageBuilder: (context, imageProvider) => CircleAvatar(
Expand Down
Loading