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 8d27884d
authored
2025-12-11 16:41:36 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
协议占位、统一iOS和Android的操作风格等
1 parent
ec067c1e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
71 deletions
lib/app.dart
lib/ui/pages/link_page.dart
lib/ui/pages/web_page.dart
lib/app.dart
View file @
8d27884
import
'dart:io'
;
import
'package:appframe/l10n/gen/app_localizations.dart'
;
import
'package:appframe/l10n/gen/app_localizations.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_localizations/flutter_localizations.dart'
;
// 添加这行
import
'config/routes.dart'
;
import
'config/routes.dart'
;
...
@@ -11,39 +7,11 @@ class App extends StatelessWidget {
...
@@ -11,39 +7,11 @@ class App extends StatelessWidget {
const
App
({
super
.
key
});
const
App
({
super
.
key
});
@override
@override
Widget
build
(
BuildContext
context
)
=>
Platform
.
isIOS
Widget
build
(
BuildContext
context
)
=>
MaterialApp
.
router
(
?
CupertinoApp
.
router
(
localizationsDelegates:
AppLocalizations
.
localizationsDelegates
,
routerConfig:
router
,
supportedLocales:
AppLocalizations
.
supportedLocales
,
title:
'班小二'
,
routerConfig:
router
,
theme:
const
CupertinoThemeData
(
primaryColor:
CupertinoColors
.
systemBlue
),
title:
'班小二'
,
localizationsDelegates:
AppLocalizations
.
localizationsDelegates
,
theme:
ThemeData
(
primarySwatch:
Colors
.
blue
),
supportedLocales:
AppLocalizations
.
supportedLocales
,
);
// // === 为 iOS 添加本地化配置 ===
// localizationsDelegates: const [
// GlobalMaterialLocalizations.delegate, // 为Material组件提供本地化
// GlobalCupertinoLocalizations.delegate, // 为Cupertino组件提供本地化
// GlobalWidgetsLocalizations.delegate, // 定义文本方向等
// ],
// supportedLocales: const [
// Locale('zh', 'CN'), // 中文(中国)
// Locale('en', 'US'), // 英语(美国)
// ],
)
:
MaterialApp
.
router
(
localizationsDelegates:
AppLocalizations
.
localizationsDelegates
,
supportedLocales:
AppLocalizations
.
supportedLocales
,
routerConfig:
router
,
title:
'班小二'
,
theme:
ThemeData
(
primarySwatch:
Colors
.
blue
),
// // === 为 iOS 添加本地化配置 ===
// localizationsDelegates: const [
// GlobalMaterialLocalizations.delegate, // 为Material组件提供本地化
// GlobalCupertinoLocalizations.delegate, // 为Cupertino组件提供本地化
// GlobalWidgetsLocalizations.delegate, // 定义文本方向等
// ],
// supportedLocales: const [
// Locale('zh', 'CN'), // 中文(中国)
// Locale('en', 'US'), // 英语(美国)
// ],
);
}
}
lib/ui/pages/link_page.dart
View file @
8d27884
...
@@ -11,6 +11,7 @@ class LinkPage extends StatelessWidget {
...
@@ -11,6 +11,7 @@ class LinkPage extends StatelessWidget {
Widget
build
(
BuildContext
buildContext
)
{
Widget
build
(
BuildContext
buildContext
)
{
final
Map
<
String
,
dynamic
>?
extraData
=
GoRouterState
.
of
(
buildContext
).
extra
as
Map
<
String
,
dynamic
>?;
final
Map
<
String
,
dynamic
>?
extraData
=
GoRouterState
.
of
(
buildContext
).
extra
as
Map
<
String
,
dynamic
>?;
final
String
?
url
=
extraData
?[
'url'
];
final
String
?
url
=
extraData
?[
'url'
];
final
String
?
title
=
extraData
?[
'title'
];
return
BlocProvider
(
return
BlocProvider
(
create:
(
context
)
=>
LinkCubit
(
LinkState
(
loaded:
false
,
url:
url
!)),
create:
(
context
)
=>
LinkCubit
(
LinkState
(
loaded:
false
,
url:
url
!)),
...
@@ -23,15 +24,10 @@ class LinkPage extends StatelessWidget {
...
@@ -23,15 +24,10 @@ class LinkPage extends StatelessWidget {
},
},
child:
Scaffold
(
child:
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
Text
(
'adv'
),
title:
Text
(
title
??
''
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
18
)
),
centerTitle:
true
,
centerTitle:
true
,
automaticallyImplyLeading:
false
,
backgroundColor:
Color
(
0xFF7691FA
),
leading:
IconButton
(
iconTheme:
IconThemeData
(
color:
Colors
.
white
),
icon:
const
Icon
(
Icons
.
arrow_back
),
onPressed:
()
async
{
await
ctx
.
read
<
LinkCubit
>().
handleBack
(
ctx
);
},
),
),
),
body:
state
.
loaded
body:
state
.
loaded
?
SizedBox
(
?
SizedBox
(
...
...
lib/ui/pages/web_page.dart
View file @
8d27884
...
@@ -2,6 +2,7 @@ import 'package:appframe/bloc/web_cubit.dart';
...
@@ -2,6 +2,7 @@ import 'package:appframe/bloc/web_cubit.dart';
import
'package:appframe/config/constant.dart'
;
import
'package:appframe/config/constant.dart'
;
import
'package:appframe/config/evn_config.dart'
;
import
'package:appframe/config/evn_config.dart'
;
import
'package:appframe/config/locator.dart'
;
import
'package:appframe/config/locator.dart'
;
import
'package:appframe/config/routes.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:go_router/go_router.dart'
;
import
'package:go_router/go_router.dart'
;
...
@@ -186,7 +187,7 @@ class WebPage extends StatelessWidget {
...
@@ -186,7 +187,7 @@ class WebPage extends StatelessWidget {
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
[
children:
[
Card
(
Card
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
2
),
// 减小垂直间距
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
2
),
shape:
RoundedRectangleBorder
(
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
6
),
borderRadius:
BorderRadius
.
circular
(
6
),
),
),
...
@@ -194,26 +195,22 @@ class WebPage extends StatelessWidget {
...
@@ -194,26 +195,22 @@ class WebPage extends StatelessWidget {
children:
[
children:
[
ListTile
(
ListTile
(
leading:
const
Icon
(
Icons
.
lock
,
size:
20
),
leading:
const
Icon
(
Icons
.
lock
,
size:
20
),
// 减小图标大小
title:
const
Text
(
'账号与安全'
,
style:
TextStyle
(
fontSize:
14
)),
title:
const
Text
(
'账号与安全'
,
style:
TextStyle
(
fontSize:
14
)),
// 设置字体大小
onTap:
()
{
onTap:
()
{
Navigator
.
pop
(
ctx
);
Navigator
.
pop
(
ctx
);
ctx
.
read
<
WebCubit
>().
goAccount
();
ctx
.
read
<
WebCubit
>().
goAccount
();
},
},
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
8
),
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
4
),
trailing:
Icon
(
Icons
.
arrow_forward_ios
,
size:
14
),
trailing:
Icon
(
Icons
.
arrow_forward_ios
,
size:
14
),
// 调整内边距
dense:
true
,
dense:
true
,
// 使用紧凑布局
visualDensity:
VisualDensity
.
compact
,
visualDensity:
VisualDensity
.
compact
,
// 视觉密度设为紧凑
),
),
],
],
),
),
),
),
SizedBox
(
height:
8
),
SizedBox
(
height:
8
),
Card
(
Card
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
2
),
// 减小垂直间距
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
2
),
shape:
RoundedRectangleBorder
(
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
6
),
borderRadius:
BorderRadius
.
circular
(
6
),
),
),
...
@@ -221,18 +218,50 @@ class WebPage extends StatelessWidget {
...
@@ -221,18 +218,50 @@ class WebPage extends StatelessWidget {
children:
[
children:
[
ListTile
(
ListTile
(
leading:
const
Icon
(
Icons
.
book_outlined
,
size:
20
),
leading:
const
Icon
(
Icons
.
book_outlined
,
size:
20
),
// 减小图标大小
title:
const
Text
(
'用户协议A'
,
style:
TextStyle
(
fontSize:
14
)),
title:
const
Text
(
'用户协议'
,
style:
TextStyle
(
fontSize:
14
)),
// 设置字体大小
onTap:
()
{
onTap:
()
{
Navigator
.
pop
(
ctx
);
Navigator
.
pop
(
ctx
);
router
.
push
(
'/link'
,
extra:
{
'url'
:
'https://www.baidu.com/duty/'
,
'title'
:
'用户协议A'
},
);
},
},
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
8
),
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
4
),
trailing:
Icon
(
Icons
.
arrow_forward_ios
,
size:
14
),
trailing:
Icon
(
Icons
.
arrow_forward_ios
,
size:
14
),
// 调整内边距
dense:
true
,
dense:
true
,
// 使用紧凑布局
visualDensity:
VisualDensity
.
compact
,
visualDensity:
VisualDensity
.
compact
,
// 视觉密度设为紧凑
),
Divider
(
height:
1
,
thickness:
0.5
,
indent:
16
,
endIndent:
16
),
ListTile
(
leading:
const
Icon
(
Icons
.
book_outlined
,
size:
20
),
title:
const
Text
(
'用户协议B'
,
style:
TextStyle
(
fontSize:
14
)),
onTap:
()
{
Navigator
.
pop
(
ctx
);
router
.
push
(
'/link'
,
extra:
{
'url'
:
'https://www.baidu.com/duty/'
,
'title'
:
'用户协议B'
},
);
},
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
4
),
trailing:
Icon
(
Icons
.
arrow_forward_ios
,
size:
14
),
dense:
true
,
visualDensity:
VisualDensity
.
compact
,
),
Divider
(
height:
1
,
thickness:
0.5
,
indent:
16
,
endIndent:
16
),
ListTile
(
leading:
const
Icon
(
Icons
.
book_outlined
,
size:
20
),
title:
const
Text
(
'用户协议C'
,
style:
TextStyle
(
fontSize:
14
)),
onTap:
()
{
Navigator
.
pop
(
ctx
);
router
.
push
(
'/link'
,
extra:
{
'url'
:
'https://www.baidu.com/duty/'
,
'title'
:
'用户协议C'
},
);
},
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
4
),
trailing:
Icon
(
Icons
.
arrow_forward_ios
,
size:
14
),
dense:
true
,
visualDensity:
VisualDensity
.
compact
,
),
),
],
],
),
),
...
@@ -252,10 +281,11 @@ class WebPage extends StatelessWidget {
...
@@ -252,10 +281,11 @@ class WebPage extends StatelessWidget {
Navigator
.
pop
(
ctx
);
Navigator
.
pop
(
ctx
);
_showClearCacheDialog
(
ctx
);
_showClearCacheDialog
(
ctx
);
},
},
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
8
),
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
4
),
dense:
true
,
dense:
true
,
visualDensity:
VisualDensity
.
compact
,
visualDensity:
VisualDensity
.
compact
,
),
),
Divider
(
height:
1
,
thickness:
0.5
,
indent:
16
,
endIndent:
16
),
ListTile
(
ListTile
(
leading:
const
Icon
(
Icons
.
logout
,
size:
20
),
leading:
const
Icon
(
Icons
.
logout
,
size:
20
),
title:
const
Text
(
'退出登录'
,
style:
TextStyle
(
fontSize:
14
)),
title:
const
Text
(
'退出登录'
,
style:
TextStyle
(
fontSize:
14
)),
...
@@ -263,7 +293,7 @@ class WebPage extends StatelessWidget {
...
@@ -263,7 +293,7 @@ class WebPage extends StatelessWidget {
Navigator
.
pop
(
ctx
);
Navigator
.
pop
(
ctx
);
ctx
.
read
<
WebCubit
>().
logout
();
ctx
.
read
<
WebCubit
>().
logout
();
},
},
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
8
),
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
4
),
dense:
true
,
dense:
true
,
visualDensity:
VisualDensity
.
compact
,
visualDensity:
VisualDensity
.
compact
,
),
),
...
@@ -272,7 +302,7 @@ class WebPage extends StatelessWidget {
...
@@ -272,7 +302,7 @@ class WebPage extends StatelessWidget {
),
),
SizedBox
(
height:
8
),
SizedBox
(
height:
8
),
Card
(
Card
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
2
),
// 减小垂直间距
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
2
),
shape:
RoundedRectangleBorder
(
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
6
),
borderRadius:
BorderRadius
.
circular
(
6
),
),
),
...
@@ -280,18 +310,14 @@ class WebPage extends StatelessWidget {
...
@@ -280,18 +310,14 @@ class WebPage extends StatelessWidget {
children:
[
children:
[
ListTile
(
ListTile
(
leading:
const
Icon
(
Icons
.
timeline
,
size:
20
),
leading:
const
Icon
(
Icons
.
timeline
,
size:
20
),
// 减小图标大小
title:
const
Text
(
'切换日志模式'
,
style:
TextStyle
(
fontSize:
14
)),
title:
const
Text
(
'切换日志模式'
,
style:
TextStyle
(
fontSize:
14
)),
// 设置字体大小
onTap:
()
{
onTap:
()
{
Navigator
.
pop
(
ctx
);
Navigator
.
pop
(
ctx
);
ctx
.
read
<
WebCubit
>().
handleToggleDebug
();
ctx
.
read
<
WebCubit
>().
handleToggleDebug
();
},
},
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
8
),
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
16
,
vertical:
4
),
// trailing: Icon(Icons.arrow_forward_ios, size: 14),
// trailing: Icon(Icons.arrow_forward_ios, size: 14),
// 调整内边距
dense:
true
,
dense:
true
,
// 使用紧凑布局
visualDensity:
VisualDensity
.
compact
,
// 视觉密度设为紧凑
visualDensity:
VisualDensity
.
compact
,
// 视觉密度设为紧凑
),
),
],
],
...
@@ -304,7 +330,7 @@ class WebPage extends StatelessWidget {
...
@@ -304,7 +330,7 @@ class WebPage extends StatelessWidget {
const
Divider
(),
const
Divider
(),
Container
(
Container
(
width:
double
.
infinity
,
width:
double
.
infinity
,
// padding: const EdgeInsets.all(16.0
),
padding:
const
EdgeInsets
.
all
(
1
),
child:
Center
(
child:
Center
(
child:
Column
(
child:
Column
(
children:
[
children:
[
...
...
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