feat: no overlap with player controls

plus beta scrollbar
This commit is contained in:
Matyáš Caras 2024-06-21 12:58:40 +02:00
parent 017c52f96d
commit e68c775fca
Signed by: hernik
GPG key ID: 2A3175F98820C5C6
3 changed files with 46 additions and 30 deletions

View file

@ -1,5 +1,6 @@
import 'dart:async';
import 'package:flexible_scrollbar/flexible_scrollbar.dart';
import 'package:flutter/material.dart';
import 'package:grouped_list/grouped_list.dart';
import 'package:ocarina/api/audio/audioplayer_service.dart';
@ -28,6 +29,7 @@ class _HomeViewState extends State<HomeView> {
var _loading = true;
final _artists = <ArtistIndex>[];
final _scrollController = ScrollController();
Future<void> authenticate() async {
if (!(await LoginManager.hasSavedLogin)) {
@ -80,10 +82,11 @@ class _HomeViewState extends State<HomeView> {
appBar: AppBar(
title: Text("Home"),
),
body: Center(
body: Align(
alignment: Alignment.topCenter,
child: SingleChildScrollView(
child: SizedBox(
height: 100.h,
height: 77.h,
width: 95.w,
child: _loading
? const Column(
@ -92,36 +95,40 @@ class _HomeViewState extends State<HomeView> {
CircularProgressIndicator.adaptive(),
],
)
: GroupedListView<ArtistIndex, String>(
elements: _artists,
groupBy: (a) => a.index,
groupHeaderBuilder: (index) => Text(
index.index,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
: FlexibleScrollbar(
controller: _scrollController,
child: GroupedListView<ArtistIndex, String>(
controller: _scrollController,
elements: _artists,
groupBy: (a) => a.index,
groupHeaderBuilder: (index) => Text(
index.index,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
),
),
itemBuilder: (c, index) => Wrap(
alignment: (index.artists.length > 1)
? WrapAlignment.spaceBetween
: WrapAlignment.start,
children: List<Widget>.generate(
index.artists.length,
(n) => InkWell(
onTap: () async {
await Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (c) => ArtistView(
artist: index.artists[n],
itemBuilder: (c, index) => Wrap(
alignment: (index.artists.length > 1)
? WrapAlignment.spaceBetween
: WrapAlignment.start,
children: List<Widget>.generate(
index.artists.length,
(n) => InkWell(
onTap: () async {
await Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (c) => ArtistView(
artist: index.artists[n],
),
),
),
);
},
child: ImageCover(
cacheKey: index.artists[n].coverArtId,
imageUrl: index.artists[n].coverArtUrl,
title: index.artists[n].name,
heroTag: index.artists[n].name,
);
},
child: ImageCover(
cacheKey: index.artists[n].coverArtId,
imageUrl: index.artists[n].coverArtUrl,
title: index.artists[n].name,
heroTag: index.artists[n].name,
),
),
),
),

View file

@ -302,6 +302,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.0"
flexible_scrollbar:
dependency: "direct main"
description:
name: flexible_scrollbar
sha256: f5b808009624c49929b9a9c19c41c36fefeac7d8f36cb84558fd26614158d6e9
url: "https://pub.dev"
source: hosted
version: "0.1.3"
flutter:
dependency: "direct main"
description: flutter

View file

@ -56,6 +56,7 @@ dependencies:
dynamic_color: ^1.7.0
cached_network_image: ^3.3.1
flutter_xlider: ^3.5.0
flexible_scrollbar: ^0.1.3
dev_dependencies:
build_runner: ^2.4.9