fix page pop
This commit is contained in:
parent
6206c8f900
commit
b106ed5717
@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:tuple/tuple.dart';
|
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import '../common.dart';
|
import '../common.dart';
|
||||||
@ -164,7 +163,6 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
|||||||
icon: Icon(Icons.arrow_forward,
|
icon: Icon(Icons.arrow_forward,
|
||||||
color: MyTheme.darkGray, size: 45),
|
color: MyTheme.darkGray, size: 45),
|
||||||
onPressed: onConnect,
|
onPressed: onConnect,
|
||||||
autofocus: _idController.text.isNotEmpty,
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
@ -29,27 +29,38 @@ class _HomePageState extends State<HomePage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return WillPopScope(
|
||||||
backgroundColor: MyTheme.grayBg,
|
onWillPop: () async {
|
||||||
appBar: AppBar(
|
if (_selectedIndex != 0) {
|
||||||
centerTitle: true,
|
setState(() {
|
||||||
title: Text("RustDesk"),
|
_selectedIndex = 0;
|
||||||
actions: _pages.elementAt(_selectedIndex).appBarActions,
|
});
|
||||||
),
|
} else {
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
return true;
|
||||||
items: _pages
|
}
|
||||||
.map((page) =>
|
return false;
|
||||||
BottomNavigationBarItem(icon: page.icon, label: page.title))
|
},
|
||||||
.toList(),
|
child: Scaffold(
|
||||||
currentIndex: _selectedIndex,
|
backgroundColor: MyTheme.grayBg,
|
||||||
type: BottomNavigationBarType.fixed,
|
appBar: AppBar(
|
||||||
selectedItemColor: MyTheme.accent,
|
centerTitle: true,
|
||||||
unselectedItemColor: MyTheme.darkGray,
|
title: Text("RustDesk"),
|
||||||
onTap: (index) => setState(() {
|
actions: _pages.elementAt(_selectedIndex).appBarActions,
|
||||||
_selectedIndex = index;
|
),
|
||||||
}),
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
),
|
items: _pages
|
||||||
body: _pages.elementAt(_selectedIndex),
|
.map((page) =>
|
||||||
);
|
BottomNavigationBarItem(icon: page.icon, label: page.title))
|
||||||
|
.toList(),
|
||||||
|
currentIndex: _selectedIndex,
|
||||||
|
type: BottomNavigationBarType.fixed,
|
||||||
|
selectedItemColor: MyTheme.accent,
|
||||||
|
unselectedItemColor: MyTheme.darkGray,
|
||||||
|
onTap: (index) => setState(() {
|
||||||
|
_selectedIndex = index;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
body: _pages.elementAt(_selectedIndex),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,40 +209,44 @@ void showLoginReqAlert(String peerID, String name) async {
|
|||||||
builder: (alertContext) {
|
builder: (alertContext) {
|
||||||
DialogManager.reset();
|
DialogManager.reset();
|
||||||
DialogManager.register(alertContext);
|
DialogManager.register(alertContext);
|
||||||
return AlertDialog(
|
return WillPopScope(
|
||||||
title: Text("Control Request"),
|
onWillPop: () async {
|
||||||
content: Container(
|
return false;
|
||||||
height: 100,
|
},
|
||||||
child: Column(
|
child: AlertDialog(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
title: Text("Control Request"),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
content: Container(
|
||||||
children: [
|
height: 100,
|
||||||
Text(translate("Do you accept?")),
|
child: Column(
|
||||||
SizedBox(height: 20),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
getConnInfo(name, peerID),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
],
|
children: [
|
||||||
)),
|
Text(translate("Do you accept?")),
|
||||||
actions: [
|
SizedBox(height: 20),
|
||||||
TextButton(
|
getConnInfo(name, peerID),
|
||||||
child: Text(translate("Dismiss")),
|
],
|
||||||
onPressed: () {
|
)),
|
||||||
FFI.setByName("login_res", "false");
|
actions: [
|
||||||
DialogManager.reset();
|
TextButton(
|
||||||
}),
|
child: Text(translate("Dismiss")),
|
||||||
ElevatedButton(
|
onPressed: () {
|
||||||
child: Text(translate("Accept")),
|
FFI.setByName("login_res", "false");
|
||||||
onPressed: () {
|
DialogManager.reset();
|
||||||
FFI.setByName("login_res", "true");
|
}),
|
||||||
if (!FFI.serverModel.isFileTransfer) {
|
ElevatedButton(
|
||||||
_toAndroidStartCapture();
|
child: Text(translate("Accept")),
|
||||||
}
|
onPressed: () {
|
||||||
FFI.serverModel.setPeer(true);
|
FFI.setByName("login_res", "true");
|
||||||
DialogManager.reset();
|
if (!FFI.serverModel.isFileTransfer) {
|
||||||
}),
|
_toAndroidStartCapture();
|
||||||
],
|
}
|
||||||
);
|
FFI.serverModel.setPeer(true);
|
||||||
|
DialogManager.reset();
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
));
|
||||||
});
|
});
|
||||||
DialogManager.reset();
|
DialogManager.drop();
|
||||||
}
|
}
|
||||||
|
|
||||||
class PermissionRow extends StatelessWidget {
|
class PermissionRow extends StatelessWidget {
|
||||||
@ -403,7 +407,7 @@ showInputWarnAlert() async {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
DialogManager.reset();
|
DialogManager.drop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void toAndroidChannelInit() {
|
void toAndroidChannelInit() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user