feat: no overlap with player controls
plus beta scrollbar
This commit is contained in:
parent
017c52f96d
commit
e68c775fca
3 changed files with 46 additions and 30 deletions
|
@ -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,36 +95,40 @@ class _HomeViewState extends State<HomeView> {
|
||||||
CircularProgressIndicator.adaptive(),
|
CircularProgressIndicator.adaptive(),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: GroupedListView<ArtistIndex, String>(
|
: FlexibleScrollbar(
|
||||||
elements: _artists,
|
controller: _scrollController,
|
||||||
groupBy: (a) => a.index,
|
child: GroupedListView<ArtistIndex, String>(
|
||||||
groupHeaderBuilder: (index) => Text(
|
controller: _scrollController,
|
||||||
index.index,
|
elements: _artists,
|
||||||
style: TextStyle(
|
groupBy: (a) => a.index,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
groupHeaderBuilder: (index) => Text(
|
||||||
|
index.index,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
itemBuilder: (c, index) => Wrap(
|
||||||
itemBuilder: (c, index) => Wrap(
|
alignment: (index.artists.length > 1)
|
||||||
alignment: (index.artists.length > 1)
|
? WrapAlignment.spaceBetween
|
||||||
? WrapAlignment.spaceBetween
|
: WrapAlignment.start,
|
||||||
: WrapAlignment.start,
|
children: List<Widget>.generate(
|
||||||
children: List<Widget>.generate(
|
index.artists.length,
|
||||||
index.artists.length,
|
(n) => InkWell(
|
||||||
(n) => InkWell(
|
onTap: () async {
|
||||||
onTap: () async {
|
await Navigator.of(context).push(
|
||||||
await Navigator.of(context).push(
|
MaterialPageRoute<void>(
|
||||||
MaterialPageRoute<void>(
|
builder: (c) => ArtistView(
|
||||||
builder: (c) => ArtistView(
|
artist: index.artists[n],
|
||||||
artist: index.artists[n],
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
child: ImageCover(
|
||||||
child: ImageCover(
|
cacheKey: index.artists[n].coverArtId,
|
||||||
cacheKey: index.artists[n].coverArtId,
|
imageUrl: index.artists[n].coverArtUrl,
|
||||||
imageUrl: index.artists[n].coverArtUrl,
|
title: index.artists[n].name,
|
||||||
title: index.artists[n].name,
|
heroTag: index.artists[n].name,
|
||||||
heroTag: index.artists[n].name,
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue