Skip to content

Commit

Permalink
适配flutter 3.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
simplezhli committed Nov 16, 2023
1 parent cbb4e1c commit f49ad66
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/flutter-drive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
# https://github.com/marketplace/actions/flutter-action
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.6'
flutter-version: '3.16.0'
channel: 'stable' # or: 'dev' or 'beta'
architecture: x64
- run: "flutter clean"
Expand All @@ -78,7 +78,7 @@ jobs:
java-version: '11'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.6'
flutter-version: '3.16.0'
channel: 'stable' # or: 'dev' or 'beta'
architecture: x64
- name: "Run Flutter Driver tests"
Expand All @@ -104,7 +104,7 @@ jobs:
# https://github.com/marketplace/actions/flutter-action
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.6'
flutter-version: '3.16.0'
channel: 'stable'
architecture: x64
- run: "flutter pub get"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/flutter-web-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: flutter_deer web deploy
on:
push:
paths:
- 'pubspec1.yaml'
- 'pubspec.yaml'

jobs:
web_build_and_deploy:
Expand All @@ -14,7 +14,7 @@ jobs:
- uses: actions/[email protected]
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.6'
flutter-version: '3.16.0'
channel: 'stable'
architecture: x64
- name: "Web Build 🔧"
Expand Down
4 changes: 2 additions & 2 deletions README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ For web experience, please visit: https://simplezhli.github.io/flutter_deer/

[![Build Status](https://github.com/simplezhli/flutter_deer/workflows/flutter_deer%20driver/badge.svg?branch=master)](https://github.com/simplezhli/flutter_deer/actions?query=workflow%3A%22flutter_deer+driver%22+branch%3Amaster)

1. Flutter version 3.13.6
1. Flutter version 3.16.0

2. Dart version 3.1.3
2. Dart version 3.2.0

## Precautions to be taken.

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ Web体验地址:https://simplezhli.github.io/flutter_deer/

[![Build Status](https://github.com/simplezhli/flutter_deer/workflows/flutter_deer%20driver/badge.svg?branch=master)](https://github.com/simplezhli/flutter_deer/actions?query=workflow%3A%22flutter_deer+driver%22+branch%3Amaster)

1. Flutter version 3.13.6
1. Flutter version 3.16.0

2. Dart version 3.1.3
2. Dart version 3.2.0

## 注意事项

Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
platform :ios, '11.0'

# source 'https://github.com/CocoaPods/Specs.git'

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

Expand Down
5 changes: 2 additions & 3 deletions lib/account/page/withdrawal_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ class _WithdrawalPageState extends State<WithdrawalPage> {

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () {
return PopScope(
onPopInvoked: (_) {
/// 拦截返回,关闭键盘,否则会造成上一页面短暂的组件溢出
FocusManager.instance.primaryFocus?.unfocus();
return Future.value(true);
},
child: Scaffold(
appBar: const MyAppBar(
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class MyApp extends StatelessWidget {

/// 保证文字大小不受手机系统设置影响 https://www.kikt.top/posts/flutter/layout/dynamic-text/
return MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.noScaling),
child: child!,
);
},
Expand Down
5 changes: 2 additions & 3 deletions lib/mvp/base_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ mixin BasePageMixin<T extends StatefulWidget, P extends BasePresenter> on State<
barrierDismissible: false,
barrierColor: const Color(0x00FFFFFF), // 默认dialog背景色为半透明黑色,这里修改为透明(1.20添加属性)
builder:(_) {
return WillPopScope(
onWillPop: () async {
return PopScope(
onPopInvoked: (_) {
// 拦截到返回键,证明dialog被手动关闭
_isShowDialog = false;
return Future.value(true);
},
child: buildProgress(),
);
Expand Down
7 changes: 2 additions & 5 deletions lib/setting/widgets/update_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ class _UpdateDialogState extends State<UpdateDialog> {
@override
Widget build(BuildContext context) {
final Color primaryColor = Theme.of(context).primaryColor;
return WillPopScope(
onWillPop: () async {
/// 使用false禁止返回键返回,达到强制升级目的
return true;
},
return PopScope(
canPop: false, /// 使用false禁止返回键返回,达到强制升级目的
child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.transparent,
Expand Down
3 changes: 2 additions & 1 deletion lib/widgets/bezier_chart/my_single_child_scroll_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ class _RenderSingleChildViewport extends RenderBox

@override
RevealedOffset getOffsetToReveal(RenderObject target, double alignment,
{Rect? rect}) {
{Rect? rect, Axis? axis,}) {
axis = this.axis;
rect ??= target.paintBounds;
if (target is! RenderBox)
return RevealedOffset(offset: offset.pixels, rect: rect);
Expand Down
26 changes: 12 additions & 14 deletions lib/widgets/double_tap_back_exit_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,19 @@ class _DoubleTapBackExitAppState extends State<DoubleTapBackExitApp> {

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: _isExit,
return PopScope(
canPop: _lastTime == null || DateTime.now().difference(_lastTime!) > widget.duration,
onPopInvoked: (didPop) {
if (!didPop) {
Toast.cancelToast();
/// 不推荐使用 `dart:io` 的 exit(0)
SystemNavigator.pop();
} else {
_lastTime = DateTime.now();
Toast.show('再次点击退出应用');
}
},
child: widget.child,
);
}

Future<bool> _isExit() async {
if (_lastTime == null || DateTime.now().difference(_lastTime!) > widget.duration) {
_lastTime = DateTime.now();
Toast.show('再次点击退出应用');
return Future.value(false);
}
Toast.cancelToast();
/// 不推荐使用 `dart:io` 的 exit(0)
await SystemNavigator.pop();
return Future.value(true);
}
}

0 comments on commit f49ad66

Please sign in to comment.