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 'dart:async';
import 'package:flexible_scrollbar/flexible_scrollbar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:grouped_list/grouped_list.dart'; import 'package:grouped_list/grouped_list.dart';
import 'package:ocarina/api/audio/audioplayer_service.dart'; import 'package:ocarina/api/audio/audioplayer_service.dart';
@ -28,6 +29,7 @@ class _HomeViewState extends State<HomeView> {
var _loading = true; var _loading = true;
final _artists = <ArtistIndex>[]; final _artists = <ArtistIndex>[];
final _scrollController = ScrollController();
Future<void> authenticate() async { Future<void> authenticate() async {
if (!(await LoginManager.hasSavedLogin)) { if (!(await LoginManager.hasSavedLogin)) {
@ -80,10 +82,11 @@ class _HomeViewState extends State<HomeView> {
appBar: AppBar( appBar: AppBar(
title: Text("Home"), title: Text("Home"),
), ),
body: Center( body: Align(
alignment: Alignment.topCenter,
child: SingleChildScrollView( child: SingleChildScrollView(
child: SizedBox( child: SizedBox(
height: 100.h, height: 77.h,
width: 95.w, width: 95.w,
child: _loading child: _loading
? const Column( ? const Column(
@ -92,7 +95,10 @@ class _HomeViewState extends State<HomeView> {
CircularProgressIndicator.adaptive(), CircularProgressIndicator.adaptive(),
], ],
) )
: GroupedListView<ArtistIndex, String>( : FlexibleScrollbar(
controller: _scrollController,
child: GroupedListView<ArtistIndex, String>(
controller: _scrollController,
elements: _artists, elements: _artists,
groupBy: (a) => a.index, groupBy: (a) => a.index,
groupHeaderBuilder: (index) => Text( groupHeaderBuilder: (index) => Text(
@ -130,6 +136,7 @@ class _HomeViewState extends State<HomeView> {
), ),
), ),
), ),
),
); );
} }
} }

View file

@ -302,6 +302,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.0" 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: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter

View file

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