mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
refactor: use undraw for not_found component
This commit is contained in:
parent
b8ffb9b75f
commit
3649b67869
@ -1,30 +1,27 @@
|
||||
import 'package:flutter_undraw/flutter_undraw.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
import 'package:spotube/collections/assets.gen.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter_extension.dart';
|
||||
import 'package:spotube/extensions/context.dart';
|
||||
|
||||
class NotFound extends StatelessWidget {
|
||||
final bool vertical;
|
||||
const NotFound({super.key, this.vertical = false});
|
||||
const NotFound({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final widgets = [
|
||||
SizedBox(
|
||||
height: 150,
|
||||
width: 150,
|
||||
child: Assets.emptyBox.image(),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(context.l10n.nothing_found).large().semiBold(),
|
||||
Text(
|
||||
context.l10n.the_box_is_empty,
|
||||
).semiBold(),
|
||||
],
|
||||
Undraw(
|
||||
illustration: UndrawIllustration.empty,
|
||||
height: 200 * context.theme.scaling,
|
||||
color: context.theme.colorScheme.primary,
|
||||
),
|
||||
];
|
||||
return vertical ? Column(children: widgets) : Row(children: widgets);
|
||||
const Gap(10),
|
||||
Text(
|
||||
context.l10n.nothing_found,
|
||||
textAlign: TextAlign.center,
|
||||
).muted().small()
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class PlayerQueue extends HookConsumerWidget {
|
||||
);
|
||||
|
||||
if (tracks.isEmpty) {
|
||||
return const NotFound(vertical: true);
|
||||
return const NotFound();
|
||||
}
|
||||
|
||||
return Stack(
|
||||
|
@ -4,6 +4,7 @@ import 'dart:math';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:flutter_undraw/flutter_undraw.dart';
|
||||
import 'package:fuzzywuzzy/fuzzywuzzy.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
@ -320,10 +321,21 @@ class LocalLibraryPage extends HookConsumerWidget {
|
||||
|
||||
if (!trackSnapshot.isLoading &&
|
||||
filteredTracks.isEmpty) {
|
||||
return const Expanded(
|
||||
child: Row(
|
||||
return Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [NotFound()],
|
||||
children: [
|
||||
Undraw(
|
||||
illustration: UndrawIllustration.empty,
|
||||
height: 200 * scale,
|
||||
color: context.theme.colorScheme.primary,
|
||||
),
|
||||
const Gap(10),
|
||||
Text(
|
||||
context.l10n.nothing_found,
|
||||
textAlign: TextAlign.center,
|
||||
).muted().small()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -184,6 +184,7 @@ flutter:
|
||||
- packages/flutter_undraw/assets/undraw/happy_music.svg
|
||||
- packages/flutter_undraw/assets/undraw/follow_me_drone.svg
|
||||
- packages/flutter_undraw/assets/undraw/taken.svg
|
||||
- packages/flutter_undraw/assets/undraw/empty.svg
|
||||
fonts:
|
||||
- family: GeistSans
|
||||
fonts:
|
||||
|
Loading…
Reference in New Issue
Block a user