update style / UI

This commit is contained in:
csf 2022-02-25 22:16:51 +08:00
parent eaff76370e
commit 31ff6923d2

View File

@ -172,6 +172,8 @@ class _PermissionCheckerState extends State<PermissionChecker> {
const Divider(), const Divider(),
serverModel.mediaOk serverModel.mediaOk
? ElevatedButton.icon( ? ElevatedButton.icon(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.red)),
icon: Icon(Icons.stop), icon: Icon(Icons.stop),
onPressed: _toAndroidStopService, onPressed: _toAndroidStopService,
label: Text(translate("Stop service"))) label: Text(translate("Stop service")))
@ -184,6 +186,18 @@ class _PermissionCheckerState extends State<PermissionChecker> {
} }
} }
Widget getConnInfo(String name, String peerID) {
return Row(
children: [
CircleAvatar(child: Text(name[0]), backgroundColor: MyTheme.border),
SizedBox(width: 12),
Text(name, style: TextStyle(color: MyTheme.idColor)),
SizedBox(width: 8),
Text(peerID, style: TextStyle(color: MyTheme.idColor))
],
);
}
BuildContext? loginReqAlertCtx; BuildContext? loginReqAlertCtx;
void showLoginReqAlert(String peerID, String name) async { void showLoginReqAlert(String peerID, String name) async {
@ -203,15 +217,7 @@ void showLoginReqAlert(String peerID, String name) async {
children: [ children: [
Text(translate("Do you accept?")), Text(translate("Do you accept?")),
SizedBox(height: 20), SizedBox(height: 20),
Row( getConnInfo(name, peerID),
children: [
CircleAvatar(child: Text(name[0])),
SizedBox(width: 10),
Text(name),
SizedBox(width: 5),
Text(peerID)
],
),
], ],
)), )),
actions: [ actions: [
@ -257,15 +263,21 @@ class PermissionRow extends StatelessWidget {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text.rich(TextSpan(children: [ Row(
TextSpan( children: [
text: name + ": ", SizedBox(
style: TextStyle(fontSize: 16.0, color: MyTheme.accent50)), width: 60,
TextSpan( child: Text(name + ":",
text: isOk ? translate("ON") : translate("OFF"), style: TextStyle(fontSize: 16.0, color: MyTheme.accent50))),
style: TextStyle( SizedBox(
fontSize: 16.0, color: isOk ? Colors.green : Colors.grey)), width: 50,
])), child: Text(isOk ? translate("ON") : translate("OFF"),
style: TextStyle(
fontSize: 16.0,
color: isOk ? Colors.green : Colors.grey)),
)
],
),
TextButton( TextButton(
onPressed: isOk ? null : onPressed, onPressed: isOk ? null : onPressed,
child: Text( child: Text(
@ -281,16 +293,14 @@ class ConnectionManager extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final serverModel = Provider.of<ServerModel>(context); final serverModel = Provider.of<ServerModel>(context);
var info =
"${serverModel.peerName != "" ? serverModel.peerName : "NA"}-${serverModel.peerID != "" ? serverModel.peerID : "NA"}";
return serverModel.isPeerStart return serverModel.isPeerStart
? myCard(Column( ? myCard(Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
cardTitle("当前连接"), cardTitle(translate("Connection")), // TODO t
Padding( Padding(
padding: EdgeInsets.symmetric(vertical: 5.0), padding: EdgeInsets.symmetric(vertical: 5.0),
child: Text(info, style: TextStyle(color: Colors.grey)), child: getConnInfo(serverModel.peerName, serverModel.peerID),
), ),
ElevatedButton.icon( ElevatedButton.icon(
style: ButtonStyle( style: ButtonStyle(
@ -301,7 +311,7 @@ class ConnectionManager extends StatelessWidget {
// _toAndroidStopCapture(); // _toAndroidStopCapture();
serverModel.setPeer(false); serverModel.setPeer(false);
}, },
label: Text("断开连接")) label: Text(translate("Close")))
], ],
)) ))
: SizedBox.shrink(); : SizedBox.shrink();
@ -369,19 +379,19 @@ showInputWarnAlert() async {
await showDialog<bool>( await showDialog<bool>(
context: globalKey.currentContext!, context: globalKey.currentContext!,
builder: (alertContext) { builder: (alertContext) {
// TODO t
return AlertDialog( return AlertDialog(
title: Text("获取输入权限引导"), title: Text("获取输入权限引导"),
// content: Text("请在接下来的系统设置页面 \n进入 [服务] 配置页面\n将[RustDesk Input]服务开启"), // content: Text("请在接下来的系统设置页面 \n进入 [服务] 配置页面\n将[RustDesk Input]服务开启"),
content: Text.rich(TextSpan( content: Text.rich(TextSpan(style: TextStyle(), children: [
style: TextStyle(), TextSpan(text: "请在接下来的系统设置页\n进入"),
children: [ TextSpan(text: " [服务] ", style: TextStyle(color: MyTheme.accent)),
TextSpan(text:"请在接下来的系统设置页\n进入"), TextSpan(text: "配置页面\n"),
TextSpan(text:" [服务] ",style: TextStyle(color: MyTheme.accent)), TextSpan(
TextSpan(text:"配置页面\n"), text: " [RustDesk Input] ",
TextSpan(text:" [RustDesk Input] ",style: TextStyle(color: MyTheme.accent)), style: TextStyle(color: MyTheme.accent)),
TextSpan(text:"服务开启") TextSpan(text: "服务开启")
] ])),
)),
actions: [ actions: [
TextButton( TextButton(
child: Text(translate("Do nothing")), child: Text(translate("Do nothing")),