This commit is contained in:
open-trade 2020-11-17 12:08:31 +08:00
parent 190dc6006c
commit cc0139a85c
2 changed files with 29 additions and 6 deletions

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'common.dart';
import 'home_page.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
void main() {
runApp(App());
@ -20,7 +19,7 @@ class App extends StatelessWidget {
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: FlutterEasyLoading(child: HomePage(title: 'RustDesk')),
home: HomePage(title: 'RustDesk'),
));
}
}

View File

@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'common.dart';
import 'package:flutter/services.dart';
import 'dart:ui' as ui;
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'dart:async';
class RemotePage extends StatefulWidget {
RemotePage({Key key, this.id}) : super(key: key);
@ -12,20 +14,42 @@ class RemotePage extends StatefulWidget {
_RemotePageState createState() => _RemotePageState();
}
// https://github.com/hanxu317317/flutter_plan_demo/blob/master/lib/src/enter.dart
class _RemotePageState extends State<RemotePage> {
Timer _interval;
@override
void initState() {
super.initState();
FFI.connect(widget.id);
WidgetsBinding.instance.addPostFrameCallback((_) {
showLoading("Connecting...");
_interval =
Timer.periodic(Duration(milliseconds: 30), (timer) => interval());
});
}
@override
void dispose() {
super.dispose();
_interval.cancel();
dismissLoading();
FFI.close();
}
void interval() {
print(1);
}
@override
Widget build(BuildContext context) {
// Size size = MediaQueryData.fromWindow(ui.window).size;
// https://stackoverflow.com/questions/46640116/make-flutter-application-fullscreen
SystemChrome.setEnabledSystemUIOverlays([]);
return CustomPaint(
return FlutterEasyLoading(
child: CustomPaint(
painter: new ImageEditor(image: null),
);
));
}
}
@ -38,12 +62,12 @@ class ImageEditor extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
if (image = null) return;
if (image == null) return;
canvas.drawImage(image, new Offset(0.0, 0.0), new Paint());
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return false;
return oldDelegate != this;
}
}