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

feat: 升级至 Flutter 3.16 #383

Merged
merged 6 commits into from
Dec 5, 2023
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: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ concurrency:
cancel-in-progress: true

env:
flutter_version: "3.13.0-0.1.pre"
flutter_channel: "beta"
flutter_version: "3.16.2"
flutter_channel: "stable"

jobs:
test:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/
### Added

- 留言板支持多行选择
- 升级至 Flutter 3.16

### Fixed

Expand Down
9 changes: 4 additions & 5 deletions lib/app/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import 'package:smarthome/user/user.dart';

class MyApp extends StatelessWidget {
MyApp({
Key? key,
super.key,
required this.settingsController,
required this.graphQLApiClient,
}) : super(key: key) {
}) {
// 在应用最开始用设置里的 API URL 初始化 GraphQLClient
graphQLApiClient.initailize(settingsController.apiUrl ??
settingsController.appConfig.defaultApiUrl);
Expand Down Expand Up @@ -112,9 +112,9 @@ class MyMaterialApp extends StatefulWidget {
final SettingsController settingsController;

const MyMaterialApp({
Key? key,
super.key,
required this.settingsController,
}) : super(key: key);
});

@override
State<MyMaterialApp> createState() => _MyMaterialAppState();
Expand Down Expand Up @@ -154,7 +154,6 @@ class _MyMaterialAppState extends State<MyMaterialApp> {
),
darkTheme: ThemeData.dark().copyWith(
colorScheme: darkDynamic,
useMaterial3: true,
),
themeMode: themeMode,
localizationsDelegates: AppLocalizations.localizationsDelegates,
Expand Down
4 changes: 2 additions & 2 deletions lib/blog/view/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class BlogHomePage extends Page {

/// 利用 WebView 实现的博客页面
class BlogHomeScreen extends StatefulWidget {
const BlogHomeScreen({Key? key}) : super(key: key);
const BlogHomeScreen({super.key});

@override
State<BlogHomeScreen> createState() => _BlogHomeScreenState();
Expand Down Expand Up @@ -118,7 +118,7 @@ class _BlogHomeScreenState extends State<BlogHomeScreen> {
}

class SettingButton extends StatelessWidget {
const SettingButton({Key? key}) : super(key: key);
const SettingButton({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/blog/view/settings/blog_admin_url_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:smarthome/app/settings/settings_controller.dart';
import 'package:smarthome/widgets/text_edit_page.dart';

class BlogAdminUrlPage extends StatelessWidget {
const BlogAdminUrlPage({Key? key}) : super(key: key);
const BlogAdminUrlPage({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/blog/view/settings/blog_url_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:smarthome/app/settings/settings_controller.dart';
import 'package:smarthome/widgets/text_edit_page.dart';

class BlogUrlPage extends StatelessWidget {
const BlogUrlPage({Key? key}) : super(key: key);
const BlogUrlPage({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/blog/view/settings/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class BlogSettingsPage extends Page {
}

class BlogSettingsScreen extends StatelessWidget {
const BlogSettingsScreen({Key? key}) : super(key: key);
const BlogSettingsScreen({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/board/model/board.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions lib/board/view/comment_edit_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class CommentEditPage extends StatefulWidget {
final Topic? topic;

const CommentEditPage({
Key? key,
super.key,
required this.isEditing,
this.comment,
this.topic,
}) : super(key: key);
});

@override
State<CommentEditPage> createState() => _CommentEditPageState();
Expand Down Expand Up @@ -122,12 +122,11 @@ class _EditPage extends StatelessWidget {
final GlobalKey<FormState> formKey;

const _EditPage({
Key? key,
required this.isEditing,
this.comment,
this.bodyController,
required this.formKey,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -166,9 +165,8 @@ class _PreviewPage extends StatefulWidget {
final TextEditingController? bodyController;

const _PreviewPage({
Key? key,
this.bodyController,
}) : super(key: key);
});

@override
__PreviewPageState createState() => __PreviewPageState();
Expand Down
4 changes: 2 additions & 2 deletions lib/board/view/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class BoardHomePage extends Page {

class BoardHomeScreen extends StatelessWidget {
const BoardHomeScreen({
Key? key,
}) : super(key: key);
super.key,
});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/board/view/settings/comment_order_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:smarthome/widgets/home_page.dart';
import 'package:smarthome/widgets/settings/settings.dart';

class CommentOrderPage extends StatelessWidget {
const CommentOrderPage({Key? key}) : super(key: key);
const CommentOrderPage({super.key});

@override
Widget build(BuildContext context) {
Expand Down
8 changes: 4 additions & 4 deletions lib/board/view/topic_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class TopicDetailScreen extends StatelessWidget {
final String topicId;

const TopicDetailScreen({
Key? key,
super.key,
required this.topicId,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -432,10 +432,10 @@ class TopicDetailScreen extends StatelessWidget {

class CommentOrder extends StatelessWidget {
const CommentOrder({
Key? key,
super.key,
required this.topicId,
required this.descending,
}) : super(key: key);
});

final String topicId;
final bool descending;
Expand Down
10 changes: 4 additions & 6 deletions lib/board/view/topic_edit_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class TopicEditPage extends StatefulWidget {
final Topic? topic;

const TopicEditPage({
Key? key,
super.key,
required this.isEditing,
this.topic,
}) : super(key: key);
});

@override
State<TopicEditPage> createState() => _TopicEditPageState();
Expand Down Expand Up @@ -122,13 +122,12 @@ class _EditPage extends StatelessWidget {
final GlobalKey<FormState> formKey;

const _EditPage({
Key? key,
required this.isEditing,
this.topic,
required this.titleController,
required this.descriptionController,
required this.formKey,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -183,10 +182,9 @@ class _PreviewPage extends StatefulWidget {
final TextEditingController descriptionController;

const _PreviewPage({
Key? key,
required this.titleController,
required this.descriptionController,
}) : super(key: key);
});

@override
__PreviewPageState createState() => __PreviewPageState();
Expand Down
4 changes: 2 additions & 2 deletions lib/board/view/widgets/comment_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class CommentItem extends StatelessWidget {
final void Function()? onEdit;

const CommentItem({
Key? key,
super.key,
required this.comment,
required this.showMenu,
this.onEdit,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/board/view/widgets/item_title.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class ItemTitle extends StatelessWidget {
final Function(Menu)? onSelected;

const ItemTitle({
Key? key,
super.key,
required this.user,
required this.createdAt,
required this.editedAt,
this.onSelected,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/board/view/widgets/topic_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class TopicItem extends StatelessWidget {
final bool showBody;

const TopicItem({
Key? key,
super.key,
required this.topic,
this.showBody = false,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/model/push.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions lib/core/view/admin_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class AdminPage extends Page {

class AdminScreen extends StatefulWidget {
const AdminScreen({
Key? key,
}) : super(key: key);
super.key,
});

@override
State<AdminScreen> createState() => _AdminScreenState();
Expand Down Expand Up @@ -54,13 +54,19 @@ class _AdminScreenState extends State<AdminScreen> {
}
controller.loadRequest(Uri.parse(settings.adminUrl));
return Scaffold(
body: WillPopScope(
onWillPop: () async {
if (await controller.canGoBack()) {
await controller.goBack();
return false;
body: PopScope(
canPop: false,
onPopInvoked: (bool didPop) async {
if (didPop) {
return;
}
final NavigatorState navigator = Navigator.of(context);
final bool canGoBack = await controller.canGoBack();
if (canGoBack) {
controller.goBack();
} else {
navigator.pop();
}
return true;
},
child: SafeArea(
child: WebViewWidget(controller: controller),
Expand Down
10 changes: 5 additions & 5 deletions lib/core/view/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class LoginPage extends Page {

class LoginScreen extends StatefulWidget {
const LoginScreen({
Key? key,
}) : super(key: key);
super.key,
});

@override
State<LoginScreen> createState() => _LoginScreenState();
Expand Down Expand Up @@ -76,10 +76,10 @@ class ApiUrlForm extends StatefulWidget {
final VoidCallback onTapNext;

const ApiUrlForm({
Key? key,
super.key,
required this.apiUrl,
required this.onTapNext,
}) : super(key: key);
});

@override
State<ApiUrlForm> createState() => _ApiUrlFormState();
Expand Down Expand Up @@ -163,7 +163,7 @@ class _ApiUrlFormState extends State<ApiUrlForm> {
class LoginForm extends StatefulWidget {
final Function onTapBack;

const LoginForm({Key? key, required this.onTapBack}) : super(key: key);
const LoginForm({super.key, required this.onTapBack});

@override
State<LoginForm> createState() => _LoginFormState();
Expand Down
2 changes: 1 addition & 1 deletion lib/core/view/settings/admin_url_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:smarthome/app/settings/settings_controller.dart';
import 'package:smarthome/widgets/text_edit_page.dart';

class AdminUrlPage extends StatelessWidget {
const AdminUrlPage({Key? key}) : super(key: key);
const AdminUrlPage({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/view/settings/api_url_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:smarthome/core/core.dart';
import 'package:smarthome/widgets/text_edit_page.dart';

class ApiUrlPage extends StatelessWidget {
const ApiUrlPage({Key? key}) : super(key: key);
const ApiUrlPage({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/view/settings/default_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:smarthome/widgets/home_page.dart';
import 'package:smarthome/widgets/settings/settings.dart';

class DefaultPage extends StatelessWidget {
const DefaultPage({Key? key}) : super(key: key);
const DefaultPage({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/view/settings/mipush_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:smarthome/core/bloc/blocs.dart';
import 'package:smarthome/widgets/home_page.dart';

class MiPushPage extends StatelessWidget {
const MiPushPage({Key? key}) : super(key: key);
const MiPushPage({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/view/settings/mipush_settings_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:smarthome/core/view/settings/mipush_page.dart';
import 'package:smarthome/widgets/settings/settings.dart';

class MiPushSettingsTile extends StatelessWidget {
const MiPushSettingsTile({Key? key}) : super(key: key);
const MiPushSettingsTile({super.key});

@override
Widget build(BuildContext context) {
Expand Down
Loading
Loading