mobile: limited height scroll tags/users, and scrollable peers
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
5236dcfe52
commit
167bf70cd6
@ -1,3 +1,5 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:dynamic_layouts/dynamic_layouts.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/common/formatter/id_formatter.dart';
|
||||
@ -170,16 +172,18 @@ class _AddressBookState extends State<AddressBook> {
|
||||
});
|
||||
}
|
||||
|
||||
final gridView = DynamicGridView.builder(
|
||||
shrinkWrap: isMobile,
|
||||
gridDelegate: SliverGridDelegateWithWrapping(),
|
||||
itemCount: tags.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final e = tags[index];
|
||||
return tagBuilder(e);
|
||||
});
|
||||
final maxHeight = max(MediaQuery.of(context).size.height / 6, 100.0);
|
||||
return isDesktop
|
||||
? DynamicGridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithWrapping(
|
||||
mainAxisSpacing: 0, crossAxisSpacing: 0),
|
||||
itemCount: tags.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final e = tags[index];
|
||||
return tagBuilder(e);
|
||||
})
|
||||
: Wrap(children: tags.map((e) => tagBuilder(e)).toList());
|
||||
? gridView
|
||||
: LimitedBox(maxHeight: maxHeight, child: gridView);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/common/hbbs/hbbs.dart';
|
||||
import 'package:flutter_hbb/common/widgets/login.dart';
|
||||
@ -157,11 +159,14 @@ class _MyGroupState extends State<MyGroup> {
|
||||
}
|
||||
return true;
|
||||
}).toList();
|
||||
final listView = ListView.builder(
|
||||
shrinkWrap: isMobile,
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) => _buildUserItem(items[index]));
|
||||
var maxHeight = max(MediaQuery.of(context).size.height / 6, 100.0);
|
||||
return isDesktop
|
||||
? ListView.builder(
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) => _buildUserItem(items[index]))
|
||||
: Column(children: items.map((e) => _buildUserItem(e)).toList());
|
||||
? listView
|
||||
: LimitedBox(maxHeight: maxHeight, child: listView);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -197,23 +197,14 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
|
||||
: SizedBox(width: mobileWidth, child: visibilityChild);
|
||||
}
|
||||
|
||||
final Widget child;
|
||||
if (isDesktop) {
|
||||
child = DynamicGridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithWrapping(
|
||||
mainAxisSpacing: space / 2, crossAxisSpacing: space),
|
||||
itemCount: peers.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return buildOnePeer(peers[index]);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
child = Wrap(
|
||||
spacing: space,
|
||||
runSpacing: space,
|
||||
children: peers.map((e) => buildOnePeer(e)).toList());
|
||||
}
|
||||
|
||||
final child = DynamicGridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithWrapping(
|
||||
mainAxisSpacing: space / 2, crossAxisSpacing: space),
|
||||
itemCount: peers.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return buildOnePeer(peers[index]);
|
||||
},
|
||||
);
|
||||
if (updateEvent == UpdateEvent.load) {
|
||||
_curPeers.clear();
|
||||
_curPeers.addAll(peers.map((e) => e.id));
|
||||
|
@ -80,7 +80,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
||||
_buildRemoteIDTextField(),
|
||||
])),
|
||||
SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
hasScrollBody: true,
|
||||
child: PeerTabPage(),
|
||||
)
|
||||
],
|
||||
|
@ -400,11 +400,11 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "packages/dynamic_layouts"
|
||||
ref: "0023d01996576e494094793a6552463f01c5627a"
|
||||
resolved-ref: "0023d01996576e494094793a6552463f01c5627a"
|
||||
url: "https://github.com/flutter/packages.git"
|
||||
ref: "74cc4b495dcf3a4cb8df38d9ecc89f53f074a2c6"
|
||||
resolved-ref: "74cc4b495dcf3a4cb8df38d9ecc89f53f074a2c6"
|
||||
url: "https://github.com/21pages/packages.git"
|
||||
source: git
|
||||
version: "0.0.1+1"
|
||||
version: "0.0.1+2"
|
||||
event_bus:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -102,9 +102,9 @@ dependencies:
|
||||
flex_color_picker: ^3.3.0
|
||||
dynamic_layouts:
|
||||
git:
|
||||
url: https://github.com/flutter/packages.git
|
||||
url: https://github.com/21pages/packages.git
|
||||
path: packages/dynamic_layouts
|
||||
ref: 0023d01996576e494094793a6552463f01c5627a
|
||||
ref: 74cc4b495dcf3a4cb8df38d9ecc89f53f074a2c6
|
||||
|
||||
dev_dependencies:
|
||||
icons_launcher: ^2.0.4
|
||||
|
Loading…
Reference in New Issue
Block a user