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