mobile cm client info CircleAvatar color

This commit is contained in:
csf 2022-09-29 21:53:50 +08:00
parent d11ae197f3
commit fe506c5ff2
3 changed files with 38 additions and 110 deletions

View File

@ -529,85 +529,6 @@ class _CmControlPanel extends StatelessWidget {
}
}
class PaddingCard extends StatelessWidget {
PaddingCard({required this.child, this.title, this.titleIcon});
final String? title;
final IconData? titleIcon;
final Widget child;
@override
Widget build(BuildContext context) {
final children = [child];
if (title != null) {
children.insert(
0,
Padding(
padding: EdgeInsets.symmetric(vertical: 5.0),
child: Row(
children: [
titleIcon != null
? Padding(
padding: EdgeInsets.only(right: 10),
child: Icon(titleIcon,
color: MyTheme.accent80, size: 30))
: SizedBox.shrink(),
Text(
title!,
style: TextStyle(
fontFamily: 'WorkSans',
fontWeight: FontWeight.bold,
fontSize: 20,
color: MyTheme.accent80,
),
)
],
)));
}
return Container(
width: double.maxFinite,
child: Card(
margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0),
child: Padding(
padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 30.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: children,
),
),
));
}
}
Widget clientInfo(Client client) {
return Padding(
padding: EdgeInsets.symmetric(vertical: 8),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Row(
children: [
Expanded(
flex: -1,
child: Padding(
padding: EdgeInsets.only(right: 12),
child: CircleAvatar(
child: Text(client.name[0]),
backgroundColor: MyTheme.border))),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(client.name,
style: TextStyle(color: MyTheme.idColor, fontSize: 18)),
SizedBox(width: 8),
Text(client.peerId,
style: TextStyle(color: MyTheme.idColor, fontSize: 10))
]))
],
),
]));
}
void checkClickTime(int id, Function() callback) async {
var clickCallbackTime = DateTime.now().millisecondsSinceEpoch;
await bind.cmCheckClickTime(connId: id);

View File

@ -381,7 +381,7 @@ class ConnectionManager extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: clientInfo(client)),
Expanded(child: ClientInfo(client)),
Expanded(
flex: -1,
child: client.isFileTransfer || !client.authorized
@ -493,35 +493,42 @@ class PaddingCard extends StatelessWidget {
}
}
Widget clientInfo(Client client) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Row(
children: [
Expanded(
flex: -1,
child: Padding(
padding: const EdgeInsets.only(right: 12),
child: CircleAvatar(
backgroundColor: MyTheme.border,
child: Text(client.name[0])))),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(client.name,
style: const TextStyle(
color: MyTheme.idColor, fontSize: 18)),
const SizedBox(width: 8),
Text(client.peerId,
style:
const TextStyle(color: MyTheme.idColor, fontSize: 10))
]))
],
),
]));
class ClientInfo extends StatelessWidget {
final Client client;
ClientInfo(this.client);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Row(
children: [
Expanded(
flex: -1,
child: Padding(
padding: const EdgeInsets.only(right: 12),
child: CircleAvatar(
backgroundColor:
str2color(client.name).withOpacity(0.7),
child: Text(client.name[0])))),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(client.name,
style: const TextStyle(
color: MyTheme.idColor, fontSize: 18)),
const SizedBox(width: 8),
Text(client.peerId,
style: const TextStyle(
color: MyTheme.idColor, fontSize: 10))
]))
],
),
]));
}
}
void androidChannelInit() {

View File

@ -433,7 +433,7 @@ class ServerModel with ChangeNotifier {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(translate("Do you accept?")),
clientInfo(client),
ClientInfo(client),
Text(
translate("android_new_connection_tip"),
style: Theme.of(globalKey.currentContext!).textTheme.bodyMedium,