reduced peer view type to one toggle, moved sorting button under peer view type

This commit is contained in:
NicKoehler 2023-03-07 19:27:39 +01:00
parent a04351baf4
commit a4ef60a250
No known key found for this signature in database
GPG Key ID: BAE01394EB51AC58

View File

@ -113,14 +113,19 @@ class _PeerTabPageState extends State<PeerTabPage>
offstage: !isDesktop, offstage: !isDesktop,
child: _createPeerViewTypeSwitch(context) child: _createPeerViewTypeSwitch(context)
.marginOnly(left: 13)), .marginOnly(left: 13)),
Offstage(
offstage: _hideSort,
child: PeerSortDropdown(),
)
], ],
), ),
), ),
), ),
Row(
children: [
Expanded(child: SizedBox()),
Offstage(
offstage: _hideSort,
child: PeerSortDropdown(),
),
],
),
_createPeersView(), _createPeersView(),
], ],
); );
@ -240,32 +245,32 @@ class _PeerTabPageState extends State<PeerTabPage>
Widget _createPeerViewTypeSwitch(BuildContext context) { Widget _createPeerViewTypeSwitch(BuildContext context) {
final textColor = Theme.of(context).textTheme.titleLarge?.color; final textColor = Theme.of(context).textTheme.titleLarge?.color;
final activeDeco = final activeDeco = BoxDecoration(
BoxDecoration(color: Theme.of(context).colorScheme.background); color: Theme.of(context).colorScheme.background,
return Row( borderRadius: BorderRadius.circular(5),
children: [PeerUiType.grid, PeerUiType.list] );
.map((type) => Obx( final types = [PeerUiType.grid, PeerUiType.list];
() => Container(
padding: EdgeInsets.all(4.0), return Obx(
decoration: peerCardUiType.value == type ? activeDeco : null, () => Container(
child: InkWell( padding: EdgeInsets.all(4.0),
onTap: () async { decoration: activeDeco,
await bind.setLocalFlutterConfig( child: InkWell(
k: 'peer-card-ui-type', v: type.index.toString()); onTap: () async {
peerCardUiType.value = type; final type = types.elementAt(
}, peerCardUiType.value == types.elementAt(0) ? 1 : 0);
child: Icon( await bind.setLocalFlutterConfig(
type == PeerUiType.grid k: 'peer-card-ui-type', v: type.index.toString());
? Icons.grid_view_rounded peerCardUiType.value = type;
: Icons.list, },
size: 18, child: Icon(
color: peerCardUiType.value == PeerUiType.grid
peerCardUiType.value == type ? textColor : textColor ? Icons.list_rounded
?..withOpacity(0.5), : Icons.grid_view_rounded,
)), size: 18,
), color: textColor,
)) )),
.toList(), ),
); );
} }
@ -441,7 +446,7 @@ class _PeerSortDropdownState extends State<PeerSortDropdown> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DropdownButton<String>( return DropdownButton<String>(
value: _sortType, value: _sortType == "" ? 'id' : _sortType,
elevation: 16, elevation: 16,
underline: SizedBox(), underline: SizedBox(),
onChanged: (v) { onChanged: (v) {