Commit fd2a7435 by tanghuan

还原测试的修改

1 parent e7cbb1fd
...@@ -43,74 +43,80 @@ class WebPage extends StatelessWidget { ...@@ -43,74 +43,80 @@ class WebPage extends StatelessWidget {
), ),
child: BlocConsumer<WebCubit, WebState>( child: BlocConsumer<WebCubit, WebState>(
builder: (ctx, state) { builder: (ctx, state) {
return Scaffold( return PopScope(
appBar: _buildAppBar(ctx, state), canPop: false,
endDrawer: _buildDrawer(ctx, state), onPopInvokedWithResult: (didPop, result) {
body: Stack( ctx.read<WebCubit>().handleBack();
children: [ },
state.loaded child: Scaffold(
? SizedBox( appBar: _buildAppBar(ctx, state),
height: MediaQuery.of(ctx).size.height - 60, // 减去100像素留空 endDrawer: _buildDrawer(ctx, state),
child: WebViewWidget(controller: ctx.read<WebCubit>().controller), body: Stack(
) children: [
: const Center( state.loaded
child: Column( ? SizedBox(
mainAxisAlignment: MainAxisAlignment.center, height: MediaQuery.of(ctx).size.height - 60, // 减去100像素留空
children: [ child: WebViewWidget(controller: ctx.read<WebCubit>().controller),
CircularProgressIndicator(color: Color(0xFF7691fa)), )
SizedBox(height: 16), : const Center(
Text('加载中...'), child: Column(
], mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(color: Color(0xFF7691fa)),
SizedBox(height: 16),
Text('加载中...'),
],
),
), ),
), // 添加升级遮罩层
// 添加升级遮罩层 if (state.isUpgrading)
if (state.isUpgrading) Container(
Container( color: Colors.black54,
color: Colors.black54, child: const Center(
child: const Center( child: Column(
child: Column( mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, children: [
children: [ CircularProgressIndicator(color: Color(0xFF7691fa)),
CircularProgressIndicator(color: Color(0xFF7691fa)), SizedBox(height: 16),
SizedBox(height: 16), Text('资源更新中...', style: TextStyle(color: Colors.white)),
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) { listener: (context, state) {
...@@ -139,19 +145,19 @@ class WebPage extends StatelessWidget { ...@@ -139,19 +145,19 @@ class WebPage extends StatelessWidget {
actionsIconTheme: IconThemeData(color: Colors.white), actionsIconTheme: IconThemeData(color: Colors.white),
leading: state.opIcon == 'back' leading: state.opIcon == 'back'
? IconButton( ? IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.white), icon: const Icon(Icons.arrow_back, color: Colors.white),
onPressed: () { onPressed: () {
ctx.read<WebCubit>().handleBack(); ctx.read<WebCubit>().handleBack();
}, },
) )
: (state.opIcon == 'home' : (state.opIcon == 'home'
? IconButton( ? IconButton(
icon: const Icon(Icons.home, color: Colors.white), icon: const Icon(Icons.home, color: Colors.white),
onPressed: () { onPressed: () {
ctx.read<WebCubit>().handleHome(); ctx.read<WebCubit>().handleHome();
}, },
) )
: null), : null),
); );
} }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!