Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
base_data_channel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PublicSource
base_data_channel
Commits
f3bff3c7
Commit
f3bff3c7
authored
Apr 06, 2023
by
tongzifang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common
parent
3e244491
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
0 deletions
+86
-0
common_colors.dart
lib/config/common_colors.dart
+5
-0
page_utils.dart
lib/utils/page_utils.dart
+81
-0
No files found.
lib/config/common_colors.dart
0 → 100644
View file @
f3bff3c7
import
'dart:ui'
;
class
CommonColor
{
static
Color
get
color33
=>
const
Color
(
0xFF333333
);
}
lib/utils/page_utils.dart
0 → 100644
View file @
f3bff3c7
import
'dart:io'
;
import
'package:base_data_channel/config/common_colors.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/flutter_boost.dart'
;
class
PageUtils
{
static
navigator
(
BuildContext
context
,
{
String
title
=
''
,
Color
appColor
=
Colors
.
white
,
Widget
?
backIcon
,
bool
isDark
=
true
,
PreferredSizeWidget
?
bottom
,
List
<
Widget
>?
actions
})
{
return
AppBar
(
backgroundColor:
appColor
,
leading:
GestureDetector
(
child:
backIcon
!=
null
?
backIcon
:
new
Icon
(
Icons
.
arrow_back_ios
),
onTap:
()
{
if
(
Platform
.
isIOS
)
{
BoostNavigator
.
instance
.
pop
();
//BoostChannel.instance.sendEventToNative("exit",{ });
}
else
{
BoostNavigator
.
instance
.
pop
();
//BoostNavigator.instance.popUntil(route: "login_device_manage");
// onBackPressed(context);
}
},
),
bottom:
bottom
,
iconTheme:
IconThemeData
(
color:
isDark
?
CommonColor
.
color33
:
Colors
.
white
),
elevation:
0
,
brightness:
isDark
?
Brightness
.
light
:
Brightness
.
dark
,
centerTitle:
true
,
actions:
actions
,
title:
Text
(
title
,
style:
TextStyle
(
color:
isDark
?
CommonColor
.
color33
:
Colors
.
white
,
fontSize:
18
,
fontWeight:
FontWeight
.
w700
),
),
);
}
static
statusBar
()
{
//黑色沉浸式状态栏,基于SystemUiOverlayStyle.dark修改了statusBarColor
SystemUiOverlayStyle
uiOverlayStyle
=
SystemUiOverlayStyle
(
systemNavigationBarColor:
Color
(
0xFF333333
),
systemNavigationBarDividerColor:
null
,
statusBarColor:
Colors
.
transparent
,
systemNavigationBarIconBrightness:
Brightness
.
light
,
statusBarIconBrightness:
Brightness
.
dark
,
statusBarBrightness:
Brightness
.
light
,
);
SystemUiOverlayStyle
systemUiOverlayStyle
=
SystemUiOverlayStyle
(
statusBarColor:
Colors
.
transparent
,
//全局设置透明
statusBarIconBrightness:
Brightness
.
light
//light:黑色图标 dark:白色图标
//在此处设置statusBarIconBrightness为全局设置
);
SystemChrome
.
setSystemUIOverlayStyle
(
systemUiOverlayStyle
);
}
static
pop
(
BuildContext
context
,
{
String
?
result
})
=>
Navigator
.
pop
(
context
,
result
);
static
popAndNoFocus
(
BuildContext
context
,
{
String
?
result
})
=>
{
Navigator
.
pop
(
context
,
result
),
FocusScope
.
of
(
context
).
requestFocus
(
FocusNode
())
};
static
onBackPressed
(
BuildContext
context
)
{
NavigatorState
navigatorState
=
Navigator
.
of
(
context
);
if
(
navigatorState
.
canPop
())
{
navigatorState
.
pop
();
}
else
{
SystemNavigator
.
pop
();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment