opt: adapt global scroll on mobile

This commit is contained in:
Kingtous 2022-09-28 21:07:44 +08:00
parent ff56753756
commit e42b543a42
2 changed files with 52 additions and 34 deletions

View File

@ -73,21 +73,34 @@ class _PeerCardState extends State<_PeerCard>
_menuPos = RelativeRect.fromLTRB(x, y, x, y); _menuPos = RelativeRect.fromLTRB(x, y, x, y);
_showPeerMenu(peer.id); _showPeerMenu(peer.id);
}, },
child: ListTile( child: Container(
contentPadding: const EdgeInsets.only(left: 12), // padding: EdgeInsets.only(left: 12, top: 8, bottom: 8),
subtitle: Text('${peer.username}@${peer.hostname}'), child: Row(
title: Row(children: [ children: [
getOnline(4, peer.online), Container(
Text(peer.alias.isEmpty ? formatID(peer.id) : peer.alias) width: 50,
]), height: 50,
leading: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: str2color('${peer.id}${peer.platform}', 0x7f), color: str2color('${peer.id}${peer.platform}', 0x7f),
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
), ),
padding: const EdgeInsets.all(6), padding: const EdgeInsets.all(6),
child: getPlatformImage(peer.platform)), child: getPlatformImage(peer.platform)),
trailing: InkWell( Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(children: [
getOnline(4, peer.online),
Text(peer.alias.isEmpty
? formatID(peer.id)
: peer.alias)
]),
Text('${peer.username}@${peer.hostname}')
],
).paddingOnly(left: 8.0),
),
InkWell(
child: const Padding( child: const Padding(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
child: Icon(Icons.more_vert)), child: Icon(Icons.more_vert)),
@ -98,7 +111,9 @@ class _PeerCardState extends State<_PeerCard>
}, },
onTap: () { onTap: () {
_showPeerMenu(peer.id); _showPeerMenu(peer.id);
}), })
],
),
))); )));
} }

View File

@ -66,14 +66,15 @@ class _ConnectionPageState extends State<ConnectionPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Provider.of<FfiModel>(context); Provider.of<FfiModel>(context);
return Column( return CustomScrollView(
mainAxisAlignment: MainAxisAlignment.start, slivers: [
mainAxisSize: MainAxisSize.max, SliverList(
crossAxisAlignment: CrossAxisAlignment.center, delegate: SliverChildListDelegate([
children: <Widget>[
_buildUpdateUI(), _buildUpdateUI(),
_buildRemoteIDTextField(), _buildRemoteIDTextField(),
Expanded( ])),
SliverFillRemaining(
hasScrollBody: false,
child: PeerTabPage( child: PeerTabPage(
tabs: [ tabs: [
translate('Recent Sessions'), translate('Recent Sessions'),
@ -87,8 +88,10 @@ class _ConnectionPageState extends State<ConnectionPage> {
DiscoveredPeersView(), DiscoveredPeersView(),
const AddressBook(), const AddressBook(),
], ],
)), ),
]).marginOnly(top: 2, left: 10, right: 10); )
],
).marginOnly(top: 2, left: 10, right: 10);
} }
/// Callback for the connect button. /// Callback for the connect button.