Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 647c7088
authored
2025-12-12 11:41:43 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
测试iOS返回的手势操作
1 parent
3c9b96b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
9 deletions
lib/app.dart
lib/ui/pages/web_page.dart
lib/app.dart
View file @
647c708
import
'dart:io'
;
import
'package:appframe/l10n/gen/app_localizations.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'config/routes.dart'
;
...
...
@@ -7,11 +10,29 @@ class App extends StatelessWidget {
const
App
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
=>
MaterialApp
.
router
(
localizationsDelegates:
AppLocalizations
.
localizationsDelegates
,
supportedLocales:
AppLocalizations
.
supportedLocales
,
routerConfig:
router
,
title:
'班小二'
,
theme:
ThemeData
(
primarySwatch:
Colors
.
blue
),
);
Widget
build
(
BuildContext
context
)
=>
Platform
.
isIOS
?
CupertinoApp
.
router
(
routerConfig:
router
,
title:
'班小二'
,
theme:
const
CupertinoThemeData
(
primaryColor:
CupertinoColors
.
systemBlue
),
localizationsDelegates:
AppLocalizations
.
localizationsDelegates
,
supportedLocales:
AppLocalizations
.
supportedLocales
,
// // === 为 iOS 添加本地化配置 ===
// localizationsDelegates: const [
// GlobalMaterialLocalizations.delegate, // 为Material组件提供本地化
// GlobalCupertinoLocalizations.delegate, // 为Cupertino组件提供本地化
// GlobalWidgetsLocalizations.delegate, // 定义文本方向等
// ],
// supportedLocales: const [
// Locale('zh', 'CN'), // 中文(中国)
// Locale('en', 'US'), // 英语(美国)
// ],
)
:
MaterialApp
.
router
(
routerConfig:
router
,
title:
'班小二'
,
theme:
ThemeData
(
primarySwatch:
Colors
.
blue
),
supportedLocales:
AppLocalizations
.
supportedLocales
,
localizationsDelegates:
AppLocalizations
.
localizationsDelegates
,
);
}
lib/ui/pages/web_page.dart
View file @
647c708
import
'dart:io'
;
import
'package:appframe/bloc/web_cubit.dart'
;
import
'package:appframe/config/constant.dart'
;
import
'package:appframe/config/evn_config.dart'
;
...
...
@@ -44,9 +46,16 @@ class WebPage extends StatelessWidget {
child:
BlocConsumer
<
WebCubit
,
WebState
>(
builder:
(
ctx
,
state
)
{
return
PopScope
(
canPop:
false
,
canPop:
Platform
.
isIOS
,
onPopInvokedWithResult:
(
didPop
,
result
)
{
ctx
.
read
<
WebCubit
>().
handleBack
();
print
(
"onPopInvokedWithResult---------------------------
$didPop
$result
"
);
if
(
Platform
.
isIOS
)
{
if
(
didPop
)
{
ctx
.
read
<
WebCubit
>().
handleBack
();
}
}
else
{
ctx
.
read
<
WebCubit
>().
handleBack
();
}
},
child:
Scaffold
(
appBar:
_buildAppBar
(
ctx
,
state
),
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment