Commit fd2a7435 by tanghuan

还原测试的修改

1 parent e7cbb1fd
......@@ -43,74 +43,80 @@ class WebPage extends StatelessWidget {
),
child: BlocConsumer<WebCubit, WebState>(
builder: (ctx, state) {
return Scaffold(
appBar: _buildAppBar(ctx, state),
endDrawer: _buildDrawer(ctx, state),
body: Stack(
children: [
state.loaded
? SizedBox(
height: MediaQuery.of(ctx).size.height - 60, // 减去100像素留空
child: WebViewWidget(controller: ctx.read<WebCubit>().controller),
)
: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(color: Color(0xFF7691fa)),
SizedBox(height: 16),
Text('加载中...'),
],
return PopScope(
canPop: false,
onPopInvokedWithResult: (didPop, result) {
ctx.read<WebCubit>().handleBack();
},
child: Scaffold(
appBar: _buildAppBar(ctx, state),
endDrawer: _buildDrawer(ctx, state),
body: Stack(
children: [
state.loaded
? SizedBox(
height: MediaQuery.of(ctx).size.height - 60, // 减去100像素留空
child: WebViewWidget(controller: ctx.read<WebCubit>().controller),
)
: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(color: Color(0xFF7691fa)),
SizedBox(height: 16),
Text('加载中...'),
],
),
),
),
// 添加升级遮罩层
if (state.isUpgrading)
Container(
color: Colors.black54,
child: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(color: Color(0xFF7691fa)),
SizedBox(height: 16),
Text('资源更新中...', style: TextStyle(color: Colors.white)),
],
// 添加升级遮罩层
if (state.isUpgrading)
Container(
color: Colors.black54,
child: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(color: Color(0xFF7691fa)),
SizedBox(height: 16),
Text('资源更新中...', style: TextStyle(color: Colors.white)),
],
),
),
),
],
),
bottomNavigationBar: state.showBottomNavBar
? BottomNavigationBar(
type: BottomNavigationBarType.fixed,
currentIndex: state.selectedIndex,
selectedItemColor: Color(0xFF7691fa),
unselectedItemColor: Color(0xFF969799),
onTap: (index) {
// 更新选中索引
ctx.read<WebCubit>().updateSelectedIndex(index);
// 根据 index 执行相应的操作
},
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home, size: 32),
label: '我的班级',
),
BottomNavigationBarItem(
icon: Icon(Icons.contact_page, size: 32),
label: '通讯录',
),
BottomNavigationBarItem(
icon: Icon(Icons.find_in_page, size: 32),
label: '发现',
),
BottomNavigationBarItem(
icon: Icon(Icons.person, size: 32),
label: '我的',
),
],
],
)
: null,
),
bottomNavigationBar: state.showBottomNavBar
? BottomNavigationBar(
type: BottomNavigationBarType.fixed,
currentIndex: state.selectedIndex,
selectedItemColor: Color(0xFF7691fa),
unselectedItemColor: Color(0xFF969799),
onTap: (index) {
// 更新选中索引
ctx.read<WebCubit>().updateSelectedIndex(index);
// 根据 index 执行相应的操作
},
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home, size: 32),
label: '我的班级',
),
BottomNavigationBarItem(
icon: Icon(Icons.contact_page, size: 32),
label: '通讯录',
),
BottomNavigationBarItem(
icon: Icon(Icons.find_in_page, size: 32),
label: '发现',
),
BottomNavigationBarItem(
icon: Icon(Icons.person, size: 32),
label: '我的',
),
],
)
: null,
);
},
listener: (context, state) {
......@@ -139,19 +145,19 @@ class WebPage extends StatelessWidget {
actionsIconTheme: IconThemeData(color: Colors.white),
leading: state.opIcon == 'back'
? IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.white),
onPressed: () {
ctx.read<WebCubit>().handleBack();
},
)
icon: const Icon(Icons.arrow_back, color: Colors.white),
onPressed: () {
ctx.read<WebCubit>().handleBack();
},
)
: (state.opIcon == 'home'
? IconButton(
icon: const Icon(Icons.home, color: Colors.white),
onPressed: () {
ctx.read<WebCubit>().handleHome();
},
)
: null),
? IconButton(
icon: const Icon(Icons.home, color: Colors.white),
onPressed: () {
ctx.read<WebCubit>().handleHome();
},
)
: null),
);
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!