74 lines
1.8 KiB
Dart
74 lines
1.8 KiB
Dart
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(),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|