自习室优化ok
This commit is contained in:
73
lib/widgets/room/board/board_dialog.dart
Normal file
73
lib/widgets/room/board/board_dialog.dart
Normal file
@@ -0,0 +1,73 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
|
||||
class BoardDialog extends StatefulWidget {
|
||||
final WebViewController controller;
|
||||
const BoardDialog({super.key, required this.controller});
|
||||
|
||||
@override
|
||||
State<BoardDialog> createState() => _BoardDialogState();
|
||||
}
|
||||
|
||||
class _BoardDialogState extends State<BoardDialog> {
|
||||
bool _loading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
// 绑定加载事件
|
||||
widget.controller.setNavigationDelegate(
|
||||
NavigationDelegate(
|
||||
onPageStarted: (_) {
|
||||
setState(() => _loading = true);
|
||||
},
|
||||
onPageFinished: (_) {
|
||||
setState(() => _loading = false);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('白板', style: Theme.of(context).textTheme.titleSmall),
|
||||
IconButton(
|
||||
onPressed: () => context.pop(),
|
||||
icon: const Icon(RemixIcons.close_circle_fill),
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
WebViewWidget(
|
||||
controller: widget.controller,
|
||||
),
|
||||
if (_loading)
|
||||
Container(
|
||||
color: Colors.white,
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user