add loading

This commit is contained in:
open-trade 2020-11-16 21:21:27 +08:00
parent 02719f45f6
commit 521c8ad18e
5 changed files with 28 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import 'dart:io';
import 'dart:ffi';
import 'dart:async';
import 'dart:convert';
import 'package:flutter_easyloading/flutter_easyloading.dart';
class HexColor extends Color {
HexColor(final String hexColor) : super(_getColorFromHex(hexColor));
@ -104,3 +105,12 @@ class Peer {
hostname = json['hostname'],
platform = json['platform'];
}
// https://github.com/huangjianke/flutter_easyloading
void showLoading(String text) {
EasyLoading.show(status: text);
}
void dismissLoading() {
EasyLoading.dismiss();
}

View File

@ -72,7 +72,7 @@ class _HomePageState extends State<HomePage> {
fontSize: 30,
color: Color(0xFF00B6F0),
),
keyboardType: TextInputType.text,
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: 'Remote ID',
border: InputBorder.none,

View File

@ -2,6 +2,7 @@ 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());
@ -19,7 +20,7 @@ class App extends StatelessWidget {
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: HomePage(title: 'RustDesk'),
home: FlutterEasyLoading(child: HomePage(title: 'RustDesk')),
));
}
}

View File

@ -76,6 +76,20 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_easyloading:
dependency: "direct main"
description:
name: flutter_easyloading
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
flutter_spinkit:
dependency: transitive
description:
name: flutter_spinkit
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.2+1"
flutter_test:
dependency: "direct dev"
description: flutter

View File

@ -31,6 +31,7 @@ dependencies:
ffi: ^0.1.3
path_provider: ^1.6.24
provider: ^4.3.2+2
flutter_easyloading: ^2.1.3
dev_dependencies:
flutter_test: